Data Query question

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

Moderators: Developers, Moderators

xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Data Query question

Post by xefil »

Hello!

I'm trying to create my first SNMP Data Query following cacti guide, but I'm having some problems.
The device I'm scanning is an air conditioning system. The index of the different devices is formed by the last two digits of the mib, example:

.1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.1 = STRING: "CDZ-01"
.1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.2 = STRING: "CDZ-02"
.1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.3 = STRING: "CDZ-03"
(...)

On this basis I've created this xml template:

Code: Select all

<query>
        <name>Get SNMP Stulz WIB 8000</name>
        <description>Queries Stulz WIB 8000</description>
        <oid_uptime>.1.3.x.x.x</oid_uptime>
        <oid_index>.1.3.6.1.4.1.29462.10.1.1.6.1.1.393221</oid_index>
        <oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3})$</oid_index_parse>
        <index_order>unitsettingName</index_order>
        <index_order_type>alphabetic</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>
        <fields>
                <unitsettingName>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.29462.10.1.1.6.1.1.393221</oid>
                </unitsettingName>
                <unitReturnAirTemperature>
                        <name>ReturnAirTemperature</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1192</oid>
                </unitReturnAirTemperature>
        </fields>
</query>
My first question is, why the "Verbose Query" is obtaining this result? I mean these simil-MAC Addresses:

Code: Select all

Data Query Debug Information
+ Running data query [15].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/opt/cacti/resource/snmp_queries/wib8000.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.29462.10.1.1.6.1.1.393221' Index Count: 5
+ Index found at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.1' value: '55:6E:69:74:C3:A0:20:54:2D:31'
+ Index found at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.2' value: '55:6E:69:74:C3:A0:20:54:2D:32'
+ Index found at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.3' value: '55:6E:69:74:C3:A0:20:48:2D:31'
+ Index found at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.4' value: '55:6E:69:74:C3:A0:20:48:2D:32'
+ Index found at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.5' value: '55:6E:69:74:C3:A0:20:48:2D:33'
+ index_parse at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.1' results: '1.1'
+ index_parse at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.2' results: '1.2'
+ index_parse at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.3' results: '1.3'
+ index_parse at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.4' results: '1.4'
+ index_parse at OID: '1.3.6.1.4.1.29462.10.1.1.6.1.1.393221.1.5' results: '1.5'
+ Located input field 'unitsettingName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.29462.10.1.1.6.1.1.393221'
+ Found item [unitsettingName='55:6E:69:74:C3:A0:20:54:2D:31'] index: 1.1 [from value]
+ Found item [unitsettingName='55:6E:69:74:C3:A0:20:54:2D:32'] index: 1.2 [from value]
+ Found item [unitsettingName='55:6E:69:74:C3:A0:20:48:2D:31'] index: 1.3 [from value]
+ Found item [unitsettingName='55:6E:69:74:C3:A0:20:48:2D:32'] index: 1.4 [from value]
+ Found item [unitsettingName='55:6E:69:74:C3:A0:20:48:2D:33'] index: 1.5 [from value]
This causes me the following result when trying to add a graph:
img1.jpg
img1.jpg (66.51 KiB) Viewed 5896 times

why?

Thank's

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

Re: Data Query question

Post by gandalf »

The Cacti output looks like a hexadecimal representation wheras your snmpwalk shows us a STRING field. Which field type is assigned by the MIB file, please?
R.
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Re: Data Query question

Post by xefil »

Well, I've a MIB containing this:

Code: Select all

(...)
UnitEntry ::= SEQUENCE {
        unitsettingName Unsigned32,
        unitsettingHwType Unsigned32,
        unitsettingType Unsigned32
}
(...)
unitsettingName OBJECT-TYPE
        SYNTAX Unsigned32
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
                "unitsettingName"
        ::= { unitEntry 393221 }
But

This has caused me this error:

Code: Select all

