[BACK]Return to check_hw_sensors CVS log [TXT][DIR] Up to [local] / nagios / check_hw_sensors

Annotation of nagios/check_hw_sensors/check_hw_sensors, Revision 1.43

1.14      andrew      1: #!/usr/bin/perl -T
1.42      andrew      2: # $RedRiver: check_hw_sensors,v 1.41 2009/11/12 18:53:52 andrew Exp $
1.2       andrew      3: ########################################################################
1.26      andrew      4: # check_hw_sensors *** A nagios check for OpenBSD sysctl hw.sensors
                      5: #
1.31      andrew      6: # 2006.05.01 #*#*# andrew fresh <andrew@afresh1.com>
1.2       andrew      7: ########################################################################
                      8: use strict;
                      9: use warnings;
                     10:
1.33      andrew     11: local %ENV = ();
1.14      andrew     12:
1.42      andrew     13: use POSIX;
                     14: use Config;
                     15: use Getopt::Long;
                     16: use List::Util qw/ first /;
                     17:
1.34      andrew     18: my $NAGIOS_OUTPUT = 1;
1.4       andrew     19:
1.43    ! andrew     20: our $VERSION = q{$Revision: 1.42 $}; $VERSION =~ s/^\D+([\d\.]+)\D+$/v$1/xms;
1.42      andrew     21:
1.33      andrew     22: my $LICENSE = <<'EOL';
1.26      andrew     23: Copyright (c) 2009 Andrew Fresh <andrew@afresh1.com>
                     24: Permission to use, copy, modify, and distribute this software for any
                     25: purpose with or without fee is hereby granted, provided that the above
                     26: copyright notice and this permission notice appear in all copies.
                     27:
                     28: THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     29: WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     30: MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     31: ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     32: WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     33: ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     34: OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     35: EOL
                     36:
1.41      andrew     37: my $PROGNAME       = 'check_hw_sensors';
                     38: my $SYSCTL         = '/sbin/sysctl';
                     39: my $GETCAP         = '/usr/bin/getcap';
                     40: my $BASE           = 'hw.sensors';
                     41: my $DEFAULT_CONFIG = '/etc/sensorsd.conf';
                     42:
1.38      andrew     43: my $PREFIX;
1.40      andrew     44:
1.38      andrew     45: BEGIN {
                     46:     ## no critic 'warnings'
                     47:     no warnings 'uninitialized';
1.40      andrew     48:     $PREFIX = "${PREFIX}" || '/usr/local';    # Magic for OpenBSD ports tree
1.38      andrew     49: }
                     50: use lib $PREFIX . '/libexec/nagios';
1.26      andrew     51: use utils qw($TIMEOUT %ERRORS &support);
1.2       andrew     52:
1.41      andrew     53: $SIG{'ALRM'} = sub {
1.42      andrew     54:     print "ERROR: $PROGNAME timeout\n";
1.41      andrew     55:     exit $ERRORS{'UNKNOWN'};
                     56: };
1.42      andrew     57: alarm $TIMEOUT;
1.41      andrew     58:
1.2       andrew     59: Getopt::Long::Configure('bundling');
                     60:
1.41      andrew     61: my $OSVer = $Config{'osvers'} || 0;
1.2       andrew     62:
1.26      andrew     63: my $state = 'UNKNOWN';    # tells whether the it is warning, critical, or OK
1.28      andrew     64: my $opt_V;
                     65: my $opt_h;
1.33      andrew     66: my $IGNORE_STATUS;
                     67: my $FILENAME;
                     68: my $SENSOR;
                     69: my $WARNING;
                     70: my $CRITICAL;
1.2       andrew     71:
                     72: #Option checking
