[mrtg] Re: graphing integer based on calculation from multiple OIDs

Daniel J McDonald dan.mcdonald at austinenergy.com
Fri Sep 26 22:22:08 MEST 2003


On Fri, 2003-09-26 at 13:22, Duane Cox wrote:
> Hey guys:
> Is there a easy way to graph an integer with MRTG based on getting 2 OID values, adding them, dividing that by another OID, then multiplying by 100 ??? :)

Yes, write an external program.  Call it "find_result.pl" or some
such...
#!/usr/bin/perl -w
use lib qw(/usr/local/mrtg-2/lib/mrtg2/);
use SNMP_util;
my ($first, $second, $third) = snmpget($ARGV[0],
	'1.3.6.1.4..',	#replace this with the first OID
	'1.3.6.1.4..',	#and the second oid, etc...
	'1.3.6.1.4..');
my $result =  100 * ($first+$second) / $third;
print "$result\n0\n0\n0\n";

then call the program with:

Target[somename]: `find_result.pl community at ip.address.to.poll`
maxbytes[somename]: 100
options[somename]: gauge
-- 
Daniel J McDonald, CCIE 2495, CNX
Austin Energy


--
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