Can't get SNMP index values with XML query, but snmpwalk can

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

Moderators: Moderators, Developers

Post Reply
Author
Message
Deele
Posts: 37
Joined: Thu Nov 25, 2010 9:15 am
Location: Latvia, Riga

Can't get SNMP index values with XML query, but snmpwalk can

#1 Post by Deele » Fri Oct 07, 2011 2:26 am

I have been fighting for some time already, to get this working, but still, with no luck.
It's a "Alvarion Walkair3000 system" with 2933 enterprise ID, that I need to monitor.

SNMPWalk over device index OID .1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1 returns:

Code: Select all

.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66049 = INTEGER: 66049
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66050 = INTEGER: 66050
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66051 = INTEGER: 66051
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66052 = INTEGER: 66052
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66053 = INTEGER: 66053
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66054 = INTEGER: 66054
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.66055 = INTEGER: 66055
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131585 = INTEGER: 131585
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131586 = INTEGER: 131586
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131587 = INTEGER: 131587
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131588 = INTEGER: 131588
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131589 = INTEGER: 131589
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131590 = INTEGER: 131590
.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1.131591 = INTEGER: 131591
But when I use XML:

Code: Select all

		<oid_index>.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1</oid_index>
		<index_order>apmCurrentDeviceIndex</index_order>
		<index_order_type>alphabetic</index_order_type>
		<fields>
			<apmCurrentDeviceIndex>
				<name>Current Device Index</name>
				<source>index</source>
				<direction>input</direction>
				<oid>.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1</oid>
			</apmCurrentDeviceIndex>
		</fields>
Or even with regex

Code: Select all

		<oid_index_parse>OID/REGEXP:^.*\.2933(?:\.\d{1,3}){8}\.(\d{5,6})$</oid_index_parse>
		<index_order>apmCurrentDeviceIndex</index_order>
		<index_order_type>alphabetic</index_order_type>
		<fields>
			<apmCurrentDeviceIndex>
				<name>Current Device Index</name>
				<source>index</source>
				<direction>input</direction>
			</apmCurrentDeviceIndex>
		</fields>
Data Query Debug Information @ Cacti outputs:

Code: Select all

+ Running data query [10].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/www/apache22/data/cactiBeta/resource/snmp_queries/alvarion_walkair.xml'
+ XML file parsed ok.
+ <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1' Index Count: 0
+ No SNMP data returned
My Cacti Version 0.8.7h and
cacti-technical-data.zip
My Cacti technical data (zipped HTML file with <table>)
(9.79 KiB) Downloaded 588 times

User avatar
classen
Cacti User
Posts: 116
Joined: Thu Nov 12, 2009 3:07 pm

Re: Can't get SNMP index values with XML query, but snmpwalk

#2 Post by classen » Fri Oct 07, 2011 6:26 pm

Deele wrote: But when I use XML:

Code: Select all

		<oid_index>.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1</oid_index>
		<index_order>apmCurrentDeviceIndex</index_order>
		<index_order_type>alphabetic</index_order_type>
		<fields>
			<apmCurrentDeviceIndex>
				<name>Current Device Index</name>
				<source>index</source>
				<direction>input</direction>
				<oid>.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1</oid>
			</apmCurrentDeviceIndex>
		</fields>
Data Query Debug Information @ Cacti outputs:

Code: Select all

+ Running data query [10].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/www/apache22/data/cactiBeta/resource/snmp_queries/alvarion_walkair.xml'
+ XML file parsed ok.
+ <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2933.1.2.17.1.1.1.1.1' Index Count: 0
+ No SNMP data returned

I think the error message is pretty self explanatory. You need to add <oid_num_indexes> in your xml file.

like this example:

Code: Select all

<interface>
	<name>Get SNMP Interfaces</name>
	<description>Queries a host for a list of monitorable interfaces</description>
	<oid_index>.1.3.6.1.2.1.2.2.1.1</oid_index>
	<oid_num_indexes>.1.3.6.1.2.1.2.1.0</oid_num_indexes>

	<fields>
		<ifIndex>
			<name>Index</name>
			<method>walk</method>
			<source>value</source>
			<direction>input</direction>
			<oid>.1.3.6.1.2.1.2.2.1.1</oid>
		</ifIndex>
	</fields>
</interface>

Deele
Posts: 37
Joined: Thu Nov 25, 2010 9:15 am
Location: Latvia, Riga

Re: Can't get SNMP index values with XML query, but snmpwalk

#3 Post by Deele » Fri Oct 07, 2011 7:48 pm

classen wrote: I think the error message is pretty self explanatory. You need to add <oid_num_indexes> in your xml file.
Thats not an error, thats warning with notice 'Index Count Changed' emulated by counting oid_index entries
oid_num_indexes is optional field, as said in all documents as most devices doesn't have such value.
Any way, I tried it, and got same result. I found one OID for that device, with integer value of 14. That time, only difference was, it used snmpget for oid_num_indexes OID, and got value 14, showed it - the next snmpwalk for indexes, returned 0.

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

Re: Can't get SNMP index values with XML query, but snmpwalk

#4 Post by gandalf » Sun Oct 23, 2011 12:34 pm

The warning is indeed a warning only; there's no need to change that.
But I'm wondering why the sweep over the index does not return sensible data. May you please provide us with the snmpwalk statement that you've used on cli? Did you select specific snmp options for that?
R.

Deele
Posts: 37
Joined: Thu Nov 25, 2010 9:15 am
Location: Latvia, Riga

Re: Can't get SNMP index values with XML query, but snmpwalk

#5 Post by Deele » Sun Oct 23, 2011 12:49 pm

No specific options, just for this case, I used -On output option to show numberic output. Without it, it would be:

Code: Select all

SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66049 = INTEGER: 66049
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66050 = INTEGER: 66050
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66051 = INTEGER: 66051
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66052 = INTEGER: 66052
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66053 = INTEGER: 66053
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66054 = INTEGER: 66054
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.66055 = INTEGER: 66055
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131585 = INTEGER: 131585
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131586 = INTEGER: 131586
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131587 = INTEGER: 131587
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131588 = INTEGER: 131588
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131589 = INTEGER: 131589
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131590 = INTEGER: 131590
SNMPv2-SMI::enterprises.2933.1.2.17.1.1.1.1.1.131591 = INTEGER: 131591

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

Re: Can't get SNMP index values with XML query, but snmpwalk

#6 Post by gandalf » Sun Oct 23, 2011 1:45 pm

Can you do a wireshark trace while running a "Verbose Query"?
R.

tjh
Posts: 5
Joined: Fri Dec 23, 2011 4:39 am

Re: Can't get SNMP index values with XML query, but snmpwalk

#7 Post by tjh » Sun Jan 01, 2012 4:45 am

I am experiencing the same problem with 0.8.7i/spine

+ Executing SNMP get for num of indexes @ '.1.3.6.1.4.1.2636.3.2.1.3.0' Index Count: 86
+ Debug: cacti_snmp_walk(x.x.x.x,public,.1.3.6.1.4.1.2636.3.2.3.1.1,2) - sizeof(snmp_indexes)=0 (I added this to check)
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2636.3.2.3.1.1' Index Count: 0

I have compared packet captures from a 'verbose query' and manually from the CLI. The bulkget cacti requests has max-repetitions set to 20 but the device does not respond when it is above 17

~$ snmpbulkget -c public -v2c -Cr17 x.x.x.x .1.3.6.1.4.1.2636.3.2.3.1.1
MPLS-MIB::mplsLspName.'test1...........................' = STRING: test1
MPLS-MIB::mplsLspName.'test2...........................' = STRING: test2
MPLS-MIB::mplsLspName.'test3...........................' = STRING: test3
MPLS-MIB::mplsLspName.'test4...........................' = STRING: test4
MPLS-MIB::mplsLspName.'test5...........................' = STRING: test5
MPLS-MIB::mplsLspName.'test6...........................' = STRING: test6
MPLS-MIB::mplsLspName.'test7...........................' = STRING: test7
MPLS-MIB::mplsLspName.'test8...........................' = STRING: test8
MPLS-MIB::mplsLspName.'test9...........................' = STRING: test9
MPLS-MIB::mplsLspName.'test10..........................' = STRING: test10
MPLS-MIB::mplsLspName.'test11..........................' = STRING: test11
MPLS-MIB::mplsLspName.'test12..........................' = STRING: test12
MPLS-MIB::mplsLspName.'test13..........................' = STRING: test13
MPLS-MIB::mplsLspName.'test14..........................' = STRING: test14
MPLS-MIB::mplsLspName.'test15..........................' = STRING: test15
MPLS-MIB::mplsLspName.'test16..........................' = STRING: test16
MPLS-MIB::mplsLspName.'test17..........................' = STRING: test17
~$ snmpbulkget -c public -v2c -Cr18 x.x.x.x .1.3.6.1.4.1.2636.3.2.3.1.1
Timeout: No Response from x.x.x.x
~$ snmpbulkget -c public -v2c -Cr20 x.x.x.x .1.3.6.1.4.1.2636.3.2.3.1.1
Timeout: No Response from x.x.x.x
~$

max oid is set to 10 under the device and within the poller settings, so I am not sure if it is possible to change this value.

Thanks
tjh

tjh
Posts: 5
Joined: Fri Dec 23, 2011 4:39 am

Re: Can't get SNMP index values with XML query, but snmpwalk

#8 Post by tjh » Sun Jan 01, 2012 4:29 pm

I have resolved my problem.

snmp.c in php5-snmp has max-repetition hard coded to 20.

pdu->max_repetitions = 20;

I decreased this to 15 and recompiled php5-snmp, restarted apache and the snmp queries now work within cacti.

Juniper MX80 and RE2000 (MX240/480/960) as at JunOS 11.X. The Juniper routers do no respond if the max-rep is above 17.

tjh

klr0514
Posts: 27
Joined: Tue Apr 04, 2006 8:19 am
Contact:

Re: Can't get SNMP index values with XML query, but snmpwalk

#9 Post by klr0514 » Fri Nov 02, 2012 10:22 am

snmp.c in php5-snmp has max-repetition hard coded to 20.

pdu->max_repetitions = 20;

I decreased this to 15 and recompiled php5-snmp, restarted apache and the snmp queries now work within cacti.

Juniper MX80 and RE2000 (MX240/480/960) as at JunOS 11.X. The Juniper routers do no respond if the max-rep is above 17.


Where did you find this file? I am hitting the same issues with Junos 12.2.

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

Re: Can't get SNMP index values with XML query, but snmpwalk

#10 Post by gandalf » Sat Nov 10, 2012 2:10 pm

tjh wrote:I have resolved my problem.

snmp.c in php5-snmp has max-repetition hard coded to 20.

pdu->max_repetitions = 20;

I decreased this to 15 and recompiled php5-snmp, restarted apache and the snmp queries now work within cacti.

Juniper MX80 and RE2000 (MX240/480/960) as at JunOS 11.X. The Juniper routers do no respond if the max-rep is above 17.

tjh
Wow, I just stumbled across the same issue. php-snmp unconditionally uses bulkwalk. You can't cahnge neither max-rep nor refrain from using bulkwalk. Only way to do this from "outside" is to use snmp version 1 instead of version 2. But this may have other drawbacks
R.

sushantwinner
Posts: 2
Joined: Sat Mar 17, 2012 2:15 pm

Re: Can't get SNMP index values with XML query, but snmpwalk

#11 Post by sushantwinner » Fri Aug 16, 2013 8:22 am

Hi All,

I am also facing the same issue for juniper m120 qos and TE tunnel template.

i also tried to check snmp.c in php5-snmp but there is no max-repetition hard coded to 20.

I am using UBUNTU.

Kindly help me to resolve this issue.



Running data query [21].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/juniper_intcos.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting arg_index entries
+ Executing script for list of indexes 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea index' Index Count: 0
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query index'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query desc'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query ifname'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query ifalias'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query iftype'

nox
Posts: 3
Joined: Wed Nov 25, 2015 5:39 am

Re: Can't get SNMP index values with XML query, but snmpwalk

#12 Post by nox » Wed Nov 25, 2015 5:42 am

sushantwinner wrote:Hi All,

I am also facing the same issue for juniper m120 qos and TE tunnel template.

i also tried to check snmp.c in php5-snmp but there is no max-repetition hard coded to 20.

I am using UBUNTU.

Kindly help me to resolve this issue.



Running data query [21].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/juniper_intcos.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting arg_index entries
+ Executing script for list of indexes 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea index' Index Count: 0
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query index'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query desc'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query ifname'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query ifalias'
+ Executing script query 'perl /usr/share/cacti/site/scripts/junipercos.pl 10.160.4.226 idea query iftype'
I has similar error until i changed Data Input Metod in Data Template, it was "Get Scrip Data", i changed it to "Get SNMP Data".

Post Reply