[SNMP QUERIES] VALUE/REGEXP in output direction

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

Moderators: Developers, Moderators

Post Reply
rbo
Posts: 5
Joined: Mon Sep 07, 2009 3:18 pm
Location: Guadeloupe

[SNMP QUERIES] VALUE/REGEXP in output direction

Post by rbo »

Hi there,

I am struggling to get a working graph for monitoring SDSL connectivity through Redback Active Subscribers MIB.

Everything is ok for input variable (SessionID) and Counter outputs (rbnSubsOctetsSent and rbnSubsOctetsReceived) to graph traffic.

But I also try to get a variable called rbnSubsActiveStartTime, which syntax is DateAndTime and looks like :

Code: Select all

 snmpwalk -v 2c -c <community> <host> .1.3.6.1.4.1.2352.2.27.1.1.1.1.5 
SNMPv2-SMI::enterprises.2352.2.27.1.1.1.1.5.17.48.48.58.50.50.58.56.51.58.99.50.58.99.98.58.56.48.25.48.51.48.51.70.70.70.70.55.56.48.48.48.48.67.65.45.52.65.56.66.70.53.55.70 = Hex-STRING: 07 D9 08 13 0C 34 0F 00 2B 00 00
Decoding this seems simple : http://www.webnms.com/net-snmp/help/dev ... dtime.html

I tried to parse out the interesting fields (year, month, day, hour, minutes) but the VALUE/REGEXP in output direction does not seem to work (I always have the same float returned by hexdec as if the value was not parsed).

I found an old Feature Request about this (http://bugs.cacti.net/view.php?id=444) but don't think is has been integrated...
Is that correct ?

Does anyone know a workaround ?

Code: Select all

<query>
        <name>Get Redback Subscriber Active Statistics</name>
        <description> Projet SHDSL </description>
        <index_order_type>numeric</index_order_type>
        <oid_index>.1.3.6.1.4.1.2352.2.27.1.1.1.1.3</oid_index>
        <index_order>SessionID</index_order>
        <oid_index_parse>OID/REGEXP:1\.3\.6\.1\.4\.1\.2352\.2\.27\.1\.1\.1\.1\.3\.(.*)$</oid_index_parse>
        <fields>
                <SessionID>
                        <name>Session ID</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^(.*) clips [0-9]+$</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2352.2.27.1.1.1.1.3</oid>
                </SessionID>
                <rbnSubsOctetsSent>
                        <name>rbnSubsOctetsSent</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2352.2.27.1.2.3.1.1</oid>
                </rbnSubsOctetsSent>
                <rbnSubsOctetsReceived>
                        <name>rbnSubsOctetsReceived</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2352.2.27.1.2.3.1.2</oid>
                </rbnSubsOctetsReceived>
                <rbnSubsActiveStartTime>
                        <name>rbnSubsActiveStartTime</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^([0-9A-F][0-9A-F]).*$</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2352.2.27.1.1.1.1.5</oid>
                </rbnSubsActiveStartTime>
        </fields>
</query>

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

Post by BSOD2600 »

I'm curious why you're trying to parse and then output the DateAndTime field, as this type of data isn't storable via rrdtool.

Now if you're trying to simply display this OCTET STRING on a graph, then you need to change the direction to INPUT. Then in a graph template you'd need to insert |query_rbnSubsActiveStartTime| as an item to have it displayed.
rbo
Posts: 5
Joined: Mon Sep 07, 2009 3:18 pm
Location: Guadeloupe

Post by rbo »

Hi,

Thanks for your hints. In fact I don't only want to show the Date as Text in the graph but I need to track any change to it to detect resets of the connection I need to supervise.

In fact since 0.8.7c Cacti is able to convert Hex-STRING to float.
My DateAndTime is coded as Hex-STRING and is the time at which the connection has been active.

In my exemple 07 D9 = 2009
08 = august
13 = 13th of
0C = 12 hours
34 = 52 minutes
The rest 0F 00 2B 00 00 I don't mind.

POLLER to CACTI2RRD is ok as I get 9.4873832105669E+24 but this result cannot actually be stored in the RRD (I get a NaN, don't know why).

Code: Select all

09/08/2009 02:40:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/brtr5-gp_-_msv_internet_global_rbnsubsactivestartt_17622.rrd --template rbnSubsActiveStartT 1252420802:9.4873832105669E+24
09/08/2009 02:40:02 PM - SPINE: Poller[0] Host[147] DS[17622] SNMP: v2: 213.188.170.31, dsname: rbnSubsActiveStartT, oid: .1.3.6.1.4.1.2352.2.27.1.1.1.1.5.17.48.48.58.50.50.58.56.51.58.99.50.58.99.98.58.56.48.25.48.51.48.51.70.70.70.70.55.56.48.48.48.48.67.65.45.52.65.56.66.70.53.55.70, value: 07 D9 08 13 0C 34 0F 00 2B 00 00 
Then I was trying to convert it to a smaller Hex value using a REGEXP.

If I use this number as a COUNTER then it should always be 0 unless the connection has been reset.

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

Post by BSOD2600 »

rbo wrote:POLLER to CACTI2RRD is ok as I get 9.4873832105669E+24 but this result cannot actually be stored in the RRD (I get a NaN, don't know why).
Possibly the MAX DS for the rrd file is too small. run rrdtool info <filename.rrd> and check if that MAX is smaller than 9.4E+24.
rbo
Posts: 5
Joined: Mon Sep 07, 2009 3:18 pm
Location: Guadeloupe

Post by rbo »

You're right I changed the Data Template to set a high "maximum value" but didn't recreate my graph to propagate this change in the RRD file.

But :cry: the value in the RRD is still NaN.

Code: Select all

filename = "brtr5-gp_-_msv_internet_global_rbnsubsactivestartt_17625.rrd"
rrd_version = "0003"
step = 300
last_update = 1252449602
ds[rbnSubsActiveStartT].type = "COUNTER"
ds[rbnSubsActiveStartT].minimal_heartbeat = 600
ds[rbnSubsActiveStartT].min = 0.0000000000e+00
ds[rbnSubsActiveStartT].max = 9.0000000000e+26
ds[rbnSubsActiveStartT].last_ds = "9.4874008671669E+24"
ds[rbnSubsActiveStartT].value = NaN
ds[rbnSubsActiveStartT].unknown_sec = 2
I am guessing whether the problem would be the slightly different representation between max (without double quotes with a small e in the scientific notation) versus last_ds (with quotes and E) ...
rbo
Posts: 5
Joined: Mon Sep 07, 2009 3:18 pm
Location: Guadeloupe

Post by rbo »

I tried to update the rrd file manually to see if any errors :

Code: Select all

/usr/bin/rrdtool update /var/www/html/rra/brtr5-gp_-_msv_internet_global_rbnsubsactivestartt_17625.rrd --template
 rbnSubsActiveStartT 1252451802:9.4874008671669E+24
ERROR: not a simple integer: '9.4874008671669E+24'

Same with "e+24".

RRDTool 1.2.23, will try another version cause I read from RRDTool site :
What data can be put into an RRD?

You name it, it will probably fit as long as it is some sort of time-series data. This means you have to be able to measure some value at several points in time and provide this information to RRDtool. If you can do this, RRDtool will be able to store it. The values must be numerical but don't have to be integers, as is the case with MRTG (the next section will give more details on this more specialized application).
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

1) your MAX DS is still too small.
2) You must use rrdtool update with the full numeric number, not using scientific notation.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests