Board index

Cheshire Cat Software

Steve Shipway's Discussion Groups
Locations of visitors to this page
It is currently Wed 08 Sep, 2010 11:56 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: cfgcpumaker
PostPosted: Thu 18 Jun, 2009 4:23 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
This standalone perl script by Justin Davidson generates a whole cfg file with CPU graphs.

Code:
#!/usr/bin/perl

if ($ARGV[0] eq '') {
print "Usage: cfgcpumaker <snmpread>@<host>\n";
exit;
}
my $snmpver = "2c";
my ($snmpread, $host) = split(/@/, "@ARGV");
my @indexs = ();
@hrDeviceTypes = `snmpwalk -On -v $snmpver -c $snmpread $host hrProcessorLoad`;
foreach $t (@hrDeviceTypes) {
        chomp($t);
        (@sections)=split(/\s/,"$t");
        (@vals)=split(/\./, "$sections[0]");
        push(@indexes, "$vals[12]");
        }
print "WorkDir: /home/mrtg/data/boxstats\n";
print "Directory[_]: $host\n";
print "PageTop[_]: $host\n";
print "Options[_]: gauge,growright,nopercent\n";
print "Forks: 10\n";
print "Refresh: 300\n";
print "LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt\n";
print "#\n";
print "# CPU Monitoring\n";
print "# (Scaled so that the sum of all three values doesn't exceed 100)\n";
print "#\n";
my $count = 0;
foreach $i (@indexes) {
$count++;
print "Target[$host.cpu.$count]:hrProcessorLoad.$i&hrProcessorLoad.$i:$snmpread\@$host\n";
print "Title[$host.cpu.$count]: Server CPU Load\n";
print "PageTop[$host.cpu.$count]: <H1>CPU Load #$count</H1>\n";
print "MaxBytes[$host.cpu.$count]: 100\n";
print "ShortLegend[$host.cpu.$count]: %\n";
print "YLegend[$host.cpu.$count]: CPU Utilization\n";
print "Legend1[$host.cpu.$count]: Current CPU percentage load\n";
print "LegendI[$host.cpu.$count]: Used\n";
print "LegendO[$host.cpu.$count]:\n";
print "Unscaled[$host.cpu.$count]: ymwd\n";
print "\n\n";
}
exit 0;

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

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