[solved] Data Query not able to walk a specific OID

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
bl243
Posts: 19
Joined: Tue Feb 03, 2009 6:11 am

[solved] Data Query not able to walk a specific OID

Post by bl243 »

Hi All,

I am trying to use an F5 template found elsewhere in the forum to get per VS stats from some F5 load balancers.

I have a Data Query that won't return data from an snmpwalk for a specific OID.

I am running Cacti 0.8.7e with Net-SNMP 5.4.1 on linux. Cacti is set to use NET-SNMP 5.x. SNMP v2c is a requirement for some other stuff I do in Cacti.

The start of the data query looks like this.

Code: Select all

<interface>
        <name>Get F5 Big-IP Load Balancer Virtual Server Statistics</name>
        <oid_index>.1.3.6.1.4.1.3375.2.2.10.2.3.1.1</oid_index>
        <oid_index_parse>OID/REGEXP:^.{31}(.*)</oid_index_parse>
        <index_order>vsIndex</index_order>
        <index_order_type>alphabetic</index_order_type>
The Data Query Debug Information looks like this:

Code: Select all

+ Running data query [11].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/resource/snmp_queries/f5_bigip_vs.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.3375.2.2.10.2.3.1.1'
+ No SNMP data returned
+ Found data query XML file at '/var/www/resource/snmp_queries/f5_bigip_vs.xml'
+ Found data query XML file at '/var/www/resource/snmp_queries/f5_bigip_vs.xml'
+ Found data query XML file at '/var/www/resource/snmp_queries/f5_bigip_vs.xml'
If I manually run an snmpwalk (snmpwalk -v2c -c public myhost .1.3.6.1.4.1.3375.2.2.10.2.3.1.1) I get this:

Code: Select all

SNMPv2-SMI::enterprises.3375.2.2.10.2.3.1.1.3.73.112.70 = STRING: "IpF"
SNMPv2-SMI::enterprises.3375.2.2.10.2.3.1.1.9.99.105.101.111.110.108.105.110.101 = STRING: "cieonline"
...
If I adjust the OID by one number (.1.3.6.1.4.1.3375.2.2.10.2.3.1.2), the query gets futher and does identify all the index OIDs, however, the name of the VS is found in the original OID (.1.3.6.1.4.1.3375.2.2.10.2.3.1.1). So I am still back at square one.

Any reason why this particular OID should cause Cacti to return no data when it attempts to walk it?

Is this issue due to the SNMP values returned being Strings? In case it helps, here is the section of the data query that tries to get the VS name:

Code: Select all

<vsName>
           <name>Name</name>
           <method>walk</method>
           <source>value</source>
           <direction>input</direction>
           <oid>.1.3.6.1.4.1.3375.2.2.10.2.3.1.1</oid>
</vsName>
Cheers,
Ben
Last edited by bl243 on Tue Oct 13, 2009 9:56 am, edited 2 times in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

This almost looks like the example I wrote in the wiki: http://docs.cacti.net/howto:data_query_ ... s_a_string

I'd change that REGEX back to <oid_index_parse>OID/REGEXP:^.{32}(.*)</oid_index_parse>. Also get rid of the OID field from the vsName section.
bl243
Posts: 19
Joined: Tue Feb 03, 2009 6:11 am

Post by bl243 »

Thanks for the suggestion BSOD2600, however the issue appears to be with the snmpwalk rather than the syntax within the data query.

For example, I have created a new data query called f5test.xml and associated bits in the GUI. This is a direct copy and paste from your wiki entry.

Code: Select all

<interface>
	<name>Get F5 Big-IP Load Balancer Virtual Server Statistics</name>
	<oid_index>.1.3.6.1.4.1.3375.2.2.10.2.3.1.1</oid_index>
        <oid_index_parse>OID/REGEXP:^.{32}(.*)</oid_index_parse>
        <index_order>vsIndex</index_order>
        <index_order_type>alphabetic</index_order_type>

        <fields>
                <vsIndex>
                        <name>Index</name>
                        <source>index</source>
                        <direction>input</direction>
                </vsIndex>
	</fields>
</interface>
This is the debug output it generates.

Code: Select all

+ Running data query [16].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/resource/snmp_queries/f5test.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.3375.2.2.10.2.3.1.1'
+ No SNMP data returned
+ Found data query XML file at '/var/www/resource/snmp_queries/f5test.xml'
+ Found data query XML file at '/var/www/resource/snmp_queries/f5test.xml'
+ Found data query XML file at '/var/www/resource/snmp_queries/f5test.xml'
The snmpwalk is still not returning anything for this OID. However a manual snmpwalk on the server with the syntax as shown in this sticky: http://forums.cacti.net/viewtopic.php?t=29492 works fine.

Any futher ideas? Could it be the combination of Cacti version and Net-SNMP?

Cheers,
Ben
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

bl243 wrote:Could it be the combination of Cacti version and Net-SNMP?
Could be. At least the F5 BigIP device I updated/made templates for, net-snmp snmpwalk worked fine. Does a snmpbulkwalk and snmpgetnext work against OID .1.3.6.1.4.1.3375.2.2.10.2.3.1.1 too?
bl243
Posts: 19
Joined: Tue Feb 03, 2009 6:11 am

Post by bl243 »

BSOD2600 wrote:Could be. At least the F5 BigIP device I updated/made templates for, net-snmp snmpwalk worked fine. Does a snmpbulkwalk and snmpgetnext work against OID .1.3.6.1.4.1.3375.2.2.10.2.3.1.1 too?
Yes, both snmpbulkwalk and snmpgetnext return results as expected. I am at a complete loss as where to go next.

Is it possible to turn on debugging to show the actual command cacti is running and the output it received - if so how?
bl243
Posts: 19
Joined: Tue Feb 03, 2009 6:11 am

Post by bl243 »

Just found that I also can't SNMP Walk that OID (.1.3.6.1.4.1.3375.2.2.10.2.3.1.1) from the Network Tools section under Utilities in the GUI.

It doesn't give an error, just returns no results.

A walk of .1.3.6.1.4.1.3375.2.2.10.2.3.1.2 works fine.

Any idea how to debug this bit?
bl243
Posts: 19
Joined: Tue Feb 03, 2009 6:11 am

Post by bl243 »

Ok - I have got somewhere with this. As I understand from reading the function "cacti_snmp_walk" within snmp.php, if you have PHP version 5.1 or greater then Cacti will use PHP inbuilt snmp functions rather than NET-SNMP or UCD-SNMP.

When I munged this function to pretend I had an earlier version of PHP thereby forcing Cacti to use NET-SNMP.

All now works fine.

Would be nice if there was a way for the user to pick whether to use PHP's snmp support or NET-SNMP.
bl243
Posts: 19
Joined: Tue Feb 03, 2009 6:11 am

Post by bl243 »

For anyone who has stumbled upon this with a similar problem. The final resolution was to edit this file:

<cacti-dir>/lib/snmp.php

Look for the function "cacti_snmp_walk"

Code: Select all

function cacti_snmp_walk($hostname, $community, $oid, $version, $username, $password, $auth_proto, $priv_pass, $priv_proto, $context, $port = 161, $timeout = 500, $retries = 0, $max_oids = 10, $environ = SNMP_POLLER) {
Then look for this statement:

Code: Select all

if ((snmp_get_method($version) == SNMP_METHOD_PHP) &&
                (!strlen($context) || ($version != 3)) &&
                (($version == 1) ||
                (version_compare(phpversion(), "5.1") >= 0) ||
                (!file_exists($path_snmpbulkwalk)))) {
This is looking to see whether to use PHP's inbuilt SNMP functions rather than calling NET-SNMP or UCD-SNMP.

Change to this:

Code: Select all

if ((snmp_get_method($version) == SNMP_METHOD_PHP) &&
                (!strlen($context) || ($version != 3)) &&
                (($version == 1) &&
                (version_compare(phpversion(), "5.1") >= 0) ||
                (!file_exists($path_snmpbulkwalk)))) {
So long as you are using SNMP version 2, this statement will now never be true and will force NET-SNMP/UCD-SNMP to be used instead.

This resolved my problem.

Cheers,
Ben
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest