Changes of Revision 25
[-] | Changed | check_openmanage.changes |
x 1
2 ------------------------------------------------------------------- 3 +Mon Aug 15 14:52:04 UTC 2011 - cs@linux-administrator.com 4 + 5 +- Update to version 3.7.0: 6 + * Major feature enhancements 7 + * Major overhaul of the perfdata code. This includes API breakage and fixes the following: - Probes were not sorted correctly - Voltage data was not included 8 + * The PNP template check_openmanage.php has been redone to work with the changes in perfdata output from the plugin 9 + * A new option --legacy-perfdata will make the the plugin output the performance data in the old format 10 + * Added support for a configuration file 11 + * Added manual page for the configuration file 12 + * If using html output, URLs will now open in a new window 13 + * Added a compatibility fix for OMSA 6.5.0, related to performance data for amperage probes when the plugin is used in local mode. Thanks to Benedikt Meyer for a patch. 14 + 15 + 16 +------------------------------------------------------------------- 17 Fri Jun 24 20:56:18 UTC 2011 - cs@linux-administrator.com 18 19 - Update to version 3.6.8: 20 |
||
[-] | Changed | check_openmanage.spec ^ |
9 1
2 Summary: A Nagios plugin to check hardware health on Dell servers 3 Name: check_openmanage 4 -Version: 3.6.8 5 +Version: 3.7.0 6 Release: 2%{?dist} 7 License: GPL 8 Group: Applications/System 9 |
||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/CHANGES ^ |
@@ -1,3 +1,21 @@ +3.7.0 2011-08-15 +------------------ + +* Major overhaul of the perfdata code. This includes API breakage and + fixes the following: + - Probes were not sorted correctly + - Voltage data was not included +* The PNP template check_openmanage.php has been redone to work with + the changes in perfdata output from the plugin +* A new option '--legacy-perfdata' will make the the plugin output the + performance data in the old format +* Added support for a configuration file +* Added manual page for the configuration file +* If using html output, URLs will now open in a new window +* Added a compatibility fix for OMSA 6.5.0, related to performance + data for amperage probes when the plugin is used in local + mode. Thanks to Benedikt Meyer for a patch. + 3.6.8 2011-06-07 ------------------ | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/INSTALL ^ |
@@ -10,11 +10,13 @@ ------------------- To install check_openmanage, copy the file check_openmanage to the -Nagios plugin directory (usually /usr/lib/nagios/plugins): +Nagios plugin directory (usually /usr/lib/nagios/plugins for 32bit or +/usr/lib64/nagios/plugins for 64bit): cp check_openmanage /usr/lib/nagios/plugins -To install the manual page: +To install the manual pages: cp check_openmanage.8 /usr/share/man/man8 + cp check_openmanage.conf.5 /usr/share/man/man5 | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/README ^ |
@@ -6,8 +6,10 @@ check_openmanage - The plugin check_openmanage.exe - Win32 standalone executable - check_openmanage.8 - Man page - check_openmanage.pod - Man page source + check_openmanage.8 - Program man page + check_openmanage.conf.5 - Config file man page + check_openmanage.pod - Program man page source + check_openmanage.conf.pod - Config file man page source check_openmanage.php - PNP4Nagios template nagios-plugins-check-openmanage.spec - RPM spec file COPYING - License information | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/check_openmanage ^ |
@@ -5,7 +5,7 @@ # Monitor Dell server hardware status using Dell OpenManage Server # Administrator, either locally via NRPE, or remotely via SNMP. # -# $Id: check_openmanage 19355 2011-02-09 13:50:00Z trondham $ +# $Id: check_openmanage 20643 2011-08-15 11:45:29Z trondham $ # # Copyright (C) 2008-2011 Trond H. Amundsen # @@ -51,7 +51,7 @@ # Version and similar info $NAME = 'check_openmanage'; -$VERSION = '3.6.8'; +$VERSION = '3.7.0'; $AUTHOR = 'Trond H. Amundsen'; $CONTACT = 't.h.amundsen@usit.uio.no'; @@ -74,10 +74,12 @@ GENERAL OPTIONS: + -f, --config Specify configuration file -p, --perfdata Output performance data [default=no] -t, --timeout Plugin timeout in seconds [default=30] -c, --critical Custom temperature critical limits -w, --warning Custom temperature warning limits + -F, --fahrenheit Use Fahrenheit as temperature unit -d, --debug Debug output, reports everything -h, --help Display this help text -V, --version Display version info @@ -97,7 +99,7 @@ -e, --extinfo Append system info to alerts -s, --state Prefix alerts with alert state -S, --short-state Prefix alerts with alert state abbreviated - -o, --ok-info Verbosity when check result is OK + -o, --okinfo Verbosity when check result is OK -B, --show-blacklist Show blacklistings in OK output -I, --htmlinfo HTML output with clickable links @@ -129,10 +131,14 @@ 'check' => [], # check control 'critical' => [], # temperature critical limits 'warning' => [], # temperature warning limits + 'tempunit' => 'C', # temperature unit + 'fahrenheit' => 0, # Use fahrenheit + 'configfile' => undef, # configuration file 'timeout' => 30, # default timeout is 30 seconds 'debug' => 0, # debugging / verbose output 'help' => 0, # display help output 'perfdata' => undef, # output performance data + 'legacy_perfdata' => 0, # legacy performance data output 'info' => 0, # display servicetag 'extinfo' => 0, # display extra info 'htmlinfo' => undef, # html tags in output @@ -168,11 +174,15 @@ 'check=s' => \@{ $opt{check} }, 'c|critical=s' => \@{ $opt{critical} }, 'w|warning=s' => \@{ $opt{warning} }, + 'tempunit=s' => \$opt{tempunit}, + 'F|fahrenheit' => \$opt{fahrenheit}, + 'f|configfile=s' => \$opt{configfile}, 't|timeout=i' => \$opt{timeout}, 'd|debug' => \$opt{debug}, 'h|help' => \$opt{help}, 'V|version' => \$opt{version}, 'p|perfdata:s' => \$opt{perfdata}, + 'legacy-perfdata' => \$opt{legacy_perfdata}, 'i|info' => \$opt{info}, 'e|extinfo' => \$opt{extinfo}, 'I|htmlinfo:s' => \$opt{htmlinfo}, @@ -214,6 +224,34 @@ exit $E_UNKNOWN; } +# Initialize blacklist +%blacklist = (); + +# Check flags, override available with the --check option +%check = ( 'storage' => 1, # check storage subsystem + 'memory' => 1, # check memory (dimms) + 'fans' => 1, # check fan status + 'power' => 1, # check power supplies + 'temp' => 1, # check temperature + 'cpu' => 1, # check processors + 'voltage' => 1, # check voltage + 'batteries' => 1, # check battery probes + 'amperage' => 1, # check power consumption + 'intrusion' => 1, # check intrusion detection + 'sdcard' => 1, # check removable flash media (SD cards) + 'alertlog' => 0, # check the alert log + 'esmlog' => 0, # check the ESM log (hardware log) + 'esmhealth' => 1, # check the ESM log overall health + ); + +# Messages +@report_storage = (); # messages with associated nagios level (storage) +@report_chassis = (); # messages with associated nagios level (chassis) +@report_other = (); # messages with associated nagios level (other) + +# Read config file +parse_configfile() if defined $opt{configfile}; + # Setting timeout $SIG{ALRM} = sub { print "PLUGIN TIMEOUT: $NAME timed out after $opt{timeout} seconds\n"; @@ -231,23 +269,6 @@ # The omreport command $omreport = undef; -# Check flags, override available with the --check option -%check = ( 'storage' => 1, # check storage subsystem - 'memory' => 1, # check memory (dimms) - 'fans' => 1, # check fan status - 'power' => 1, # check power supplies - 'temp' => 1, # check temperature - 'cpu' => 1, # check processors - 'voltage' => 1, # check voltage - 'batteries' => 1, # check battery probes - 'amperage' => 1, # check power consumption - 'intrusion' => 1, # check intrusion detection - 'sdcard' => 1, # check removable flash media (SD cards) - 'alertlog' => 0, # check the alert log - 'esmlog' => 0, # check the ESM log (hardware log) - 'esmhealth' => 1, # check the ESM log overall health - ); - # Default line break $linebreak = isatty(*STDOUT) ? "\n" : '<br/>'; @@ -271,49 +292,44 @@ } # List of controllers and enclosures -@controllers = (); # controllers -@enclosures = (); # enclosures -%snmp_enclosure = (); # enclosures - -# Messages -@report_storage = (); # messages with associated nagios level (storage) -@report_chassis = (); # messages with associated nagios level (chassis) -@report_other = (); # messages with associated nagios level (other) +@controllers = (); # controllers +@enclosures = (); # enclosures +%snmp_enclosure = (); # enclosures # Counters for everything %count = ( - 'pdisk' => 0, # number of physical disks - 'vdisk' => 0, # number of logical drives (virtual disks) - 'temp' => 0, # number of temperature probes - 'volt' => 0, # number of voltage probes - 'amp' => 0, # number of amperage probes - 'intr' => 0, # number of intrusion probes - 'dimm' => 0, # number of memory modules - 'mem' => 0, # total memory - 'fan' => 0, # number of fan probes - 'cpu' => 0, # number of CPUs - 'bat' => 0, # number of batteries - 'power' => 0, # number of power supplies - 'sd' => 0, # number of SD cards - 'esm' => { - 'Critical' => 0, # critical entries in ESM log - 'Non-Critical' => 0, # warning entries in ESM log - 'Ok' => 0, # ok entries in ESM log - }, - 'alert' => { - 'Critical' => 0, # critical entries in alert log - 'Non-Critical' => 0, # warning entries in alert log - 'Ok' => 0, # ok entries in alert log - }, + 'pdisk' => 0, # number of physical disks + 'vdisk' => 0, # number of logical drives (virtual disks) + 'temp' => 0, # number of temperature probes + 'volt' => 0, # number of voltage probes + 'amp' => 0, # number of amperage probes + 'intr' => 0, # number of intrusion probes + 'dimm' => 0, # number of memory modules + 'mem' => 0, # total memory + 'fan' => 0, # number of fan probes + 'cpu' => 0, # number of CPUs + 'bat' => 0, # number of batteries + 'power' => 0, # number of power supplies + 'sd' => 0, # number of SD cards + 'esm' => { + 'Critical' => 0, # critical entries in ESM log + 'Non-Critical' => 0, # warning entries in ESM log + 'Ok' => 0, # ok entries in ESM log + }, + 'alert' => { + 'Critical' => 0, # critical entries in alert log + 'Non-Critical' => 0, # warning entries in alert log + 'Ok' => 0, # ok entries in alert log + }, ); # Performance data @perfdata = (); # Global health status -$global = 1; # default is to check global status -$globalstatus = $E_OK; # default global health status is "OK" +$global = 1; # default is to check global status +$globalstatus = $E_OK; # default global health status is "OK" # Nagios error levels reversed %reverse_exitcode @@ -398,7 +414,7 @@ adjust_checks() if defined $opt{check}; # Blacklisted components -%blacklist = defined $opt{blacklist} ? %{ get_blacklist() } : (); +set_blacklist($opt{blacklist}) if defined $opt{blacklist}; # If blacklisting is in effect, don't check global health status if (scalar keys %blacklist > 0) { @@ -424,11 +440,355 @@ check_omreport_options(); } +# Temperature unit +if ($opt{fahrenheit}) { + $opt{tempunit} = 'F'; +} + +# Check tempunit syntax +if ($opt{tempunit} !~ m{\A C|F|K|R \z}xms) { + print "ERROR: Unknown temperature unit '$opt{tempunit}'\n"; + exit $E_UNKNOWN; +} #--------------------------------------------------------------------- # Helper functions #--------------------------------------------------------------------- +# Make a regex from a glob pattern. Shamelessly stolen from Perl +# Cookbook chapter 6.9 +sub glob2regex { + my $globstr = shift; + my %patmap + = ( '*' => '.*', + '?' => '.', + '[' => '[', + ']' => ']', + ); + $globstr =~ s{(.)} { $patmap{$1} || "\Q$1" }ge; + return '\A' . $globstr . '\z'; +} + +# +# Read config file +# +sub parse_configfile { + our $tiny = undef; + + # Regexp for boolean values + our $off = qr{\A (0|off|false) \s* \z}ixms; + our $on = qr{\A (1|on|true) \s* \z}ixms; + + # Mapping between command line options and the corresponding + # config file options + our %opt2config + = ( 'info' => 'output_servicetag', + 'extinfo' => 'output_sysinfo', + 'postmsg' => 'output_post_message', + 'state' => 'output_servicestate', + 'shortstate' => 'output_servicestate_abbr', + 'show_blacklist' => 'output_blacklist', + 'htmlinfo' => 'output_html', + 'okinfo' => 'output_ok_verbosity', + 'protocol' => 'snmp_version', + 'community' => 'snmp_community', + 'port' => 'snmp_port', + 'ipv6' => 'snmp_use_ipv6', + 'tcp' => 'snmp_use_tcp', + 'warning' => 'temp_threshold_warning', + 'critical' => 'temp_threshold_critical', + 'all' => 'check_everything', + 'perfdata' => 'performance_data', + 'tempunit' => 'temperature_unit', + 'timeout' => 'timeout', + 'blacklist' => 'blacklist', + 'legacy_perfdata' => 'legacy_performance_data', + ); + + # Load the perl module + if ( eval { require Config::Tiny; 1 } ) { + $tiny = Config::Tiny->new(); + } + else { + print "ERROR: Required perl module 'Config::Tiny' not found\n"; + exit $E_UNKNOWN; + } + + # Read the config file + $tiny = Config::Tiny->read($opt{configfile}) + or do { report('other', (sprintf q{Couldn't read configuration file: %s}, Config::Tiny->errstr()), $E_UNKNOWN); + return; }; + + # Syntax check + foreach my $section (keys %{ $tiny }) { + KEYWORD: + foreach my $keyword (keys %{ $tiny->{$section} }) { + next KEYWORD if $keyword eq 'check_everything'; + if ($keyword =~ m{\A check_(.+)}xms) { + my $c = $1; + foreach my $cl (keys %check) { + next KEYWORD if $c eq $cl; + } + } + else { + LEGAL: + foreach my $legal (keys %opt2config) { + next KEYWORD if $keyword eq $opt2config{$legal}; + } + } + if ($section eq '_') { + report('other', qq{CONFIG ERROR: In the global section: Unknown statement "$keyword"}, $E_UNKNOWN); + } + else { + report('other', qq{CONFIG ERROR: Unknown statement "$keyword" in section "$section"}, $E_UNKNOWN); + } + } + } + + # Adjust checks according to statements in the configuration file + sub configfile_adjust_checks { + my $keyword = shift; + CHECK_CONFIG: + foreach my $key (keys %check) { + my $copt = join '_', 'check', $key; + next CHECK_CONFIG if !defined $tiny->{$keyword}->{$copt} or $tiny->{$keyword}->{$copt} eq q{}; + if ($tiny->{$keyword}->{$copt} =~ m{$on}ixms) { + $check{$key} = 1; + } + elsif ($tiny->{$keyword}->{$copt} =~ m{$off}ixms) { + $check{$key} = 0; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$copt' must be boolean (True/False)", $E_UNKNOWN); + } + } + return; + } + + # Set blacklist according to statements in the configuration file + sub configfile_set_blacklist { + my $keyword = shift; + if (defined $tiny->{$keyword}->{blacklist} and $tiny->{$keyword}->{blacklist} ne q{}) { + # set_blacklist() takes an array ref + set_blacklist([$tiny->{$keyword}->{blacklist}]); + } + return; + } + + # Set timeout according to statements in the configuration file + sub configfile_set_timeout { + my $keyword = shift; + if (defined $tiny->{$keyword}->{timeout} and $tiny->{$keyword}->{timeout} ne q{}) { + if ($tiny->{$keyword}->{timeout} =~ m{\A \d+ \z}xms) { # integer + $opt{timeout} = $tiny->{$keyword}->{timeout}; + } + else { + report('other', "CONFIG ERROR: Rvalue for 'timeout' must be a positive integer", $E_UNKNOWN); + } + } + return; + } + + # Set a boolean option + sub configfile_set_boolean { + my ($keyword, $bool) = @_; + my $cbool = $opt2config{$bool}; + if (defined $tiny->{$keyword}->{$cbool} and $tiny->{$keyword}->{$cbool} ne q{}) { + if ($tiny->{$keyword}->{$cbool} =~ m{$on}ixms) { + $opt{$bool} = 1; + } + elsif ($tiny->{$keyword}->{$cbool} =~ m{$off}ixms) { + $opt{$bool} = 0; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$cbool' must be boolean (True/False)", $E_UNKNOWN); + } + } + return; + } + + # Set htmlinfo option from config file + sub configfile_set_htmlinfo { + my $keyword = shift; + my $conf = $opt2config{htmlinfo}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + if ($tiny->{$keyword}->{$conf} =~ m{$on}ixms) { + $opt{htmlinfo} = 1; + } + elsif ($tiny->{$keyword}->{$conf} =~ m{$off}ixms) { + $opt{htmlinfo} = undef; + } + else { + $opt{htmlinfo} = $tiny->{$keyword}->{$conf}; + } + } + return; + } + + # Set OK output verbosity + sub configfile_set_ok_verbosity { + my $keyword = shift; + my $conf = $opt2config{okinfo}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + if ($tiny->{$keyword}->{$conf} =~ m{\A \d+ \z}xms) { + $opt{okinfo} = $tiny->{$keyword}->{$conf}; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$conf' must be a positive integer", $E_UNKNOWN); + } + } + return; + } + + # Set SNMP protocol version from config file + sub configfile_set_snmp_version { + my $keyword = shift; + my $conf = $opt2config{protocol}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + if ($tiny->{$keyword}->{$conf} =~ m{\A 1|2|3 \z}xms) { + $opt{protocol} = $tiny->{$keyword}->{$conf}; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$conf' must be '1', '2' or '3'", $E_UNKNOWN); + } + } + return; + } + + # Set SNMP community name from config file + sub configfile_set_snmp_community { + my $keyword = shift; + my $conf = $opt2config{community}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + $opt{community} = $tiny->{$keyword}->{$conf}; + } + return; + } + + # Set SNMP port number from config file + sub configfile_set_snmp_port { + my $keyword = shift; + my $conf = $opt2config{port}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + if ($tiny->{$keyword}->{$conf} =~ m{\A \d+ \z}xms) { # integer + $opt{port} = $tiny->{$keyword}->{$conf}; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$conf' must be a positive integer", $E_UNKNOWN); + } + } + return; + } + + # Set temperature threshold from config file + sub configfile_set_temp_threshold { + my $keyword = shift; + my $level = shift; + my $conf = $opt2config{$level}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + $opt{$level} = [$tiny->{$keyword}->{$conf}]; # array ref + } + return; + } + + # Set perfdata from config file + sub configfile_set_perfdata { + my $keyword = shift; + my $conf = $opt2config{perfdata}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + if ($tiny->{$keyword}->{$conf} =~ m{$on}ixms) { + $opt{perfdata} = 1; + } + elsif ($tiny->{$keyword}->{$conf} =~ m{$off}ixms) { + $opt{perfdata} = undef; + } + elsif ($tiny->{$keyword}->{$conf} =~ m{\A minimal|multiline \z}xms) { + $opt{perfdata} = $tiny->{$keyword}->{$conf}; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$conf' must be either boolean, 'minimal' or 'multiline'", $E_UNKNOWN); + } + } + return; + } + + # Set temp unit from config file + sub configfile_set_tempunit { + my $keyword = shift; + my $conf = $opt2config{tempunit}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + if ($tiny->{$keyword}->{$conf} =~ m{\A C|F|K|R \z}ixms) { + $opt{tempunit} = $tiny->{$keyword}->{$conf}; + } + else { + report('other', "CONFIG ERROR: Rvalue for '$conf' must one of C/F/K/R", $E_UNKNOWN); + } + } + return; + } + + # Set postmsg string from config file + sub configfile_set_postmsg { + my $keyword = shift; + my $conf = $opt2config{postmsg}; + if (defined $tiny->{$keyword}->{$conf} and $tiny->{$keyword}->{$conf} ne q{}) { + $opt{postmsg} = $tiny->{$keyword}->{$conf}; # array ref + } + return; + } + + # Sections in the config file to check for statements + my @sections = (); + + # First: Populate the sections array with the global section + @sections = ('_'); + + # Second: Populate the sections array with host glob pattern (but + # not exact match) + PATTERN: + foreach my $glob (sort keys %{ $tiny }) { + next PATTERN if $glob eq '_'; # global section + next PATTERN if $glob eq $opt{hostname}; # exact match + my $regex = glob2regex($glob); # make regexp + if ($opt{hostname} =~ m{$regex}) { + push @sections, $glob; + } + } + + # Third: Populate the sections array with exact hostname + if (defined $tiny->{$opt{hostname}}) { + push @sections, $opt{hostname}; + } + + # Loop through the sections array and get options + foreach my $sect (@sections) { + configfile_adjust_checks($sect); + configfile_set_blacklist($sect); + configfile_set_timeout($sect); + configfile_set_htmlinfo($sect); + configfile_set_ok_verbosity($sect); + configfile_set_boolean($sect, 'all'); + configfile_set_boolean($sect, 'info'); + configfile_set_boolean($sect, 'extinfo'); + configfile_set_boolean($sect, 'state'); + configfile_set_boolean($sect, 'shortstate'); + configfile_set_boolean($sect, 'show_blacklist'); + configfile_set_boolean($sect, 'ipv6'); + configfile_set_boolean($sect, 'tcp'); + configfile_set_boolean($sect, 'legacy_perfdata'); + configfile_set_snmp_version($sect); + configfile_set_snmp_community($sect); + configfile_set_snmp_port($sect); + configfile_set_temp_threshold($sect, 'warning'); + configfile_set_temp_threshold($sect, 'critical'); + configfile_set_perfdata($sect); + configfile_set_tempunit($sect); + configfile_set_postmsg($sect); + } + + return; +} + # # Store a message in one of the message arrays # @@ -446,7 +806,6 @@ return push @{ $type2array{$type} }, [ $msg, $exval, $id ]; } - # # Run command, put resulting output lines in an array and return a # pointer to that array @@ -700,12 +1059,12 @@ # Read the blacklist option and return a hash containing the # blacklisted components # -sub get_blacklist { +sub set_blacklist { + my $foo = shift; my @bl = (); - my %blacklist = (); - if (scalar @{ $opt{blacklist} } >= 0) { - foreach my $black (@{ $opt{blacklist} }) { + if (scalar @{ $foo } >= 0) { + foreach my $black (@{ $foo }) { my $tmp = q{}; if (-f $black) { open my $BL, '<', $black @@ -730,11 +1089,11 @@ next if $c !~ m/=/xms; my ($key, $val) = split /=/xms, $c; my @vals = split /,/xms, $val; - $blacklist{$key} = \@vals; + push @{ $blacklist{$key} }, @vals; } } - return \%blacklist; + return; } # @@ -881,7 +1240,7 @@ # information that isn't possible to parse consistently. Remove # everything after and including "Path Health" if ($command =~ m{\A storage\sconnector}xms) { - $rawtext =~ s{Path\sHealth.*}{}xms; + $rawtext =~ s{Path\sHealth.*}{}xms; } # Report if no controllers found @@ -1138,6 +1497,23 @@ return $alt; } +# Converts from Celsius to something else +sub temp_from_celsius { + my $x = shift; + my $to = shift; + + if ($to eq 'F') { + return sprintf '%.1f', ($x * 9/5 + 32); + } + elsif ($to eq 'K') { + return sprintf '%.1f', ($x + 273.15); + } + elsif ($to eq 'R') { + return sprintf '%.1f', ($x * 9/5 + 32 + 459.67); + } + return $x; +} + #--------------------------------------------------------------------- # Check functions @@ -2478,6 +2854,15 @@ $min_warn =~ s{\A \s* (-?\d+) \s* C? \s* \z}{$1}xms or $min_warn = '[N/A]'; $min_crit =~ s{\A \s* (-?\d+) \s* C? \s* \z}{$1}xms or $min_crit = '[N/A]'; + # Convert temp units + if ($opt{tempunit} ne 'C') { + $reading = temp_from_celsius($reading, $opt{tempunit}); + $max_warn = temp_from_celsius($max_warn, $opt{tempunit}); + $max_crit = temp_from_celsius($max_crit, $opt{tempunit}); + $min_warn = temp_from_celsius($min_warn, $opt{tempunit}); + $min_crit = temp_from_celsius($min_crit, $opt{tempunit}); + } + # Inactive temp probes if ($status eq 'Unknown' and $state eq 'Inactive') { my $msg = sprintf '%s in enclosure %s [%s] is %s', @@ -2485,26 +2870,26 @@ report('storage', $msg, $E_OK, $nexus); } elsif ($status ne 'Ok' and $max_crit ne '[N/A]' and $reading > $max_crit) { - my $msg = sprintf '%s in enclosure %s [%s] is critically high at %d C', - $name, $encl_id, $encl_name, $reading; + my $msg = sprintf '%s in enclosure %s [%s] is critically high at %s %s', + $name, $encl_id, $encl_name, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $nexus); } elsif ($status ne 'Ok' and $max_warn ne '[N/A]' and $reading > $max_warn) { - my $msg = sprintf '%s in enclosure %s [%s] is too high at %d C', - $name, $encl_id, $encl_name, $reading; + my $msg = sprintf '%s in enclosure %s [%s] is too high at %s %s', + $name, $encl_id, $encl_name, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $nexus); } elsif ($status ne 'Ok' and $min_crit ne '[N/A]' and $reading < $min_crit) { - my $msg = sprintf '%s in enclosure %s [%s] is critically low at %d C', - $name, $encl_id, $encl_name, $reading; + my $msg = sprintf '%s in enclosure %s [%s] is critically low at %s %s', + $name, $encl_id, $encl_name, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $nexus); } elsif ($status ne 'Ok' and $min_warn ne '[N/A]' and $reading < $min_warn) { - my $msg = sprintf '%s in enclosure %s [%s] is too low at %d C', - $name, $encl_id, $encl_name, $reading; + my $msg = sprintf '%s in enclosure %s [%s] is too low at %s %s', + $name, $encl_id, $encl_name, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $nexus); } @@ -2515,7 +2900,7 @@ if (defined $reading && $reading =~ m{\A -?\d+ \z}xms) { # take into account that with certain states the # reading doesn't exist or is not an integer - $msg .= sprintf ' at %s C', $reading; + $msg .= sprintf ' at %s %s', $reading, $opt{tempunit}; if ($min_warn eq '[N/A]' or $min_crit eq '[N/A]') { $msg .= sprintf ' (max=%s/%s)', $max_warn, $max_crit; } @@ -2534,7 +2919,7 @@ if (defined $reading && $reading ne '[N/A]') { # take into account that with certain states the # reading doesn't exist or is not an integer - $msg .= sprintf ' reads %d C', $reading; + $msg .= sprintf ' reads %s %s', $reading, $opt{tempunit}; if ($min_warn eq '[N/A]' or $min_crit eq '[N/A]') { $msg .= sprintf ' (max=%s/%s)', $max_warn, $max_crit; } @@ -2551,16 +2936,23 @@ # Collect performance data if (defined $opt{perfdata} && $reading ne '[N/A]') { - $name =~ s{\A Temperature\sProbe\s(\d+) \z}{temp_$1}gxms; - my $label = "enclosure_${encl_id}_${name}"; - my $mini = $label; - $mini =~ s{enclosure_(.+?)_temp_(.+?)}{e$1t$2}xms; + my $index = $name; + $index =~ s{\A Temperature\sProbe\s(\d+) \z}{$1}gxms; + my $legacy_name = $name; + $legacy_name =~ s{\A Temperature\sProbe\s(\d+) \z}{temp_$1}gxms; + my $legacy_label = lc "enclosure_${encl_id}_${legacy_name}"; + my $legacy_mini = $legacy_label; + $legacy_mini =~ s{enclosure_(.+?)_temp_(.+?)}{e$1t$2}xms; push @perfdata, { - label => $label, - mini => $mini, - value => $reading, - warn => $max_warn, - crit => $max_crit, + type => 'E', + id => $opt{perfdata} eq 'minimal' ? "${encl_id}_t${index}" : "${encl_id}_temp_${index}", + unit => $opt{tempunit}, + label => q{}, + legacy => $legacy_label, + mini => $legacy_mini, + value => $reading, + warn => $max_warn, + crit => $max_crit, }; } } @@ -2887,15 +3279,21 @@ # Collect performance data if (defined $opt{perfdata}) { - my $pname = lc $location; + my $pname = $location; $pname =~ s{\s}{_}gxms; $pname =~ s{proc_}{cpu#}xms; + my $legacy_pname = $pname; + $pname =~ s{_rpm\z}{}ixms; push @perfdata, { - label => "fan_${index}_${pname}", - mini => "f$index", - value => $reading, - warn => $max_warn, - crit => $max_crit, + type => 'F', + id => $index, + unit => 'rpm', + label => $pname, + legacy => lc "fan_${index}_${legacy_pname}", + mini => "f$index", + value => $reading, + warn => $max_warn, + crit => $max_crit, }; } } @@ -3137,6 +3535,15 @@ $count{temp}++; next TEMP if blacklisted('temp', $index); + # Convert temp units + if ($opt{tempunit} ne 'C') { + $reading = temp_from_celsius($reading, $opt{tempunit}); + $max_warn = temp_from_celsius($max_warn, $opt{tempunit}); + $max_crit = temp_from_celsius($max_crit, $opt{tempunit}); + $min_warn = temp_from_celsius($min_warn, $opt{tempunit}); + $min_crit = temp_from_celsius($min_crit, $opt{tempunit}); + } + if ($type eq 'Discrete') { my $msg = sprintf 'Temperature probe %d [%s] is %s', $index, $location, $discrete; @@ -3147,56 +3554,56 @@ # First check according to custom thresholds if (exists $crit_threshold{$index}{max} and $reading > $crit_threshold{$index}{max}) { # Custom critical MAX - my $msg = sprintf 'Temperature Probe %d [%s] reads %d C (custom max=%d)', - $index, $location, $reading, $crit_threshold{$index}{max}; + my $msg = sprintf 'Temperature Probe %d [%s] reads %s %s (custom max=%s)', + $index, $location, $reading, $opt{tempunit}, $crit_threshold{$index}{max}; report('chassis', $msg, $E_CRITICAL, $index); } elsif (exists $warn_threshold{$index}{max} and $reading > $warn_threshold{$index}{max}) { # Custom warning MAX - my $msg = sprintf 'Temperature Probe %d [%s] reads %d C (custom max=%d)', - $index, $location, $reading, $warn_threshold{$index}{max}; + my $msg = sprintf 'Temperature Probe %d [%s] reads %s %s (custom max=%s)', + $index, $location, $reading, $opt{tempunit}, $warn_threshold{$index}{max}; report('chassis', $msg, $E_WARNING, $index); } elsif (exists $crit_threshold{$index}{min} and $reading < $crit_threshold{$index}{min}) { # Custom critical MIN - my $msg = sprintf 'Temperature Probe %d [%s] reads %d C (custom min=%d)', - $index, $location, $reading, $crit_threshold{$index}{min}; + my $msg = sprintf 'Temperature Probe %d [%s] reads %s %s (custom min=%s)', + $index, $location, $reading, $opt{tempunit}, $crit_threshold{$index}{min}; report('chassis', $msg, $E_CRITICAL, $index); } elsif (exists $warn_threshold{$index}{min} and $reading < $warn_threshold{$index}{min}) { # Custom warning MIN - my $msg = sprintf 'Temperature Probe %d [%s] reads %d C (custom min=%d)', - $index, $location, $reading, $warn_threshold{$index}{min}; + my $msg = sprintf 'Temperature Probe %d [%s] reads %s %s (custom min=%s)', + $index, $location, $reading, $opt{tempunit}, $warn_threshold{$index}{min}; report('chassis', $msg, $E_WARNING, $index); } elsif ($status ne 'Ok' and $max_crit ne '[N/A]' and $reading > $max_crit) { - my $msg = sprintf 'Temperature Probe %d [%s] is critically high at %d C', - $index, $location, $reading; + my $msg = sprintf 'Temperature Probe %d [%s] is critically high at %s %s', + $index, $location, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $index); } elsif ($status ne 'Ok' and $max_warn ne '[N/A]' and $reading > $max_warn) { - my $msg = sprintf 'Temperature Probe %d [%s] is too high at %d C', - $index, $location, $reading; + my $msg = sprintf 'Temperature Probe %d [%s] is too high at %s %s', + $index, $location, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $index); } elsif ($status ne 'Ok' and $min_crit ne '[N/A]' and $reading < $min_crit) { - my $msg = sprintf 'Temperature Probe %d [%s] is critically low at %d C', - $index, $location, $reading; + my $msg = sprintf 'Temperature Probe %d [%s] is critically low at %s %s', + $index, $location, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $index); } elsif ($status ne 'Ok' and $min_warn ne '[N/A]' and $reading < $min_warn) { - my $msg = sprintf 'Temperature Probe %d [%s] is too low at %d C', - $index, $location, $reading; + my $msg = sprintf 'Temperature Probe %d [%s] is too low at %s %s', + $index, $location, $reading, $opt{tempunit}; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $index); } # Ok else { - my $msg = sprintf 'Temperature Probe %d [%s] reads %d C', - $index, $location, $reading; + my $msg = sprintf 'Temperature Probe %d [%s] reads %s %s', + $index, $location, $reading, $opt{tempunit}; if ($min_warn eq '[N/A]' and $min_crit eq '[N/A]') { $msg .= sprintf ' (max=%s/%s)', $max_warn, $max_crit; } @@ -3210,16 +3617,20 @@ # Collect performance data if (defined $opt{perfdata}) { - my $pname = lc $location; + my $pname = $location; $pname =~ s{\s}{_}gxms; - $pname =~ s{_temp\z}{}xms; + $pname =~ s{_temp\z}{}ixms; $pname =~ s{proc_}{cpu#}xms; push @perfdata, { - label => "temp_${index}_${pname}", - mini => "t$index", - value => $reading, - warn => $max_warn, - crit => $max_crit, + type => 'T', + id => $index, + unit => $opt{tempunit}, + label => $pname, + legacy => lc "temp_${index}_${pname}", + mini => "t$index", + value => $reading, + warn => $max_warn, + crit => $max_crit, }; } } @@ -3533,6 +3944,8 @@ my $status = undef; my $reading = undef; my $location = undef; + my $max_crit = undef; + my $max_warn = undef; my @output = (); if ($snmp) { @@ -3575,12 +3988,19 @@ ? sprintf('%.3f V', $out->{voltageProbeReading}/1000) : (get_hashval($out->{voltageProbeDiscreteReading}, \%volt_discrete_reading) || 'Unknown reading'); $location = $out->{voltageProbeLocationName} || 'Unknown location'; + $max_crit = $out->{voltageProbeUpperCriticalThreshold} || 0; + $max_warn = $out->{voltageProbeUpperNonCriticalThreshold} || 0; } else { $index = get_nonempty_string('Index', $out, 9999); $status = get_nonempty_string('Status', $out, 'Unknown'); $reading = get_nonempty_string('Reading', $out, 'Unknown reading'); $location = get_nonempty_string('Probe Name', $out, 'Unknown location'); + $max_crit = get_nonempty_string('Maximum Failure Threshold', $out, 0); + $max_warn = get_nonempty_string('Maximum Warning Threshold', $out, 0); + + $max_crit = 0 if $max_crit eq '[N/A]'; + $max_warn = 0 if $max_warn eq '[N/A]'; } $count{volt}++; @@ -3590,6 +4010,24 @@ $index, $location, $reading; my $err = $snmp ? $probestatus2nagios{$status} : $status2nagios{$status}; report('chassis', $msg, $err, $index); + + # Collect performance data + if (defined $opt{perfdata} and !$opt{legacy_perfdata}) { + $reading =~ s{\s+V\z}{}xms; # remove unit + $reading =~ s{\.000\z}{}xms; # if integer + next VOLT if $reading !~ m{\A \d+(\.\d+)? \z}xms; # discrete reading (not number) + my $label = join q{_}, $location; + $label =~ s{\s}{_}gxms; + push @perfdata, { + type => 'V', + id => $index, + unit => 'V', + label => $label, + value => $reading, + warn => 0, + crit => 0, + }; + } } return; } @@ -3819,14 +4257,18 @@ # Collect performance data if (defined $opt{perfdata}) { next AMP if $reading !~ m{\A \d+(\.\d+)? \z}xms; # discrete reading (not number) - my $label = join q{_}, 'pwr_mon', $index, lc $location; + my $label = join q{_}, $location; $label =~ s{\s}{_}gxms; push @perfdata, { - label => $label, - mini => "p${index}" . lc $unit, - value => $reading, - warn => $max_warn, - crit => $max_crit, + type => $unit, + id => $index, + unit => $unit, + label => $label, + legacy => (join q{_}, 'pwr_mon', $index, lc $label), + mini => "p${index}" . lc $unit, + value => $reading, + warn => $max_warn, + crit => $max_crit, }; } } @@ -3840,7 +4282,7 @@ # find used indexes foreach (@perfdata) { - if ($_->{label} =~ m/\A pwr_mon_(\d+)/xms) { + if ($_->{label} =~ m/\A [WA](\d+)/xms) { $used{$1} = 1; } } @@ -3848,7 +4290,7 @@ AMP2: foreach my $line (@{ run_command("$omreport $omopt_chassis pwrmonitoring -fmt ssv") }) { chop $line; - if ($line eq 'Location;Reading') { + if ($line eq 'Location;Reading' or $line eq 'Amperage') { $found = 1; next AMP2; } @@ -3856,20 +4298,25 @@ $found = 0; next AMP2; } - if ($found and $line =~ m/\A ([^;]+?) ; (\d*\.\d+) \s [AW] \z/xms) { - my $aname = lc $1; - my $aval = $2; + if ($found and $line =~ m/\A ([^;]+?) ; (\d*\.\d+) \s ([AW]) \z/xms) { + my $aname = $1; + my $aval = $2; + my $aunit = $3; $aname =~ s{\s}{_}gxms; # don't use an existing index while (exists $used{$index}) { ++$index; } push @perfdata, { - label => "pwr_mon_${index}_${aname}", - mini => "p${index}a", - value => $aval, - warn => 0, - crit => 0, + type => $aunit, + id => $index, + unit => $aunit, + label => $aname, + legacy => "pwr_mon_${index}_${aname}", + mini => "p${index}a", + value => $aval, + warn => 0, + crit => 0, }; ++$index; } @@ -4680,7 +5127,7 @@ # Prefix with service tag if specified with option '-i|--info' if ($opt{info}) { if (defined $opt{htmlinfo}) { - $msg = '[<a href="' . warranty_url($sysinfo{serial}) + $msg = '[<a target="_blank" href="' . warranty_url($sysinfo{serial}) . "\">$sysinfo{serial}</a>] " . $msg; } else { @@ -4748,7 +5195,7 @@ } elsif ($exit_code == $E_OK && !$opt{debug}) { if (defined $opt{htmlinfo}) { - printf q{OK - System: '<a href="%s">%s%s</a>', SN: '<a href="%s">%s</a>'}, + printf q{OK - System: '<a target="_blank" href="%s">%s%s</a>', SN: '<a target="_blank" href="%s">%s</a>'}, documentation_url($sysinfo{model}), $sysinfo{model}, $sysinfo{rev}, warranty_url($sysinfo{serial}), $sysinfo{serial}; } @@ -4834,7 +5281,7 @@ if ($opt{extinfo}) { print $linebreak; if (defined $opt{htmlinfo}) { - printf '------ SYSTEM: <a href="%s">%s%s</a>, SN: <a href="%s">%s</a>', + printf '------ SYSTEM: <a target="_blank" href="%s">%s%s</a>, SN: <a target="_blank" href="%s">%s</a>', documentation_url($sysinfo{model}), $sysinfo{model}, $sysinfo{rev}, warranty_url($sysinfo{serial}), $sysinfo{serial}; } @@ -4893,14 +5340,39 @@ # Sort routine for performance data sub perfsort { + my %order = ( 'T' => 0, 'W' => 1, 'A' => 2, 'V' => 3, 'F' => 4, 'E' => 5, ); + + # sort in this order: + # 1. the type according to the hash "order" above + # 2. the id (index) numerically + # 3. the id (index) alphabetically + # 4. the label + return $order{$a->{type}} cmp $order{$b->{type}} || + ($a->{id} =~ m{\A\d+\z}xms and $a->{id} <=> $b->{id}) || + ($a->{id} !~ m{\A\d+\z}xms and $a->{id} cmp $b->{id}) || + $a->{label} cmp $b->{label}; + } + + # LEGACY sort routine for performance data + sub perfsort_legacy { my %order = ( fan => 0, pwr => 1, tem => 2, enc => 3, ); - return ($order{(substr $a->{label}, 0, 3)} cmp $order{(substr $b->{label}, 0, 3)}) || - $a->{label} cmp $b->{label}; + return ($order{(substr $a->{legacy}, 0, 3)} cmp $order{(substr $b->{legacy}, 0, 3)}) || + $a->{legacy} cmp $b->{legacy}; } # Print performance data sorted - my $type = $opt{perfdata} eq 'minimal' ? 'mini' : 'label'; - print join $lb, map { "$_->{$type}=$_->{value};$_->{warn};$_->{crit}" } sort perfsort @perfdata; + if ($opt{legacy_perfdata}) { + my $type = $opt{perfdata} eq 'minimal' ? 'mini' : 'legacy'; + print join $lb, map { "$_->{$type}=$_->{value};$_->{warn};$_->{crit}" } sort perfsort_legacy @perfdata; + } + else { + if ($opt{perfdata} eq 'minimal') { + print join $lb, map { "$_->{type}$_->{id}=$_->{value}$_->{unit};$_->{warn};$_->{crit}" } sort perfsort @perfdata; + } + else { + print join $lb, map { "$_->{type}$_->{id}_$_->{label}=$_->{value}$_->{unit};$_->{warn};$_->{crit}" } sort perfsort @perfdata; + } + } } # Wrapping up and finishing | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/check_openmanage.8 ^ |
@@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "CHECK_OPENMANAGE 8" -.TH CHECK_OPENMANAGE 8 "2011-04-28" "check_openmanage 3.6.6" "Nagios plugin" +.TH CHECK_OPENMANAGE 8 "2011-06-27" "check_openmanage 3.7.0" "Nagios plugin" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -152,6 +152,10 @@ in \s-1SNMP\s0 mode. .SH "GENERAL OPTIONS" .IX Header "GENERAL OPTIONS" +.IP "\-f, \-\-config \fI\s-1FILE\s0\fR" 4 +.IX Item "-f, --config FILE" +Specify a configuration file. For reference on the config file syntax +and options, consult the \fIcheck_openmanage.conf\fR\|(5) manual page. .IP "\-t, \-\-timeout \fI\s-1SECONDS\s0\fR" 4 .IX Item "-t, --timeout SECONDS" The number of seconds after which the plugin will abort. Default @@ -171,6 +175,11 @@ .Sp If given the argument \f(CW\*(C`multiline\*(C'\fR, the plugin will output the performance data on multiple lines, for Nagios 3.x and above. +.IP "\-\-legacy\-perfdata" 4 +.IX Item "--legacy-perfdata" +With version 3.7.0, performance data output changed. The new format is +not compatible with the old format. Users who wish to postpone +switching to the new performance data \s-1API\s0 may set this option. .IP "\-w, \-\-warning \fI\s-1STRING\s0\fR or \fI\s-1FILE\s0\fR" 4 .IX Item "-w, --warning STRING or FILE" Override the machine-default temperature warning thresholds. Syntax is @@ -194,6 +203,14 @@ .IX Item "-c, --critical STRING or FILE" Override the machine-default temperature critical thresholds. Syntax and behaviour is the same as for warning thresholds described above. +.IP "\-F, \-\-fahrenheit" 4 +.IX Item "-F, --fahrenheit" +Set Fahrenheit as unit for all temperatures. This option will override +the \f(CW\*(C`\-\-tempunit\*(C'\fR option, if used simultaneously. +.IP "\-\-tempunit \fI\s-1CHAR\s0\fR" 4 +.IX Item "--tempunit CHAR" +Set temperature unit. Legal values are \f(CW\*(C`F\*(C'\fR for Fahrenheit, \f(CW\*(C`C\*(C'\fR for +Celsius, \f(CW\*(C`K\*(C'\fR for Kelvin and \f(CW\*(C`R\*(C'\fR for Rankine. .IP "\-o, \-\-ok\-info \fI\s-1NUMBER\s0\fR" 4 .IX Item "-o, --ok-info NUMBER" This option lets you define how much output you want the plugin to @@ -502,6 +519,9 @@ .IP "\fBpdisk\fR" 8 .IX Item "pdisk" Physical disk. +.IP "\fBpdisk_cert\fR" 8 +.IX Item "pdisk_cert" +Suppress warning message about non-certified physical disk. .IP "\fBvdisk\fR" 8 .IX Item "vdisk" Logical drive (virtual disk) @@ -742,4 +762,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .SH "SEE ALSO" .IX Header "SEE ALSO" +\&\fIcheck_openmanage.conf\fR\|(5) <http://folk.uio.no/trondham/software/check_openmanage.html> | ||
[+] | Added | check_openmanage-3.7.0.tar.bz2/check_openmanage.conf.5 ^ |
@@ -0,0 +1,492 @@ +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "CHECK_OPENMANAGE.CONF 5" +.TH CHECK_OPENMANAGE.CONF 5 "2011-07-04" "check_openmanage 3.7.0" "Nagios plugin" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +\&\fIcheck_openmanage.conf\fR \- Configuration file for check_openmanage +.SH "FILE FORMAT" +.IX Header "FILE FORMAT" +The file has an ini-style syntax and consists of sections and +parameters. A section begins with the name of the section in square +brackets and continues until the next section begins. An example of +section with two keywords and parameters: +.Sp +.RS 8 +\&\fI[section]\fR + \fIkey1\fR = \fIboolean\fR + \fIkey2\fR = \fIstring\fR +.RE +.PP +The data types used are string (no quotes needed) and bool (with +values of \f(CW\*(C`TRUE/FALSE\*(C'\fR). For boolean values, \f(CW1\fR, \f(CW\*(C`on\*(C'\fR and \f(CW\*(C`true\*(C'\fR +are equivalent, likewise for \f(CW0\fR, \f(CW\*(C`off\*(C'\fR and \f(CW\*(C`false\*(C'\fR. They are also +case insensitive. +.PP +The root section or global section has no section name in brackets, +example: +.PP +.Vb 2 +\& key1 = false +\& key2 = foo +\& +\& [section] +\& key1 = true +\& key2 = bar +.Ve +.PP +The values set in a bracket section will override those set in the +root section, in case of conflicts. +.PP +Lines starting with \f(CW\*(C`#\*(C'\fR or \f(CW\*(C`;\*(C'\fR are considered comments and ignored, as +are blank lines. +.PP +The configuration file must be a regular file. Owner and group does +not matter, but the Nagios user must have read access. +.SH "SECTIONS AND ORDERING" +.IX Header "SECTIONS AND ORDERING" +The section name should correspond to the hostname, i.e. the value +passed to the \f(CW\*(C`\-H\*(C'\fR or \f(CW\*(C`\-\-hostname\*(C'\fR parameter. The section name +itself can be either an exact match to the hostname, or a glob +pattern, as this example shows: +.PP +.Vb 2 +\& key1 = true +\& key2 = foo +\& +\& [192.168.1.2] +\& key1 = true +\& +\& [192.168.*] +\& key1 = false +\& key2 = bar +.Ve +.PP +The sections are read in order of significance. The root section is +read first. Then any sections with glob patterns that match the +hostname are read (alphabetically). Any section whose name is an exact +match to the hostname is read last. +.PP +For boolean values, any conflicts are resolved by letting the section +with the most significance (closest match to the hostname) override +any previous definitions. For string values, they are simply added +together. +.PP +In the example above, for the host \f(CW192.168.1.2\fR the value of \fIkey1\fR +will be \fItrue\fR and \fIkey2\fR will be \fIbar\fR. Any other host that +matches \f(CW\*(C`192.168.*\*(C'\fR will have \fIkey1 = false\fR and \fIkey2 = bar\fR. All +other hosts will have \fIkey1 = true\fR and \fIkey2 = foo\fR. +.PP +Normal shell globbing may be used for the section names. This is +limited to \f(CW\*(C`*\*(C'\fR, \f(CW\*(C`?\*(C'\fR and \f(CW\*(C`[]\*(C'\fR. Some examples: +.PP +.Vb 2 +\& [192.168.*] +\& # matches e.g. 192.168.10.20 +\& +\& [192.168.10[34].1] +\& # matches 192.168.103.1 and 192.168.104.1 +\& +\& [login?.example.com] +\& # mathces e.g. login1.example.com +.Ve +.PP +\&\s-1CAUTION\s0! Be careful not to have more than one glob pattern section +match any single host. This may lead to unpredictable results. +.SH "COMMAND LINE OPTIONS" +.IX Header "COMMAND LINE OPTIONS" +Unless otherwise noted, options given in the configuration file will +override any corresponding command line options. +.PP +In general, avoid using the same options on command line and in the +configuration file. +.SH "CONFIGURATION" +.IX Header "CONFIGURATION" +.SS "\s-1GENERAL\s0" +.IX Subsection "GENERAL" +.IP "Check control" 4 +.IX Item "Check control" +Any keyword to the \f(CW\*(C`\-\-check\*(C'\fR parameter are accepted in the +configuration file, as \f(CW\*(C`check_\f(CIKEYWORD\f(CW\*(C'\fR. These options take boolean +values (\f(CW\*(C`true\*(C'\fR or \f(CW\*(C`false\*(C'\fR). The following keywords are accepted for +check control, listed here with their default values: +.Sp +.Vb 10 +\& check_storage = true +\& check_memory = true +\& check_fans = true +\& check_power = true +\& check_temp = true +\& check_cpu = true +\& check_voltage = true +\& check_batteries = true +\& check_amperage = true +\& check_intrusion = true +\& check_sdcard = true +\& check_esmhealth = true +\& check_esmlog = false +\& check_alertlog = false +\& check_everything = false +.Ve +.Sp +If used together with the \f(CW\*(C`\-\-check\*(C'\fR command line option, the command +line option will override the configuration file, if there is a +conflict. +.Sp +The option \f(CW\*(C`check_everything\*(C'\fR is special and turns on all +checks. Setting this option to \*(L"true\*(R" will effectively negate any +other check options. This option corresponds to the \f(CW\*(C`\-a\*(C'\fR or \f(CW\*(C`\-\-all\*(C'\fR +command line option. +.Sp +For more information about check control, see +\&\*(L"\s-1CHECK\s0 \s-1CONTROL\s0\*(R" in \fIcheck_openmanage\fR\|(8). +.IP "Blacklisting" 4 +.IX Item "Blacklisting" +For blacklisting the keyword \f(CW\*(C`blacklist\*(C'\fR is used, and the value is a +string that uses the same syntax as the \f(CW\*(C`\-b\*(C'\fR or \f(CW\*(C`\-\-blacklist\*(C'\fR +parameter. Example: +.Sp +.Vb 1 +\& blacklist = ctrl_fw=all/pdisk=0:0:1 +.Ve +.Sp +If used together with the \f(CW\*(C`\-b\*(C'\fR or \f(CW\*(C`\-\-blacklist\*(C'\fR command line option, +the two blacklists from the config file and command line are merged +together. +.Sp +For more information about blacklisting, including syntax, see +\&\*(L"\s-1BLACKLISTING\s0\*(R" in \fIcheck_openmanage\fR\|(8). +.IP "Timeout" 4 +.IX Item "Timeout" +The plugin timeout can be configured with the \f(CW\*(C`timeout\*(C'\fR keyword. The +argument is number of seconds and should be a positive +integer. Example: +.Sp +.Vb 1 +\& timeout = 60 +.Ve +.Sp +The corresponding command line option is \f(CW\*(C`\-t\*(C'\fR or \f(CW\*(C`\-\-timeout\*(C'\fR. +.IP "Performance data" 4 +.IX Item "Performance data" +Performance data can be turned on in the configuration file with +\&\f(CW\*(C`performance_data\*(C'\fR. Accepted values are boolean (\s-1TRUE/FALSE\s0) or +either of the keywords \*(L"minimal\*(R" and \*(L"multiline\*(R". Example: +.Sp +.Vb 1 +\& performance_data = true +.Ve +.Sp +The corresponding command line option is \f(CW\*(C`\-p\*(C'\fR or \f(CW\*(C`\-\-perfdata\*(C'\fR. +.IP "Legacy Performance data" 4 +.IX Item "Legacy Performance data" +With version 3.7.0, performance data output changed. The new format is +not compatible with the old format. Users who wish to postpone +switching to the new performance data \s-1API\s0 may use this option. This +option takes a boolean value. Example: +.Sp +.Vb 1 +\& legacy_performance_data = true +.Ve +.Sp +The corresponding command line option is \f(CW\*(C`\-\-legacy\-perfdata\*(C'\fR. +.IP "Temperature unit" 4 +.IX Item "Temperature unit" +The temperature unit used for reporting, performance data etc. can be +set with the \f(CW\*(C`temperature_unit\*(C'\fR option. Allowed values are \f(CW\*(C`F\*(C'\fR for +Fahrenheit, \f(CW\*(C`C\*(C'\fR for Celsius, \f(CW\*(C`K\*(C'\fR for Kelvin and \f(CW\*(C`R\*(C'\fR for +Rankine. Example: +.Sp +.Vb 1 +\& temperature_unit = F +.Ve +.Sp +The corresponding command line option is \f(CW\*(C`\-\-tempunit\*(C'\fR. Note that the +command line option \f(CW\*(C`\-F\*(C'\fR or \f(CW\*(C`\-\-fahrenheit\*(C'\fR will override both the +command line option and the configuration file option. +.IP "Temperature limits" 4 +.IX Item "Temperature limits" +Custom temperature limits may be configured with the options +\&\f(CW\*(C`temp_threshold_warning\*(C'\fR and \f(CW\*(C`temp_threshold_critical\*(C'\fR. These +options corresponds to the command line options \f(CW\*(C`\-w\*(C'\fR or \f(CW\*(C`\-\-warning\*(C'\fR +and \f(CW\*(C`\-c\*(C'\fR or \f(CW\*(C`\-\-critical\*(C'\fR, respectively. They take the same arguments +as the command line options. Examples: +.Sp +.Vb 2 +\& temp_threshold_warning = 0=30/10 +\& temp_threshold_critical = 0=35/8 +.Ve +.SS "\s-1SNMP\s0 \s-1OPTIONS\s0" +.IX Subsection "SNMP OPTIONS" +Several \s-1SNMP\s0 related options may be set in the configuration file. The +configuration file may contain the following \s-1SNMP\s0 options: +.IP "\s-1SNMP\s0 community string" 4 +.IX Item "SNMP community string" +The \s-1SNMP\s0 community string can be set with \f(CW\*(C`snmp_community\*(C'\fR. Example: +.Sp +.Vb 1 +\& snmp_community = mycommunity +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-C\*(C'\fR or \f(CW\*(C`\-\-community\*(C'\fR +.IP "\s-1SNMP\s0 protocol version" 4 +.IX Item "SNMP protocol version" +The \s-1SNMP\s0 protocol version can be set with \f(CW\*(C`snmp_version\*(C'\fR. Example: +.Sp +.Vb 1 +\& snmp_version = 2 +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-P\*(C'\fR or \f(CW\*(C`\-\-protocol\*(C'\fR +.IP "\s-1SNMP\s0 port number" 4 +.IX Item "SNMP port number" +The remote port number used with \s-1SNMP\s0 can be set with +\&\f(CW\*(C`snmp_port\*(C'\fR. Example: +.Sp +.Vb 1 +\& snmp_port = 161 +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-\-port\*(C'\fR +.IP "Use IPv6 instead of IPv4" 4 +.IX Item "Use IPv6 instead of IPv4" +The option \f(CW\*(C`snmp_use_ipv6\*(C'\fR instructs the plugin to use IPv6 instead +of IPv4. This option takes a boolean value. Example: +.Sp +.Vb 1 +\& snmp_use_ipv6 = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-6\*(C'\fR or \f(CW\*(C`\-\-ipv6\*(C'\fR +.IP "Use \s-1TCP\s0 instead of \s-1UDP\s0" 4 +.IX Item "Use TCP instead of UDP" +The option \f(CW\*(C`snmp_use_ipv6\*(C'\fR instructs the plugin to use IPv6 instead +of IPv4. This option takes a boolean value. Example: +.Sp +.Vb 1 +\& snmp_use_tcp = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-\-tcp\*(C'\fR +.SS "\s-1OUTPUT\s0 \s-1CONTROL\s0" +.IX Subsection "OUTPUT CONTROL" +These options gives some control over the output given by the plugin. +.IP "Include servicetag in alerts" 4 +.IX Item "Include servicetag in alerts" +The option \f(CW\*(C`output_servicetag\*(C'\fR will make the plugin include the +servers servicetag (serial number) in every alert. This option takes a +boolean value. Example: +.Sp +.Vb 1 +\& output_servicetag = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-i\*(C'\fR or \f(CW\*(C`\-\-info\*(C'\fR +.IP "Include service state in alerts" 4 +.IX Item "Include service state in alerts" +The option \f(CW\*(C`output_servicestate\*(C'\fR will make the plugin include the +service state in any alerts. This option takes a boolean +value. Example: +.Sp +.Vb 1 +\& output_servicestate = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-s\*(C'\fR or \f(CW\*(C`\-\-state\*(C'\fR +.IP "Include abbreviated service state in alerts" 4 +.IX Item "Include abbreviated service state in alerts" +The option \f(CW\*(C`output_servicestate_abbr\*(C'\fR will make the plugin include +the abbreviated service state in any alerts. This option takes a +boolean value. Example: +.Sp +.Vb 1 +\& output_servicestate_abbr = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-S\*(C'\fR or \f(CW\*(C`\-\-short\-state\*(C'\fR +.IP "Show system info with alerts" 4 +.IX Item "Show system info with alerts" +The option \f(CW\*(C`output_sysinfo\*(C'\fR will make the plugin output some system +information with alerts. This option takes a boolean value. Example: +.Sp +.Vb 1 +\& output_sysinfo = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-e\*(C'\fR or \f(CW\*(C`\-\-extinfo\*(C'\fR +.IP "Show blacklistings in \s-1OK\s0 output" 4 +.IX Item "Show blacklistings in OK output" +The option \f(CW\*(C`output_blacklist\*(C'\fR will make the plugin show any +blacklistings in the \s-1OK\s0 output. This option takes a boolean +value. Example: +.Sp +.Vb 1 +\& output_blacklist = true +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-B\*(C'\fR or \f(CW\*(C`\-\-show\-blacklist\*(C'\fR +.IP "Verbosity of \s-1OK\s0 output" 4 +.IX Item "Verbosity of OK output" +The option \f(CW\*(C`output_ok_verbosity\*(C'\fR lets you adjust how much information +is shown in the \s-1OK\s0 output. This option takes a positive integer as +parameter. Example: +.Sp +.Vb 1 +\& output_ok_verbosity = 3 +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-o\*(C'\fR or \f(CW\*(C`\-\-ok\-info\*(C'\fR +.IP "\s-1HTML\s0 output" 4 +.IX Item "HTML output" +The output \f(CW\*(C`output_html\*(C'\fR makes the plugin produce \s-1HTML\s0 output. This +option takes either a boolean value, or a country or area +code. Example: +.Sp +.Vb 1 +\& output_html = de +.Ve +.Sp +Corresponding command line option: \f(CW\*(C`\-I\*(C'\fR or \f(CW\*(C`\-\-htmlinfo\*(C'\fR +.IP "Custom line after alerts" 4 +.IX Item "Custom line after alerts" +The option \f(CW\*(C`output_post_message\*(C'\fR lets you specify one line of +information to be shown after any alerts. This option takes a string +as parameter. Examples: +.Sp +.Vb 2 +\& output_post_message = OS: %o %r +\& output_post_message = NOTE: Handled in ticket 123456 +.Ve +.Sp +For more information about codes and formatting, see the corresponding +command line option \f(CW\*(C`\-\-postmsg\*(C'\fR in \fIcheck_openmanage\fR\|(8). +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fIcheck_openmanage\fR\|(8) +<http://folk.uio.no/trondham/software/check_openmanage.html> | ||
[+] | Added | check_openmanage-3.7.0.tar.bz2/check_openmanage.conf.pod ^ |
@@ -0,0 +1,364 @@ +# Man page created with: +# +# pod2man -s 5 -r "`./check_openmanage -V | head -n 1`" -c 'Nagios plugin' check_openmanage.conf.pod check_openmanage.conf.5 +# +# $Id: check_openmanage.pod 20039 2011-04-26 09:56:56Z trondham $ + +=head1 NAME + +F<check_openmanage.conf> - Configuration file for check_openmanage + +=head1 FILE FORMAT + +The file has an ini-style syntax and consists of sections and +parameters. A section begins with the name of the section in square +brackets and continues until the next section begins. An example of +section with two keywords and parameters: + +=over 8 + +I<[section]> + I<key1> = I<boolean> + I<key2> = I<string> + +=back + +The data types used are string (no quotes needed) and bool (with +values of C<TRUE/FALSE>). For boolean values, C<1>, C<on> and C<true> +are equivalent, likewise for C<0>, C<off> and C<false>. They are also +case insensitive. + +The root section or global section has no section name in brackets, +example: + + key1 = false + key2 = foo + + [section] + key1 = true + key2 = bar + +The values set in a bracket section will override those set in the +root section, in case of conflicts. + +Lines starting with C<#> or C<;> are considered comments and ignored, as +are blank lines. + +The configuration file must be a regular file. Owner and group does +not matter, but the Nagios user must have read access. + +=head1 SECTIONS AND ORDERING + +The section name should correspond to the hostname, i.e. the value +passed to the C<-H> or C<--hostname> parameter. The section name +itself can be either an exact match to the hostname, or a glob +pattern, as this example shows: + + key1 = true + key2 = foo + + [192.168.1.2] + key1 = true + + [192.168.*] + key1 = false + key2 = bar + +The sections are read in order of significance. The root section is +read first. Then any sections with glob patterns that match the +hostname are read (alphabetically). Any section whose name is an exact +match to the hostname is read last. + +For boolean values, any conflicts are resolved by letting the section +with the most significance (closest match to the hostname) override +any previous definitions. For string values, they are simply added +together. + +In the example above, for the host C<192.168.1.2> the value of I<key1> +will be I<true> and I<key2> will be I<bar>. Any other host that +matches C<192.168.*> will have I<key1 = false> and I<key2 = bar>. All +other hosts will have I<key1 = true> and I<key2 = foo>. + +Normal shell globbing may be used for the section names. This is +limited to C<*>, C<?> and C<[]>. Some examples: + + [192.168.*] + # matches e.g. 192.168.10.20 + + [192.168.10[34].1] + # matches 192.168.103.1 and 192.168.104.1 + + [login?.example.com] + # mathces e.g. login1.example.com + +CAUTION! Be careful not to have more than one glob pattern section +match any single host. This may lead to unpredictable results. + +=head1 COMMAND LINE OPTIONS + +Unless otherwise noted, options given in the configuration file will +override any corresponding command line options. + +In general, avoid using the same options on command line and in the +configuration file. + +=head1 CONFIGURATION + +=head2 GENERAL + +=over 4 + +=item Check control + +Any keyword to the C<--check> parameter are accepted in the +configuration file, as C<check_I<KEYWORD>>. These options take boolean +values (C<true> or C<false>). The following keywords are accepted for +check control, listed here with their default values: + + check_storage = true + check_memory = true + check_fans = true + check_power = true + check_temp = true + check_cpu = true + check_voltage = true + check_batteries = true + check_amperage = true + check_intrusion = true + check_sdcard = true + check_esmhealth = true + check_esmlog = false + check_alertlog = false + check_everything = false + +If used together with the C<--check> command line option, the command +line option will override the configuration file, if there is a +conflict. + +The option C<check_everything> is special and turns on all +checks. Setting this option to "true" will effectively negate any +other check options. This option corresponds to the C<-a> or C<--all> +command line option. + +For more information about check control, see +L<check_openmanage(8)/CHECK CONTROL>. + +=item Blacklisting + +For blacklisting the keyword C<blacklist> is used, and the value is a +string that uses the same syntax as the C<-b> or C<--blacklist> +parameter. Example: + + blacklist = ctrl_fw=all/pdisk=0:0:1 + +If used together with the C<-b> or C<--blacklist> command line option, +the two blacklists from the config file and command line are merged +together. + +For more information about blacklisting, including syntax, see +L<check_openmanage(8)/BLACKLISTING>. + +=item Timeout + +The plugin timeout can be configured with the C<timeout> keyword. The +argument is number of seconds and should be a positive +integer. Example: + + timeout = 60 + +The corresponding command line option is C<-t> or C<--timeout>. + +=item Performance data + +Performance data can be turned on in the configuration file with +C<performance_data>. Accepted values are boolean (TRUE/FALSE) or +either of the keywords "minimal" and "multiline". Example: + + performance_data = true + +The corresponding command line option is C<-p> or C<--perfdata>. + +=item Legacy Performance data + +With version 3.7.0, performance data output changed. The new format is +not compatible with the old format. Users who wish to postpone +switching to the new performance data API may use this option. This +option takes a boolean value. Example: + + legacy_performance_data = true + +The corresponding command line option is C<--legacy-perfdata>. + +=item Temperature unit + +The temperature unit used for reporting, performance data etc. can be +set with the C<temperature_unit> option. Allowed values are C<F> for +Fahrenheit, C<C> for Celsius, C<K> for Kelvin and C<R> for +Rankine. Example: + + temperature_unit = F + +The corresponding command line option is C<--tempunit>. Note that the +command line option C<-F> or C<--fahrenheit> will override both the +command line option and the configuration file option. + +=item Temperature limits + +Custom temperature limits may be configured with the options +C<temp_threshold_warning> and C<temp_threshold_critical>. These +options corresponds to the command line options C<-w> or C<--warning> +and C<-c> or C<--critical>, respectively. They take the same arguments +as the command line options. Examples: + + temp_threshold_warning = 0=30/10 + temp_threshold_critical = 0=35/8 + +=back + +=head2 SNMP OPTIONS + +Several SNMP related options may be set in the configuration file. The +configuration file may contain the following SNMP options: + +=over 4 + +=item SNMP community string + +The SNMP community string can be set with C<snmp_community>. Example: + + snmp_community = mycommunity + +Corresponding command line option: C<-C> or C<--community> + +=item SNMP protocol version + +The SNMP protocol version can be set with C<snmp_version>. Example: + + snmp_version = 2 + +Corresponding command line option: C<-P> or C<--protocol> + +=item SNMP port number + +The remote port number used with SNMP can be set with +C<snmp_port>. Example: + + snmp_port = 161 + +Corresponding command line option: C<--port> + +=item Use IPv6 instead of IPv4 + +The option C<snmp_use_ipv6> instructs the plugin to use IPv6 instead +of IPv4. This option takes a boolean value. Example: + + snmp_use_ipv6 = true + +Corresponding command line option: C<-6> or C<--ipv6> + +=item Use TCP instead of UDP + +The option C<snmp_use_ipv6> instructs the plugin to use IPv6 instead +of IPv4. This option takes a boolean value. Example: + + snmp_use_tcp = true + +Corresponding command line option: C<--tcp> + +=back + +=head2 OUTPUT CONTROL + +These options gives some control over the output given by the plugin. + +=over 4 + +=item Include servicetag in alerts + +The option C<output_servicetag> will make the plugin include the +servers servicetag (serial number) in every alert. This option takes a +boolean value. Example: + + output_servicetag = true + +Corresponding command line option: C<-i> or C<--info> + +=item Include service state in alerts + +The option C<output_servicestate> will make the plugin include the +service state in any alerts. This option takes a boolean +value. Example: + + output_servicestate = true + +Corresponding command line option: C<-s> or C<--state> + +=item Include abbreviated service state in alerts + +The option C<output_servicestate_abbr> will make the plugin include +the abbreviated service state in any alerts. This option takes a +boolean value. Example: + + output_servicestate_abbr = true + +Corresponding command line option: C<-S> or C<--short-state> + +=item Show system info with alerts + +The option C<output_sysinfo> will make the plugin output some system +information with alerts. This option takes a boolean value. Example: + + output_sysinfo = true + +Corresponding command line option: C<-e> or C<--extinfo> + +=item Show blacklistings in OK output + +The option C<output_blacklist> will make the plugin show any +blacklistings in the OK output. This option takes a boolean +value. Example: + + output_blacklist = true + +Corresponding command line option: C<-B> or C<--show-blacklist> + +=item Verbosity of OK output + +The option C<output_ok_verbosity> lets you adjust how much information +is shown in the OK output. This option takes a positive integer as +parameter. Example: + + output_ok_verbosity = 3 + +Corresponding command line option: C<-o> or C<--ok-info> + +=item HTML output + +The output C<output_html> makes the plugin produce HTML output. This +option takes either a boolean value, or a country or area +code. Example: + + output_html = de + +Corresponding command line option: C<-I> or C<--htmlinfo> + +=item Custom line after alerts + +The option C<output_post_message> lets you specify one line of +information to be shown after any alerts. This option takes a string +as parameter. Examples: + + output_post_message = OS: %o %r + output_post_message = NOTE: Handled in ticket 123456 + +For more information about codes and formatting, see the corresponding +command line option C<--postmsg> in L<check_openmanage(8)>. + +=back + +=head1 SEE ALSO + +L<check_openmanage(8)> +L<http://folk.uio.no/trondham/software/check_openmanage.html> + +=cut | ||
Changed | check_openmanage-3.7.0.tar.bz2/check_openmanage.exe ^ | |
[+] | Changed | check_openmanage-3.7.0.tar.bz2/check_openmanage.php ^ |
@@ -4,7 +4,24 @@ # Author: Trond Hasle Amundsen # Contact: t.h.amundsen@usit.uio.no # Website: http://folk.uio.no/trondham/software/check_openmanage.html -# Date: 2010-03-16 +# Date: 2011-08-15 +# +# $Id: check_openmanage.php 20655 2011-08-15 13:16:38Z trondham $ +# +# Copyright (C) 2008-2011 Trond H. Amundsen +# +# 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 3 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, see <http://www.gnu.org/licenses/>. # Array with different colors $colors = array("0022ff", "22ff22", "ff0000", "00aaaa", "ff00ff", @@ -13,20 +30,24 @@ "000000", "00FF00", "0080FF", "FF8000", "800000", "FB31FB"); -# Color for power usage in watts -$PWRcolor = "66FF00"; - # Counters -$count = 0; # general counter $f = 0; # fan probe counter $t = 0; # temp probe counter $a = 0; # amp probe counter +$v = 0; # volt probe counter $e = 0; # enclosure counter # Flags -$visited_fan = 0; -$visited_temp = 0; -$visited_pwr = 0; +$visited_amp = 0; + +# IDs +$id_temp1 = 1; +$id_temp2 = 2; +$id_watt = 3; +$id_amp = 4; +$id_volt = 5; +$id_fan = 6; +$id_enc = 7; # Enclosure id $enclosure_id = ''; @@ -34,188 +55,491 @@ # Default title $def_title = 'Dell OpenManage'; -# Loop through the performance data -foreach ($DS as $i) { - - # AMPERAGE PROBE - if(preg_match('/^pwr_mon_/', $NAME[$i]) || preg_match('/^p\d+[aw]$/', $NAME[$i])) { +# Temperature unit +if (!defined('tempunit_defined')) { + define('tempunit_defined', 1); + + function tempunit($arg) + { + $unit = 'unknown'; + $vlabel = 'unknown'; + + switch ($arg) { + default: + $vlabel = "Celsius"; + $unit = "°C"; + break; + case "F": + $vlabel = "Fahrenheit"; + $unit = "°F"; + break; + case "K": + $vlabel = "Kelvin"; + $unit = "K"; + break; + case "R": + $vlabel = "Rankine"; + $unit = "°R"; + break; + } + return array($unit, $vlabel); + } +} + + +# Determine if we're running in legacy mode +$legacy = "no"; +foreach ($this->DS as $KEY=>$VAL) { + if (preg_match('/^(pwr_mon_|fan_|temp_|enclosure_|p\d+|f\d+|t\d+|e.+?t\d+)/', $VAL['LABEL'])) { + $legacy = "yes"; + break; + } +} + +#------------------------------------------------------ +# MAIN LOOP +#------------------------------------------------------ +if ($legacy == "yes") { # --legacy-- + + $count = 0; # general counter + $PWRcolor = "66FF00"; + + # Flags + $visited_fan = 0; + $visited_temp = 0; + $visited_pwr = 0; + + # Loop through the performance data + foreach ($this->DS as $KEY=>$VAL) { + + # AMPERAGE PROBE + if(preg_match('/^pwr_mon_/', $VAL['NAME']) || preg_match('/^p\d+[aw]$/', $VAL['NAME'])) { + + # Watt + if (preg_match('/system/', $VAL['NAME']) || preg_match('/^p\d+w$/', $VAL['NAME'])) { + + # Long label + $VAL['NAME'] = preg_replace('/^pwr_mon_\d+_/', '', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/_/', ' ', $VAL['NAME']); + + # Short label + $VAL['NAME'] = preg_replace('/^p(\d+)w$/', 'Power Probe $1', $VAL['NAME']); + + ++$count; + $ds_name[$count] = "Power Consumption"; + $vlabel = "Watt"; + + $title = $ds_name[$count]; + + $opt[$count] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; + + if(isset($def[$count])){ + $def[$count] .= rrd::def("var".$KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); + } + else { + $def[$count] = rrd::def("var".$KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); + } + $def[$count] .= rrd::area("var$KEY", "#".$PWRcolor, $VAL['NAME']); + $def[$count] .= rrd::line1("var$KEY","#000000"); + $def[$count] .= rrd::gprint("var$KEY",array("LAST", "MAX", "AVERAGE"), "%6.0lf W"); + } + # Ampere + elseif (preg_match('/current/', $VAL['NAME']) || preg_match('/^p\d+a$/', $VAL['NAME'])) { + + # Long label + $VAL['NAME'] = preg_replace('/^pwr_mon_\d+_/', '', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/_/', ' ', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/ current \d+$/', '', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/ps/', 'PowerSupply', $VAL['NAME']); + + # Short label + $VAL['NAME'] = preg_replace('/^p(\d+)a$/', 'Amperage Probe $1', $VAL['NAME']); + + if ($visited_pwr == 0) { + ++$count; + $visited_pwr = 1; + } + $ds_name[$count] = "Amperage Probes"; + $vlabel = "Ampere"; + + $title = $ds_name[$count]; + + $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; + if(isset($def[$count])){ + $def[$count] .= rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + else { + $def[$count] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + $def[$count] .= rrd::line1("var$KEY", "#".$colors[$a], $VAL['NAME']) ; + $def[$count] .= rrd::area("var$KEY","#".$colors[$a++]."20") ; + $def[$count] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%4.2lf A") ; + } + } + + # FANS (RPMs) + if(preg_match('/^fan_/', $VAL['NAME']) || preg_match('/^f\d+$/', $VAL['NAME'])){ + if ($visited_fan == 0) { + ++$count; + $visited_fan = 1; + } - # Watt - if (preg_match('/system/', $NAME[$i]) || preg_match('/^p\d+w$/', $NAME[$i])) { - # Long label - $NAME[$i] = preg_replace('/^pwr_mon_\d+_/', '', $NAME[$i]); - $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]); + $VAL['NAME'] = preg_replace('/^fan_\d+_/', '', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/_rpm$/', '', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/_/', ' ', $VAL['NAME']); # Short label - $NAME[$i] = preg_replace('/^p(\d+)w$/', 'Power Probe $1', $NAME[$i]); + $VAL['NAME'] = preg_replace('/^f(\d+)$/', 'Fan Probe $1', $VAL['NAME']); - ++$count; - $ds_name[$count] = "Power Consumption"; - $vlabel = "Watt"; + $ds_name[$count] = "Fan Speed"; + + $opt[$count] = "-X0 --slope-mode --vertical-label \"RPMs\" --title \"$def_title: Fan Speeds\" "; + if(isset($def[$count])){ + $def[$count] .= rrd::def("var$KEY", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE") ; + } + else { + $def[$count] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE"); + } + $def[$count] .= rrd::line1("var$KEY", "#".$colors[$f++],$VAL['NAME']); + $def[$count] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%6.0lf RPM"); + } + + # TEMPERATURES (Celsius) + if(preg_match('/^temp_/', $VAL['NAME']) || preg_match('/^t\d+$/', $VAL['NAME'])){ + if ($visited_temp == 0) { + ++$count; + $visited_temp = 1; + } + + # Long label + $VAL['NAME'] = preg_replace('/^temp_\d+_/', '', $VAL['NAME']); + $VAL['NAME'] = preg_replace('/_/', ' ', $VAL['NAME']); + + # Short label + $VAL['NAME'] = preg_replace('/^t(\d+)$/', 'Temperature Probe $1', $VAL['NAME']); - $title = $ds_name[$count]; + $ds_name[$count] = "Chassis Temperatures"; - $opt[$count] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; + $warnThresh = "INF"; + $critThresh = "INF"; + if ($VAL['WARN'] != "") { + $warnThresh = $VAL['WARN']; + } + if ($VAL['CRIT'] != "") { + $critThresh = $VAL['CRIT']; + } + + $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Chassis Temperatures\" "; if(isset($def[$count])){ - $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; + $def[$count] .= rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; } else { - $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; + $def[$count] = rrd::def("var$KEY", $VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; } - $def[$count] .= "AREA:var$i#$PWRcolor:\"$NAME[$i]\" " ; - $def[$count] .= "LINE:var$i#000000: " ; - $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf W last \" "; - $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf W max \" "; - $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf W avg \\n\" "; + $def[$count] .= rrd::line1("var$KEY", "#".$colors[$t++], $VAL['NAME']); + $def[$count] .= rrd::gprint("var$KEY",array("LAST", "MAX", "AVERAGE"),"%6.0lf C"); } - # Ampere - elseif (preg_match('/current/', $NAME[$i]) || preg_match('/^p\d+a$/', $NAME[$i])) { + + # ENCLOSURE TEMPERATURES (Celsius) + if(preg_match('/^enclosure_(?P<id>.+?)_temp_\d+$/', $VAL['NAME'], $matches) + || preg_match('/^e(?P<id>.+?)t\d+$/', $VAL['NAME'], $matches)) { + $this_id = $matches['id']; + + if ($enclosure_id != $this_id) { + $e = 0; + ++$count; + $enclosure_id = $this_id; + } # Long label - $NAME[$i] = preg_replace('/^pwr_mon_\d+_/', '', $NAME[$i]); - $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]); - $NAME[$i] = preg_replace('/ current \d+$/', '', $NAME[$i]); - $NAME[$i] = preg_replace('/ps/', 'PowerSupply', $NAME[$i]); + $VAL['NAME'] = preg_replace('/^enclosure_.+?_temp_(\d+)$/', 'Probe $1', $VAL['NAME']); # Short label - $NAME[$i] = preg_replace('/^p(\d+)a$/', 'Amperage Probe $1', $NAME[$i]); - - if ($visited_pwr == 0) { - ++$count; - $visited_pwr = 1; + $VAL['NAME'] = preg_replace('/^e.+?t(\d+)$/', 'Probe $1', $VAL['NAME']); + + $ds_name[$count] = "Enclosure $enclosure_id Temperatures"; + + $warnThresh = "INF"; + $critThresh = "INF"; + + if ($VAL['WARN'] != "") { + $warnThresh = $VAL['WARN']; + } + if ($VAL['CRIT'] != "") { + $critThresh = $VAL['CRIT']; } - $ds_name[$count] = "Amperage Probes"; - $vlabel = "Ampere"; - $title = $ds_name[$count]; + $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Enclosure $enclosure_id Temperatures\" "; - $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; if(isset($def[$count])){ - $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; + $def[$count] .= rrd::def("var$KEY", $VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; } else { - $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; + $def[$count] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; } - $def[$count] .= "LINE:var$i#".$colors[$a].":\"$NAME[$i]\" " ; - $def[$count] .= "AREA:var$i#".$colors[$a++]."20: " ; - $def[$count] .= "GPRINT:var$i:LAST:\"%4.2lf A last \" "; - $def[$count] .= "GPRINT:var$i:MAX:\"%4.2lf A max \" "; - $def[$count] .= "GPRINT:var$i:AVERAGE:\"%4.4lf A avg \\n\" "; + $def[$count] .= rrd::line1("var$KEY","#".$colors[$e++],$VAL['NAME']) ; + $def[$count] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%6.0lf C"); } } - - # FANS (RPMs) - if(preg_match('/^fan_/', $NAME[$i]) || preg_match('/^f\d+$/', $NAME[$i])){ - if ($visited_fan == 0) { - ++$count; - $visited_fan = 1; - } - - # Long label - $NAME[$i] = preg_replace('/^fan_\d+_/', '', $NAME[$i]); - $NAME[$i] = preg_replace('/_rpm$/', '', $NAME[$i]); - $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]); - - # Short label - $NAME[$i] = preg_replace('/^f(\d+)$/', 'Fan Probe $1', $NAME[$i]); - - $ds_name[$count] = "Fan Speed"; - - $opt[$count] = "-X0 --slope-mode --vertical-label \"RPMs\" --title \"$def_title: Fan Speeds\" "; - if(isset($def[$count])){ - $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; - } - else { - $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; - } - $def[$count] .= "LINE:var$i#".$colors[$f++].":\"$NAME[$i]\" " ; - $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf RPM last \" "; - $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf RPM max \" "; - $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf RPM avg \\n\" "; - } +} +else { # --new-- - # TEMPERATURES (Celsius) - if(preg_match('/^temp_/', $NAME[$i]) || preg_match('/^t\d+$/', $NAME[$i])){ - if ($visited_temp == 0) { - ++$count; - $visited_temp = 1; - } + # Loop through the performance data + foreach ($this->DS as $KEY=>$VAL) { + + $label = $VAL['LABEL']; - # Long label - $NAME[$i] = preg_replace('/^temp_\d+_/', '', $NAME[$i]); - $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]); + # TEMPERATURES (AMBIENT) + if (preg_match('/^T/', $label) && preg_match('/Ambient/', $label)) { - # Short label - $NAME[$i] = preg_replace('/^t(\d+)$/', 'Temperature Probe $1', $NAME[$i]); + # Temperature unit and vertical label + list ($unit, $vlabel) = tempunit($VAL['UNIT']); - $ds_name[$count] = "Chassis Temperatures"; + # Long label + $label = preg_replace('/^T(\d+)_(.+)/', '$2', $label); + $label = preg_replace('/_/', ' ', $label); - $warnThresh = "INF"; - $critThresh = "INF"; + # Short label + $label = preg_replace('/^T(\d+)$/', 'Probe $1', $label); - if ($WARN[$i] != "") { - $warnThresh = $WARN[$i]; - } - if ($CRIT[$i] != "") { - $critThresh = $CRIT[$i]; - } + $ds_name[$id_temp1] = "Temperatures"; - $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Chassis Temperatures\" "; - if(isset($def[$count])){ - $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; - } - else { - $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; - } - $def[$count] .= "LINE:var$i#".$colors[$t++].":\"$NAME[$i]\" " ; - $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" "; - $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" "; - $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" "; - } + $opt[$id_temp1] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: Ambient Temperature\" "; + if(isset($def[$id_temp1])){ + $def[$id_temp1] .= rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + else { + $def[$id_temp1] = rrd::def("var$KEY", $VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + + # fancy graphing + $def[$id_temp1] .= rrd::gradient("var$KEY","#114480", "#1144dc", $label, 10, "50%"); + $def[$id_temp1] .= rrd::gprint("var$KEY",array("LAST", "MAX", "AVERAGE"),"%5.1lf $unit"); + + # insert extra vertical space if we have thresholds + if ($VAL['WARN'] != "" || $VAL['CRIT'] != "") { + $def[$id_temp1] .= "COMMENT:\\s "; + } + + # warning threshold + if ($VAL['WARN'] != "") { + $warnThresh = $VAL['WARN']; + $def[$id_temp1] .= rrd::cdef("warn$KEY", "var$KEY,$warnThresh,GT,var$KEY,UNKN,IF"); + $def[$id_temp1] .= rrd::gradient("warn$KEY","#c4c400", "#ffff00","Above Upper Warning Threshold\: $warnThresh $unit\\l", 10, "50%"); + } - # ENCLOSURE TEMPERATURES (Celsius) - if(preg_match('/^enclosure_(?<id>.+?)_temp_\d+$/', $NAME[$i], $matches) - || preg_match('/^e(?<id>.+?)t\d+$/', $NAME[$i], $matches)){ - $this_id = $matches['id']; + # critical threshold + if ($VAL['CRIT'] != "") { + $critThresh = $VAL['CRIT']; + $def[$id_temp1] .= rrd::cdef("crit$KEY", "var$KEY,$critThresh,GT,var$KEY,UNKN,IF"); + $def[$id_temp1] .= rrd::gradient("crit$KEY","#800000", "#dc0000","Above Upper Critical Threshold\: $critThresh $unit\\l", 10, "50%"); + } + } + + # TEMPERATURES + if (preg_match('/^T/', $label) && !preg_match('/Ambient/', $label)) { + + # Temperature unit and vertical label + list ($unit, $vlabel) = tempunit($VAL['UNIT']); + + # Long label + $label = preg_replace('/^T(\d+)_(.+)/', '$2', $label); + $label = preg_replace('/_/', ' ', $label); - if ($enclosure_id != $this_id) { - $e = 0; - ++$count; - $enclosure_id = $this_id; + # Short label + $label = preg_replace('/^T(\d+)$/', 'Probe $1', $label); + + $ds_name[$id_temp2] = "Temperatures"; + + $opt[$id_temp2] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: Chassis Temperatures\" "; + if (isset($def[$id_temp2])) { + $def[$id_temp2] .= rrd::def("var$KEY", $VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + else { + $def[$id_temp2] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + $def[$id_temp2] .= rrd::line1("var$KEY", "#".$colors[$t++], rrd::cut($label,20) ); + $def[$id_temp2] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"), "%4.1lf $unit"); } - # Long label - $NAME[$i] = preg_replace('/^enclosure_.+?_temp_(\d+)$/', 'Probe $1', $NAME[$i]); + # WATTAGE PROBE + if (preg_match('/^W/', $label)) { + + # Long label + $label = preg_replace('/^W(\d+)_(.+)/', '$2', $label); + $label = preg_replace('/_/', ' ', $label); + + # Short label + $label = preg_replace('/^W(\d+)$/', 'Probe $1', $label); + + $ds_name[$id_watt] = "Power Consumption"; + $vlabel = "Watt"; + + $title = $ds_name[$id_watt]; - # Short label - $NAME[$i] = preg_replace('/^e.+?t(\d+)$/', 'Probe $1', $NAME[$i]); + $opt[$id_watt] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; + + if(isset($def[$id_watt])){ + $def[$id_watt] .= rrd::def("var$KEY",$VAL['RRDFILE'], $VAL['DS'], "AVERAGE") ; + } + else { + $def[$id_watt] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE") ; + } + + # calculate kWh and BTU + $def[$id_watt] .= "VDEF:tot$KEY=var$KEY,TOTAL "; + # rrd:vdef is broken in pnp4nagios 0.6.13 # $def[$id_watt] .= rrd::vdef("tot$KEY","var$KEY,TOTAL"); + $def[$id_watt] .= rrd::cdef("kwh$KEY","var$KEY,POP,tot$KEY,1000,/,60,/,60,/"); + $def[$id_watt] .= rrd::cdef("btu$KEY","kwh$KEY,3412.3,*"); + + # fancy graphing + $def[$id_watt] .= rrd::gradient("var$KEY","#800000","#dc0000","$label", 10, "50%"); + + # print avg, max and min + $def[$id_watt] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%6.0lf W"); + + # print kWh and BTU for time period + $def[$id_watt] .= rrd::comment("\\s"); + $def[$id_watt] .= rrd::comment(" Total power used in time period\:"); + $def[$id_watt] .= rrd::gprint("kwh$KEY","AVERAGE","%10.2lf kWh\l"); + $def[$id_watt] .= rrd::comment(" "); + $def[$id_watt] .= rrd::gprint("btu$KEY","AVERAGE","%10.2lf BTU\l"); + } + + # AMPERAGE PROBE + if (preg_match('/^A/', $label)) { + + $first = 0; + if ($visited_amp == 0) { + $first = 1; + $visited_amp = 1; + } + + # Long label + $label = preg_replace('/^A(\d+)_(.+)/', '$2', $label); + $label = preg_replace('/_/', ' ', $label); + + # Short label + $label = preg_replace('/^A(\d+)$/', 'Probe $1', $label); + + $ds_name[$id_amp] = "Amperage Probes"; + $vlabel = "Ampere"; + + $title = $ds_name[$id_amp]; + + $opt[$id_amp] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; + if(isset($def[$id_amp])){ + $def[$id_amp] .= rrd::def("var$KEY",$VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); + } + else { + $def[$id_amp] = rrd::def("var$KEY",$VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); + } - $ds_name[$count] = "Enclosure $enclosure_id Temperatures"; + $space = strlen($label) < 16 ? str_repeat(' ', 16 - strlen($label)) : ' '; - $warnThresh = "INF"; - $critThresh = "INF"; + $def[$id_amp] .= rrd::cdef("tier$KEY", "var$KEY,10,/"); + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."b7::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."bf::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."c7::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."cf::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."d7::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."df::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."e7::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."ef::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."f7::STACK "; + $def[$id_amp] .= "AREA:tier$KEY#".$colors[$a]."ff:\"$label$space\":STACK "; + $a++; - if ($WARN[$i] != "") { - $warnThresh = $WARN[$i]; + if ($first) { + $def[$id_amp] .= rrd::cdef("sum$KEY", "var$KEY,0,+"); + } + else { + $def[$id_amp] .= rrd::cdef("sum$KEY", "sum".($KEY-1).",var$KEY,+"); + } + $def[$id_amp] .= rrd::line1("sum$KEY", "#555555"); + $def[$id_amp] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%6.1lf A last") ; } - if ($CRIT[$i] != "") { - $critThresh = $CRIT[$i]; + + # VOLTAGE PROBE + if (preg_match('/^V/', $label)) { + + # Long label + $label = preg_replace('/^V(\d+)_(.+)/', '$2', $label); + $label = preg_replace('/_/', ' ', $label); + + # Short label + $label = preg_replace('/^V(\d+)$/', 'Probe $1', $label); + + $ds_name[$id_volt] = "Voltage Probes"; + $vlabel = "Volts"; + + $title = $ds_name[$id_volt]; + + $opt[$id_volt] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" "; + if(isset($def[$id_volt])){ + $def[$id_volt] .= rrd::def("var$KEY", $VAL['RRDFILE'], $VAL['DS'],"AVERAGE"); + } + else { + $def[$id_volt] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'],"AVERAGE"); + } + $def[$id_volt] .= rrd::line1("var$KEY", "#".$colors[$v++], rrd::cut($label,18) ) ; + $def[$id_volt] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%8.2lf V"); } - $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Enclosure $enclosure_id Temperatures\" "; + # FANS (RPMs) + if (preg_match('/^F/', $label)) { + + # Long label + $label = preg_replace('/^F(\d+)_(.+)/', '$2', $label); + $label = preg_replace('/_/', ' ', $label); + + # Short label + $label = preg_replace('/^F(\d+)$/', 'Probe $1', $label); + + $ds_name[$id_fan] = "Fan Probes"; - if(isset($def[$count])){ - $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; + $opt[$id_fan] = "-X0 --slope-mode --vertical-label \"RPMs\" --title \"$def_title: Fan Speeds\" "; + if(isset($def[$id_fan])){ + $def[$id_fan] .= rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'], "AVERAGE") ; + } + else { + $def[$id_fan] = rrd::def("var$KEY",$VAL['RRDFILE'],$VAL['DS'], "AVERAGE") ; + } + $def[$id_fan] .= rrd::line1("var$KEY", "#".$colors[$f++], rrd::cut($label,18) ) ; + $def[$id_fan] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"), "%6.0lf RPM"); } - else { - $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ; + + # ENCLOSURE TEMPERATURES (Celsius) + if (preg_match('/^E(?P<encl>.+?)_t(emp_)?(?P<probe>\d+)/', $label, $matches)) { + + $this_id = $matches['encl']; + $probe_index = $matches['probe']; + + if ($enclosure_id != $this_id) { + $e = 0; + $id_enc++; + $enclosure_id = $this_id; + } + + # Label + $label = "Probe $probe_index"; + + $ds_name[$id_enc] = "Enclosure $enclosure_id Temperatures"; + + $opt[$id_enc] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Enclosure $enclosure_id Temperatures\" "; + + if(isset($def[$id_enc])){ + $def[$id_enc] .= rrd::def("var$KEY", $VAL['RRDFILE'],$VAL['DS'], "AVERAGE") ; + } + else { + $def[$id_enc] = rrd::def("var$KEY", $VAL['RRDFILE'],$VAL['DS'], "AVERAGE") ; + } + $def[$id_enc] .= rrd::line1("var$KEY", "#".$colors[$e++], rrd::cut($label, 14) ); + $def[$id_enc] .= rrd::gprint("var$KEY", array("LAST", "MAX", "AVERAGE"),"%6.1lf C"); } - $def[$count] .= "LINE:var$i#".$colors[$e++].":\"$NAME[$i]\" " ; - $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" "; - $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" "; - $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" "; } } + ?> | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/check_openmanage.pod ^ |
@@ -2,7 +2,7 @@ # # pod2man -s 8 -r "`./check_openmanage -V | head -n 1`" -c 'Nagios plugin' check_openmanage.pod check_openmanage.8 # -# $Id: check_openmanage.pod 19334 2011-02-08 16:41:21Z trondham $ +# $Id: check_openmanage.pod 20420 2011-06-27 08:02:05Z trondham $ =head1 NAME @@ -33,6 +33,11 @@ =over 4 +=item -f, --config I<FILE> + +Specify a configuration file. For reference on the config file syntax +and options, consult the L<check_openmanage.conf(5)> manual page. + =item -t, --timeout I<SECONDS> The number of seconds after which the plugin will abort. Default @@ -54,6 +59,12 @@ If given the argument C<multiline>, the plugin will output the performance data on multiple lines, for Nagios 3.x and above. +=item --legacy-perfdata + +With version 3.7.0, performance data output changed. The new format is +not compatible with the old format. Users who wish to postpone +switching to the new performance data API may set this option. + =item -w, --warning I<STRING> or I<FILE> Override the machine-default temperature warning thresholds. Syntax is @@ -79,6 +90,16 @@ Override the machine-default temperature critical thresholds. Syntax and behaviour is the same as for warning thresholds described above. +=item -F, --fahrenheit + +Set Fahrenheit as unit for all temperatures. This option will override +the C<--tempunit> option, if used simultaneously. + +=item --tempunit I<CHAR> + +Set temperature unit. Legal values are C<F> for Fahrenheit, C<C> for +Celsius, C<K> for Kelvin and C<R> for Rankine. + =item -o, --ok-info I<NUMBER> This option lets you define how much output you want the plugin to @@ -437,6 +458,10 @@ Physical disk. +=item B<pdisk_cert> + +Suppress warning message about non-certified physical disk. + =item B<vdisk> Logical drive (virtual disk) @@ -746,6 +771,7 @@ =head1 SEE ALSO +L<check_openmanage.conf(5)> L<http://folk.uio.no/trondham/software/check_openmanage.html> =cut | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/debian/changelog ^ |
@@ -1,3 +1,9 @@ +check-openmanage (3.7.0-1) unstable; urgency=low + + * New upstream release. + + -- Trond Hasle Amundsen <t.h.amundsen@usit.uio.no> Mon, 15 Aug 2011 14:00:00 +0200 + check-openmanage (3.6.8-1) unstable; urgency=low * New upstream release. | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/debian/rules ^ |
@@ -45,6 +45,7 @@ dh_installdocs dh_installexamples check_openmanage.php dh_installman check_openmanage.8 + dh_installman check_openmanage.conf.5 dh_link dh_strip dh_compress | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/install.sh ^ |
@@ -9,7 +9,7 @@ # Default install locations def_plugindir=${libdir}/nagios/plugins -def_mandir=/usr/share/man/man8 +def_mandir=/usr/share/man # Find install locations if [ "$1" = "-q" ]; then @@ -28,6 +28,9 @@ fi fi +man5dir=$mandir/man5 +man8dir=$mandir/man8 + # Error if plugin dir doesn't exist if [ -d $plugindir ]; then : @@ -48,7 +51,8 @@ # Install install -p -m 0755 check_openmanage $plugindir -install -m 0644 check_openmanage.8 $mandir +install -m 0644 check_openmanage.8 $man8dir +install -m 0644 check_openmanage.conf.5 $man5dir # Done echo "done." | ||
[+] | Changed | check_openmanage-3.7.0.tar.bz2/nagios-plugins-check-openmanage.spec ^ |
@@ -6,7 +6,7 @@ %global debug_package %{nil} Name: nagios-plugins-check-openmanage -Version: 3.6.8 +Version: 3.7.0 Release: 1%{?dist} Summary: Nagios plugin to monitor hardware health on Dell servers @@ -36,13 +36,16 @@ %build pod2man -s 8 -r "%{plugin} %{version}" -c "Nagios plugin" %{plugin}.pod %{plugin}.8 +pod2man -s 5 -r "%{plugin} %{version}" -c "Nagios plugin" %{plugin}.conf.pod %{plugin}.5 %install %{__rm} -rf %{buildroot} -%{__install} -d %{buildroot}%{nagiospluginsdir} -%{__install} -d %{buildroot}%{_mandir}/man8 +%{__install} -d -m 0755 %{buildroot}%{nagiospluginsdir} +%{__install} -d -m 0755 %{buildroot}%{_mandir}/man8 +%{__install} -d -m 0755 %{buildroot}%{_mandir}/man5 %{__install} -pD -m 0755 %{plugin} %{buildroot}%{nagiospluginsdir} %{__install} -pD -m 0644 %{plugin}.8 %{buildroot}%{_mandir}/man8 +%{__install} -pD -m 0644 %{plugin}.conf.5 %{buildroot}%{_mandir}/man5 %clean %{__rm} -rf %{buildroot} @@ -52,9 +55,13 @@ %doc README COPYING CHANGES %{nagiospluginsdir}/* %{_mandir}/man8/*.8* +%{_mandir}/man5/*.5* %changelog +* Mon Aug 15 2011 Trond H. Amundsen <t.h.amundsen@usit.uio.no> - 3.7.0-1 +- Version 3.7.0 + * Tue Jun 06 2011 Trond H. Amundsen <t.h.amundsen@usit.uio.no> - 3.6.8-1 - Version 3.6.8 |