CPU Temperatur mit Nagios überwachen
Hallo, sensors ergibt xxx:/etc/init.d # sensors coretemp-isa-0000 Adapter: ISA adapter Core 0: +43.0°C (high = +78.0°C, crit = +100.0°C) coretemp-isa-0001 Adapter: ISA adapter Core 1: +42.0°C (high = +78.0°C, crit = +100.0°C) Ich suche jetzt einen Weg diese Werte in Nagios einzubinden. http://www.monitoringexchange.org/ gibt nichts her was wirklich funktioniert. ipmi lauft auf dem System nicht. snmp wäre noch möglich. Hat jemand einen Tip? Gruß -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um eine Liste aller verfuegbaren Kommandos zu bekommen, schicken Sie eine Mail an: opensuse-de+help@opensuse.org
On 2010.03.05 14:05, Ralf Prengel wrote:
Hallo,
sensors ergibt xxx:/etc/init.d # sensors coretemp-isa-0000 Adapter: ISA adapter Core 0: +43.0°C (high = +78.0°C, crit = +100.0°C)
coretemp-isa-0001 Adapter: ISA adapter Core 1: +42.0°C (high = +78.0°C, crit = +100.0°C)
Ich suche jetzt einen Weg diese Werte in Nagios einzubinden. http://www.monitoringexchange.org/ gibt nichts her was wirklich funktioniert. ipmi lauft auf dem System nicht. snmp wäre noch möglich.
Hat jemand einen Tip?
Schon lange nichts mit Perl gemacht, deshalb hier ein schnell zusammengehacktes Plugin: check_cpu_temp: #!/usr/bin/perl -w # # check_skeleton.pl - nagios plugin # # Copyright (C) 2006 AUTHOR, # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # # Report bugs to: nagiosplug-help@lists.sourceforge.net # # 26.10.2006 Version 0.2 # # use strict; use Getopt::Long; use vars qw($PROGNAME); use lib "/usr/lib/nagios/plugins"; # path to util.pm !! use utils qw ($TIMEOUT %ERRORS &print_revision &support); sub print_help (); sub print_usage (); my ($opt_V, $opt_h, $opt_w, $opt_c, $opt_t); my ($result, $message ); $PROGNAME="check_cpu_temp"; $opt_w=""; $opt_c=""; Getopt::Long::Configure('bundling'); GetOptions( # "V" => \$opt_V, "version" => \$opt_V, "h" => \$opt_h, "help" => \$opt_h, "w=s" => \$opt_w, "warning=s" => \$opt_w, "c=s" => \$opt_c, "critical=s" => \$opt_c); if ($opt_t) { $TIMEOUT=$opt_t; } # Just in case of problems, let's not hang Nagios $SIG{'ALRM'} = sub { print "UNKNOWN - Plugin Timed out\n"; exit $ERRORS{"UNKNOWN"}; }; alarm($TIMEOUT); if ($opt_V) { exit $ERRORS{'OK'}; } if ($opt_h) { print_help(); exit $ERRORS{'OK'}; } sub print_usage () { print "Usage:\n"; print " $PROGNAME [-w <INTEGER>] [-c <INTEGER>]\n"; print " $PROGNAME [-h | --help]\n"; # print " $PROGNAME [-V | --version]\n"; print "\n\nOptions:\n"; print " -w, --critical\n"; print " Manual warn temperature threshold (default is to rely on output of sensors)\n"; print " -c, --critical\n"; print " Manual critical temperature threshold (default is to rely on output of sensors) (\n"; print " -h, --help\n"; print " Print detailed help screen\n"; # print " -V, --version\n"; # print " Print version information\n\n"; sub print_help () { print "This plugin checks the temperature of the cpu cores.\n"; print "For the moment it only works with core cpus.\n"; print "The plugin uses the output of sensors to get the cpu temperatures.\n"; print "\n"; print "Copyright (c) 2010 Sandy Drobic\n\n"; print_usage(); print "\n"; # print " <help> This output\n"; # print "\n"; # support(); } $result = 'UNKNOWN'; $message = ""; my $coretemp; my $crittemp; my $warntemp; my $core_found = 'false'; open (SENSORS, "/usr/bin/sensors|"); while (<SENSORS>) { if ( $_ =~ /^Core/ ) { $core_found = 'true'; # print $_; ($coretemp, $warntemp, $crittemp) = /\+(.+) C +\(high = \+(.+) C, crit = \+(.+) C\)/; $message = $message . " " . $coretemp . ","; if ($opt_w) { $warntemp = $opt_w; } if ($opt_c) { $crittemp = $opt_c; } if ($coretemp >= $crittemp ) { $result = 'CRIT'; } if (($coretemp >= $warntemp) && ($coretemp < $crittemp)) { $result = 'WARN'; } #print "Coretemp: " . $coretemp . ", Warntemp: " . $warntemp . ", Crittemp: " . $crittemp . "\n"; } } if ($core_found eq 'false') { print "Can not find a Core line in output of sensor\n"; exit 3; } if (($core_found eq 'true' ) && ($result ne 'WARN') && ($result ne 'CRIT' )){ $result = 'OK'; } print $result . ": " . $message . "\n"; if ($result eq 'OK') { exit 0; } if ( $result eq 'WARN'){ exit 1; } if ( $result eq 'CRIT'){ exit 2; } if ( $result eq 'UNKNOWN') { exit 3; } #-------- check_cpu_temp ende Das sollte bei dir funktionieren ohne Anpassungen. Bitte aufpassen auf falsche Zeilenumbrüche, die durch das Posten entstanden sind! -- Sandy Antworten bitte nur in die Mailingliste! PMs bitte an: news-reply2 (@)drobic (.) de -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um eine Liste aller verfuegbaren Kommandos zu bekommen, schicken Sie eine Mail an: opensuse-de+help@opensuse.org
participants (2)
-
Ralf Prengel
-
Sandy Drobic