.iso.org.dod.internet.private.enterprises.stulz.stulzWib.wibIntern.settings.unitSettings.unitTable.unitEntry.unitsettingName.1.1 = Wrong Type (should be Gauge32 or Unsigned32): STRING: "CDZ-01"
.iso.org.dod.internet.private.enterprises.stulz.stulzWib.wibIntern.settings.unitSettings.unitTable.unitEntry.unitsettingName.1.2 = Wrong Type (should be Gauge32 or Unsigned32): STRING: "CDZ-02"
.iso.org.dod.internet.private.enterprises.stulz.stulzWib.wibIntern.settings.unitSettings.unitTable.unitEntry.unitsettingName.1.3 = Wrong Type (should be Gauge32 or Unsigned32): STRING: "CDZ-03"
Also I've corrected the MIB file to have String:

Code: Select all

(...)
UnitEntry ::= SEQUENCE {
        unitsettingName OCTET STRING (SIZE(0..64)),
        unitsettingHwType Unsigned32,
        unitsettingType Unsigned32
}
(...)
unitsettingName OBJECT-TYPE
        SYNTAX OCTET STRING (SIZE(0..64))
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
                "unitsettingName"
        ::= { unitEntry 393221 }

and now:

Code: Select all

[root@cacti spine]# snmpwalk -v1 -Of -c public mywib8000 Stulz-WIB8000-MIB::unitTable -t 20 
.iso.org.dod.internet.private.enterprises.stulz.stulzWib.wibIntern.settings.unitSettings.unitTable.unitEntry.unitsettingName.1.1 = STRING: "CDZ-01"
.iso.org.dod.internet.private.enterprises.stulz.stulzWib.wibIntern.settings.unitSettings.unitTable.unitEntry.unitsettingName.1.2 = STRING: "CDZ-02"
.iso.org.dod.internet.private.enterprises.stulz.stulzWib.wibIntern.settings.unitSettings.unitTable.unitEntry.unitsettingName.1.3 = STRING: "CDZ-03"
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Data Query question

Post by gandalf »

And waht happens to the Cacti table, when you rerun the data query now?
R.
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Re: Data Query question

Post by xefil »

gandalf wrote:And waht happens to the Cacti table, when you rerun the data query now?
R.
I've still done this before asking the question. I mean, the output in the table is the same.
Do you suggest using a Script Data Query instead snmp query?

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

Re: Data Query question

Post by gandalf »

Not yet.
Your example shows, that when using the correct data type, the output is handled as a string. What has to be done now to get it right, is to change the SNMP agent on the target device to print STRINGs instead of HEX. So, this is a vendor issue. In case you see any chance to manage that, fine.

Else, we indeed have to implement some workaround.
1. Indeed, a script would help as you now may convert the data as you like
2. A "data type conversion feature" might come in useful. This is not the first time we're hitting this wall. So we already made up our (my?) mind to add such a functionality. It would be implemented for next release (0.8.9). But if you like, you may test it on 088 as a "custom patch" as well. I'm currently thinking about an XML extension like "<convert>hex2string</convert>" or the like as an optional field.

R.
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Re: Data Query question

Post by xefil »

Thank's Reinhard for the help,

Meanwhile I've solved the HEX issue working on the device. There was my fault.
I've other little issues.

1. Trying with a default little data template and graph associated, on log I obtain:

01/29/2013 10:33:10 AM - SPINE: Poller[0] Host[1477] TH[1] DS[11418] SNMP: v1: wib01, dsname: SupplyAirTemperatur, oid: .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1, value: U

But if I query it manually:

[root@cacti spine]# snmpwalk -v1 -On -c public wib01 .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1.1 = INTEGER: 198

The datasource has max value set to 1200 also shouldn't give an "U" result:
DS[SupplyAirTemperatur] typ: GAUGE hbt: 600 min: 0.0000 max: 1200.0000

Why happens this? And how can I debug it more in deep?

2. And....
The index is like descrived before, the last two digits from the mib searching into the unitTable. Well, this gives me as result, for second unit: "1.2". Ok, If I query the temperature, I've to add an additional 1, otherwise I cannot obtain a result by cli. Example:

Code: Select all

[root@cacti spine]# snmpwalk -v1 -On -c public wib01 .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.2
[root@cacti spine]# snmpwalk -v1 -On -c public wib01 .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.2.1
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.2.1 = INTEGER: 194
Note: For index "1.1" it works without specifying the additional 1 at the end, also for question 1 should work.

If I made an snmpwalk starting a level upper:

Code: Select all

[root@cacti spine]# snmpwalk -v1 -On -c public wib01 .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1.1 = INTEGER: 197
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.2.1 = INTEGER: 193
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.3.1 = INTEGER: 227
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.4.1 = INTEGER: 226
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.5.1 = INTEGER: 234
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.6.1 = INTEGER: 251
I obtain all entries. Why?


Thank's

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

Re: Data Query question

Post by gandalf »

xefil wrote:1. Trying with a default little data template and graph associated, on log I obtain:

01/29/2013 10:33:10 AM - SPINE: Poller[0] Host[1477] TH[1] DS[11418] SNMP: v1: wib01, dsname: SupplyAirTemperatur, oid: .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1, value: U

But if I query it manually:

[root@cacti spine]# snmpwalk -v1 -On -c public wib01 .1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1
.1.3.6.1.4.1.29462.10.2.1.1.1.1.1.1.1.1193.1.1.1 = INTEGER: 198
You see the difference?
Please better use snmpget as a test.
R.
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Re: Data Query question

Post by xefil »

Hello!

Yes, as seen it adds an additional index ".1" at the end. BTW I've created all the stuff using php script query and now all works perfectly. Learned something new ;-)

Thank's for your support!!

Have a nice week-end!

Simon
MrGonobob
Posts: 1
Joined: Thu Mar 14, 2013 8:26 am

Re: Data Query question

Post by MrGonobob »

Hello!
Where did you get the Stulz WIB 8000 MIB file? Can you please share it (or send to address alexey%armo.ru)?
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Re: Data Query question

Post by xefil »

MrGonobob wrote:Hello!
Where did you get the Stulz WIB 8000 MIB file? Can you please share it (or send to address alexey%armo.ru)?
Hello!

Try with this:

http://forums.apc.com/servlet/JiveServl ... 0_v115.mib

I've modified the mib for an issue on two declaration, that solved my problems

original Vs my-modified

Code: Select all

406c406
<       unitsettingName Unsigned32,
---
>       unitsettingName OCTET STRING (SIZE(0..64)),
412c412
<       SYNTAX Unsigned32
---
>       SYNTAX OCTET STRING (SIZE(0..64))
I've created a template too, to graph like follow.
Need to be translated from italian to english, but if you like/need them, I can share it too.
In addiction a weathermap icon.

Bye, Simon
Attachments
Graph
Graph
graph.jpg (118.16 KiB) Viewed 5808 times
Weathermap icon
Weathermap icon
weathermap.jpg (8.7 KiB) Viewed 5808 times
tcprado
Posts: 23
Joined: Fri Apr 12, 2013 7:25 am

Re: Data Query question

Post by tcprado »

xefil, can you share your templates and scripts with us? I am at the moment stuck with the trailing .1 and getting U as a response.
pushover
Posts: 1
Joined: Thu Jul 04, 2013 4:04 am

Re: Data Query question

Post by pushover »

Hi Xefil,

I would be interested too in the templates and scripts if you could share them with us.

Thanks!
bcook17
Posts: 1
Joined: Thu Sep 05, 2013 7:02 pm

Re: Data Query question

Post by bcook17 »

I would really like this template you have created if you could post that as well.
zoloogg
Posts: 1
Joined: Wed Jan 22, 2014 9:43 pm

Re: Data Query question

Post by zoloogg »

Hello, xefil!

Could you share your scripts? Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests