Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


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

 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
sabey



Joined: 09 Nov 2004
Posts: 11

PostPosted: Mon Feb 28, 2005 5:16 pm    Post subject: Patch to handle NONE-SNMP query into SNMP-query XML file Reply with quote

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



screenshot.png
 Description:
Here a screenshot
 Filesize:  140.61 KB
 Viewed:  1772 Time(s)

screenshot.png



data_query.php.patch
 Description:
This is the patch file

Download
 Filename:  data_query.php.patch
 Filesize:  3.22 KB
 Downloaded:  165 Time(s)

Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Mon Feb 28, 2005 7:57 pm    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group