Cheshire Cat Computing

Software support and information
It is currently Sun May 19, 2013 8:52 am

All times are UTC + 12 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: cfgcpumaker
PostPosted: Fri Jun 19, 2009 10:23 am 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 2921
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 + 12 hours [ DST ]


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:  
cron
Powered by phpBB® Forum Software © phpBB Group