[solved] first SNMP Data Query

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

Moderators: Developers, Moderators

Post Reply
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

[solved] first SNMP Data Query

Post by DraGun »

Hi,

I'm trying to follow SNMP Data Query Walkthrough to create my first one

Already did some Input Data Method, but never played with Data Query

so, here is my XML file:

Code: Select all

<interface>
        <name>Get MSE for Ceragon</name>
        <description>Get MSE for Ceragon</description>
        <index_order>gnOduMonCurrXMse</index_order>
        <index_order_type>numeric</index_order_type>
        <oid_index>.1.3.6.1.4.1.2281.3.1.6.1.1.23</oid_index>
        <oid_num_indexes>.1.3.6.1.4.1.2281.2.1.1.0</oid_num_indexes>

        <fields>
                <gnOduMonCurrXMse>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.6.1.1.23</oid>
                </gnOduMonCurrXMse>
        </fields>
</interface>
Here are an example of the snmp queries:
[lde@vma-xxx-xx /usr/local/share/cacti/resource/snmp_queries]$ snmpwalk -c public -v1 -On host1 .1.3.6.1.4.1.2281.2.1.1.0
.1.3.6.1.4.1.2281.2.1.1.0 = INTEGER: 3
[lde@vma-xxx-xx /usr/local/share/cacti/resource/snmp_queries]$ snmpwalk -c public -v1 -On host1 .1.3.6.1.4.1.2281.3.1.6.1.1.23
.1.3.6.1.4.1.2281.3.1.6.1.1.23.3 = INTEGER: -2986
.1.3.6.1.4.1.2281.3.1.6.1.1.23.4 = INTEGER: -3136
And here is the Verbose Query on the device:
Data Query Debug Information
+ Running data query [40].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/radio_ceragon_mse.xml'
+ XML file parsed ok.
+ Executing SNMP get for num of indexes @ '.1.3.6.1.4.1.2281.2.1.1.0' Index Count: 3
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2281.3.1.6.1.1.23' Index Count: 0
+ No SNMP data returned
I had to add <oid_num_indexes> which is not in the walkthrough, but still no data returned..

Anyone has any clue please?

Rgds,
Last edited by DraGun on Tue Jun 25, 2013 7:33 am, edited 1 time in total.
Errare humanum est, perseverare diabolicum
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: first SNMP Data Query

Post by BSOD2600 »

1) you dont need to add oid_num_indexes, but it does make the Reindex method smarter.
2) .1.3.6.1.4.1.2281.2.1.1.0 says there should be 3 indexes but only 2 are present when walking .1.3.6.1.4.1.2281.3.1.6.1.1.23. A problem.
3) your data template hasn't defined any other input/output fields. What did you expect cacti to display?
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

Re: first SNMP Data Query

Post by DraGun »

Hi,

1/ ok, I'll delete it while testing
2/ Right, I guess the third one is the management interface. Not sure about it, but on all this kind of device, I got one more index than interfaces
3/ I don't have any data template for now, just the XML file.

Just following the walkthrough, I'd like to return the values from .1.3.6.1.4.1.2281.3.1.6.1.1.23

got another OID that may help:
[lde@vma-xxx-xx /usr/local/share/cacti/resource/snmp_queries]$ snmpwalk -v1 -c public -On host1 .1.3.6.1.4.1.2281.3.1.5.1.1
.1.3.6.1.4.1.2281.3.1.5.1.1.3 = INTEGER: 3
.1.3.6.1.4.1.2281.3.1.5.1.1.4 = INTEGER: 4
so here the 3 OIDs I have to work with, the last one being the values I want to graph:
[lde@vma-xxx-xx /usr/local/share/cacti/resource/snmp_queries]$ snmpwalk -v1 -c public -On host1 .1.3.6.1.4.1.2281.2.1.1.0 (num_index)
.1.3.6.1.4.1.2281.2.1.1.0 = INTEGER: 3
[lde@vma-xxx-xx /usr/local/share/cacti/resource/snmp_queries]$ snmpwalk -v1 -c public -On host1 .1.3.6.1.4.1.2281.3.1.4.1.1 (Id)
.1.3.6.1.4.1.2281.3.1.4.1.1.3 = INTEGER: 3
.1.3.6.1.4.1.2281.3.1.4.1.1.4 = INTEGER: 4
[lde@vma-xxx-xx /usr/local/share/cacti/resource/snmp_queries]$ snmpwalk -v1 -c public -On host1 .1.3.6.1.4.1.2281.3.1.6.1.1.23
.1.3.6.1.4.1.2281.3.1.6.1.1.23.3 = INTEGER: -3061
.1.3.6.1.4.1.2281.3.1.6.1.1.23.4 = INTEGER: -3211
Rgds
Errare humanum est, perseverare diabolicum
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

Re: first SNMP Data Query

Post by DraGun »

Hi,

I tried a lot, but can't have anything better...

Here is my XML right now

Code: Select all

<interface>
        <name>Get MSE for Ceragon</name>
        <description>Get MSE for Ceragon</description>
        <oid_index>.1.3.6.1.4.1.2281.3.1.6.1.1.23</oid_index>
        <index_order>gnOduCfgXId</index_order>
        <index_order_type>numeric</index_order_type>

        <fields>

                <gnOduCfgXId>
                        <name>gnOduCfgXId</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.4.1.1</oid>
                </gnOduCfgXId>

                <gnOduMonCurrXMse>
                        <name>gnOduMonCurrXMse</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.6.1.1.23</oid>
                </gnOduMonCurrXMse>

        </fields>
</interface>
and here's the verbose query:
+ Running data query [40].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/radio_ceragon_mse.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.2281.3.1.6.1.1.23' Index Count: 0
+ No SNMP data returned
OID .1.3.6.1.4.1.2281.3.1.4.1.1 gives index(es) beginning with 3.
Could it be a problem for Cacti? does it have to start with a 0 or a 1?

Rgds,
Errare humanum est, perseverare diabolicum
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

Re: first SNMP Data Query

Post by DraGun »

Hi,

Here is my new XML file:

Code: Select all

<interface>
        <name>Get MSE for Ceragon</name>
        <description>Get MSE for Ceragon</description>
        <index_order>gnOduMonCurrXId</index_order>
        <index_order_type>numeric</index_order_type>
        <oid_index>.1.3.6.1.4.1.2281.3.1.6.1.1</oid_index>

        <fields>
                <gnOduMonCurrXId>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.6.1.1.1</oid>
                </gnOduMonCurrXId>
                <gnOduMonCurrXMse>
                        <name>mse</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.6.1.1.23</oid>
                </gnOduMonCurrXMse>
        </fields>
</interface>
here is the results of snmpwalk:
[lde@vma-xxx-xx ~]$ snmpwalk -On -v1 -c public host2 .1.3.6.1.4.1.2281.3.1.6.1.1.1
.1.3.6.1.4.1.2281.3.1.6.1.1.1.4 = INTEGER: 4
[lde@vma-xxx-xx ~]$ snmpwalk -On -v1 -c public host2 .1.3.6.1.4.1.2281.3.1.6.1.1.23
.1.3.6.1.4.1.2281.3.1.6.1.1.23.4 = INTEGER: -3126


[lde@vma-xxx-xx ~]$ snmpwalk -On -v1 -c public host1 .1.3.6.1.4.1.2281.3.1.6.1.1.1
.1.3.6.1.4.1.2281.3.1.6.1.1.1.3 = INTEGER: 3
.1.3.6.1.4.1.2281.3.1.6.1.1.1.4 = INTEGER: 4
[lde@vma-xxx-xx ~]$ snmpwalk -On -v1 -c public host1 .1.3.6.1.4.1.2281.3.1.6.1.1.23
.1.3.6.1.4.1.2281.3.1.6.1.1.23.3 = INTEGER: -3136
.1.3.6.1.4.1.2281.3.1.6.1.1.23.4 = INTEGER: -3136
And finally, here is my verbose query on host2:
+ Running data query [40].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/radio_ceragon_mse.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.2281.3.1.6.1.1' Index Count: 24
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.1.4' value: '4'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.2.4' value: '-56'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.3.4' value: '-54'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.4.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.5.4' value: '542'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.6.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.7.4' value: '-58'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.8.4' value: '-53'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.9.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.10.4' value: '59400'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.11.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.12.4' value: '20'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.13.4' value: '20'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.14.4' value: '20'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.15.4' value: '20'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.16.4' value: '5300'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.17.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.18.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.19.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.20.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.21.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.22.4' value: '0'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.23.4' value: '-3126'
+ Index found at OID: 'enterprises.2281.3.1.6.1.1.24.4' value: '2'
+ Located input field 'gnOduMonCurrXId' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2281.3.1.6.1.1.1'
+ Found item [gnOduMonCurrXId='4'] index: 4 [from value]
But it looks like that the return is gnOduMonCurrXId and not the one I want: gnOduMonCurrXMse

Is there something wrong with my xml file?

Rgds
Errare humanum est, perseverare diabolicum
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: first SNMP Data Query

Post by BSOD2600 »

Looks like you should still use .1.3.6.1.4.1.2281.3.1.5.1.1 as the <oid_index> and <gnOduMonCurrXId> fields. Then it should output the correct OID suffix for <gnOduMonCurrXMse>.
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

Re: first SNMP Data Query

Post by DraGun »

Hi,

Here the verbose query, after changing the xml with

Code: Select all

<oid_index>.1.3.6.1.4.1.2281.3.1.5.1.1</oid_index>
[...]
<oid>.1.3.6.1.4.1.2281.3.1.5.1.1</oid>
</gnOduMonCurrXId>
+ Running data query [40].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/radio_ceragon_mse.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.2281.3.1.5.1.1' Index Count: 1
+ Index found at OID: 'enterprises.2281.3.1.5.1.1.4' value: '4'
+ Located input field 'gnOduMonCurrXId' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2281.3.1.5.1.1'
+ Found item [gnOduMonCurrXId='4'] index: 4 [from value]
There's no walk on the value I would like to have, and still no gnOduMonCurrXMse output.
and graphs still unavailable :(
Errare humanum est, perseverare diabolicum
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

Re: first SNMP Data Query

Post by DraGun »

Hi,

it works :)

so, here is my final XML:

Code: Select all

<interface>
        <name>Get MSE for Ceragon</name>
        <description>Get MSE for Ceragon</description>
        <index_order>gnOduMonCurrXId:gnOduCfgXODUSerialNumber</index_order>
        <index_order_type>numeric</index_order_type>
        <oid_index>.1.3.6.1.4.1.2281.3.1.5.1.1</oid_index>

        <fields>
                <gnOduMonCurrXId>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.5.1.1</oid>
                </gnOduMonCurrXId>
                <gnOduCfgXODUSerialNumber>
                        <name>serial</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.4.1.19</oid>
                </gnOduCfgXODUSerialNumber>
                <gnOduMonCurrXMse>
                        <name>mse</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2281.3.1.6.1.1.23</oid>
                </gnOduMonCurrXMse>
        </fields>
</interface>
Here the verbose query on host1:
+ Running data query [40].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/radio_ceragon_mse.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.2281.3.1.5.1.1' Index Count: 2
+ Index found at OID: 'enterprises.2281.3.1.5.1.1.3' value: '3'
+ Index found at OID: 'enterprises.2281.3.1.5.1.1.4' value: '4'
+ Located input field 'gnOduMonCurrXId' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2281.3.1.5.1.1'
+ Found item [gnOduMonCurrXId='3'] index: 3 [from value]
+ Found item [gnOduMonCurrXId='4'] index: 4 [from value]
+ Located input field 'gnOduCfgXODUSerialNumber' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2281.3.1.4.1.19'
+ Found item [gnOduCfgXODUSerialNumber='R1307143'] index: 3 [from value]
+ Found item [gnOduCfgXODUSerialNumber='R1307142'] index: 4 [from value]
I just had a last issue: I put -100 in Minimum Value (cause on the graph, it's divided by 100) and had NaN values on the graph. So I put U as minimum value, as the graph template use the function to divide the value.
Everything's fine!

Thanks for your help :)
Errare humanum est, perseverare diabolicum
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: first SNMP Data Query

Post by BSOD2600 »

DraGun wrote:Hi,
it works :)
Great!
DraGun wrote: I just had a last issue: I put -100 in Minimum Value (cause on the graph, it's divided by 100) and had NaN values on the graph. So I put U as minimum value, as the graph template use the function to divide the value.
I highly suggest you set this to an appropriate value instead of leaving it as U. That way if the device ever throws a value which is too far outside a reasonable value rrdtool will discard it and not 'spike' the graph.
DraGun
Posts: 44
Joined: Thu May 24, 2012 11:21 am

Re: first SNMP Data Query

Post by DraGun »

BSOD2600 wrote: I highly suggest you set this to an appropriate value instead of leaving it as U. That way if the device ever throws a value which is too far outside a reasonable value rrdtool will discard it and not 'spike' the graph.
Well, I don't really know which value devices can return. I'll graph a couple of device with that "U option", and in a week or two, will change my data template for new graphes
Errare humanum est, perseverare diabolicum
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest