[mrtg] Re: cfgmaker for host information, rather than network information

Daniel J McDonald dan.mcdonald at austinenergy.com
Tue Oct 4 13:48:32 MEST 2005


On Tue, 2005-10-04 at 10:59 +0200, John Cushnie wrote:
> Hi all,
> cfgmaker that comes with the mrtg distribution is pretty neat in that it snifs out all the network and host information data.
> Has anyone developed other cfgmakers, to sniff out other MIB data from hosts ?
> Perhaps a win2000cfgmaker, or hpunixcfgmaker, which can be fired off at windows or unix boxes and do a snmpwalk to find which metrics are available and present them graphically.....

That's what host-templates are for.

For example, here is my host-template for dos (Works on dos-NT,dos-2000
and dos-2003).  It just finds CPUs and disk space.  More could be added
fairly easily...

$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
#

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, CNX, CISSP # 78281
Austin Energy

dan.mcdonald at austinenergy.com

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list