Formatting XML Data Query Template for Extended Objects

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

Moderators: Developers, Moderators

Post Reply
itr2401
Posts: 4
Joined: Tue Jun 21, 2011 7:46 am

Formatting XML Data Query Template for Extended Objects

Post by itr2401 »

Hi all,

I was wondering if someone can give me the right pointers here to configure a data query template xml file which will successfully query SNMP Extended Objects.

I can query without issue the extended objects as per below:

Code: Select all

snmpwalk -v 2c -c <community> -O e <ip.address> NET-SNMP-EXTEND-MIB::nsExtendOutLine

NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits".1 = STRING: 52929259
NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_size".1 = STRING: 705341648
NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_misses".1 = STRING: 15536494
NET-SNMP-EXTEND-MIB::nsExtendOutLine."zpool_name".1 = STRING: storage
NET-SNMP-EXTEND-MIB::nsExtendOutLine."zpool_snap".1 = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."zpool_used".1 = STRING: 3098676621322
NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_meta_max".1 = STRING: 606175992
NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_meta_used".1 = STRING: 567453904
NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_meta_c_max".1 = STRING: 806954598
NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_meta_limit".1 = STRING: 605215948
NET-SNMP-EXTEND-MIB::nsExtendOutLine."zpool_available".1 = STRING: 756842958838
NET-SNMP-EXTEND-MIB::nsExtendOutLine."zpool_data_used".1 = STRING: 3098676621322
NET-SNMP-EXTEND-MIB::nsExtendOutLine."zpool_used_capacity".1 = STRING: 77
However when I use the following XML, Cacti cannot find any data - 'No SNMP data returned'. As a test I am just trying to query the first item from the above list - 'arc_hits'

Code: Select all

<interface>
	<name>Get Extended Objects</name>
	<description>Query SNMP Extended Objects</description>
	<oid_index>NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits"</oid_index>
	<oid_num_indexes>NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits"</oid_num_indexes>
	<index_order_type>numeric</index_order_type>
	<index_title_format>|chosen_order_field|</index_title_format>
	
	<fields>
      <arc_hits>
         <name>arc_hits</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>
         <oid>NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits"</oid>
      </arc_hits>
	</fields>
</interface>
When I attempt to use the XML I get the following:

Code: Select all

Total: 0, Delta: 0, Running data query [9].
Total: 0, Delta: 0, Found type = '3' [SNMP Query].
Total: 0.01, Delta: 0, Found data query XML file at '/usr/share/cacti/resource/snmp_queries/net-snmp_MSA_ExtendedObjects.xml'
Total: 0.01, Delta: 0, XML file parsed ok.
Total: 0.01, Delta: 0.01, Executing SNMP get for num of indexes @ 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits"' Index Count:
Total: 1.01, Delta: 1, Executing SNMP walk for list of indexes @ 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits"' Index Count: 0
Total: 1.01, Delta: 0, No SNMP data returned
Total: 1.02, Delta: 0, Update data query sort cache complete
Total: 1.02, Delta: 0, Updated data query index ordering
Total: 2.03, Delta: 1.01, Update re-index cache complete
Total: 2.03, Delta: 0, Update graph data query cache complete
Total: 2.03, Delta: 0, Update data source data query cache complete
Total: 2.03, Delta: 0, Update data query cache complete
Total: 2.03, Delta: 0, Update poller cache from query complete
Total: 2.03, Delta: 0, Automation execute data query complete
Total: 2.03, Delta: 0, Plugin hooks complete
I have tried using the numeric OID's in the XML file - to which I get the same 'No SNMP data returned'. Can someone suggest how to fix the XML so that the SNMP data can be queried correctly within Cacti?
Last edited by itr2401 on Wed Mar 28, 2018 7:50 pm, edited 1 time in total.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Formatting XML Data Query Template for Extended Objects

Post by netniV »

As far as I have seen, Cacti expects you to always use the numeric form of the OID's in the definitions. Cacti does use MIB's to translate back for the data caching, but that's more to help the admin out with searching by name.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
itr2401
Posts: 4
Joined: Tue Jun 21, 2011 7:46 am

Re: Formatting XML Data Query Template for Extended Objects

Post by itr2401 »

netniV wrote:Cacti expects you to always use the numeric form of the OID's in the definitions.
Thanks, however given that I have already tried both numeric OID and name OID with the same result - is there something missing in the XML configuration that will make this work?
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Formatting XML Data Query Template for Extended Objects

Post by netniV »

Can you supply the XML with the numeric versions your expecting and I will see if I have a box that is returning them. If so, I can try and replicate it for you. The XML looks OK but that doesn't mean it's being interpreted correctly.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
itr2401
Posts: 4
Joined: Tue Jun 21, 2011 7:46 am

Re: Formatting XML Data Query Template for Extended Objects

Post by itr2401 »

Sure - though the extended objects may not be available on your system:

Code: Select all

cat /etc/snmp/snmpd.conf | grep extend
extend arc_meta_max /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_meta_max'
extend arc_meta_used /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_meta_used'
extend arc_size /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_size'
extend arc_meta_limit /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_meta_limit'
extend arc_meta_c_max /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_meta_c_max'
extend arc_hits /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_hits'
extend arc_misses /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php arc_misses'
extend zpool_name /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php zpool_name'
extend zpool_snap /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php zpool_snap'
extend zpool_used /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php zpool_used'
extend zpool_data_used /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php zpool_data_used'
extend zpool_available /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php zpool_available'
extend zpool_used_capacity /bin/bash -c '/usr/bin/php /etc/scripts/get_snmp_stats.php zpool_used_capacity'
ARC Hits is essentially:

Code: Select all

/bin/cat /proc/spl/kstat/zfs/arcstats | grep '^hits '
Numeric SNMP walk

Code: Select all

snmpwalk -v 2c -c <community> -O e -O n <ip.address> NET-SNMP-EXTEND-MIB::nsExtendOutLine
.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.114.99.95.104.105.116.115.1 = STRING: 58357134
.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.114.99.95.115.105.122.101.1 = STRING: 807493304
.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.97.114.99.95.109.105.115.115.101.115.1 = STRING: 16991528
.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.122.112.111.111.108.95.110.97.109.101.1 = STRING: storage
.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.122.112.111.111.108.95.115.110.97.112.1 = STRING: 0
.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.122.112.111.111.108.95.117.115.101.100.1 = STRING: 3103706867332
.1.3.6.1.4.1.8072.1.3.2.4.1.2.12.97.114.99.95.109.101.116.97.95.109.97.120.1 = STRING: 607352704
.1.3.6.1.4.1.8072.1.3.2.4.1.2.13.97.114.99.95.109.101.116.97.95.117.115.101.100.1 = STRING: 64251240
.1.3.6.1.4.1.8072.1.3.2.4.1.2.14.97.114.99.95.109.101.116.97.95.99.95.109.97.120.1 = STRING: 806954598
.1.3.6.1.4.1.8072.1.3.2.4.1.2.14.97.114.99.95.109.101.116.97.95.108.105.109.105.116.1 = STRING: 605215948
.1.3.6.1.4.1.8072.1.3.2.4.1.2.15.122.112.111.111.108.95.97.118.97.105.108.97.98.108.101.1 = STRING: 751812712828
.1.3.6.1.4.1.8072.1.3.2.4.1.2.15.122.112.111.111.108.95.100.97.116.97.95.117.115.101.100.1 = STRING: 3103706867332
.1.3.6.1.4.1.8072.1.3.2.4.1.2.19.122.112.111.111.108.95.117.115.101.100.95.99.97.112.97.99.105.116.121.1 = STRING: 77
SNMP Translate

Code: Select all

snmptranslate -On 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."arc_hits"' 
.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.114.99.95.104.105.116.115
XML File with Numeric OID's

Code: Select all

<interface>
   <name>Get Extended Objects</name>
   <description>Query SNMP Extended Objects</description>
   <oid_index>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.114.99.95.104.105.116.115</oid_index>
   <oid_num_indexes>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.114.99.95.104.105.116.115</oid_num_indexes>
   <index_order_type>numeric</index_order_type>
   <index_title_format>|chosen_order_field|</index_title_format>
   
   <fields>
      <arc_hits>
         <name>arc_hits</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>
         <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.114.99.95.104.105.116.115</oid>
      </arc_hits>
   </fields>
</interface>
Happy to setup a WebEx or whatever if you don't have a system that you can use to provide those ZFS extended attributes.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Formatting XML Data Query Template for Extended Objects

Post by netniV »

i should be able to use Net-SNMP's scripting extensions to simulate having the values if I need to. However, am I right in assuming that you are just trying to pull out a singular value for arc_hits or was that the first or many fields? Either way, you are specifying that the OID's must be used with an index in out to pull out any data. If these are singular value SNMP gets then you don't need to use an SNMP (Indexed) query, but rather a straight SNMP query.

I haven't fully compared your walk to the MIB we mentioned the other day so I may be getting that wrong plus it's late and I can't totally recall everything about this.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
itr2401
Posts: 4
Joined: Tue Jun 21, 2011 7:46 am

Re: Formatting XML Data Query Template for Extended Objects

Post by itr2401 »

netniV wrote: If these are singular value SNMP gets then you don't need to use an SNMP (Indexed) query, but rather a straight SNMP query.
The arc values are most certainly individual values. I was testing to see if I can get arc_hits correct before adding all the other arc values as additional fields, then graphing the data. The zpool values would be indexed, indexed by zpool_name, as when I have 2 x zpool's the zpool_X items have a corresponding .1 & .2 items.

When I added the XML under Data Queries, there are only 3 options for the XML file:

* Get SNMP Data (Indexed)
* Get Script Data (Indexed)
* Get Script Server Data (Indexed)

I dont see an option to use the XML file & 'Get SNMP Data (non indexed)' or similar. My intention was to have 1 file for all elements, but if needed can split this into different XML files based on query type. Alternatively is there an XML tag that can be used under the <interface> specification that tells Cacti to query as an Indexed Query or straight value query?
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Formatting XML Data Query Template for Extended Objects

Post by netniV »

For non-indexed data, you don't need a Data Query. Instead you just create a templated data source and set the Data Input Method to Get SNMP Data then specify the specific OID.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
classen
Cacti User
Posts: 116
Joined: Thu Nov 12, 2009 3:07 pm

Re: Formatting XML Data Query Template for Extended Objects

Post by classen »

Any updates to this? I've recently stumbled down the same path (trying to graph NET-SNMP-EXTEND-MIB values in cacti) and am stuck getting the xml file to work with cacti.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Formatting XML Data Query Template for Extended Objects

Post by netniV »

I would suggest posting your problem as a new thread rather than just tacking on to this one. You should also explain what issue you are having exactly plus supply screenshots of the various parts you've setup and the template XML you are using.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest