[mrtg] divide just 1 oid

Steve Shipway s.shipway at auckland.ac.nz
Tue Sep 7 01:11:53 CEST 2010


> I have a graph, but I need just divide /10 a OID or his value.
> example:
> Target[name1x]:1.3.6.1.4.1.4413.2.1.2.1.7.21478&1.3.6.1.2.1.10.17.1.1.4
> .1.5.2148:snmpcomm at 10.0.0.1
> so the OID: 1.3.6.1.4.1.4413.2.1.2.1.7.21478  I need be divide /10 and
> the other OID no be nothing.

This is a bit difficult -- you can't use Factor or a Target-line function because they apply to both OIDs.  If it were multiply by a small integer it would be easier but it's not that.

I can think of two ways to do it -- one very messy way, and one tidier way that uses MRTG/RRD with Routers2.

1. Messy way!
Very messy, but will work with native-mode MRTG.  Place ALL of this on the same line.

Target[name1x]:
  1.3.6.1.4.1.4413.2.1.2.1.7.21478&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10
  + pseudoZero&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 / 10

Yes, I know its very ugly, but it should work.

2. Tidier Routers2-userdefined graph way.

Target[name1x-a]:
  1.3.6.1.4.1.4413.2.1.2.1.7.21478&1.3.6.1.4.1.4413.2.1.2.1.7.21478:snmpcomm at 10.0.0.1 / 10
routers.cgi*InMenu[name1x-a]:no
routers.cgi*Graph[name1x-a]:name1x noo
Target[name1x-b]:
  1.3.6.1.2.1.10.17.1.1.4.1.5.2148&1.3.6.1.2.1.10.17.1.1.4.1.5.2148:snmpcomm at 10.0.0.1 
routers.cgi*InMenu[name1x-b]:no
routers.cgi*Graph[name1x-b]:name1x noo

This defines separate targets for the two OIDs (with one divided by ten), but hides them from the menu.  Then it defined a userdefined graph over the two so they end up on the same graph.

3. Programming way

Write your own data-collection plugin that does all the necessary magic, retrieving the SNMP and doing the calculations.

Hope this helps

Steve

Steve Shipway
ITS Unix Services Design Lead
University of Auckland
Floor 2, 58 Symonds Street
09 3737599 ext 86487
 Please consider the environment before printing this e-mail 




More information about the mrtg mailing list