1.33      andrew     73: my $getopt_status = GetOptions(
                     74:     'version|V'       => \$opt_V,
                     75:     'help|h'          => \$opt_h,
                     76:     'ignore-status|i' => \$IGNORE_STATUS,
                     77:     'filename|f:s'    => \$FILENAME,
                     78:     'sensor|s=s'      => \$SENSOR,
                     79:     'warning|w=s'     => \$WARNING,
                     80:     'critical|c=s'    => \$CRITICAL,
1.2       andrew     81: );
1.18      andrew     82:
1.33      andrew     83: if ( $getopt_status == 0 ) {
1.32      andrew     84:     print_help();
                     85:     exit $ERRORS{'OK'};
                     86: }
                     87:
                     88: if ($opt_V) {
1.42      andrew     89:     print_revision( $PROGNAME, $VERSION );
1.32      andrew     90:     exit $ERRORS{'OK'};
                     91: }
                     92:
                     93: if ($opt_h) {
                     94:     print_help();
                     95:     exit $ERRORS{'OK'};
                     96: }
                     97:
1.2       andrew     98: # set the default this way so it only happens if someone typed -f or --filename
1.42      andrew     99: if ( defined $FILENAME && $FILENAME eq q{} ) {
                    100:     $FILENAME = $DEFAULT_CONFIG;
                    101: }
1.2       andrew    102:
1.18      andrew    103: # Stuff is output in this file by print_sensor()
                    104: # http://www.openbsd.org/cgi-bin/cvsweb/src/sbin/sysctl/sysctl.c
1.33      andrew    105: my @TYPE_MAP = (
1.26      andrew    106:     {   type  => 'temp',
1.33      andrew    107:         regex => qr/\sdegC$/xms,
1.26      andrew    108:     },
                    109:     {   type  => 'fanrpm',
1.33      andrew    110:         regex => qr/\sRPM$/xms,
1.26      andrew    111:     },
                    112:     {   type  => 'volts_dc',
1.33      andrew    113:         regex => qr/\sV\sDC$/xms,
1.26      andrew    114:     },
                    115:     {   type  => 'amps',
1.33      andrew    116:         regex => qr/\sA$/xms,
1.26      andrew    117:     },
                    118:     {   type  => 'watthour',
1.33      andrew    119:         regex => qr/\sWh$/xms,
1.26      andrew    120:     },
                    121:     {   type  => 'amphour',
1.33      andrew    122:         regex => qr/\sAh$/xms,
1.26      andrew    123:     },
                    124:     {   type  => 'indicator',
1.33      andrew    125:         regex => qr/^(On|Off)$/xms,
1.26      andrew    126:     },
                    127:     {   type  => 'integer',
1.33      andrew    128:         regex => qr/\sraw$/xms,
1.26      andrew    129:     },
                    130:     {   type  => 'percent',
1.43    ! andrew    131:         regex => qr/\d\%$/xms,
1.26      andrew    132:     },
                    133:     {   type  => 'lux',
1.33      andrew    134:         regex => qr/\slx$/xms,
1.26      andrew    135:     },
                    136:     {   type  => 'drive',
1.33      andrew    137:         regex => qr/^drive\s/xms,
1.26      andrew    138:     },
                    139:     {   type  => 'timedelta',
1.33      andrew    140:         regex => qr/\ssecs$/xms,
1.26      andrew    141:     },
1.43    ! andrew    142:     # These below are newer than TYPE_MAP is ever used, so really, useless
        !           143:     {   type  => 'humidity',
        !           144:         regex => qr/\d\%$/xms,
        !           145:     },
        !           146:     {   type  => 'frequency',
        !           147:         regex => qr/\s Hz$/xms,
        !           148:     },
        !           149:     {   type  => 'angle',
        !           150:         regex => qr/\s degrees$/xms,
        !           151:     },
1.26      andrew    152: );
                    153:
1.33      andrew    154: my $CHECK_SENSOR = $BASE;
                    155: my %CHECKS;
                    156: if ( defined $SENSOR ) {
                    157:     if ( $SENSOR !~ /^$BASE/xms ) {
                    158:         $SENSOR = join q{.}, $BASE, $SENSOR;
1.26      andrew    159:     }
1.33      andrew    160:     $CHECK_SENSOR = $SENSOR;
1.2       andrew    161:
1.42      andrew    162:     if ($WARNING)  { $CHECKS{$SENSOR}{'warn'} = $WARNING; }
                    163:     if ($CRITICAL) { $CHECKS{$SENSOR}{'crit'} = $CRITICAL; }
1.26      andrew    164: }
1.33      andrew    165: elsif ( defined $FILENAME ) {
                    166:     %CHECKS = read_file($FILENAME);
                    167: }
                    168:
                    169: my @SENSORS = read_sensors($CHECK_SENSOR);
                    170: my %STATES = check_sensors( \@SENSORS, \%CHECKS,
                    171:     { IGNORE_STATUS => $IGNORE_STATUS } );
                    172:
                    173: my $have_results = 0;
                    174: $state = 'OK';
1.37      andrew    175: foreach
                    176:     my $error ( reverse sort { $ERRORS{$a} <=> $ERRORS{$b} } keys %ERRORS )
                    177: {
1.33      andrew    178:     if ( exists $STATES{$error} ) {
                    179:         $have_results++;
                    180:         $state = $error if $ERRORS{$state} < $ERRORS{$error};
                    181:
                    182:         if ($NAGIOS_OUTPUT) {
1.36      andrew    183:             print $error . ' (' . scalar( @{ $STATES{$error} } ) . ')';
1.33      andrew    184:             if ( $error ne 'OK' ) {
                    185:                 print '<br>';
1.40      andrew    186:                 print map {" - $_<br>"} @{ $STATES{$error} };
1.33      andrew    187:             }
                    188:         }
                    189:         else {
1.36      andrew    190:             print $error . ' (' . scalar( @{ $STATES{$error} } ) . "):\n";
1.33      andrew    191:             foreach ( @{ $STATES{$error} } ) {
                    192:                 print "   $_\n";
                    193:             }
                    194:         }
                    195:     }
                    196: }
                    197: if ( $have_results == 0 ) {
                    198:     print "No results found\n";
1.2       andrew    199: }
1.33      andrew    200: exit $ERRORS{$state};
1.2       andrew    201:
1.33      andrew    202: sub read_sensors {
                    203:     my ($sensor) = @_;
                    204:     my @S;
1.42      andrew    205:     open my $sysctl, q{-|}, $SYSCTL, $sensor
1.33      andrew    206:         or die "Couldn't open sysctl: $!\n";
                    207:     while (<$sysctl>) {
                    208:         chomp;
                    209:         push @S, parse_sensor($_);
                    210:     }
                    211:     ## no critic 'die'
                    212:     close $sysctl
                    213:         or die $!
                    214:         ? "Error closing sysctl pipe: $!\n"
                    215:         : "Exit status $? from sysctl\n";
                    216:
                    217:     return @S;
                    218: }
                    219:
                    220: sub parse_sensor {
                    221:     my ($sensor) = @_;
                    222:
1.42      andrew    223:     ## no critic 'literal'
1.33      andrew    224:     my ( $id, $output ) = split /=/xms, $sensor;
1.32      andrew    225:     my @s = split /\./xms,   $id;
                    226:     my @o = split /,\s*/xms, $output;
1.26      andrew    227:
                    228:     my ( $type, $source, $descr, $data, $status );
                    229:
                    230:     $source = $o[0];
                    231:     $descr  = $o[1];
                    232:
                    233:     if ( $OSVer >= 4.1 ) {
                    234:         $data = $o[0];
1.32      andrew    235:         if ( $data =~ s/\s+\((.*)\).*$//xms ) {
1.26      andrew    236:             $descr = $1;
                    237:         }
                    238:         $status = $o[1];
1.32      andrew    239:         ( $source, $type ) = $id =~ /([^\.]+)\.([^\.]+?)\d+$/xms;
1.26      andrew    240:     }
                    241:     elsif ( $OSVer >= 4.0 ) {
                    242:         $data   = $o[2];
                    243:         $status = $o[3];
1.33      andrew    244:         foreach my $t (@TYPE_MAP) {
1.32      andrew    245:             if ( $data =~ /$t->{'regex'}/xms ) {
1.26      andrew    246:                 $type = $t->{'type'};
                    247:                 last;
                    248:             }
                    249:         }
                    250:     }
                    251:     else {
                    252:         $data   = $o[-1];
                    253:         $status = $o[2] if @o == 5;
                    254:         $type   = $o[-2];
                    255:     }
                    256:
                    257:     $type ||= 'unknown';
                    258:
1.33      andrew    259:     return {
1.26      andrew    260:         id          => $id,
                    261:         output      => $output,
                    262:         source      => $source,
                    263:         description => $descr,
                    264:         status      => $status,
                    265:         type        => $type,
                    266:         data        => $data,
1.33      andrew    267:     };
1.2       andrew    268: }
                    269:
1.33      andrew    270: sub read_file {
1.26      andrew    271:     my $filename = shift;
                    272:     my %contents;
1.2       andrew    273:
1.42      andrew    274:     die "file '$filename' does not exist.\n" if !-e $filename;
1.26      andrew    275:
1.42      andrew    276:     open my $fh, q{-|}, $GETCAP, q{-a}, q{-f}, $filename
1.33      andrew    277:         or die "Couldn't open '$GETCAP -a -f $filename': $!\n";
1.26      andrew    278:     while (<$fh>) {
                    279:         chomp;
1.33      andrew    280:         my ( $s, @c ) = split /\:/xms;
                    281:         $contents{$s} = parse_line(@c);
1.26      andrew    282:     }
1.33      andrew    283:     ## no critic 'die'
                    284:     close $fh
                    285:         or die $!
                    286:         ? "Error closing getcap pipe: $!\n"
                    287:         : "Exit status $? from getcap\n";
1.2       andrew    288:
1.26      andrew    289:     return %contents;
1.2       andrew    290: }
                    291:
1.33      andrew    292: sub parse_line {
                    293:     my (@c) = @_;
                    294:     my %c;
                    295:     foreach (@c) {
                    296:         my ( $k, $v ) = split /\=/xms;
                    297:         if    ( lc($k) eq 'ignore' ) { $c{'IGNORE'} = 1; }
                    298:         elsif ( lc($k) eq 'status' ) { $c{'STATUS'} = 1; }
                    299:         else                         { $c{$k}       = $v; }
                    300:     }
                    301:     return \%c;
                    302: }
                    303:
1.2       andrew    304: sub parse_check {
1.26      andrew    305:     my $check = shift;
1.2       andrew    306:
1.42      andrew    307:     return          if !$check;
1.32      andrew    308:     return 'STATUS' if $check->{'STATUS'};
1.26      andrew    309:     return 'IGNORE' if $check->{'IGNORE'};
                    310:
                    311:     foreach my $code ( 'crit', 'warn' ) {
1.33      andrew    312:         if ( defined $check->{$code} && $check->{$code} =~ /:/xms ) {
                    313:             if ( my ( $low, $high ) = split /:/xms, $check->{$code} ) {
1.26      andrew    314:                 $check->{ $code . '.low' }  = $low  if length $low;
                    315:                 $check->{ $code . '.high' } = $high if length $high;
                    316:             }
                    317:             delete $check->{$code};
                    318:         }
                    319:
1.33      andrew    320:         foreach my $direction ( 'low', 'high' ) {
1.42      andrew    321:             my $c = $code . q{.} . $direction;
1.33      andrew    322:             if ( defined $check->{$direction} ) {
                    323:                 $check->{$c} ||= $check->{$direction};
1.26      andrew    324:             }
1.33      andrew    325:
                    326:             if ( defined $check->{$c} ) {
                    327:                 my $old = $check->{$c};
                    328:                 $check->{$c} =~ s/[^\d\.]//gxms;
                    329:                 if ( !length $check->{$c} ) {
                    330:                     warn "INVALID CHECK ($old)\n";
                    331:                     delete $check->{$c};
                    332:                 }
                    333:             }
                    334:         }
                    335:
                    336:         if ( defined $check->{$code} ) {
                    337:             $check->{$code} = [ split /,\s*/xms, $check->{$code} ];
                    338:         }
                    339:         else {
                    340:             $check->{$code} = [];
1.26      andrew    341:         }
                    342:     }
1.2       andrew    343:
1.26      andrew    344:     return $check;
1.2       andrew    345: }
                    346:
