Converting output value from STRING to INTEGER

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

Moderators: Developers, Moderators

Post Reply
hmorandell
Cacti User
Posts: 73
Joined: Mon May 03, 2010 11:48 am

Converting output value from STRING to INTEGER

Post by hmorandell »

Hi,

I try to make a script to graph the MOS Value of a One Access Device.

I'm polling the follwing SNMP fields:

Code: Select all

.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.3.0
.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.4.0
.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.5.0
and that's what I get returned:

Code: Select all

.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.3.0 = STRING: 3.98
.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.4.0 = STRING: 3.91
.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.5.0 = STRING: 4.30
I now created a XML template and want this values to be graphed, but somehow I can't sort it out...

This is my XML File:

Code: Select all

<interface>
        <name>Get MOS Statistics from One Access</name>
        <description>Queries a host for a list of xDSL interfaces</description>
        <oid_index>1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.1.0</oid_index>
        <index_order>MosAVGDisp:MosMINDisp:MosMAXDisp</index_order>

        <fields>
                <MosAVGDisp>
                        <name>MOS Average</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.3.0</oid>
                </MosAVGDisp>
                <MosMINDisp>
                        <name>MOS Minimum</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.4.0</oid>
                </MosMINDisp>
                <MosMAXDisp>
                        <name>MOS Maximum</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.5.0</oid>
                </MosMAXDisp>
                <MosAVG>
                        <name>Mos Average</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.3.0</oid>
                </MosAVG>
                <MosMIN>
                        <name>Mos Minimum</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.4.0</oid>
                </MosMIN>
                <MosMAX>
                        <name>Mos Maximum</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.5.0</oid>
                </MosMAX>
        </fields>
</interface>
the graph is being created, but no value is being showing up. This is the output of the rrdtool debug:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=1389787381 \
--end=1389801781 \
--title='xxxxxxxxxxxxxxxxxxxx - Mos Statistics' \
--base=1000 \
--height=120 \
--width=600 \
--alt-autoscale-max \
--lower-limit='0' \
COMMENT:"From 15/01/2014 13\:03\:01 To 15/01/2014 17\:03\:01\c" \
COMMENT:"  \n" \
--vertical-label='' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
DEF:a="/srv/www/htdocs/cacti/rra/xxxxxxxxxxxxxxxxxxxx_mosstatsavg_12110.rrd":'MosStatsAvg':AVERAGE \
DEF:b="/srv/www/htdocs/cacti/rra/xxxxxxxxxxxxxxxxxxxx_mosstatsavg_12110.rrd":'MosStatsMax':AVERAGE \
DEF:c="/srv/www/htdocs/cacti/rra/xxxxxxxxxxxxxxxxxxxx_mosstatsavg_12110.rrd":'MosStatsMin':AVERAGE \
LINE1:a#F51D30FF:"Mos Average"  \
LINE1:b#888888FF:"Mos Maximum"  \
LINE1:c#00BD27FF:"Mos Minimum" 
This is what the SNMP Verbose Query looks like in Cacti:

Code: Select all

+ Running data query [47].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx/cacti/resource/snmp_queries/oneAccessMOS.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.13191.10.3.5.2.1.4.1.1.1.0' Index Count: 1
+ Index found at OID: '.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.1.0' value: '0'
+ Located input field 'MosAVGDisp' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.3.0'
+ Found item [MosAVGDisp='3.92'] index: 0 [from value]
+ Located input field 'MosMINDisp' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.4.0'
+ Found item [MosMINDisp='3.92'] index: 0 [from value]
+ Located input field 'MosMAXDisp' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.13191.10.3.5.2.1.4.1.1.5.0'
+ Found item [MosMAXDisp='3.92'] index: 0 [from value]
does anybody see where I'm failing? Appreciate every help, thanks
_________________
Cacti - 1.2.14
Poller Type - SPINE 1.2.14
Devices 3,892
Graphs 21,483
hmorandell
Cacti User
Posts: 73
Joined: Mon May 03, 2010 11:48 am

Re: Converting output value from STRING to INTEGER

Post by hmorandell »

solved by using proper indexes in the XML files.
_________________
Cacti - 1.2.14
Poller Type - SPINE 1.2.14
Devices 3,892
Graphs 21,483
tinti
Posts: 2
Joined: Thu Jan 10, 2008 3:18 am

Re: Converting output value from STRING to INTEGER

Post by tinti »

Could you post your updated XML file?
HumTum1
Posts: 1
Joined: Sat Mar 07, 2015 2:10 am

Re: Converting output value from STRING to INTEGER

Post by HumTum1 »

yes Dear solved by using proper indexes in the XML files. :oops: :P





___________________
You can join us for best [url=http://www.spanishprograms.com/]spanishprograms[/url] dumps [url=http://www.spanishprograms.com/learn-spanish/]spanishprograms - learning spanish audio[/url] oracle training solutions. Our [url=www.learnchineseez.com]learnchineseez [/url] contains all those you want to pass for real
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests