Cheshire Cat Computing

Software support and information
It is currently Sat Jan 20, 2018 12:21 pm

All times are UTC + 12 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Aug 20, 2008 3:29 pm 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 3039
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 Send private message  
 
PostPosted: Fri Dec 23, 2011 3:47 am 
Offline
User

Joined: Fri Dec 23, 2011 3:43 am
Posts: 3
Template I use for webfarms: There are 4 webs in the farm: I keep 2 of them in MRTG graphing:
Example of my normal Perfmon version of a webcheck without RRD/snmp.

Code:
Workdir: c:\inetpub\wwwroot\mrtg\servers\Ctmlswebs
IconDir: /mrtg/mrtgicons

Title[Ctmlswebs-23]:xxxxx shares mlxweb0160 and mlxweb0161

Title[Ctmlswebs-1]:\\mlxweb0160\Memory\Available MBytes
Pagetop[Ctmlswebs-1]: <H1>\\mlxweb0160\Memory\Available MBytes</H1>
MaxBytes[Ctmlswebs-1]: 100000
Options[Ctmlswebs-1]: gauge, nopercent
Target[Ctmlswebs-1]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Memory\Available MBytes"`
YLegend[Ctmlswebs-1]: Legend
ShortLegend[Ctmlswebs-1]:
LegendO[Ctmlswebs-1]:
LegendI[Ctmlswebs-1]:
Legend2[Ctmlswebs-1]:
Legend1[Ctmlswebs-1]:

Title[Ctmlswebs-2]:\\mlxweb0160\Network Interface(MS TCP Loopback interface)\Bytes Total/sec
Pagetop[Ctmlswebs-2]: <H1>\\mlxweb0160\Network Interface(MS TCP Loopback interface)\Bytes Total/sec</H1>
MaxBytes[Ctmlswebs-2]: 10000000
Options[Ctmlswebs-2]: gauge, nopercent
Target[Ctmlswebs-2]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Network Interface(MS TCP Loopback interface)\Bytes Total/sec"`
YLegend[Ctmlswebs-2]: Legend
ShortLegend[Ctmlswebs-2]:
LegendO[Ctmlswebs-2]:
LegendI[Ctmlswebs-2]:
Legend2[Ctmlswebs-2]:
Legend1[Ctmlswebs-2]:

Title[Ctmlswebs-3]:\\mlxweb0160\PhysicalDisk(0 C:)\Avg. Disk Queue Length
Pagetop[Ctmlswebs-3]: <H1>\\mlxweb0160\PhysicalDisk(0 C:)\Avg. Disk Queue Length</H1>
MaxBytes[Ctmlswebs-3]: 100000
Options[Ctmlswebs-3]: gauge, nopercent
Target[Ctmlswebs-3]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\PhysicalDisk(0 C:)\Avg. Disk Queue Length"`
YLegend[Ctmlswebs-3]: Legend
ShortLegend[Ctmlswebs-3]:
LegendO[Ctmlswebs-3]:
LegendI[Ctmlswebs-3]:
Legend2[Ctmlswebs-3]:
Legend1[Ctmlswebs-3]:

Title[Ctmlswebs-4]:\\mlxweb0160\PhysicalDisk(1 E:)\Avg. Disk Queue Length
Pagetop[Ctmlswebs-4]: <H1>\\mlxweb0160\PhysicalDisk(1 E:)\Avg. Disk Queue Length</H1>
MaxBytes[Ctmlswebs-4]: 100000
Options[Ctmlswebs-4]: gauge, nopercent
Target[Ctmlswebs-4]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\PhysicalDisk(1 E:)\Avg. Disk Queue Length"`
YLegend[Ctmlswebs-4]: Legend
ShortLegend[Ctmlswebs-4]:
LegendO[Ctmlswebs-4]:
LegendI[Ctmlswebs-4]:
Legend2[Ctmlswebs-4]:
Legend1[Ctmlswebs-4]:

Title[Ctmlswebs-5]:\\mlxweb0160\Process(w3wp)\% Processor Time
Pagetop[Ctmlswebs-5]: <H1>\\mlxweb0160\Process(w3wp)\% Processor Time</H1>
MaxBytes[Ctmlswebs-5]: 100000
Options[Ctmlswebs-5]: gauge, nopercent
Target[Ctmlswebs-5]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Process(w3wp)\% Processor Time"`
YLegend[Ctmlswebs-5]: Legend
ShortLegend[Ctmlswebs-5]:
LegendO[Ctmlswebs-5]:
LegendI[Ctmlswebs-5]:
Legend2[Ctmlswebs-5]:
Legend1[Ctmlswebs-5]:

Title[Ctmlswebs-6]:\\mlxweb0160\Process(w3wp)\Private Bytes
Pagetop[Ctmlswebs-6]: <H1>\\mlxweb0160\Process(w3wp)\Private Bytes</H1>
MaxBytes[Ctmlswebs-6]: 100000
Options[Ctmlswebs-6]: gauge, nopercent
Target[Ctmlswebs-6]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Process(w3wp)\Private Bytes"`
YLegend[Ctmlswebs-6]: Legend
ShortLegend[Ctmlswebs-6]:
LegendO[Ctmlswebs-6]:
LegendI[Ctmlswebs-6]:
Legend2[Ctmlswebs-6]:
Legend1[Ctmlswebs-6]:

Title[Ctmlswebs-7]:\\mlxweb0160\Process(w3wp)\Virtual Bytes
Pagetop[Ctmlswebs-7]: <H1>\\mlxweb0160\Process(w3wp)\Virtual Bytes</H1>
MaxBytes[Ctmlswebs-7]: 100000
Options[Ctmlswebs-7]: gauge, nopercent
Target[Ctmlswebs-7]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Process(w3wp)\Virtual Bytes"`
YLegend[Ctmlswebs-7]: Legend
ShortLegend[Ctmlswebs-7]:
LegendO[Ctmlswebs-7]:
LegendI[Ctmlswebs-7]:
Legend2[Ctmlswebs-7]:
Legend1[Ctmlswebs-7]:

Title[Ctmlswebs-8]:\\mlxweb0160\Processor(_Total)\% Processor Time
Pagetop[Ctmlswebs-8]: <H1>\\mlxweb0160\Processor(_Total)\% Processor Time</H1>
MaxBytes[Ctmlswebs-8]: 100000
Options[Ctmlswebs-8]: gauge, nopercent
Target[Ctmlswebs-8]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Processor(_Total)\% Processor Time"`
YLegend[Ctmlswebs-8]: Legend
ShortLegend[Ctmlswebs-8]:
LegendO[Ctmlswebs-8]:
LegendI[Ctmlswebs-8]:
Legend2[Ctmlswebs-8]:
Legend1[Ctmlswebs-8]:

Title[Ctmlswebs-9]:\\mlxweb0160\Web Service(_Total)\Get Requests/sec
Pagetop[Ctmlswebs-9]: <H1>\\mlxweb0160\Web Service(_Total)\Get Requests/sec</H1>
MaxBytes[Ctmlswebs-9]: 100000
Options[Ctmlswebs-9]: gauge, nopercent
Target[Ctmlswebs-9]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Web Service(_Total)\Get Requests/sec"`
YLegend[Ctmlswebs-9]: Legend
ShortLegend[Ctmlswebs-9]:
LegendO[Ctmlswebs-9]:
LegendI[Ctmlswebs-9]:
Legend2[Ctmlswebs-9]:
Legend1[Ctmlswebs-9]:

Title[Ctmlswebs-10]:\\mlxweb0160\Web Service(_Total)\Post Requests/sec
Pagetop[Ctmlswebs-10]: <H1>\\mlxweb0160\Web Service(_Total)\Post Requests/sec</H1>
MaxBytes[Ctmlswebs-10]: 100000
Options[Ctmlswebs-10]: gauge, nopercent
Target[Ctmlswebs-10]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0160\Web Service(_Total)\Post Requests/sec"`
YLegend[Ctmlswebs-10]: Legend
ShortLegend[Ctmlswebs-10]:
LegendO[Ctmlswebs-10]:
LegendI[Ctmlswebs-10]:
Legend2[Ctmlswebs-10]:
Legend1[Ctmlswebs-10]:

Title[Ctmlswebs-11]:\\mlxweb0161\Memory\Available MBytes
Pagetop[Ctmlswebs-11]: <H1>\\mlxweb0161\Memory\Available MBytes</H1>
MaxBytes[Ctmlswebs-11]: 100000
Options[Ctmlswebs-11]: gauge, nopercent
Target[Ctmlswebs-11]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Memory\Available MBytes"`
YLegend[Ctmlswebs-11]: Legend
ShortLegend[Ctmlswebs-11]:
LegendO[Ctmlswebs-11]:
LegendI[Ctmlswebs-11]:
Legend2[Ctmlswebs-11]:
Legend1[Ctmlswebs-11]:

