Patch to handle NONE-SNMP query into SNMP-query XML file

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
sabey
Posts: 11
Joined: Tue Nov 09, 2004 6:15 am

Patch to handle NONE-SNMP query into SNMP-query XML file

Post by sabey »

Hi gang,

I will share with you some change I did into the lib/data_query.php module of caci to add some cool feature in the SNMP Query XML file.

The patch is based on the Cacti v0.8.6c

What are those features?
===================================================
1. If you put this into your XML files:

<ifPort>
<name>Port ID</name>
<method></method>
<source>index</source>
<direction>input</direction>
</ifPort>

The query will return port number start at Index 0 instead of 1. (Useful when your switch port ID start at 0!)
===================================================
2. If you want value based on an external script with hostname and index as parameter

<ifName>
<name>Port Name</name>
<method>external</method>
<source>script</source>
<direction>input</direction>
<cmd>/home/www/cacti/test.sh</cmd>
</ifName>

This will execute the script between the cmd tag and will attach the hostname and indexid as first and second parameter. My test.sh script go into my MySQL database and give me the hostname of what is connected to the give Index (port ID - 1).
===================================================

SO now I can put the hostname or the real port id into my data source and graph!

Let me know what do you think about that. For sure I will improve that a lot. But for me that's a good start.

:-)

Sabey
Attachments
data_query.php.patch
This is the patch file
(3.22 KiB) Downloaded 374 times
Here a screenshot
Here a screenshot
screenshot.png (140.61 KiB) Viewed 3495 times
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

There is a better way to handle this with the new OID type called "OID_PARSE" method introduced in Cacti 0.8.6c. I just have not had time at the office to create the Catalyst Interface XML file.

TheWtiness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests