recursive use of values in templates/scripts

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
fdmalex
Posts: 3
Joined: Fri Aug 21, 2009 6:26 am

recursive use of values in templates/scripts

Post by fdmalex »

Hello,
I want to put in Cacti some devices but I don't know how to use values from a SNMP data query in a second snmpget.
Shortly, the process must be like that:
step1: snmp querry <ip address> with community "public" oid1 and get some values
step2: snmp querry the same <ip address> with a new community (obtained from values obtained in step1 - with a script or something) oid 2..n and obtain value that must be loaded to RRD
It's like the process used by Cisco Router template but with different values for snmp community between querry and graph actions.

Can anybody point me in the right direction?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

No plain SNMP solution available, but http://docs.cacti.net/manual:087:3a_adv ... ut_methods will do
Reinhard
fdmalex
Posts: 3
Joined: Fri Aug 21, 2009 6:26 am

Post by fdmalex »

Hi and thanks for the answer. As you suggested, I made :
1. SNMP data query, in order to list the first values
2. Added a data input method, based on a script. The script is supposed to get its inputs passed by data input method as hostname (ip) and by previous declared SNMP data query output.
3. Added a data template based on the values from the previous script.
4. Also added graph templates based on data templates and host templates based on graph templates.
Now questions:
a) is this how it's supposed to work?
b) can I pass the arguments between snmp data querry to the data input's method script?
fdmalex
Posts: 3
Joined: Fri Aug 21, 2009 6:26 am

Post by fdmalex »

So far, I tried to debug the arguments passing.
Shortly, from the SNMP data querry, I got the expected results:
XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.12394.1.2.5.1.1.3'
+ Index found at OID: '1.3.6.1.4.1.12394.1.2.5.1.1.3.0.16.231.66.230.38' value: '256'
+ Located input field 'ifMAC' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.12394.1.2.5.1.1.2'
+ Found item [ifMAC='HEX-:00:10:E7:42:E6:26'] index: 38 [from value]
+ Located input field 'ifIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.12394.1.2.5.1.1.3'
+ Found item [ifIndex='256'] index: 38 [from value]
+ Located input field 'ifDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.12394.1.2.5.1.1.7'
....

From this output I want to pass ifMAC value to the script of data input method as input string: bash <path_cacti>/scripts/second_get <query_ifMAC>

Is this possible? Because the script is not getting the supposed value (the mac address). I tried with ifMAC declared both as input and output in the XML file, with no difference visible.

Thank you,
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

It is NOT possible to pass a value from a Data Query to a Script or vice versa. It must be a complete solution. So you may want to change the Data Query/Script do perform both steps if this is applicable.
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests