enh(ups-apc-snmp): improve last time in battery status + fix dereference in script.pm (#5524 + #5412)

- Update the output for the "replace last time" for the battery status mode : it was displayed in seconds, it is now converted to a human readable format.

Refs: CTOR-1077

- $rebuild_args needs to be dereferenced when used in a join because it is a reference to an array. This is done when the script is executed with a non-root user (line 359) but not when called with root.

Authored by eseyman@users.noreply.github.com #5412
This commit is contained in:
sdepassio 2025-03-31 14:28:23 +02:00 committed by GitHub
parent 75873668bf
commit b5c5fb4b61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 435 additions and 110 deletions

View File

@ -353,7 +353,7 @@ sub check_relaunch {
}
if ($uid != $>) {
if ($> == 0) {
unshift @$args, '-s', '/bin/bash', '-l', $self->{runas}, '-c', join(' ', $cmd, $rebuild_args);
unshift @$args, '-s', '/bin/bash', '-l', $self->{runas}, '-c', join(' ', $cmd, @$rebuild_args);
$cmd = 'su';
} else {
unshift @$args, '-S', '-u', $self->{runas}, $cmd, @$rebuild_args;

View File

@ -1,5 +1,5 @@
#
# Copyright 2024 Centreon (http://www.centreon.com/)
# Copyright 2025 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -48,6 +48,15 @@ sub custom_status_calc {
return 0;
}
sub custom_last_replace_output {
my ($self, %options) = @_;
return sprintf(
'replace last time: %s',
centreon::plugins::misc::change_seconds(value => $self->{result_values}->{last_replace_time})
);
}
sub custom_status_output {
my ($self, %options) = @_;
@ -80,108 +89,127 @@ sub set_counters {
$self->{maps_counters_type} = [
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'bpacks', type => 3, cb_prefix_output => 'prefix_bpack_output', cb_long_output => 'bpack_long_output', indent_long_output => ' ', message_multiple => 'All battery packs are ok',
group => [
{ name => 'bpack_global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'cartridges', display_long => 1, cb_prefix_output => 'prefix_cartridge_output', message_multiple => 'cartridges are ok', type => 1, skipped_code => { -10 => 1 } }
]
{ name => 'bpacks', type => 3, cb_prefix_output => 'prefix_bpack_output', cb_long_output => 'bpack_long_output', indent_long_output => ' ', message_multiple => 'All battery packs are ok',
group => [
{ name => 'bpack_global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'cartridges', display_long => 1, cb_prefix_output => 'prefix_cartridge_output', message_multiple => 'cartridges are ok', type => 1, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{global} = [
{
label => 'status',
type => 2,
unknown_default => '%{status} =~ /unknown/i',
warning_default => '%{status} =~ /batteryLow/i',
critical_default => '%{replace} =~ /yes/i',
set => {
key_values => [
{
label => 'status',
type => 2,
unknown_default => '%{status} =~ /unknown/i',
warning_default => '%{status} =~ /batteryLow/i',
critical_default => '%{replace} =~ /yes/i',
set => {
key_values => [
{ name => 'upsBasicBatteryStatus' },
{ name => 'upsAdvBatteryReplaceIndicator' },
{ name => 'upsBasicBatteryLastReplaceDate' }
],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_battery_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_battery_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'load', nlabel => 'battery.charge.remaining.percent', set => {
key_values => [ { name => 'upsAdvBatteryCapacity' } ],
output_template => 'remaining capacity: %s %%',
perfdatas => [
{ label => 'load', template => '%s', min => 0, max => 100, unit => '%' }
]
}
key_values => [ { name => 'upsAdvBatteryCapacity' } ],
output_template => 'remaining capacity: %s %%',
perfdatas => [
{ label => 'load',
template => '%s',
min => 0,
max => 100,
unit => '%' }
]
}
},
{ label => 'time', nlabel => 'battery.charge.remaining.minutes', set => {
key_values => [ { name => 'upsAdvBatteryRunTimeRemaining' } ],
output_template => 'remaining time: %.2f minutes',
perfdatas => [
{ label => 'load_time', template => '%.2f', min => 0, unit => 'm' }
]
}
key_values => [ { name => 'upsAdvBatteryRunTimeRemaining' } ],
output_template => 'remaining time: %.2f minutes',
perfdatas => [
{ label => 'load_time',
template => '%.2f',
min => 0,
unit => 'm' }
]
}
},
{ label => 'timeon', nlabel => 'battery.timeon.minutes', set => {
key_values => [ { name => 'upsBasicBatteryTimeOnBattery' } ],
output_template => 'time on battery: %.2f minutes',
perfdatas => [
{ label => 'timeon', template => '%.2f', min => 0, unit => 'm' }
]
}
key_values => [ { name => 'upsBasicBatteryTimeOnBattery' } ],
output_template => 'time on battery: %.2f minutes',
perfdatas => [
{ label => 'timeon',
template => '%.2f',
min => 0,
unit => 'm' }
]
}
},
{ label => 'current', nlabel => 'battery.current.ampere', set => {
key_values => [ { name => 'upsAdvBatteryCurrent' } ],
output_template => 'current: %s A',
perfdatas => [
{ label => 'current', template => '%s', min => 0, unit => 'A' }
]
}
key_values => [ { name => 'upsAdvBatteryCurrent' } ],
output_template => 'current: %s A',
perfdatas => [
{ label => 'current',
template => '%s',
min => 0,
unit => 'A' }
]
}
},
{ label => 'voltage', nlabel => 'battery.voltage.volt', set => {
key_values => [ { name => 'upsAdvBatteryActualVoltage' } ],
output_template => 'voltage: %s V',
perfdatas => [
{ label => 'voltage', template => '%s', unit => 'V' }
]
}
key_values => [ { name => 'upsAdvBatteryActualVoltage' } ],
output_template => 'voltage: %s V',
perfdatas => [
{ label => 'voltage',
template => '%s',
unit => 'V' }
]
}
},
{ label => 'temperature', nlabel => 'battery.temperature.celsius', set => {
key_values => [ { name => 'upsAdvBatteryTemperature' } ],
output_template => 'temperature: %s C',
perfdatas => [
{ label => 'temperature', template => '%s', unit => 'C'}
]
}
key_values => [ { name => 'upsAdvBatteryTemperature' } ],
output_template => 'temperature: %s C',
perfdatas => [
{ label => 'temperature',
template => '%s',
unit => 'C' }
]
}
},
{ label => 'replace-lasttime', nlabel => 'battery.replace.lasttime.seconds', display_ok => 0, set => {
key_values => [ { name => 'last_replace_time' } ],
output_template => 'replace last time: %s s',
perfdatas => [
{ label => 'replace_last_time', template => '%s', unit => 's'}
]
}
key_values => [ { name => 'last_replace_time' } ],
closure_custom_output => $self->can('custom_last_replace_output'),
perfdatas => [
{ label => 'replace_last_time',
template => '%s',
unit => 's' }
]
}
}
];
$self->{maps_counters}->{bpack_global} = [
{ label => 'battery-pack-status', type => 2, critical_default => '%{status} ne "OK"', set => {
key_values => [ { name => 'status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
key_values => [ { name => 'status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
];
$self->{maps_counters}->{cartridges} = [
{ label => 'cartridge-status', type => 2, critical_default => '%{status} ne "OK"', set => {
key_values => [ { name => 'status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
key_values => [ { name => 'status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
];
}
@ -221,17 +249,17 @@ my $map_replace_status = {
};
my $mapping = {
upsBasicBatteryStatus => { oid => '.1.3.6.1.4.1.318.1.1.1.2.1.1', map => $map_battery_status },
upsBasicBatteryTimeOnBattery => { oid => '.1.3.6.1.4.1.318.1.1.1.2.1.2' },
upsBasicBatteryLastReplaceDate => { oid => '.1.3.6.1.4.1.318.1.1.1.2.1.3' }
upsBasicBatteryStatus => { oid => '.1.3.6.1.4.1.318.1.1.1.2.1.1', map => $map_battery_status },
upsBasicBatteryTimeOnBattery => { oid => '.1.3.6.1.4.1.318.1.1.1.2.1.2' },
upsBasicBatteryLastReplaceDate => { oid => '.1.3.6.1.4.1.318.1.1.1.2.1.3' }
};
my $mapping2 = {
upsAdvBatteryCapacity => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.1' },
upsAdvBatteryTemperature => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.2' },
upsAdvBatteryRunTimeRemaining => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.3' },
upsAdvBatteryReplaceIndicator => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.4', map => $map_replace_status },
upsAdvBatteryActualVoltage => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.8' },
upsAdvBatteryCurrent => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.9' }
upsAdvBatteryCapacity => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.1' },
upsAdvBatteryTemperature => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.2' },
upsAdvBatteryRunTimeRemaining => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.3' },
upsAdvBatteryReplaceIndicator => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.4', map => $map_replace_status },
upsAdvBatteryActualVoltage => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.8' },
upsAdvBatteryCurrent => { oid => '.1.3.6.1.4.1.318.1.1.1.2.2.9' }
};
my $oid_upsBasicBattery = '.1.3.6.1.4.1.318.1.1.1.2.1';
my $oid_upsAdvBattery = '.1.3.6.1.4.1.318.1.1.1.2.2';
@ -239,11 +267,11 @@ my $oid_upsHighPrecBatteryPackOnlyStatus = '.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5'
my $oid_upsHighPrecBatteryPackCartridgeStatus = '.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10';
my $map_battery_pack_status = {
0 => 'disconnected', 1 => 'overvoltage',
2 => 'needsReplacement', 3 => 'overtemperatureCritical',
4 => 'charger', 5 => 'temperatureSensor',
6 => 'busSoftStart', 7 => 'overtemperatureWarning',
8 => 'generalError', 9 => 'communication',
0 => 'disconnected', 1 => 'overvoltage',
2 => 'needsReplacement', 3 => 'overtemperatureCritical',
4 => 'charger', 5 => 'temperatureSensor',
6 => 'busSoftStart', 7 => 'overtemperatureWarning',
8 => 'generalError', 9 => 'communication',
10 => 'disconnectedFrame', 11 => 'firmwareMismatch'
};
@ -257,12 +285,12 @@ sub add_battery_pack {
$oid =~ /^$oid_upsHighPrecBatteryPackOnlyStatus\.(\d+)/;
my $pack_index = $1;
$self->{bpacks}->{$pack_index} = {
display => $pack_index,
display => $pack_index,
bpack_global => {
display => $pack_index,
status => 'OK'
status => 'OK'
},
cartridges => {}
cartridges => {}
};
my $status = '';
@ -285,14 +313,14 @@ sub add_battery_pack {
my ($pack_index, $cartridge_index) = ($1, $2);
if (!defined($self->{bpacks}->{$pack_index})) {
$self->{bpacks}->{$pack_index} = {
display => $pack_index,
display => $pack_index,
cartridges => {}
};
}
$self->{bpacks}->{$pack_index}->{cartridges}->{$cartridge_index} = {
display => $cartridge_index,
status => 'OK'
status => 'OK'
};
my $status = '';
@ -313,7 +341,7 @@ sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
oids => [
{ oid => $oid_upsBasicBattery },
{ oid => $oid_upsAdvBattery, end => $mapping2->{upsAdvBatteryCurrent}->{oid} },
{ oid => $oid_upsHighPrecBatteryPackCartridgeStatus },
@ -344,7 +372,7 @@ sub manage_selection {
}
$self->add_battery_pack(snmp_result => $snmp_result);
}
1;
@ -360,62 +388,112 @@ Check battery status and battery charge remaining.
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^status|load$'
Example: C<--filter-counters='^status|load$'>
=item B<--replace-lasttime-format>
Define the date format (default: '%m/%d/%Y').
Define the date format (default: C<%m/%d/%Y>).
=item B<--unknown-status>
Define the conditions to match for the status to be UNKNOWN (default: '%{status} =~ /unknown/i').
Define the conditions to match for the status to be UNKNOWN (default: C<%{status} =~ /unknown/i>).
You can use the following variables: %{status}, %{replace}
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (default: '%{status} =~ /batteryLow/i').
You can use the following variables: %{status}, %{replace}
Define the conditions to match for the status to be WARNING (default: C<%{status} =~ /batteryLow/i>).
You can use the following variables: C<%{status}>, C<%{replace}>
=item B<--critical-status>
Define the conditions to match for the status to be CRITICAL (default: '%{replace} =~ /yes/i').
You can use the following variables: %{status}, %{replace}
Define the conditions to match for the status to be CRITICAL (default: C<%{replace} =~ /yes/i>).
You can use the following variables: C<%{status}>, C<%{replace}>
=item B<--unknown-battery-pack-status>
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}
You can use the following variables: C<%{status}>
=item B<--warning-battery-pack-status>
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{status}
You can use the following variables: C<%{status}>
=item B<--critical-battery-pack-status>
Define the conditions to match for the status to be CRITICAL (default: '%{status} ne "OK"').
You can use the following variables: %{status}
Define the conditions to match for the status to be CRITICAL (default: C<%{status} ne "OK">).
You can use the following variables: C<%{status}>
=item B<--unknown-cartridge-status>
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}
You can use the following variables: C<%{status}>
=item B<--warning-cartridge-status>
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{status}
You can use the following variables: C<%{status}>
=item B<--critical-cartridge-status>
Define the conditions to match for the status to be CRITICAL (default: '%{status} ne "OK"').
You can use the following variables: %{status}
Define the conditions to match for the status to be CRITICAL (default: C<%{status} ne "OK">).
You can use the following variables: C<%{status}>
=item B<--warning-*> B<--critical-*>
=item B<--warning-load>
Thresholds.
Can be: 'load', 'voltage', 'current',
'temperature', 'time', 'replace-lasttime', 'timeon'.
Warning threshold for battery load (in %).
=item B<--critical-load>
Critical threshold for battery load (in %).
=item B<--warning-voltage>
Warning threshold for battery voltage (in V).
=item B<--critical-voltage>
Critical threshold for battery voltage (in V).
=item B<--warning-current>
Warning threshold for battery current (in A).
=item B<--critical-current>
Critical threshold for battery current (in A).
=item B<--warning-temperature>
Warning threshold for battery temperature (in C).
=item B<--critical-temperature>
Critical threshold for battery temperature (in C).
=item B<--warning-time>
Warning threshold for battery remaining time (in minutes).
=item B<--critical-time>
Critical threshold for battery remaining time (in minutes).
=item B<--warning-replace-lasttime>
Warning threshold for battery last replace time (in seconds).
=item B<--critical-replace-lasttime>
Critical threshold for battery last replace time (in seconds).
=item B<--warning-timeon>
Warning threshold for time on battery (in minutes).
=item B<--critical-timeon>
Critical threshold for time on battery (in minutes).
=back

View File

@ -0,0 +1,57 @@
*** Settings ***
Documentation Check battery status
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Ctn Generic Suite Setup
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::ups::apc::snmp::plugin
... --mode=battery-status
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-timeout=1
*** Test Cases ***
battery status ${tc}
[Tags] hardware ups apc
${command} Catenate
... ${CMD}
... --snmp-community=hardware/ups/apc/snmp/ups-apc-battery-ok
... ${extra_options}
Ctn Run Command And Check Result As Regexp ${command} ${expected_regexp}
Examples: tc extra_options expected_regexp --
... 1 ${EMPTY} ^OK: battery status is 'batteryNormal' \\\\[battery needs replace: no\\\\] \\\\[last replace date: 10-05-2022\\\\], remaining capacity: 100 %, remaining time: 665.00 minutes, time on battery: 205761.00 minutes, voltage: 110 V, temperature: 23 C - All battery packs are ok \\\\| 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=205761.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;;
... 2 --replace-lasttime-format='%d-%m-%Y' ^OK: battery status is 'batteryNormal' \\\\[battery needs replace: no\\\\] \\\\[last replace date: 10-05-2022\\\\], remaining capacity: 100 %, remaining time: 665.00 minutes, time on battery: 205761.00 minutes, voltage: 110 V, temperature: 23 C - All battery packs are ok \\\\| 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=205761.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;
... 3 --replace-lasttime-format='%d-%m-%Y' --warning-replace-lasttime=2 ^WARNING: replace last time: (\\\\d+y )?(\\\\d+M )?(\\\\d+w )?(\\\\d+d )?(\\\\d+h )?(\\\\d+m )?(\\\\d+s )?\\\\| 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=205761.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;0:2;;;$
... 4 --replace-lasttime-format='%d-%m-%Y' --critical-replace-lasttime=2 ^CRITICAL: replace last time: (\\\\d+y )?(\\\\d+M )?(\\\\d+w )?(\\\\d+d )?(\\\\d+h )?(\\\\d+m )?(\\\\d+s )?\\\\| 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=205761.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;0:2;;$
*** Test Cases ***
battery low status ${tc}
[Tags] hardware ups apc
${command} Catenate
... ${CMD}
... --snmp-community=hardware/ups/apc/snmp/ups-apc-battery-low
... --warning-status='${warning_status}'
... --critical-status='${critical_status}'
... --critical-battery-pack-status='${critical_battery_pack_status}'
... --critical-cartridge-status='${critical_cartridge_status}'
... ${extra_options}
Ctn Run Command And Check Result As Regexp ${command} ${expected_regexp}
Examples: tc warning_status critical_status critical_battery_pack_status critical_cartridge_status extra_options expected_regexp --
... 1 \\\%{status} =~ /batteryLow/i \\\%{replace} =~ /yes/i \\\%{status} ne "OK" \\\%{status} ne "OK" ${EMPTY} ^CRITICAL: battery status is 'batteryLow' \\\\[battery needs replace: yes\\\\] \\\\[last replace date: 10/05/2022\\\\] - battery pack '1' status is 'needsReplacement' - cartridge '1' status is 'needsReplacement' - cartridge '2' status is 'needsReplacement' - battery pack '2' status is 'needsReplacement' \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$
... 2 \\\%{status} =~ /batteryLow/i ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ^WARNING: battery status is 'batteryLow' \\\\[battery needs replace: yes\\\\] \\\\[last replace date: 10/05/2022\\\\] \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$
... 3 ${EMPTY} \\\%{replace} =~ /yes/i ${EMPTY} ${EMPTY} ${EMPTY} ^CRITICAL: battery status is 'batteryLow' \\\\[battery needs replace: yes\\\\] \\\\[last replace date: 10/05/2022\\\\] \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$
... 4 ${EMPTY} ${EMPTY} \\\%{status} ne "OK" ${EMPTY} ${EMPTY} ^CRITICAL: battery pack '1' status is 'needsReplacement' - battery pack '2' status is 'needsReplacement' \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$
... 5 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} --warning-battery-pack-status='\\\%{status} ne "OK"' ^WARNING: battery pack '1' status is 'needsReplacement' - battery pack '2' status is 'needsReplacement' \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$
... 6 ${EMPTY} ${EMPTY} ${EMPTY} \\\%{status} ne "OK" ${EMPTY} ^CRITICAL: battery pack '1' cartridge '1' status is 'needsReplacement' - cartridge '2' status is 'needsReplacement' \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$
... 7 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} --warning-cartridge-status='\\\%{status} ne "OK"' ^WARNING: battery pack '1' cartridge '1' status is 'needsReplacement' - cartridge '2' status is 'needsReplacement' \\\\| 'battery.charge.remaining.percent'=75%;;;0;100 'battery.charge.remaining.minutes'=665.00m;;;0; 'battery.timeon.minutes'=390946.00m;;;0; 'battery.voltage.volt'=110V;;;; 'battery.temperature.celsius'=23C;;;; 'battery.replace.lasttime.seconds'=\\\\d*s;;;;$

View File

@ -0,0 +1,95 @@
.1.3.6.1.4.1.318.1.1.1.2.1.1.0 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.1.2.1.2.0 = 2345678901
.1.3.6.1.4.1.318.1.1.1.2.1.3.0 = STRING: "10/05/2022"
.1.3.6.1.4.1.318.1.1.1.2.2.1.0 = Gauge32: 75
.1.3.6.1.4.1.318.1.1.1.2.2.2.0 = Gauge32: 23
.1.3.6.1.4.1.318.1.1.1.2.2.3.0 = 3992500
.1.3.6.1.4.1.318.1.1.1.2.2.4.0 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.1.2.2.5.0 = INTEGER: 4
.1.3.6.1.4.1.318.1.1.1.2.2.8.0 = INTEGER: 110
.1.3.6.1.4.1.318.1.1.1.2.2.19.0 = STRING: Anonymized 198
.1.3.6.1.4.1.318.1.1.1.2.2.20.0 = STRING: Anonymized 057
.1.3.6.1.4.1.318.1.1.1.2.2.21.0 = STRING: Anonymized 150
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.1.1.1 = STRING: "0010000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.1.1.2 = STRING: "0010000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.2.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.2.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.3.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.3.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.4.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.4.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.5.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.5.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.6.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.6.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.7.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.7.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.8.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.8.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.9.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.9.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.10.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.10.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.11.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.11.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.1.1 = STRING: "0010000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.2.1 = STRING: "0010000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.3.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.4.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.5.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.6.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.7.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.8.1 = ""
.1.3.6.1.4.1.318.1.1.1.3.2.1.0 = Gauge32: 234
.1.3.6.1.4.1.318.1.1.1.3.2.4.0 = Gauge32: 50
.1.3.6.1.4.1.318.1.1.1.3.2.5.0 = INTEGER: 9
.1.3.6.1.4.1.318.1.1.1.3.3.1.0 = Gauge32: 2341
.1.3.6.1.4.1.318.1.1.1.3.3.4.0 = Gauge32: 500
.1.3.6.1.4.1.318.1.1.1.4.1.1.0 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.1.4.2.1.0 = Gauge32: 220
.1.3.6.1.4.1.318.1.1.1.4.2.2.0 = Gauge32: 50
.1.3.6.1.4.1.318.1.1.1.4.2.3.0 = Gauge32: 10
.1.3.6.1.4.1.318.1.1.1.4.2.4.0 = Gauge32: 1
.1.3.6.1.4.1.318.1.1.1.4.3.1.0 = Gauge32: 2200
.1.3.6.1.4.1.318.1.1.1.4.3.2.0 = Gauge32: 500
.1.3.6.1.4.1.318.1.1.1.4.3.3.0 = Gauge32: 97
.1.3.6.1.4.1.318.1.1.1.4.3.4.0 = Gauge32: 13
.1.3.6.1.4.1.318.1.1.1.5.2.2.0 = INTEGER: 245
.1.3.6.1.4.1.318.1.1.1.5.2.3.0 = INTEGER: 198
.1.3.6.1.4.1.318.1.1.1.5.2.20.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.21.0 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.1.5.2.22.0 = INTEGER: -1
.1.3.6.1.4.1.318.1.1.1.5.2.23.0 = INTEGER: -1
.1.3.6.1.4.1.318.1.1.1.5.2.24.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.26.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.27.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.28.0 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.1.5.2.30.0 = 15000
.1.3.6.1.4.1.318.1.1.1.5.2.31.0 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.2.1 = STRING: Anonymized 133
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.3.1 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1 = INTEGER: 18
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.1 = INTEGER: 37
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.7.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.8.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.9.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.10.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.11.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.12.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.13.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.14.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.15.1 = STRING: Anonymized 205
.1.3.6.1.4.1.318.1.1.25.1.2.1.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.25.1.2.1.2.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.25.1.2.1.3.1.1 = STRING: Anonymized 192
.1.3.6.1.4.1.318.1.1.25.1.2.1.4.1.1 = STRING: Anonymized 169
.1.3.6.1.4.1.318.1.1.25.1.2.1.5.1.1 = INTEGER: 64
.1.3.6.1.4.1.318.1.1.25.1.2.1.6.1.1 = INTEGER: 18
.1.3.6.1.4.1.318.1.1.25.1.2.1.7.1.1 = INTEGER: 37
.1.3.6.1.4.1.318.1.1.25.1.2.1.8.1.1 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.25.1.2.1.9.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.25.1.2.1.10.1.1 = INTEGER: 2
.1.3.6.1.4.1.318.2.1.6.1.0 = STRING: Anonymized 210
.1.3.6.1.4.1.318.2.1.6.2.0 = STRING: Anonymized 141

View File

@ -0,0 +1,95 @@
.1.3.6.1.4.1.318.1.1.1.2.1.1.0 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.1.2.1.2.0 = 1234567890
.1.3.6.1.4.1.318.1.1.1.2.1.3.0 = STRING: "10-05-2022"
.1.3.6.1.4.1.318.1.1.1.2.2.1.0 = Gauge32: 100
.1.3.6.1.4.1.318.1.1.1.2.2.2.0 = Gauge32: 23
.1.3.6.1.4.1.318.1.1.1.2.2.3.0 = 3992500
.1.3.6.1.4.1.318.1.1.1.2.2.4.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.2.2.5.0 = INTEGER: 4
.1.3.6.1.4.1.318.1.1.1.2.2.8.0 = INTEGER: 110
.1.3.6.1.4.1.318.1.1.1.2.2.19.0 = STRING: Anonymized 198
.1.3.6.1.4.1.318.1.1.1.2.2.20.0 = STRING: Anonymized 057
.1.3.6.1.4.1.318.1.1.1.2.2.21.0 = STRING: Anonymized 150
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.1.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.1.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.2.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.2.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.3.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.3.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.4.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.4.1.2 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.5.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.5.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.6.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.6.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.7.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.7.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.8.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.8.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.9.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.9.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.10.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.10.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.11.1.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.2.1.10.11.1.2 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.1.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.2.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.3.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.4.1 = STRING: "0000000000000000"
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.5.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.6.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.7.1 = ""
.1.3.6.1.4.1.318.1.1.1.2.3.10.4.1.5.8.1 = ""
.1.3.6.1.4.1.318.1.1.1.3.2.1.0 = Gauge32: 234
.1.3.6.1.4.1.318.1.1.1.3.2.4.0 = Gauge32: 50
.1.3.6.1.4.1.318.1.1.1.3.2.5.0 = INTEGER: 9
.1.3.6.1.4.1.318.1.1.1.3.3.1.0 = Gauge32: 2341
.1.3.6.1.4.1.318.1.1.1.3.3.4.0 = Gauge32: 500
.1.3.6.1.4.1.318.1.1.1.4.1.1.0 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.1.4.2.1.0 = Gauge32: 220
.1.3.6.1.4.1.318.1.1.1.4.2.2.0 = Gauge32: 50
.1.3.6.1.4.1.318.1.1.1.4.2.3.0 = Gauge32: 10
.1.3.6.1.4.1.318.1.1.1.4.2.4.0 = Gauge32: 1
.1.3.6.1.4.1.318.1.1.1.4.3.1.0 = Gauge32: 2200
.1.3.6.1.4.1.318.1.1.1.4.3.2.0 = Gauge32: 500
.1.3.6.1.4.1.318.1.1.1.4.3.3.0 = Gauge32: 97
.1.3.6.1.4.1.318.1.1.1.4.3.4.0 = Gauge32: 13
.1.3.6.1.4.1.318.1.1.1.5.2.2.0 = INTEGER: 245
.1.3.6.1.4.1.318.1.1.1.5.2.3.0 = INTEGER: 198
.1.3.6.1.4.1.318.1.1.1.5.2.20.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.21.0 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.1.5.2.22.0 = INTEGER: -1
.1.3.6.1.4.1.318.1.1.1.5.2.23.0 = INTEGER: -1
.1.3.6.1.4.1.318.1.1.1.5.2.24.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.26.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.27.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.1.5.2.28.0 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.1.5.2.30.0 = 15000
.1.3.6.1.4.1.318.1.1.1.5.2.31.0 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.2.1 = STRING: Anonymized 133
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.3.1 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1 = INTEGER: 18
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.1 = INTEGER: 37
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.7.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.8.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.9.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.10.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.11.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.12.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.13.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.14.1 = INTEGER: 3
.1.3.6.1.4.1.318.1.1.10.2.3.2.1.15.1 = STRING: Anonymized 205
.1.3.6.1.4.1.318.1.1.25.1.2.1.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.25.1.2.1.2.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.25.1.2.1.3.1.1 = STRING: Anonymized 192
.1.3.6.1.4.1.318.1.1.25.1.2.1.4.1.1 = STRING: Anonymized 169
.1.3.6.1.4.1.318.1.1.25.1.2.1.5.1.1 = INTEGER: 64
.1.3.6.1.4.1.318.1.1.25.1.2.1.6.1.1 = INTEGER: 18
.1.3.6.1.4.1.318.1.1.25.1.2.1.7.1.1 = INTEGER: 37
.1.3.6.1.4.1.318.1.1.25.1.2.1.8.1.1 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.25.1.2.1.9.1.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.25.1.2.1.10.1.1 = INTEGER: 2
.1.3.6.1.4.1.318.2.1.6.1.0 = STRING: Anonymized 210
.1.3.6.1.4.1.318.2.1.6.2.0 = STRING: Anonymized 141