What I'm tring to do is get and graph ip accounting infomation from my cisco
router on a per user basis, if I issue:
[EMAIL PROTECTED] src]# snmpwalk server public .1.3.6.1.4.1.9.2.4.9.1.4
I get
enterprises.9.2.4.9 .1.4. 216.246.18.156. 12.18.122.173 = 1904
which is:
[libckaccounting table] [OID outbyts] [src] [dest]
[Bytes]
I want to chop off the "enterprises.9.2.4.9.1.4.216.246.18.156."
and use the dest and bytes fields to feed them into RRDTOOL
Any help would be appricated, especially if someone know a more appropriate
place to ask this question.
Thanks
Alex
----- Original Message -----
From: Todd Caine
To: Alex Kourafas
Sent: Friday, March 01, 2002 2:34 PM
Subject: Re: [rrd-users] Re: RRD Tutorial - Question -Real World Example
Alex,
There are a couple of things about the script which don't work on my system.
You should run the following command on your system to make sure it actually
returns a number:
snmpwalk server public interfaces.ifTable.ifEntry.ifInOctets.1 | awk -- '
BEGIN { FS = " " }{ print $2 } '
I had to modify the '$2' to '$4'.
Also the snmpwalk should be changed to snmpget since you are only trying are
passing it the ifIndex. It will still work either way but snmpget is really
what you are doing. The snmpwalk command will try to follow the oid branch
until it reaches a leaf node which happens in this case immediately so no
getnext request is ever needed.
BTW - I would change the 5 second polling period (sleep 5) to something like
5 minutes (sleep 300).
Alex Kourafas wrote:
Thank you VERY much Todd. Alex
----- Original Message -----
From: Todd Caine
To: Alex Kourafas
Cc: [email protected]
Sent: Friday, March 01, 2002 2:16 PM
Subject: Re: [rrd-users] Re: RRD Tutorial - Question -Real World Example
The program runs in a loop forever collecting in/out octet counts every
5 seconds for the interface that was assigned an interface index of 1. If you
want to run a command in the background just start it up like normal but follow
it with an ampersand, e.g.: # ./collect.sh &
You might also want to use nohup like so:
# nohup /home/foo/collect.sh &
see 'man nohup' for more information.
Alex Kourafas wrote:
Can anyone tell me why the command below runs but returns nothing to
the
screen and I dont have a
command prompt?
Is this correct? If so how do I run it in the backround?
Thanks
#!/bin/sh
while (true)
do
input=`snmpwalk server public
interfaces.ifTable.ifEntry.ifInOctets.1 | awk -- ' BEGIN { FS = " " }{print $2
} '`
output=`snmpwalk server public
interfaces.ifTable.ifEntry.ifOutOctets.1 | awk -- ' BEGIN { FS = " " } print $2
} '`
DATE=`date +%s`
/usr/local/rrdtool-1.0.33/bin/./rrdtool update myrouter.rrd
$DATE:$input:output
echo $DATE - $input - $output
sleep 5
done
--
Unsubscribe mailto:[EMAIL PROTECTED]
Help mailto:[EMAIL PROTECTED]
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi