Board index

Cheshire Cat Software

Steve Shipway's Discussion Groups
Locations of visitors to this page
It is currently Thu 09 Sep, 2010 12:05 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Host template for windows
PostPosted: Tue 19 Aug, 2008 9:29 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
This host template for Windows SNMP was created by Dan MacDonald, and modified slightly by myself. It takes care of CPU use, and disk space - but watch out with this, because inserting USB devices will potentially cause re-enumeration of the devices, requiring a re-generation of the configuration file.

Code:
$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
;
}
my (@temp) = snmpwalk($router_connect,'1.3.6.1.2.1.25.2.3.1.4');
foreach my $tempi(@temp) {
        $tempi =~ /(\d+):(\d+)/;
        next if $2 == 0;
        my $instance=$1;
        my $blocksize=$2;
        my ($diskname, $disksize) = snmpget($router_connect,'1.3.6.1.2.1.25.2.3.1.3.'.$instance,'1.3.6.1.2.1.25.2.3.1.5.'.$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
;
}


Possible improvements: The code should detect >1 CPU and then define a routers2 combination graph over the top of them and hide the individual CPU graphs. Currently, it just produces multiple CPU graphs.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group