--- a/check_roomtemp.pl Tue Aug 07 14:51:16 2012 +0200
+++ b/check_roomtemp.pl Tue Aug 07 17:04:06 2012 +0200
@@ -70,40 +70,20 @@
sub report($$$) {
my ( $temp, $warning, $critical ) = @_;
- $warning = sprintf( "%.2f", $$warning );
- $critical = sprintf( "%.2f", $$critical );
-
- $$temp =~ /^(\d+)\.(\d+)/;
- my $ta = $1;
- my $tb = $2;
+ $$warning = sprintf( "%.2f", $$warning );
+ $$critical = sprintf( "%.2f", $$critical );
- $warning =~ /^(\d+)\.(\d+)/;
- my $wa = $1;
- my $wb = $2;
-
- $critical =~ /^(\d+)\.(\d+)/;
- my $ca = $1;
- my $cb = $2;
-
- if ( $ta > $ca ) {
+ if ( $$temp >= $$critical ) {
print
- "$NAME CRITICAL: +$$temp C | roomtemp=$$temp;$warning;$critical\n";
+ "$NAME CRITICAL: +$$temp C | roomtemp=$$temp;$$warning;$$critical\n";
exit $ERRORS{CRITICAL};
}
- if ( ( $ta == $ca ) && ( $tb >= $cb ) ) {
+ if ( $$temp >= $$warning ) {
print
- "$NAME CRITICAL: +$$temp C | roomtemp=$$temp;$warning;$critical\n";
- exit $ERRORS{CRITICAL};
- }
- if ( $ta > $wa ) {
- print "$NAME WARNING: +$$temp C | roomtemp=$$temp;$warning;$critical\n";
+ "$NAME WARNING: +$$temp C | roomtemp=$$temp;$$warning;$$critical\n";
exit $ERRORS{WARNING};
}
- if ( ( $ta == $wa ) && ( $tb >= $wb ) ) {
- print "$NAME WARNING: +$$temp C | roomtemp=$$temp;$warning;$critical\n";
- exit $ERRORS{WARNING};
- }
- print "$NAME OK: +$$temp C | roomtemp=$$temp;$warning;$critical\n";
+ print "$NAME OK: +$$temp C | roomtemp=$$temp;$$warning;$$critical\n";
exit $ERRORS{OK};
}