1.33      andrew    347: sub check_sensors {
                    348:     my ( $S, $C, $O ) = @_;
                    349:
                    350:     my %states;
                    351:     foreach my $sensor ( @{$S} ) {
                    352:         my ( $r, $data );
                    353:         if ( exists $C->{ $sensor->{id} } ) {
                    354:             $r = check_sensor( $sensor, $C->{ $sensor->{id} } );
1.42      andrew    355:             $data = $sensor->{id} . q{=} . $sensor->{output};
1.33      andrew    356:         }
1.37      andrew    357:         elsif ( $sensor->{status} && !$O->{IGNORE_STATUS} ) {
1.33      andrew    358:             $r = check_sensor( $sensor, { STATUS => 1 } );
1.42      andrew    359:             $data = $sensor->{id} . q{=} . $sensor->{output};
1.33      andrew    360:         }
                    361:         else {
                    362:
                    363:             # ignore this sensor, theoretically you could do the check and
                    364:             # that would show unknown sensors.
                    365:         }
                    366:         if ( defined $r ) {
                    367:             push @{ $states{$r} }, $data;
                    368:         }
                    369:     }
                    370:
                    371:     return %states;
                    372: }
                    373:
1.2       andrew    374: sub check_sensor {
1.33      andrew    375:     my ( $sensor, $check ) = @_;
1.26      andrew    376:     my $result = 'UNKNOWN';
                    377:
1.42      andrew    378:     return $result if ref $sensor ne 'HASH';
1.26      andrew    379:     $check = parse_check($check) if $check;
                    380:
1.33      andrew    381:     if ( !$check ) { return $result; }
1.32      andrew    382:     elsif ( $check eq 'STATUS' ) {
1.27      andrew    383:
1.33      andrew    384:         # It looks like returning $sensor->{status} should be safe, from
1.26      andrew    385:         # src/sbin/sysctl/sysctl.c
1.32      andrew    386:         return ( $sensor->{'status'} || $result );
1.26      andrew    387:     }
1.33      andrew    388:     elsif ( $check eq 'IGNORE' ) { return; }
                    389:
                    390:     my $type = $sensor->{'type'};
1.42      andrew    391:     if (first { $type eq $_ }
1.33      andrew    392:         qw(
                    393:         fan fanrpm
                    394:         volt volts_dc
                    395:         amps watthour amphour
                    396:         integer raw percent
                    397:         lux temp timedelta
1.43    ! andrew    398:         humidity frequency angle
1.33      andrew    399:         )
                    400:         )
                    401:     {
                    402:         $result = check_sensor_numeric( $sensor->{'data'}, $check );
                    403:     }
1.42      andrew    404:     elsif ( first { $type eq $_ } qw( drive indicator ) ) {
1.33      andrew    405:         my $data = $sensor->{'data'};
                    406:         $data =~ s/^drive\s+//xms;
                    407:         $result = check_sensor_list( $data, $check );
                    408:     }
                    409:     else {
1.42      andrew    410:         warn "Unknown Sensor Type: $sensor->{id} = $type\n";
1.33      andrew    411:     }
                    412:
                    413:     return $result;
                    414: }
                    415:
                    416: sub check_sensor_numeric {
                    417:     my ( $data, $check ) = @_;
                    418:
                    419:     my $result = 'UNKNOWN';
                    420:     my %errors = (
                    421:         'warn' => 'WARNING',
                    422:         'crit' => 'CRITICAL',
                    423:     );
                    424:
                    425:     $data =~ s/[^\d\.]//gxms;
                    426:     if ( !length $data ) {
                    427:         warn "INVALID DATA ($data)\n";
                    428:         return $result;
1.26      andrew    429:     }
                    430:
                    431:     foreach my $code ( 'warn', 'crit' ) {
1.36      andrew    432:         if (   defined $check->{ $code . '.low' }
                    433:             || defined $check->{ $code . '.high' } )
1.26      andrew    434:         {
1.36      andrew    435:             if ((   defined $check->{ $code . '.low' }
                    436:                     && $check->{ $code . '.low' } >= $data
1.33      andrew    437:                 )
1.36      andrew    438:                 || ( defined $check->{ $code . '.high' }
                    439:                     && $check->{ $code . '.high' } <= $data )
1.33      andrew    440:                 )
                    441:             {
                    442:                 $result = $errors{$code};
1.26      andrew    443:             }
1.33      andrew    444:             $result = 'OK' if $result eq 'UNKNOWN';
                    445:         }
                    446:         elsif ( @{ $check->{$code} } ) {
                    447:             my $matched = 0;
                    448:         NUMERIC_CHECK: foreach ( @{ $check->{$code} } ) {
                    449:                 my $c = $_;
                    450:                 $c =~ s/[^\d\.]//gxms;
                    451:                 if ( !length $c ) {
1.36      andrew    452:                     warn "INVALID CHECK ($_) for '$code'\n";
1.33      andrew    453:                     next;
1.26      andrew    454:                 }
                    455:
1.33      andrew    456:                 if ( $c eq $data ) {
                    457:                     $matched = 1;
                    458:                     last NUMERIC_CHECK;
1.26      andrew    459:                 }
1.33      andrew    460:             }
                    461:             if ($matched) {
1.32      andrew    462:                 $result = 'OK' if $result eq 'UNKNOWN';
1.26      andrew    463:             }
1.33      andrew    464:             else {
                    465:                 $result = $errors{$code};
1.26      andrew    466:             }
                    467:         }
1.33      andrew    468:     }
                    469:
                    470:     return $result;
                    471: }
