[mrtg] Re: Obtaining OID's

darek darek at nyi.net
Mon Jul 15 14:30:05 MEST 2002




Nicolai Strøm Gylling wrote:

>Hi
>
>Is there a howto on obtaining OID's for different equipment, or how to "create" your own, ex. for monitoring a mailqueue on a Unix-server?
>
You can write your own scripts to be executed by mrtg. The script has to 
return 4 lines. The first 2 being the values you want to monitor, the 
3rd line being the name of the device, the last line being the uptime.

In my config for a particular UPS I have:

#BATTERY MINUTES REMAINING
Target[C.BattRem]: `/usr/local/bin/mrtg-battremaining.pl upsC`

Returns capacity of the UPS battery in minutes

>So I (and probably a lot others) would appreciate a little how-to on, ex.  How .1.3.6.1.4.1.1916.1.1.1.8.0 translates into the temperature of a Extreme Networks Summit48.
>
There is a usenet post that is quite informative. It is available on 
deja.com, try searching for it, as I lost the address myself.. So maybe 
I will try to explain the process of getting an OID from an MIB file.

Suppose you want to get the OID for upsAdvControlFlashAndBeep, which 
makes the UPS beep and light up so that you can find it. Open up the 
powernet.mib file, and find the entry for this:

upsAdvControlFlashAndBeep OBJECT-TYPE
   SYNTAX INTEGER  {
      noFlashAndBeep(1),
      flashAndBeep(2)
   }
...
   ::= { upsAdvControl 5 }

You note the 5.

The next step is to search backwards (up in the file) for upsAdvControl 
(the name next to the 5).  You will see something like this:

upsAdvControl                  OBJECT IDENTIFIER ::=  { upsControl 2 }

You will prepend the 2 to the previous 5 like so: 2.5

You then search for upsControl:
upsControl                     OBJECT IDENTIFIER ::=  { ups 6 }

Now you should have 6.2.5

You then repeat the search:
ups                            OBJECT IDENTIFIER ::=  { hardware 1 }
hardware                       OBJECT IDENTIFIER ::=  { products 1 }
products                       OBJECT IDENTIFIER ::=  { apc 1 }
apc                            OBJECT IDENTIFIER ::=  { enterprises 318 }

prepending each number to your string. At the end of the process you 
would end up with:
enterprises.318.1.1.1.6.2.5.0 , with an appended .0 (you need the .0 at 
the end)

You can also look up the numeric representation of enterprises and 
replace it, but enterprises seems to work fine.

So now you can issue:
    /usr/local/bin/snmpset <IP> private enterprises.318.1.1.1.6.2.5.0 i 1
and make the UPS beep and light up like a Christmas tree.

If my explanation isn't clear, you might try searching for that usenet post.

--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list