Real Time Ascend Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(ASCEND) scripts for plotting max usage using MRTG
I've seen a couple of requests for scripts for plotting
channel utilization on an Ascend MAX using MRTG. It's not
exactly the easiest thing to figure out from the MRTG docs,
so I thought I'd help everybody out.
Here's a sample code snippet using PERL. The
SNMP_Session, SNMP_util, and BER modules come with
MRTG. It uses the SNMP highwatermark variable to determine
the maximum number of channels (be it digital or analog)
connected to the max. This script isn't that useful by itself --
it is intented to be a guide for a script that can poll a
single MAX.
If you're polling a MAX other than a MAX4048, change
the return value in the max_lines() subroutine, or change
it to calculate that value programmatically. I do it
programmatically, but its done in a way that wouldn't be
generally useful so I just have it return a single value
for this example program.
pollmax.pl
-- cut here --
#! /usr/bin/perl
#
use SNMP_Session;
use SNMP_util;
use BER;
$OID = "1.3.6.1.4.1.529.11.3.0";
$WRITE_COMMUNITY = "write_comm"; # change to your write community
$READ_COMMUNITY = "read_comm"; # change to your read community
{
$max = $ARGV[0];
die("Usage: $0 max_hostname\n") if (! $max);
$current = &poll_max($max);
$free = &max_lines() - $current;
print "$current\n$free\n$max\n$max\n";
}
sub poll_max {
my($max) = @_;
my($sessions);
#
# re-set the high water mark and then read the variable
#
&snmpset($WRITE_COMMUNITY . "\@" . $max, $OID, 'int', 0);
($sessions) = &snmpget($READ_COMMUNITY . "\@" . $max, $OID);
return $sessions;
}
sub max_lines {
#
# You can change this to something more useful for you.
# Right now, it returns 48 (max lines in a MAX 4048)
#
return 48;
}
-- cut here --
And, probably the toughest thing to come up with is the
example mrtg.cfg entry:
mrtg.cfg
-- cut here --
Target[max]: `pollmax.pl mymax.domain.com`
Title[max]: My Max - Modem Usage
PageTop[max]: <H1>My Max - Modem Usage</H1>
RouterUptime[max]: read_comm@mymax.domain.com
MaxBytes[max]: 48
AbsMax[max]: 48
Options[max]: gauge, absolute
Unscaled[max]: ymwd
ShortLegend[max]: /
XSize[max]: 380
YSize[max]: 100
YLegend[max]: Modem Usage
LegendI[max]: Users Connected
LegendO[max]: Modems Free
Legend1[max]:
Legend2[max]:
Legend3[max]:
Legend4[max]:
WithPeak[max]: wmy
-- cut here --
One thing I'd like to know is if anybody is coming up
with a way to programmatically alter the MaxBytes[] and
the AbsMax[] configuration entries? It would be nice
if the authors of MRTG made those values capable of running
an external program much like the Target[] value can.
++ Ascend Users Mailing List ++
To unsubscribe: send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd: <http://www.nealis.net/ascend/faq>