Discussion:
[mrtg] Multiple OID's in expression...
David Mitchell
2002-02-21 11:23:42 UTC
Permalink
I want to calculate the percentage memory usage on a cisco router. There are
2 areas of memory and the figures for memory in use and memory free are
stored in a table.

The table oid is 1.3.6.1.4.1.9.9.48.1.1.

And the OID's I want to use are:
1.3.6.1.4.1.9.9.48.1.1.1.5.1 Proc mem in use
1.3.6.1.4.1.9.9.48.1.1.1.6.1 Proc Mem free
1.3.6.1.4.1.9.9.48.1.1.1.5.2 IO mem in use
1.3.6.1.4.1.9.9.48.1.1.1.6.2 IO mem free.

(Proc mem is row 1 in the table, IO mem is row 2, element 5 is memory in
use, element 6 is free memory)

So I want to calculate 100*mem in use / (mem in use + mem free) and use the
Proc mem as the 'in' value and IO mem as the 'out' value so they appear on
the same graph.

The original target I used was:
Target[$target_name]: 1.3.6.1.4.1.9.9.48.1.1.1.5.1 *
00/( 1.3.6.1.4.1.9.9.48.1.1.1.5.1 + 1.3.6.1.4.1.9.9.48.1.1.1.6.1 ) &
1.3.6.1.4.1.9.9.48.1.1.1.5.2 *100/( 1.3.6.1.4.1.9.9.48.1.1.1.5.2 +
1.3.6.1.4.1.9.9.48.1.1.1.6.2 ):routeraddress

I know (and have tried) that I need to add the router address to each OID,
however I cannot get the expression to evaluate, the best I have acheived is
to get a 0 result! Most variations on the target line cause rateup to
abort...!

I have put debugging on MRTG but it didn't help - I cannot see each variable
being read, just the result of 'getcurrent'. How is the expression
evaluated in MRTG (Where?) - I am learning enough PERL to be able to
understand some of what is going on.

TIA

David
--
Unsubscribe mailto:mrtg-***@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
Sawyer, David
2002-02-21 11:58:24 UTC
Permalink
For easy viewing, lets say...
OID1 = .5.1 Proc mem in use
OID2 = .6.1 Proc Mem free
OID3 = .5.2 IO mem in use
OID4 = .6.2 IO mem free.

You want...

OID1/(OID1+OID2))*100
460 /(460 + 564))* 100 = 46%

So for your target you should try...

Target[Proc_IO] (OID1&OID3:***@host /
(OID1&OID3:***@host +
OID2&OID4:***@host)) * 100

Let me know if this works.



Dave

-----Original Message-----
From: David Mitchell [mailto:***@sunman.co.uk]


I want to calculate the percentage memory usage on a cisco router.

The table oid is 1.3.6.1.4.1.9.9.48.1.1.

And the OID's I want to use are:
1.3.6.1.4.1.9.9.48.1.1.1.5.1 Proc mem in use
1.3.6.1.4.1.9.9.48.1.1.1.6.1 Proc Mem free
1.3.6.1.4.1.9.9.48.1.1.1.5.2 IO mem in use
1.3.6.1.4.1.9.9.48.1.1.1.6.2 IO mem free.

So I want to calculate 100*mem in use / (mem in use + mem free) and use the
Proc mem as the 'in' value and IO mem as the 'out' value so they appear on
the same graph.

The original target I used was:
Target[$target_name]: 1.3.6.1.4.1.9.9.48.1.1.1.5.1 *
00/( 1.3.6.1.4.1.9.9.48.1.1.1.5.1 + 1.3.6.1.4.1.9.9.48.1.1.1.6.1 ) &
1.3.6.1.4.1.9.9.48.1.1.1.5.2 *100/( 1.3.6.1.4.1.9.9.48.1.1.1.5.2 +
1.3.6.1.4.1.9.9.48.1.1.1.6.2 ):routeraddress


----------------------------------------------------------------------------
The information contained in this e-mail is confidential and is intended
only for the named recipient(s). If you are not the intended recipient you
must not copy, distribute, or take any action or reliance on it.
If you have received this e-mail in error, please notify the sender.
Any unauthorised disclosure of the information contained in this e-mail
is strictly prohibited.
----------------------------------------------------------------------------
--
Unsubscribe mailto:mrtg-***@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
David Mitchell
2002-02-21 12:59:29 UTC
Permalink
Thanks David - that worked fine, I hadn't picked up that you put the OID's
in the expression in pairs rather than pairing the expressions

Ie it is OID1&OID2:router + OID3&OID4:router

rather than

OID1:router + OID3:router & OID2:router + OID4:router

David
--
Unsubscribe mailto:mrtg-***@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
Loading...