[mrtg] procmem scripts error
Alexandre Reichert
alexandre.reichert at brb.com.br
Wed Aug 21 23:11:16 MEST 2002
Hi list!
I´m trying to use procmem scripts to monitoring CPU load and memory on some
routers. I read the instructions and altered the files to my scripts and lib
path. I´m using W2K and received the following error message:
D:\mrtg\bin>create-cfg-mem.pl xxxxx at 10.1.0.10 > memory.cfg
Can't locate MRTG_lib.pm in @INC (@INC contains: d:mrtgibmrtg2 C:/Perl/lib
C:/Pe
rl/site/lib .) at D:\mrtg\bin\create-cfg-mem.pl line 16.
BEGIN failed--compilation aborted at D:\mrtg\bin\create-cfg-mem.pl line 16.
I can see that the "\" caracter that I included on the script could not be
recognized. (d:mrtgibmrtg2 ). How can I resolve it?
Folow the scripts I used.
Thanks in advance!
Alexandre
------------------------------ xxx-------------------------------
getmem.pl
#!/usr/bin/perl
#-----------------------------------------------
# Return memory usage for a specific Cisco memory pool
#
# Author: Dimitrios Stergiou <dste at intranet.gr> , 25/10/00
# Version : 1.0
#
# Usage: ./getmem.pl cisco_hostname memory_pool
#
# 1.0 Initial version, basic functionality
#-----------------------------------------------
# Import libraries
use lib "d:\mrtg\lib\mrtg2";
use MRTG_lib "2.090006";
use SNMP_Session "0.77";
use BER "0.77";
use SNMP_util "0.77";
use locales_mrtg "0.07";
# Query public community on router, return memory used in current pool
@command = snmpget($ARGV[0], "enterprises.9.9.48.1.1.1.5.$ARGV[1]");
print @command[0];
------------------------ xxxx --------------------
create.cfg.mem.pl
#!/usr/bin/perl
#-----------------------------------------------
# Query a router about its memory pools and create MRTG cfg file for the
pools
#
# Author: Dimitrios Stergiou <dste at intranet.gr> , 25/10/00
# Version : 1.0
#
# Usage: ./create-cfg-mem.pl cisco_hostname
#
# 1.0 Initial version, basic functionality
#-----------------------------------------------
# Import libraries
use lib "d:\mrtg\lib\mrtg2";
use MRTG_lib "2.090006";
use SNMP_Session "0.77";
use BER "0.77";
use SNMP_util "0.77";
use locales_mrtg "0.07";
# Suppress warnings
$SNMP_Session::suppress_warnings = 3;
# Locate how many memory pools the router has
for ($i = 1; $i <= 5; $i++) {
$command = snmpget($ARGV[0], "enterprises.9.9.48.1.1.1.2.$i");
if ($command eq "1") { push @pools, $i; }
}
# loop through pools and find
# 1) pool names
# 2) pool usage
# 3) pool availability
# maximum pool capacity is defined as: PoolSizeUsed + PoolSizeFree
foreach $pool (@pools) {
@memtype = snmpget($ARGV[0], "enterprises.9.9.48.1.1.1.2.$pool");
if ($memtype[0] eq "I/O") { $memtype[0]="IO"; }
$target = "$ARGV[0]"."_"."$memtype[0]";
@pu = snmpget($ARGV[0], "enterprises.9.9.48.1.1.1.5.$pool");
@pf = snmpget($ARGV[0], "enterprises.9.9.48.1.1.1.6.$pool");
$maxbytes = $pu[0]+$pf[0];
print<<EOF
Target[$target]: `d:\mrtg\bin\getmem.pl $ARGV[0] $pool`
Title[$target]: $nname memory used
MaxBytes[$target]: $maxbytes
Unscaled[$target]: dwmy
PageTop[$target]: <H1> $nname memory used </H1>
Suppress[$target]: y
LegendI[$target]: kbytes used
LegendO[$target]:
Legend1[$target]: kbytes used
Legend2[$target]:
YLegend[$target]: kbytes used
ShortLegend[$target]: used
Options[$target]: gauge,growright
# ===================================
EOF
}
-- Attached file removed by Listar and put at URL below --
-- Type: text/plain
-- Size: 770 bytes
-- URL : http://www.ee.ethz.ch/~slist/pantomime/36-InterScan_Disclaimer.txt
--
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