Script per monitorare CPU e Motherboard.

Sab, 19/02/2005 - 16:49

Script per monitorare CPU e Motherboard.

Inviato da Marcoski 0 commenti

A useful script to monitor cpu and motherboard, using sensors command.Script per monitorare CPU e Motherboard, usando il comando "sensors".

#!/usr/bin/perl -w
# Written by marcoski
############ SCRIPT THAT TAKE VALUE TO MRTG TO MONITORING SYSTEM TEMPERATURE
# parameters: [cp][mb]
 
my($arg, $command, $temperature);
$command=`sensors`;
$arg = $ARGV[0];
if(length($arg) != 0){
    if($command =~ /$arg: *\+([0-9]{2}|[0-9]{2}\.[0-9])\°.*/){
        $temperature = $1;
        if($temperature =~ /([0-9]{2})\.[0-9]/){
             $temperature = $1;
        }
        print "$temperature\n0\n0\nsys temp";
    }else{
        print "ERROR string doesn't match\n";
    }
}else{
    print "ERROR $ARGV[0] unrecognized\n";
    print "USAGE: temp [sensors command label][--help]";
}