# Version and similar info
$NAME = 'check_openmanage';
-$VERSION = '3.7.1-beta1';
+$VERSION = '3.7.2';
$AUTHOR = 'Trond H. Amundsen';
$CONTACT = 't.h.amundsen@usit.uio.no';
'privkey' => undef, # SMNP v3
'privprotocol' => undef, # SMNP v3
'use_get_table' => 0, # hack for SNMPv3 on Windows with net-snmp
+ 'hide_servicetag' => 0, # hidden servicetag
);
# Get options
'privkey=s' => \$opt{privkey},
'privprotocol=s' => \$opt{privprotocol},
'use-get_table' => \$opt{use_get_table},
+ 'hide-servicetag' => \$opt{hide_servicetag},
) or do { print $USAGE; exit $E_UNKNOWN };
# If user requested help
'state' => 'output_servicestate',
'shortstate' => 'output_servicestate_abbr',
'show_blacklist' => 'output_blacklist',
+ 'hide_servicetag' => 'output_hide_servicetag',
'htmlinfo' => 'output_html',
'okinfo' => 'output_ok_verbosity',
'protocol' => 'snmp_version',
configfile_set_boolean($sect, 'ipv6');
configfile_set_boolean($sect, 'tcp');
configfile_set_boolean($sect, 'legacy_perfdata');
+ configfile_set_boolean($sect, 'hide_servicetag');
configfile_set_snmp_version($sect);
configfile_set_snmp_community($sect);
configfile_set_snmp_port($sect);
report('storage', $msg, $E_WARNING, $nexus);
}
}
+ # Special case: Foreign disk
+ elsif ($status eq 'Non-Critical' and $state eq 'Foreign'
+ and blacklisted('pdisk_foreign', $nexus)) {
+ my $msg = sprintf '%s [%s %s, %s] on ctrl %d is %s',
+ $name, $vendor, $product, $capacity, $ctrl, $state;
+ report('storage', $msg, $E_OK, $nexus);
+ }
# Default
elsif ($status ne 'Ok') {
my $msg = sprintf '%s [%s %s, %s] on ctrl %d needs attention: %s',
$state = get_hashval($out->{batteryState}, \%bat_state) || 'Unknown state';
$learn = get_hashval($out->{batteryLearnState}, \%bat_learn_state) || 'Unknown learn state';
$pred = get_hashval($out->{batteryPredictedCapacity}, \%bat_pred_cap) || 'Unknown predicted capacity status';
- $ctrl = get_hashval($out->{batteryConnectionControllerNumber}, \%snmp_controller) || 9999;
+ $ctrl = $snmp_controller{$out->{batteryConnectionControllerNumber}};
$nexus = convert_nexus(($out->{batteryNexusID} || 9999));
$id = $nexus;
$id =~ s{\A \d+:(\d+) \z}{$1}xms;
$max_warn /= 10;
$unit = 'A';
}
+ if ($unit eq 'mA' and $type ne 'amperageProbeTypeIsDiscrete') {
+ $reading /= 1000;
+ $max_crit /= 1000;
+ $max_warn /= 1000;
+ $unit = 'A';
+ }
}
else {
$index = get_nonempty_string('Index', $out, 9999);
$sysinfo{model} = $val;
}
if ($key eq 'Chassis Service Tag' or $key eq 'Service Tag') {
- $sysinfo{serial} = $val;
+ $sysinfo{serial} = $opt{hide_servicetag} ? 'XXXXXXX' : $val;
}
if ($key eq 'System Revision') {
$sysinfo{rev} = q{ } . $val;
$sysinfo{model} =~ s{\s+\z}{}xms; # remove trailing whitespace
}
elsif (exists $chassis_oid{$oid} and $chassis_oid{$oid} eq 'chassisServiceTagName') {
- $sysinfo{serial} = $result->{$oid};
+ $sysinfo{serial} = $opt{hide_servicetag} ? 'XXXXXXX' : $result->{$oid};
}
elsif (exists $chassis_oid{$oid} and $chassis_oid{$oid} eq 'chassisSystemRevisionName') {
$sysinfo{rev} = q{ } . $result->{$oid};
# Prefix with service tag if specified with option '-i|--info'
if ($opt{info}) {
- if (defined $opt{htmlinfo}) {
+ if (defined $opt{htmlinfo} and !$opt{hide_servicetag}) {
$msg = '[<a target="_blank" href="' . warranty_url($sysinfo{serial})
. "\">$sysinfo{serial}</a>] " . $msg;
}
}
}
elsif ($exit_code == $E_OK && !$opt{debug}) {
- if (defined $opt{htmlinfo}) {
+ if (defined $opt{htmlinfo} and !$opt{hide_servicetag}) {
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};
}
+ if (defined $opt{htmlinfo} and $opt{hide_servicetag}) {
+ printf q{OK - System: '<a target="_blank" href="%s">%s%s</a>', SN: '%s'},
+ documentation_url($sysinfo{model}), $sysinfo{model}, $sysinfo{rev},
+ $sysinfo{serial};
+ }
else {
printf q{OK - System: '%s%s', SN: '%s'},
$sysinfo{model}, $sysinfo{rev}, $sysinfo{serial};
else {
if ($opt{extinfo}) {
print $linebreak;
- if (defined $opt{htmlinfo}) {
+ if (defined $opt{htmlinfo} && !$opt{hide_servicetag}) {
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};
}
+ elsif (defined $opt{htmlinfo} && $opt{hide_servicetag}) {
+ printf '------ SYSTEM: <a target="_blank" href="%s">%s%s</a>, SN: %s',
+ documentation_url($sysinfo{model}), $sysinfo{model}, $sysinfo{rev},
+ $sysinfo{serial};
+ }
else {
printf '------ SYSTEM: %s%s, SN: %s',
$sysinfo{model}, $sysinfo{rev}, $sysinfo{serial};