1.26      andrew    472:
1.33      andrew    473: sub check_sensor_list {
                    474:     my ( $data, $check ) = @_;
1.26      andrew    475:
1.33      andrew    476:     my $result = 'UNKNOWN';
                    477:     my %errors = (
                    478:         'warn' => 'WARNING',
                    479:         'crit' => 'CRITICAL',
                    480:     );
1.26      andrew    481:
1.33      andrew    482:     foreach my $code ( 'warn', 'crit' ) {
                    483:         if ( @{ $check->{$code} } ) {
                    484:             my $matched = 0;
                    485:         LIST_CHECK: foreach ( @{ $check->{$code} } ) {
                    486:                 if ( $_ eq $data ) {
                    487:                     $matched = 1;
                    488:                     last LIST_CHECK;
1.26      andrew    489:                 }
1.33      andrew    490:             }
                    491:             if ($matched) {
1.32      andrew    492:                 $result = 'OK' if $result eq 'UNKNOWN';
1.26      andrew    493:             }
1.33      andrew    494:             else {
                    495:                 $result = $errors{$code};
1.26      andrew    496:             }
                    497:         }
                    498:     }
1.2       andrew    499:
1.26      andrew    500:     return $result;
1.2       andrew    501: }
                    502:
                    503: sub print_help {
1.26      andrew    504:     print <<"EOL";
                    505: $PROGNAME - monitors sysctl hw.sensors on OpenBSD
1.30      andrew    506:     $PROGNAME [-i] [-f [<FILENAME>]|(-s <hw.sensors id> [-w limit] [-c limit])]
1.2       andrew    507:
                    508: Usage:
1.15      andrew    509:     -i, --ignore-status
1.26      andrew    510:         Don't automatically check the status of sensors that report it.
1.12      andrew    511:     -f, --filename=FILE
                    512:         FILE to load checks from (defaults to /etc/sensorsd.conf)
                    513:     -s, --sensor=ID
1.26      andrew    514:         ID of a single sensor.  "-s kate0.temp0" means hw.sensors.kate0.temp0
1.27      andrew    515:         Overrides --filename.
1.12      andrew    516:     -w, --warning=RANGE or single ENTRY
                    517:         Exit with WARNING status if outside of RANGE or if != ENTRY
1.13      andrew    518:     -c, --critical=RANGE or single ENTRY
1.12      andrew    519:         Exit with CRITICAL status if outside of RANGE or if != ENTRY
                    520:
1.13      andrew    521: FILE is in the same format as sensorsd.conf(5) plus some additional
                    522: entries.  These additional entries in the file are ignored by
1.35      andrew    523: sensorsd(8).  This means you can use the same config file for $PROGNAME
1.26      andrew    524: as well as sensorsd(8).
1.12      andrew    525:
                    526: $PROGNAME understands the following entries:
                    527:
1.15      andrew    528:     low, high, crit, warn, crit.low, crit.high, warn.low, warn.high,
                    529:     ignore, status
1.12      andrew    530:
                    531: An ENTRY depends on the type.  The descriptions in sensorsd.conf(5)
                    532: can be used when appropriate, or you can use the following:
                    533:
1.20      andrew    534:     fanrpm, volts_dc, amps, watthour, amphour, integer (raw), percent,
1.33      andrew    535:     lux, temp or timedelta - Anything that includes digits.  Both the
                    536:     value of the check and the value of the sensor response that are not
                    537:     either a digit or period are stripped and then the two resultant
                    538:     values are compared.
1.12      andrew    539:
                    540:     indicator or drive - does a case sensitive match of each
                    541:     entry in the comma separated list and if it does not match
1.20      andrew    542:     any of the entries, it sets the status.
1.12      andrew    543:
                    544: The entries 'crit' or 'warn' (or the -c or -w on the command line)
                    545: may be a RANGE or a comma separated list of acceptable values.
                    546: The comma separated list of values contains a list of things that
                    547: will NOT cause the status.  This is possibly counterintuitive, but
                    548: you are more likely to know good values than bad values.
                    549:
                    550: A RANGE is a low ENTRY and a high ENTRY separated by a colon (:).
                    551: It can also be low: or :high with the other side left blank to only
1.26      andrew    552: make the single check.
1.2       andrew    553:
1.15      andrew    554: An entry marked "ignore" will cause that sensor to be skipped.
                    555: Generally used with state checking of all sensors to ignore sensors you
                    556: don't care about or that report incorrectly.
                    557:
                    558: If you are using --ignore-status, you can still check the status of
                    559: individual sensors with a status entry.
                    560:
1.2       andrew    561: EOL
1.15      andrew    562:
1.42      andrew    563:     print_revision( $PROGNAME, $VERSION );
1.26      andrew    564:
1.33      andrew    565:     print $LICENSE;
                    566:
                    567:     return;
1.2       andrew    568: }
1.26      andrew    569:
                    570: sub print_revision {
1.27      andrew    571:     my ( $prog, $rev ) = @_;
1.26      andrew    572:
                    573:     print "$prog $rev\n";
1.33      andrew    574:
                    575:     return;
1.26      andrew    576: }
1.2       andrew    577:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>