[mrtg] Re: newbie question

Daniel J McDonald dan.mcdonald at austinenergy.com
Mon Oct 20 16:33:21 MEST 2003


On Fri, 2003-10-17 at 23:12, Justin Kornaga wrote:
> I am trying to graph anything but the default bandwidth for the machine on a windows xp machine (I already have that working).  This is what I type at the command prompt: I just pick an oid that works like .1.3.6.1.2.1.2.2.1.5.1 and then type :
> perl cfgmaker .1.3.6.1.2.1.2.2.1.5.1&.1.3.6.1.2.1.2.2.1.5.1:public at 127.0.0.1 --global "WorkDir: C:\www\mrtg" --output mrtg.cfg  

cfgmaker doesn't work that way.  It's mission in life is to create a
config for mrtg that is based on bandwidth.

That being said, you can write cfgmaker templates to use other OIDs -
that's particularly helpful when you want to have cfgmaker do the
snmpwalk.

Here's a template I use to get somewhat useful information off a Windows
2000 system (although the only *really interesting* data about anything
from Microsoft is the date I can unplug that virus from my network ;-)

This can be called with:

/usr/local/mrtg-2/bin/cfgmaker --host-template=w2kcpu.template
public at somehost.somedomain.tld --output=somehost.cfg

#
#w2kcpu.template
# Version 1.0 Daniel J McDonald, CCIE #2495
# No waranties, guarantees, etc...
$head_lines .= <<ECHO
#.....................................................................
# Windows 2000 processor utilization. Based on MIBII Host MIB.
#
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*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/local/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.
     
YLegend[$target_name]: KBytes Used
Options[$target_name]: gauge, unknaszero, noo
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
MaxBytes[$target_name]: $maxsize
ShortLegend[$target_name]: bytes
routers.cgi*ShortDesc[$target_name]: Drive $shortdisk:
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
Austin Energy


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