XML queries, sees data, wont retrieve/store it

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

Moderators: Developers, Moderators

Post Reply
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

Here is my XML file:

Code: Select all

<interface>
        <name>Get SNMP Interfaces</name>
        <description>Queries a host for a list of monitorable temp sensors</description>
        <oid_index>.1.3.6.1.4.1.17373.3.4</oid_index>
        <oid_num_indexes>.1.3.6.1.4.1.17373.3.1.8.1.4</oid_num_indexes>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <senseDescr>
                        <name>Description</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.2</oid>
                </senseDescr>
                <senseName>
                        <name>Name</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.3</oid>
                </senseName>
                <senseTemp>
                        <name>Temp</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.6</oid>
                </senseTemp>
        </fields>
</interface>
here are the related SNMP walks:

Code: Select all

snmpwalk -v 2c  -On -m ALL -c xxxxx w.x.y.z .1.3.6.1.4.1.17373.3.1.8.1.4
.1.3.6.1.4.1.17373.3.1.8.1.4.0 = INTEGER: 2

Code: Select all

snmpwalk -v 2c  -On -m ALL -c xxxxx w.x.y.z .1.3.6.1.4.1.17373.3.4
.1.3.6.1.4.1.17373.3.4.1.2.1 = STRING: "9E0000041F32CF28"
.1.3.6.1.4.1.17373.3.4.1.2.2 = STRING: "A50000041F1F1A28"
.1.3.6.1.4.1.17373.3.4.1.3.1 = STRING: "Sensor1"
.1.3.6.1.4.1.17373.3.4.1.3.2 = STRING: "Sensor2"
.1.3.6.1.4.1.17373.3.4.1.4.1 = Gauge32: 1
.1.3.6.1.4.1.17373.3.4.1.4.2 = Gauge32: 1
.1.3.6.1.4.1.17373.3.4.1.5.1 = INTEGER: 16
.1.3.6.1.4.1.17373.3.4.1.5.2 = INTEGER: 29
.1.3.6.1.4.1.17373.3.4.1.6.1 = INTEGER: 61
.1.3.6.1.4.1.17373.3.4.1.6.2 = INTEGER: 84
Verbose Query Output:

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.17373.3.4'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.1' value: '9E0000041F32CF28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.2' value: 'A50000041F1F1A28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.3.1' value: 'Sensor1'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.3.2' value: 'Sensor2'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.4.1' value: '1'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.4.2' value: '1'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.5.1' value: '16'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.5.2' value: '29'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.6.1' value: '61'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.6.2' value: '84'
+ Located input field 'senseDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Located input field 'senseName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.3'
+ Located input field 'senseTemp' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.6'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
and I get "Success [0 Items, 0 Rows]"

Any thoughts as to why its not getting the data?

Thank you =)
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

Any idea where I'm going wrong here?

Thank you =)
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

Bumping for justice =)
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

So I did some toying around, not to much avail but I notice that when I run "verbose query" sometimes I get:

+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Found item [extSensorSerial='9E0000041F32CF28'] index: 1 [from value]
+ Found item [extSensorSerial='A50000041F1F1A28'] index: 2 [from value]

And sometimes I get:

+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'

Why would it find data sometimes, but not others?

Here is my updated xml file:

Code: Select all

<interface>
        <name>ITWD External Temp Sensors</name>
        <description>Queries a host for a list of monitorable temp sensors</description>
        <index_order_type>numeric</index_order_type>
        <oid_index>.1.3.6.1.4.1.17373.3.4.1</oid_index>
        <oid_num_indexes>.1.3.6.1.4.1.17373.3.4.0</oid_num_indexes>
        <index_title_format>|chosen_order_field|</index_title_format>
        <fields>
                <extSensorSerial>
                        <name>Sensor Serial Number</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.2</oid>
                </extSensorSerial>
                <extSensorName>
                        <name>Sensor Name</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.3</oid>
                </extSensorName>
                <extSensorAvail>
                        <name>Sensor Status</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.4</oid>
                </extSensorAvail>
                <extSensorTempF>
                        <name>Sensor Temperature</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.17373.3.4.1.6</oid>
                </extSensorTempF>
        </fields>
</interface>
Related Verbose Query:

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.17373.3.4.1'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.1' value: '9E0000041F32CF28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.2' value: 'A50000041F1F1A28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.3.1' value: 'Sensor01'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.3.2' value: 'Sensor02'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.4.1' value: '1'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.4.2' value: '1'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.5.1' value: '16'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.5.2' value: '27'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.6.1' value: '62'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.6.2' value: '81'
+ Located input field 'extSensorSerial' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Found item [extSensorSerial='9E0000041F32CF28'] index: 1 [from value]
+ Found item [extSensorSerial='A50000041F1F1A28'] index: 2 [from value]
+ Located input field 'extSensorName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.3'
+ Located input field 'extSensorAvail' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.4'
+ Located input field 'extSensorTempF' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.6'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
I've attached the MIB in rar format.

Any help at all would be greatly appreciated.

Thank you.
Attachments
itw_mibv3.rar
Related MIB
(16.87 KiB) Downloaded 57 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: XML queries, sees data, wont retrieve/store it

Post by BSOD2600 »

Do you have extSensorTempF as an INPUT for testing or a mistake? Input values are not stored to rrd, only output are. Also in the data query, make sure the checkbox next to the data source name is checked.

The oid_index appears to be wrong too. Try .1.3.6.1.4.1.17373.3.4.1.2
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

Thank you very much for your reply.

The input vs output was a mistake.

I've corrected that and changed the oid_index as suggested.

My results are now different from the verbose query but still not right and change between runs

First run after change

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.1' value: '9E0000041F32CF28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.2' value: 'A50000041F1F1A28'
+ Located input field 'extSensorSerial' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Found item [extSensorSerial='9E0000041F32CF28'] index: 1 [from value]
+ Found item [extSensorSerial='A50000041F1F1A28'] index: 2 [from value]
+ Located input field 'extSensorName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.3'
+ Located input field 'extSensorAvail' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.4'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
Second run

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.1' value: '9E0000041F32CF28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.2' value: 'A50000041F1F1A28'
+ Located input field 'extSensorSerial' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Located input field 'extSensorName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.3'
+ Located input field 'extSensorAvail' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.4'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
Sometimes it finds the items, other times it doesn't... and it only ever finds the value for the serial numbers, none of the other fields.

If I manually SNMP walk from the CLI, I always get the same information back from the device.

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

Re: XML queries, sees data, wont retrieve/store it

Post by BSOD2600 »

Try changing between snmp v1 and v2. some devices are picky. Another option to change is the max oids per query. Lower it down to 1 and see if the verbose query behaves better. Does the device have any anti-DoS protections which would be blocking snmp queries?
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

Not that I'm aware of, it's just a simple climate monitor from IT Watchdogs (MiniGooseXP II)

Switching to v1 seemingly made the difference:

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at /cacti/resource/snmp_queries/itwd-temps.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.1' value: '9E0000041F32CF28'
+ Index found at OID: '1.3.6.1.4.1.17373.3.4.1.2.2' value: 'A50000041F1F1A28'
+ Located input field 'extSensorSerial' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.2'
+ Found item [extSensorSerial='9E0000041F32CF28'] index: 1 [from value]
+ Found item [extSensorSerial='A50000041F1F1A28'] index: 2 [from value]
+ Located input field 'extSensorName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.3'
+ Found item [extSensorName='sensor01'] index: 1 [from value]
+ Found item [extSensorName='sensor02'] index: 2 [from value]
+ Located input field 'extSensorAvail' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.17373.3.4.1.4'
+ Found item [extSensorAvail='1'] index: 1 [from value]
+ Found item [extSensorAvail='1'] index: 2 [from value]
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/itwd-temps.xml'
I also see when I create graphs for the host, it sees both sensors, awesome.

Hopefully they'll actually graph ;)

/me waits

Thanks for the assistance everyone, I really do appreciate it.
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

I do have a quick follow up though as I can already see an issue.

Under the "Associated Graph/Data Templates" for this query I have:

Data Template - ITWD Temps
name - |host_description| - |extSensorName| - |extSensorAvail|

Graph Template - ITWD - Temps
title - |host_description| - |extSensorName| - |extSensorAvail|

The titles on the graph have the right value for the host_description, but it just throws the other two out there verbatim and doesnt swap in the values from the xml query.

On a positive note, it IS getting the temp data and graphing properly... Just need to fix the titles =)
scrupul0us
Posts: 42
Joined: Fri Sep 02, 2011 9:42 am

Re: XML queries, sees data, wont retrieve/store it

Post by scrupul0us »

annnnd I figured that out, had to prepend with "query_"
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: XML queries, sees data, wont retrieve/store it

Post by BSOD2600 »

Congrats on your first template :)

Consider posting it to http://docs.cacti.net/templates once you get all the bugs ironed out.
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests