|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/local/src/munin-1.2.6/node/node.d.sunos/ |
Upload File : |
#!@@PERL@@
#
# Plugin to monitor temperature inside Sun systems
#
# Usage: Place in /etc/munin/node.d/ (or link it there using ln -s)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Revision 1.1 2004/04/16 Richard van den Berg <richard@vdberg.org>
#
# $Log$
# Revision 1.3 2004/05/20 19:02:38 jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.2 2004/05/15 21:33:30 jimmyo
# "Upped" som plugins from contrib/manual to manual or auto.
#
#
#%# family=auto
#%# capabilities=autoconf
$arch=`uname -m`;
chomp($arch);
$prtdiag="/usr/platform/$arch/sbin/prtdiag";
@tempnam=();
@tempval=();
if($ARGV[0] eq "config") {
printconfig();
exit(0);
}
if($ARGV[0] eq "autoconf") {
if(! -x $prtdiag) {
print "no\n";
exit(1);
}
gettemps();
if($#tempnam>=0) {
print "yes\n";
exit(0);
}
print "no\n";
exit(1);
}
gettemps();
printtemps();
exit(0);
sub printtemps {
for($i=0;$i<=$#tempnam;$i++){
$name=$tempnam[$i];
$name =~ s/\s+/_/go;
print "temp_$name.value $tempval[$i]\n";
}
}
sub gettemps {
open(PRTDIAG,"$prtdiag -v|") || return;
$found=0;
while(<PRTDIAG>) {
$found=1 if(m/^[^\s].*temperature/i);
$found=0 if(m/^$/);
if($found) {
$tmp=substr($_,8);
if($tmp =~ m/ ([0-9]+)/g) {
push(@tempval,$1);
push(@tempnam,substr($_,0,index($_," ")));
$tempnam[$#tempnam] =~ s/^\s//go;
$tempnam[$#tempnam] =~ s#^.*/##go;
}
}
}
close(PRTDIAG);
}
sub printconfig {
gettemps();
print "graph_title Temperature\n";
print "graph_args -l 0\n";
print "graph_category sensors\n";
print "graph_vlabel temp in C\n";
for($i=0;$i<=$#tempnam;$i++){
$name=$tempnam[$i];
$name =~ s/\s+/_/go;
print "temp_$name.label $tempnam[$i]\n";
}
}