I was curious to know if anyone out there is using MRTG to monitor and
graph things like: number of user logged on a UNIX system, or load on the
SMTP server. I am currently working in trying to setup MRTG to do such
things. Being a newbie to SNMP and MIB's i having a hard time making it
work for me. Does anybody have any suggestion or examples of things to
try.
Thanks before hand.
Aboubacar.
---------------------------------------------------------------------------
Aboubacar S Diare
Computer Engineering Junior
a...@u.arizona.edu
http://www.u.arizona.edu/~asd
**********************************************
THE SCIENTIST DESCRIBES WHAT IS;
THE ENGINEER CREATES WHAT NEVER WAS.
anonymous,
**********************************************
----------------------------------------------------------------------------
--
* To unsubscribe from the mrtg mailing list, send a message with the
subject: unsubscribe to mrtg-r...@list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg
You need a program/script that produces output in the format
given in the README.logfile-format file.
Here is a perl script that reads the CPU load on a given DEC
UNIX box cpu.
Note that it only gives one value, it just gives it twice. If you
want to graph one thing against another, then you have to
output those 2 things.
The OID for number of users on a DEC box (or any box running
the approproate MIB II database) is
1.3.6.1.2.1.25.1.5.0
To find the right OID numbers, trot along to an RFC database
like http://www.pmg.lcs.mit.edu/rfc.html and check RFCs
1213 and 1514. Decoding the damn things is a pain, but
basically, you start off with a "universal 6 digit identifier"
(I use 1.3.6.1.2.1) then you add a number per entry.
So the above OID is
1.3.6.1.2.1.25(host).1(hrSystem).5(HrSystemNumUsers).0(end flag)
The OID in my perl script is
1.3.6.1.2.1.25(host).3(hrDevice).3(hrProcessorTable).1(hrProcEntry)
.2(hrProcessorLoad).ProcessorNumber
OIDs are a pain to get your head round, but once you manage it,
you can get them off the RFC. If you have a linux box,
install the cmu-snmp package and send snmpwalk off to have a look
at your target machine. Then with a copy of the RFC in your hand
you can translate the output into an OID that MRTG can use.
Zebee
=========================================
#!/usr/local/bin/perl
# uses SNMP to get processor load stats.
# requires 2 args - machine name and cpu number
# location of the snmp perl modules
use lib "/home/csg/perllib";
use SNMP_Session ;
use BER;
$machine = shift(@ARGV);
$cpu = shift(@ARGV);
$community = "public"; # community name
$port = 161; #standard SNMP TCP port
# OID query string. host.hrDevice.hrProcessorTable.hrProEntry.HrProLoad
# .processor#
($session = SNMP_Session->open ($machine, $community, $port) )
|| die "couldn't open SNMP session to $machine";
$OID ="1.3.6.1.2.1.25.3.3.1.2.$cpu";
$enc_oid = encode_oid(split ('\.', "$OID"));
if ($session->get_request_response ($enc_oid)) {
($bindings) = $session->decode_get_response ($session->{pdu_buffer});
($binding,$bindings) = &decode_sequence($bindings);
($oid,$value) = &decode_by_template($binding, "%O%@");
$info = pretty_print($value);
print "$info\n";
print "$info\n";
} else {
print "No response from $machine\n";
last;
}
$timestamp = time();
print "$timestamp\n";
========================