Bash script for rrdtool

Hello all,

I am very new to shell scripting. I messed with basic examples in college, but this this the first work related project I am trying to work on. I am trying to test the rrdtool on our office wan link by measuring the bandwidth utilization. The script concept is fairly easy, but I am seeing many different results online and I am not sure which to follow. I am trying to create a script that:

retrieves the result of (snmpget -v 2c -c community IF-MIB::ifInOctets.4)
places it into variable $in
retrieve the result of (snmpget -v 2c -c community IF-MIB::ifOutOctets.4)
places it into variable $out

and use rrdtool update to update the information in the variables created

You will need to parse the return from your snmpget's in order to supply the rrdtool with the information.

To get information

in=`snmpget -v 2c -c community IF-MIB::ifInOctets.4`
or 
in=$(snmpget -v 2c -c community IF-MIB::ifInOctets.4)

Post the format of the rrdtool command and what you want to send it from the ouput of your snmpget. You will either use cut or awk to parse the ouput. You can do this before variable assignment; something like...

in=`snmpget -v 2c -c community IF-MIB::ifInOctets.4 | awk ...`

Just wanted to apologize in advance for my scripting incompetency, as I mentioned, I am a newbie. This is my current output:

$ snmpget -v 2c -c dctmonitor 192.168.0.254 interfaces.ifTable.ifEntry.ifInOctets.4
           IF-MIB::ifInOctets.4 = Counter32: 1782127772
$ snmpget -v 2c -c dctmonitor 192.168.0.254 interfaces.ifTable.ifEntry.ifOutOctets.4
           IF-MIB::ifOutOctets.4 = Counter32: 4188241610

I created the rrtooldabase called bandwidth.rrd

#!/bin/bash
rrdfile=$(home/atetu/rrdtool/bin/bandwidth.rrd)
rrdtool=$(/usr/bin/rrdtool)

My next step would be to declare the variables and fill then with information:

BandOut=`snmpget -v 2c -c community IF-MIB::ifOutOctets.4 | awk ...`
BandIn=`snmpget -v 2c -c community IF-MIB::ifInOctets.4 | awk _____'  # not sure what info to insert there.