[rrd-users] rrd script assistance

Neil Calvert ncalvert at cabletron.com
Thu Jan 6 22:59:21 MET 2000


Hi all

I have created a script to roll data into a RRD database but I'm having
some problems and hope someone can shed light.

The script uses linux snmp to get the values of 8 variables :
ifinoctets, ifoutoctets, ifadmin status, ifoperstatus, discards in,
discards out, errors in and errors out. The script then runs rrdtool
update to feed values into the database. I have been using rrddump to
check values as they get added to the mix and for some reason I am
seeing that ifadminstatus and ifoperstatus are not being updated ; the
last_ds for both is reading UNKN.

When I run the script manually and force it to echo values to the screen
both ifadminstatus and ifoperstatus are appearing, with the value 1.
The variables are set as GAUGE with unknown max/min values. I tried
changing it to 'ABSOLUTE' but this didn't appear to help.

This is the script :

#!/bin/ksh
#This script queries 8 SNMP Attributes on an ethernet port. It accepts
four arguments : Device IP, Device SNMP Community Name, Port Number and
RRD Database name.
#Check number of arguments passed :
if      [ $# = 0 ]
then
        echo "Usage : enetscript <IP> <Community Name> <Port Number>
<RRD Database Name>"
        exit
else
        if      [ $# != 4 ]
then
                echo "Invalid number of parameters."
                echo "Usage : enetscript <IP> <Community Name> <Port
Number> <RRD Database Name>"
        exit
        fi
fi
inoctets="`snmpget -v1 $1 $2 2.2.1.10.$3 | awk '{print $3}'`"
outoctets="`snmpget -v1 $1 $2 2.2.1.16.$3 | awk '{print $3}'`"
ifadmin="`snmpget -v1 $1 $2 2.2.1.7.$3 | awk '{print $3}' | sed -e
's/up(1)/1/g' -e 's/down(2)/0/g' -e 's/testing(3)/0/g'`"
ifoper="`snmpget -v1 $1 $2 2.2.1.8.$3 | awk '{print $3}' | sed -e
's/up(1)/1/g' -e 's/down(2)/0/g' -e 's/testing(3)/0/g' -e
's/unknown(4)/0/g' -e 's/dormant(5)/0/g'`"
ifindiscards="`snmpget -v1 $1 $2 2.2.1.13.$3 | awk '{print $3}'`"
ifoutdiscards="`snmpget -v1 $1 $2 2.2.1.19.$3 | awk '{print $3}'`"
ifinerrors="`snmpget -v1 $1 $2 2.2.1.14.$3 | awk '{print $3}'`"
ifouterrors="`snmpget -v1 $1 $2 2.2.1.20.$3 | awk '{print $3}'`"

#Now we update the database with the gathered values.
/apps/RRD/bin/rrdtool update /apps/RRD/rrddata/$4
:$inoctets:$outoctets:$ifadmin:$ifoper:$ifindiscards:$ifoutdiscards:$ifi
nerrors:$ifouterrors
----
And this is the command line I used to create the database :

rrdtool create enet.rrd \
DS:inoctets:COUNTER:600:U:U \
DS:outoctets:COUNTER:600:U:U \
DS:ifadmin:GAUGE:600:0:1 \
DS:ifoper:GAUGE:600:0:1 \
DS:ifindiscards:COUNTER:600:U:U \
DS:ifoutdiscards:COUNTER:600:U:U \
DS:ifinerrors:COUNTER:600:U:U \
DS:ifouterrors:COUNTER:600:U:U \
RRA:AVERAGE:0.5:1:20 \
RRA:AVERAGE:0.5:6:50 \
RRA:AVERAGE:0.5:12:200 \
RRA:AVERAGE:0.5:72:120 \
RRA:AVERAGE:0.5:288:340 \
RRA:MAX:0.5:1:20 \
RRA:MAX:0.5:6:50 \
RRA:MAX:0.5:12:200 \
RRA:MAX:0.5:72:120 \
RRA:MAX:0.5:288:340

Have I overlooked something disgustingly obvious and stupid? I hope so,
and that someone can point it out for me...

cheers,

Neil


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users



More information about the rrd-users mailing list