[mrtg] Re: Two graphs, but one OID

alex at ergens.op.Het.Net alex at ergens.op.Het.Net
Fri May 5 10:58:41 MEST 2000

Tomas Magnusson wrote:

> Here comes a humble request from a ignorant swedish student.
> I am wondering how come MRTG writes two different graphs while collecting
> information from the same OID number. Should'nt they be exactly
> the same?

I assume you are referring to the following line:

   Target[myrouter.1]: 1:public at myrouter.my.org

If so: the "1" is *not* the OID.  It is an index into a table.  Search
for the snmpwalk program (or: snmputil.exe on NT) and do a walk on the
following part of the MIB:
(how to do this depends on the program; you'll have to RTFM).

You should get "ifIndex" for every interface on the device.  Now skip
that last ".1" and you will get a larger portion of the tree.  Some
useful parts are "ifInOctets" and "ifOutOctets".  It are these two OIDs
that are used by MRTG to collect the ethernet statistics.
The OID for ifInOctets is:

To use this OID, you'll also need to specify the "instance" which is just
an index into a table.  For some OIDs, this instance will be zero and there
is only one entry.  For other OIDs, such as interface statistics, there
can be more than one entry and the numbering starts with 1.  Even if there
is only one interface, it will still be number 1. 

In the same package where you get snmpwalk, you'll also get snmpget.
Use this to query one (or more) counter(s) in the same manner as MRTG
does.  Do this a couple of times, five minutes apart, and start some
calculations on the results.  You should be able to mimic MRTG's way
of calculating the average throughput on the device.

example: (lines wrapped for this mail only)

[alex at home  alex]$ date; snmpget router public \
                            . \
                            . \
      Fri May  5 10:49:28 MET DST 2000
      interfaces.ifTable.ifEntry.ifDescr.4 = "Ethernet0"
      interfaces.ifTable.ifEntry.ifInOctets.4 = 199875562
      interfaces.ifTable.ifEntry.ifOutOctets.4 = 633513295
[alex at home  alex]$ date; snmpget router public \
                            . \
                            . \
      Fri May  5 10:52:00 MET DST 2000
      interfaces.ifTable.ifEntry.ifDescr.4 = "Ethernet0"
      interfaces.ifTable.ifEntry.ifInOctets.4 = 199915057
      interfaces.ifTable.ifEntry.ifOutOctets.4 = 633667005

from 10:49:28 to 10:52:00 is 2 minutes and 32 seconds, is 152 seconds.
In those 152 seconds, ifInOctets grew with  199915057-199875562=39495
In those 152 seconds, ifOutOctets grew with 633667005-633513295=153710
 39495/152= 259 bytes per second IN
153710/152=1011 bytes per second OUT

 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |

Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org

More information about the mrtg mailing list