SNMP data query & snmp-extend troubles

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Moderators, Developers

Post Reply
Author
Message
Hotratz
Posts: 24
Joined: Thu Jun 01, 2017 12:44 pm

SNMP data query & snmp-extend troubles

#1 Post by Hotratz » Fri Aug 16, 2019 3:36 pm

I'm having some trouble with my SNMP data query using a custom xml data query file and snmp-extend on the remote host side. First off, there is no SNMP indexing for this device, an APC UPS, so I must use the method for creating a fake index as described this documentation (at bottom of page) here:

https://docs.cacti.net/howto:data_query ... is_present

The xml file is parsed without issue and the oid-index call is executed properly returning data (model of UPS in this case). However, no further data is obtained and Cacti only goes as far as "Located input field...[get], and not executing on the get. I would have expected Cacti to get the data - but nothing.
Screen Shot 2019-08-16 at 2.30.44 PM.png
Screen Shot 2019-08-16 at 2.30.44 PM.png (371.18 KiB) Viewed 117 times
Additionally, Cacti seems to ignore all <direction>ouput</direction> fields, and only remarks on the input fields ('get' methods). I've included my data query xml file below, as well. The OIDs are translated snmp-extend commands. All have been tested on the command line and work, both the human readable and OID formats. I've also included lines from my snmpd.conf file.

Thanks for any assistance/ideas.



from snmpd.conf:
...
extend ups_model /usr/local/bin/upsStatus model
extend ups_cable /usr/local/bin/upsStatus cable
extend ups_version /usr/local/bin/upsStatus version
extend ups_battdate /usr/local/bin/upsStatus battdate
extend ups_status /usr/local/bin/upsStatus status
extend ups_linev /usr/local/bin/upsStatus linev
extend ups_bcharge /usr/local/bin/upsStatus bcharge
extend ups_timeleft /usr/local/bin/upsStatus timeleft
extend ups_cumonbatt /usr/local/bin/upsStatus cumonbatt


Data query debug output:

Total: 0.000000, Delta: 0.000000, Found data query XML file at '/var/www/html/cacti-1.2.5/resource/snmp_queries/upsStatus.xml'
Total: 0.000000, Delta: 0.000000, Running Data Query [11].
Total: 0.000000, Delta: 0.000000, Found Type = '3' [SNMP Query].
Total: 0.000000, Delta: 0.000000, XML file parsed ok.
Total: 0.020000, Delta: 0.020000, <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
Total: 4.170000, Delta: 4.150000, Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.8072.1.3.2.3.1.1.9.117.112.115.95.109.111.100.101.108' Index Count: 1
Total: 4.170000, Delta: 0.000000, Index found at OID: '.1.3.6.1.4.1.8072.1.3.2.3.1.1.9.117.112.115.95.109.111.100.101.108' value: 'Back-UPS_RS_1300G'
Total: 4.170000, Delta: 0.000000, Filtering list of indexes @ '.1.3.6.1.4.1.8072.1.3.2.3.1.1.9.117.112.115.95.109.111.100.101.108' Index Count: 0
Total: 4.170000, Delta: 0.000000, Located input field 'ups_model' [get]
Total: 4.170000, Delta: 0.000000, Located input field 'ups_cable' [get]
Total: 4.170000, Delta: 0.000000, Located input field 'ups_version' [get]
Total: 4.170000, Delta: 0.000000, Located input field 'ups_battdate' [get]
Total: 4.170000, Delta: 0.000000, Located input field 'ups_status' [get]

Total: 4.170000, Delta: 0.000000, Checking for Sort Field change. No changes detected.
Total: 4.170000, Delta: 0.000000, Update Data Query Sort Cache complete
Total: 4.210000, Delta: 0.040000, Index Association with Local Data complete
Total: 4.450000, Delta: 0.240000, No Index Changes Detected, Skipping Re-Index and Poller Cache Re-population
Total: 4.450000, Delta: 0.000000, Automation Executing for Data Query complete
Total: 4.450000, Delta: 0.000000, Plugin hooks complete


<query>
<name>Get APCUPS Status</name>
<description>Gets status of APC Uninterruptable Power Supply</description>
<oid_index>.1.3.6.1.4.1.8072.1.3.2.3.1.1.9.117.112.115.95.109.111.100.101.108</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,2})$</oid_index_parse>
<index_order>ups_model</index_order>
<index_order_type>alphabetic</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>

<fields>
<ups_model>
<name>UPS Model</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.9.117.112.115.95.109.111.100.101.108</oid>
</ups_model>
<ups_cable>
<name>Cable Type</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<oid>NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.\"ups_cable\"</oid>
</ups_cable>
<ups_version>
<name>APCUPSD Version</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.11.117.112.115.95.118.101.114.115.105.111.110</oid>
</ups_version>
<ups_battdate>
<name>Battery Installation Date</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.12.117.112.115.95.98.97.116.116.100.97.116.101</oid>
</ups_battdate>
<ups_status>
<name>Status</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.10.117.112.115.95.115.116.97.116.117.115</oid>
</ups_status>
<ups_linev>
<name>Line Voltage</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.9.117.112.115.95.108.105.110.101.118</oid>
</ups_linev>
<ups_bcharge>
<name>% Battery Charge</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.11.117.112.115.95.98.99.104.97.114.103.101</oid>
</ups_bcharge>
<ups_timeleft>
<name>Time Left On Battery</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.12.117.112.115.95.116.105.109.101.108.101.102.116</oid>
</ups_timeleft>
<ups_cumonbatt>
<name>Cumulative Time on Battery</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.1.13.117.112.115.95.99.117.109.111.110.98.97.116.116</oid>
</ups_cumonbatt>
</fields>
</query>

netniV
Cacti Guru User
Posts: 3003
Joined: Sun Aug 27, 2017 12:05 am

Re: SNMP data query & snmp-extend troubles

#2 Post by netniV » Sun Aug 18, 2019 9:27 am

What happens if you snmpwalk those oids from the command line on the cacti server?

Hotratz
Posts: 24
Joined: Thu Jun 01, 2017 12:44 pm

Re: SNMP data query & snmp-extend troubles

#3 Post by Hotratz » Fri Aug 23, 2019 11:13 am

netniV wrote:
Sun Aug 18, 2019 9:27 am
What happens if you snmpwalk those oids from the command line on the cacti server?
snmpwalk returns with expected data - so that seems to work just fine:

[cactiServer ~]# snmpwalk -v 3 -a SHA -A pass1 -x AES -X pass2 -l authPriv -u pass3 192.168.100.14:22 NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.\"ups_model\"
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ups_model" = STRING: Back-UPS_RS_1300G

User avatar
camerabob
Cacti User
Posts: 295
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: SNMP data query & snmp-extend troubles

#4 Post by camerabob » Fri Aug 23, 2019 1:56 pm

Check out my APC UPS templates in my signature. Unless you're trying to learn something new, why reinvent the wheel?
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Post Reply