[mrtg] W2000 CPU monitoring via mrtg

McDonald, Dan Dan.McDonald at austinenergy.com
Mon Nov 26 14:40:58 CET 2007


On Fri, 2007-11-23 at 16:07 +0000, AA Inter.Network Services / SYED
JAHANZAiB wrote:
> 
> Hi,
>  
> I have successfully setup MRTG to monitor multiple devices or ips.
> My question is How can I monitor CPU, disk, memory usage for my server
> via MRTG ? howto crerate cfg for this ?

This is the template I use.  Watch out for line wraps.
I have another one that is tweaked a bit that seems to work, mostly, for
Cisco Call Manager 5.x


$head_lines .= <<ECHO
#.....................................................................
# Windows 2000 processor utilization. Based on MIBII Host MIB.
#
#Vendor Specific Auto-Disocery 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
;
}

-- 
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: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20071126/f7019f70/attachment.bin 


More information about the mrtg mailing list