[mrtg] How to setup the mrtg for monitoring more things

McDonald, Dan Dan.McDonald at austinenergy.com
Sat Aug 16 12:50:47 CEST 2008


On Sat, 2008-08-16 at 15:56 +0800, Shuk Pong Leong wrote:
> Dear All,
> 
> I just installed the following packages under windows :
> mrtg-2.16.2.zip
> ActivePerl 5.8.8
> 
> And running the following command lines :
> 1, perl mrtg
> 2, perl cfgmaker public at 192.168.0.1 --global "WorkDir: c:\inetpub
> \mrtg" --output mrtg.cfg
> 
> 1, During the testing, there are some problem for asking : 
> 1.1 How to create the index.html file for browser which hyper link for
> measuring / monitoring which device ?  

there should be a script called indexmaker.

> 1.2 How to output the daily grah every 15 mins ?
why?  It only rolls up 30-minute averages....

> 1.3 How to detect the following info ?
> 1.3.1 SNMP port number
> 1.3.2 SNMPOID
> 1.3.3 read-only SNMP community string

Sorry, we are not hackers.  That information should be provided by the
network administrator.

> 
> 2, How to setup ( config ) the mrtg for measuring ( monitoring ) the
> following hardware usage ( used ) percentage ?
> 2.1 CPU usage persentage.

That really depends on the platform.  But I have a template that tends
to work ok for Windows 2000 using the built-in snmp agent.  If you have
some other agent, there is no telling...

[mcdonalddj at ldap ~]$ cat /var/mrtg/cfg/w2kcpu.template 
$head_lines .= <<ECHO
#.....................................................................
# Windows 2000 processor utilization. Based on MIBII Host MIB.
#
#Vendor Specific Auto-Discovery Entry:
# 1.3.6.1.2.1.25.3.3.1.2|1.3.6.1.2.1.25.3.3.1.2|microsoft_win2k_cpu|
tree|CPU Utilization
#
# Example CFGNAME: [DEVICE NAME]-percent_processor_util
# (add instance number to the end of the name for multiple processors)
      
ECHO
;
my (@temp) = snmpwalk($router_connect,'1.3.6.1.2.1.25.3.3.1.2');
foreach my $tempi(@temp) {
	$tempi =~ /(\d+):\d/;
	my $instance=$1;
	my $target_name=$router_name.".cpu".$instance;
	$target_lines .= <<CPU
Target[$target_name]:
1.3.6.1.2.1.25.3.3.1.2.$instance&1.3.6.1.2.1.25.3.3.1.2.$instance:
$router_connect
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero, noo
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: Proc Load in next minute
Legend3[$target_name]: Maximal 5 Minute Proc Load
LegendI[$target_name]:  Load:
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
 <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
 </TABLE>
CPU
; 
}

snmpMIB_to_OID("/usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt");
my (@temp) = snmpwalk($router_connect,'hrStorageAllocationUnits');
foreach my $tempi(@temp) {
	$tempi =~ /(\d+):(\d+)/;
	next if $2 == 0;
	my $instance=$1;
	my $blocksize=$2;
	my ($diskname, $disksize) =
snmpget($router_connect,'hrStorageDescr.'.$instance,
'hrStorageSize.'.$instance);
	my $shortdisk= $instance;
	if ($diskname =~ /^(\w):/) { $shortdisk = $1; }
	my $target_name=$router_name.".disk.".$shortdisk;
	my $maxsize = $disksize * $blocksize;
	$target_lines .= <<DISK
#--------------------------------------------------------------------------------------
# WIN2000 Disk Utilization. Based on MIB II Host MIB.
    
Target[$target_name]:
1.3.6.1.2.1.25.2.3.1.6.$instance&1.3.6.1.2.1.25.2.3.1.6.$instance:
$router_connect * $blocksize
YLegend[$target_name]: KBytes Used
Options[$target_name]: gauge, unknaszero, noo
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxsize
ShortLegend[$target_name]: bytes
routers.cgi*ShortDesc[$target_name]: Drive $shortdisk: 
bb*host[$target_name]: $router_name
bb*svc[$target_name]: disk
bb*red[$target_name]: 95%
bb*yellow[$target_name]: 92%
kilo[$target_name]: 1024
Legend1[$target_name]: Disk Used
Legend3[$target_name]: Max value per interval on graph
LegendI[$target_name]: Disk Used
WithPeak[$target_name]: ymw
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$diskname on $sysname/H1>
 <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
 </TABLE>
DISK
;
}



> 2.2 Hard Disk usage persentage [ Total ( Read / Write ), Read, Write].
> 2.3 Ram ( Memory ) usage persentage [ Available MB, Page/sec ].


> 2.4 Network INT usage persentage [ Total ( Packets/sec ), Packets
> Received/sec, Packets Sent/sec].

packets per second doesn't have a hard maximum - as the packet size gets
larger, the max goes down.  It's not a terribly interesting figure.

-- 
Daniel J McDonald, CCIE #2495, CISSP #78281, CNX
Austin Energy
http://www.austinenergy.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20080816/3235a1ad/attachment.bin 


More information about the mrtg mailing list