Title[Ctmlswebs-12]:\\mlxweb0161\Network Interface(MS TCP Loopback interface)\Bytes Total/sec
Pagetop[Ctmlswebs-12]: <H1>\\mlxweb0161\Network Interface(MS TCP Loopback interface)\Bytes Total/sec</H1>
MaxBytes[Ctmlswebs-12]: 10000000
Options[Ctmlswebs-12]: gauge, nopercent
Target[Ctmlswebs-12]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Network Interface(MS TCP Loopback interface)\Bytes Total/sec"`
YLegend[Ctmlswebs-12]: Legend
ShortLegend[Ctmlswebs-12]:
LegendO[Ctmlswebs-12]:
LegendI[Ctmlswebs-12]:
Legend2[Ctmlswebs-12]:
Legend1[Ctmlswebs-12]:

Title[Ctmlswebs-13]:\\mlxweb0161\PhysicalDisk(0 C:)\% Disk Time
Pagetop[Ctmlswebs-13]: <H1>\\mlxweb0161\PhysicalDisk(0 C:)\% Disk Time</H1>
MaxBytes[Ctmlswebs-13]: 100000
Options[Ctmlswebs-13]: gauge, nopercent
Target[Ctmlswebs-13]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\PhysicalDisk(0 C:)\% Disk Time"`
YLegend[Ctmlswebs-13]: Legend
ShortLegend[Ctmlswebs-13]:
LegendO[Ctmlswebs-13]:
LegendI[Ctmlswebs-13]:
Legend2[Ctmlswebs-13]:
Legend1[Ctmlswebs-13]:

Title[Ctmlswebs-14]:\\mlxweb0161\PhysicalDisk(0 C:)\Avg. Disk Queue Length
Pagetop[Ctmlswebs-14]: <H1>\\mlxweb0161\PhysicalDisk(0 C:)\Avg. Disk Queue Length</H1>
MaxBytes[Ctmlswebs-14]: 100000
Options[Ctmlswebs-14]: gauge, nopercent
Target[Ctmlswebs-14]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\PhysicalDisk(0 C:)\Avg. Disk Queue Length"`
YLegend[Ctmlswebs-14]: Legend
ShortLegend[Ctmlswebs-14]:
LegendO[Ctmlswebs-14]:
LegendI[Ctmlswebs-14]:
Legend2[Ctmlswebs-14]:
Legend1[Ctmlswebs-14]:

Title[Ctmlswebs-15]:\\mlxweb0161\PhysicalDisk(1 E:)\% Disk Time
Pagetop[Ctmlswebs-15]: <H1>\\mlxweb0161\PhysicalDisk(1 E:)\% Disk Time</H1>
MaxBytes[Ctmlswebs-15]: 100000
Options[Ctmlswebs-15]: gauge, nopercent
Target[Ctmlswebs-15]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\PhysicalDisk(1 E:)\% Disk Time"`
YLegend[Ctmlswebs-15]: Legend
ShortLegend[Ctmlswebs-15]:
LegendO[Ctmlswebs-15]:
LegendI[Ctmlswebs-15]:
Legend2[Ctmlswebs-15]:
Legend1[Ctmlswebs-15]:

Title[Ctmlswebs-16]:\\mlxweb0161\PhysicalDisk(1 E:)\Avg. Disk Queue Length
Pagetop[Ctmlswebs-16]: <H1>\\mlxweb0161\PhysicalDisk(1 E:)\Avg. Disk Queue Length</H1>
MaxBytes[Ctmlswebs-16]: 100000
Options[Ctmlswebs-16]: gauge, nopercent
Target[Ctmlswebs-16]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\PhysicalDisk(1 E:)\Avg. Disk Queue Length"`
YLegend[Ctmlswebs-16]: Legend
ShortLegend[Ctmlswebs-16]:
LegendO[Ctmlswebs-16]:
LegendI[Ctmlswebs-16]:
Legend2[Ctmlswebs-16]:
Legend1[Ctmlswebs-16]:

Title[Ctmlswebs-17]:\\mlxweb0161\Process(w3wp)\% Processor Time
Pagetop[Ctmlswebs-17]: <H1>\\mlxweb0161\Process(w3wp)\% Processor Time</H1>
MaxBytes[Ctmlswebs-17]: 100000
Options[Ctmlswebs-17]: gauge, nopercent
Target[Ctmlswebs-17]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Process(w3wp)\% Processor Time"`
YLegend[Ctmlswebs-17]: Legend
ShortLegend[Ctmlswebs-17]:
LegendO[Ctmlswebs-17]:
LegendI[Ctmlswebs-17]:
Legend2[Ctmlswebs-17]:
Legend1[Ctmlswebs-17]:

Title[Ctmlswebs-18]:\\mlxweb0161\Process(w3wp)\Private Bytes
Pagetop[Ctmlswebs-18]: <H1>\\mlxweb0161\Process(w3wp)\Private Bytes</H1>
MaxBytes[Ctmlswebs-18]: 100000
Options[Ctmlswebs-18]: gauge, nopercent
Target[Ctmlswebs-18]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Process(w3wp)\Private Bytes"`
YLegend[Ctmlswebs-18]: Legend
ShortLegend[Ctmlswebs-18]:
LegendO[Ctmlswebs-18]:
LegendI[Ctmlswebs-18]:
Legend2[Ctmlswebs-18]:
Legend1[Ctmlswebs-18]:

Title[Ctmlswebs-19]:\\mlxweb0161\Process(w3wp)\Virtual Bytes
Pagetop[Ctmlswebs-19]: <H1>\\mlxweb0161\Process(w3wp)\Virtual Bytes</H1>
MaxBytes[Ctmlswebs-19]: 100000
Options[Ctmlswebs-19]: gauge, nopercent
Target[Ctmlswebs-19]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Process(w3wp)\Virtual Bytes"`
YLegend[Ctmlswebs-19]: Legend
ShortLegend[Ctmlswebs-19]:
LegendO[Ctmlswebs-19]:
LegendI[Ctmlswebs-19]:
Legend2[Ctmlswebs-19]:
Legend1[Ctmlswebs-19]:

Title[Ctmlswebs-20]:\\mlxweb0161\Processor(_Total)\% Processor Time
Pagetop[Ctmlswebs-20]: <H1>\\mlxweb0161\Processor(_Total)\% Processor Time</H1>
MaxBytes[Ctmlswebs-20]: 100000
Options[Ctmlswebs-20]: gauge, nopercent
Target[Ctmlswebs-20]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Processor(_Total)\% Processor Time"`
YLegend[Ctmlswebs-20]: Legend
ShortLegend[Ctmlswebs-20]:
LegendO[Ctmlswebs-20]:
LegendI[Ctmlswebs-20]:
Legend2[Ctmlswebs-20]:
Legend1[Ctmlswebs-20]:

Title[Ctmlswebs-21]:\\mlxweb0161\Web Service(_Total)\Get Requests/sec
Pagetop[Ctmlswebs-21]: <H1>\\mlxweb0161\Web Service(_Total)\Get Requests/sec</H1>
MaxBytes[Ctmlswebs-21]: 100000
Options[Ctmlswebs-21]: gauge, nopercent
Target[Ctmlswebs-21]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Web Service(_Total)\Get Requests/sec"`
YLegend[Ctmlswebs-21]: Legend
ShortLegend[Ctmlswebs-21]:
LegendO[Ctmlswebs-21]:
LegendI[Ctmlswebs-21]:
Legend2[Ctmlswebs-21]:
Legend1[Ctmlswebs-21]:

Title[Ctmlswebs-22]:\\mlxweb0161\Web Service(_Total)\Post Requests/sec
Pagetop[Ctmlswebs-22]: <H1>\\mlxweb0161\Web Service(_Total)\Post Requests/sec</H1>
MaxBytes[Ctmlswebs-22]: 100000
Options[Ctmlswebs-22]: gauge, nopercent
Target[Ctmlswebs-22]: `perl getlog.pl e:\perflogs\xxxxwebs.csv "\\mlxweb0161\Web Service(_Total)\Post Requests/sec"`
YLegend[Ctmlswebs-22]: Legend
ShortLegend[Ctmlswebs-22]:
LegendO[Ctmlswebs-22]:
LegendI[Ctmlswebs-22]:
Legend2[Ctmlswebs-22]:
Legend1[Ctmlswebs-22]:


Top
 Profile Send private message  
 
PostPosted: Fri Dec 23, 2011 4:54 pm 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 3039
Location: Auckland, New Zealand
You might like to note that Routers2 will work better if you have the Target[] definition as the direct directive for a given targetname. Otherwise, some directives may be missed as the Routers2 parser differs slightly form the MRTG one.

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


Top
 Profile Send private message  
 
PostPosted: Tue Jan 17, 2012 1:02 pm 
Offline
User

Joined: Tue Jan 17, 2012 4:45 am
Posts: 2
Hmm i have to have a good look at this coding. thanks by the way steve.

_________________
Cool Tristan


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 12 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


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

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group