(plugin) hardware::ups::ees::snmp - new (#4558)
Co-authored-by: Roman Morandell <46994680+rmorandell-pgum@users.noreply.github.com>
This commit is contained in:
parent
c603ed5476
commit
5863ac7671
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"libsnmp-perl"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"pkg_name": "centreon-plugin-Hardware-Ups-Ees-Snmp",
|
||||
"pkg_summary": "Centreon Plugin",
|
||||
"plugin_name": "centreon_ups_ees_snmp.pl",
|
||||
"files": [
|
||||
"centreon/plugins/script_snmp.pm",
|
||||
"centreon/plugins/snmp.pm",
|
||||
"snmp_standard/mode/uptime.pm",
|
||||
"hardware/ups/ees/snmp/"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"perl(SNMP)"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::mode::battery;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
my $map_battery_mode = {
|
||||
1 => 'unknown',
|
||||
2 => 'FloatCharging',
|
||||
3 => 'ShortTest',
|
||||
4 => 'BoostChargingForTest',
|
||||
5 => 'ManualTesting',
|
||||
6 => 'PlanTesting',
|
||||
7 => 'ACFailTesting',
|
||||
8 => 'ACFail',
|
||||
9 => 'ManualBoostCharging',
|
||||
10 => 'AutoBoostCharging',
|
||||
11 => 'CyclicBoostCharging',
|
||||
12 => 'MasterBoostCharging',
|
||||
13 => 'MasterBateryTesting'
|
||||
};
|
||||
|
||||
sub battery_mode_custom_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf("Battery mode: '%s'", $self->{result_values}->{battery_mode});
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'battery', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{battery} = [
|
||||
{
|
||||
label => 'voltage', nlabel => 'battery.voltage.volt',
|
||||
set => {
|
||||
key_values => [ { name => 'voltage' } ],
|
||||
output_template => 'voltage: %.2fV',
|
||||
perfdatas => [ { template => '%.2f', unit => 'V' } ],
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'current', nlabel => 'battery.current.ampere',
|
||||
set => {
|
||||
key_values => [ { name => 'current' } ],
|
||||
output_template => 'current: %.2fA',
|
||||
perfdatas => [ { template => '%.2f', unit => 'A' } ],
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'capacity', nlabel => 'battery.capacity.percentage',
|
||||
set => {
|
||||
key_values => [ { name => 'capacity' } ],
|
||||
output_template => 'capacity: %.2f%%',
|
||||
perfdatas => [ { template => '%.2f', min => 0, max => 100, unit => '%' } ],
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'nominal-capacity', nlabel => 'battery.nominal.capacity.amperehour',
|
||||
set => {
|
||||
key_values => [ { name => 'nominal_capacity' } ],
|
||||
output_template => 'used capacity: %.2fAh',
|
||||
perfdatas => [ { template => '%.2f', unit => 'Ah' } ],
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'battery-mode',
|
||||
unknown_default => '%{battery_mode} =~ /unknown/i',
|
||||
warning_default => '%{battery_mode} =~ /ShortTest|BoostChargingForTest|ManualTesting|PlanTesting|ManualBoostCharging|AutoBoostCharging|CyclicBoostCharging|MasterBoostCharging|MasterBateryTesting/i',
|
||||
critical_default => '%{battery_mode} =~ /ACFailTesting|ACFail/i',
|
||||
type => 2,
|
||||
set => {
|
||||
key_values => [ { name => 'battery_mode' } ],
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_output => $self->can('battery_mode_custom_output')
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_psStatusBatteryMode = '.1.3.6.1.4.1.6302.2.1.2.9.0';
|
||||
my $oid_psBatteryVoltage = '.1.3.6.1.4.1.6302.2.1.2.5.1.0';
|
||||
my $oid_psTotalBatteryCurrent = '.1.3.6.1.4.1.6302.2.1.2.5.2.0';
|
||||
my $oid_psBatteryCapacity = '.1.3.6.1.4.1.6302.2.1.2.5.3.0';
|
||||
my $oid_psBatteryNominalCapacity = '.1.3.6.1.4.1.6302.2.1.2.5.4.0';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_psStatusBatteryMode,
|
||||
$oid_psBatteryVoltage,
|
||||
$oid_psTotalBatteryCurrent,
|
||||
$oid_psBatteryCapacity,
|
||||
$oid_psBatteryNominalCapacity
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{battery} = {
|
||||
voltage => $snmp_result->{$oid_psBatteryVoltage} / 1000,
|
||||
current => $snmp_result->{$oid_psTotalBatteryCurrent} / 1000,
|
||||
capacity => $snmp_result->{$oid_psBatteryCapacity} / 1000,
|
||||
nominal_capacity => $snmp_result->{$oid_psBatteryNominalCapacity} / 1000,
|
||||
battery_mode => $map_battery_mode->{$snmp_result->{$oid_psStatusBatteryMode}},
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check battery.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds: voltage (V), current (A), capacity (%), nominal-capacity (Ah)
|
||||
|
||||
=item B<--unknown-battery-mode>
|
||||
|
||||
Define the conditions to match for the status to be UNKNOWN (default: '%{battery_mode} =~ /unknown/i').
|
||||
You can use the following variables: %{battery_mode}
|
||||
|
||||
=item B<--warning-battery-mode>
|
||||
|
||||
Define the conditions to match for the status to be WARNING (default: '%{battery_mode} =~ /ShortTest|BoostChargingForTest|ManualTesting|PlanTesting|ManualBoostCharging|AutoBoostCharging|CyclicBoostCharging|MasterBoostCharging|MasterBateryTesting/i').
|
||||
You can use the following variables: %{battery_mode}
|
||||
|
||||
=item B<--critical-battery-mode>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{battery_mode} =~ /ACFailTesting|ACFail/i').
|
||||
You can use the following variables: %{battery_mode}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,114 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::mode::input;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'input', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{input} = [
|
||||
{
|
||||
label => 'line-a', nlabel => 'lineA.input.voltage.volt',
|
||||
set => {
|
||||
key_values => [ { name => 'lineA' } ],
|
||||
output_template => 'line A voltage: %.2fV',
|
||||
perfdatas => [ { template => '%.2f', unit => 'V' } ]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'line-b', nlabel => 'lineB.input.voltage.volt',
|
||||
set => {
|
||||
key_values => [ { name => 'lineB' } ],
|
||||
output_template => 'line B voltage: %.2fV',
|
||||
perfdatas => [ { template => '%.2f', unit => 'V' } ]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'line-c', nlabel => 'lineC.input.voltage.volt',
|
||||
set => {
|
||||
key_values => [ { name => 'lineC' } ],
|
||||
output_template => 'line C voltage: %.2fV',
|
||||
perfdatas => [ { template => '%.2f', unit => 'V' } ]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_psInputLineAVoltage = '.1.3.6.1.4.1.6302.2.1.2.6.1.0';
|
||||
my $oid_psInputLineBVoltage = '.1.3.6.1.4.1.6302.2.1.2.6.2.0';
|
||||
my $oid_psInputLineCVoltage = '.1.3.6.1.4.1.6302.2.1.2.6.3.0';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_psInputLineAVoltage,
|
||||
$oid_psInputLineBVoltage,
|
||||
$oid_psInputLineCVoltage,
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{input} = {
|
||||
lineA => $snmp_result->{$oid_psInputLineAVoltage} / 1000,
|
||||
lineB => $snmp_result->{$oid_psInputLineBVoltage} / 1000,
|
||||
lineC => $snmp_result->{$oid_psInputLineCVoltage} / 1000,
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check input lines.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Input thresholds in V
|
||||
|
||||
Thresholds: line-a, line-c, line-c.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,155 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::mode::rectifier;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub rectifier_custom_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"installed: %d, communicating: %d, used capacity: %.2f%%",
|
||||
$self->{result_values}->{installed},
|
||||
$self->{result_values}->{communicating},
|
||||
$self->{result_values}->{used_capacity}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'rectifier', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{rectifier} = [
|
||||
{
|
||||
label => 'status',
|
||||
warning_default => '%{installed} != %{communicating}',
|
||||
type => 2,
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'used_capacity' },
|
||||
{ name => 'installed' },
|
||||
{ name => 'communicating' }
|
||||
],
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_output => $self->can('rectifier_custom_output')
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'used-capacity', display_ok => 0, nlabel => 'rectifier.capacity.used.percentage',
|
||||
set => {
|
||||
key_values => [ { name => 'used_capacity' } ],
|
||||
output_template => 'used capacity: %.2f%%',
|
||||
perfdatas => [ { template => '%.2f', min => 0, max => 100, unit => '%' } ]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'installed', display_ok => 0, nlabel => 'rectifier.installed.count',
|
||||
set => {
|
||||
key_values => [ { name => 'installed' } ],
|
||||
output_template => 'installed: %d',
|
||||
perfdatas => [ { template => '%d', min => 0 } ]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'communicating', display_ok => 0, nlabel => 'rectifier.communicating.count',
|
||||
set => {
|
||||
key_values => [ { name => 'communicating' } ],
|
||||
output_template => 'communicating: %d',
|
||||
perfdatas => [ { template => '%d', min => 0 } ]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_numberOfInstalledRectifiers = '.1.3.6.1.4.1.6302.2.1.2.11.1.0';
|
||||
my $oid_numberOfRectifiersCommunicating = '.1.3.6.1.4.1.6302.2.1.2.11.2.0';
|
||||
my $oid_rectifiersUsedCapacity = '.1.3.6.1.4.1.6302.2.1.2.11.3.0';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_numberOfInstalledRectifiers,
|
||||
$oid_numberOfRectifiersCommunicating,
|
||||
$oid_rectifiersUsedCapacity
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{rectifier} = {
|
||||
installed => $snmp_result->{$oid_numberOfInstalledRectifiers},
|
||||
communicating => $snmp_result->{$oid_numberOfRectifiersCommunicating},
|
||||
used_capacity => $snmp_result->{$oid_rectifiersUsedCapacity}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check rectifier.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Define the conditions to match for the status to be UNKNOWN.
|
||||
You can use the following variables: %{installed}, %{communicating}, %{used_capacity}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING (default: '%{installed} != %{communicating}').
|
||||
You can use the following variables: %{installed}, %{communicating}, %{used_capacity}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL.
|
||||
You can use the following variables: %{installed}, %{communicating}, %{used_capacity}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'used-capacity', 'installed', 'communicating'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,177 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::mode::system;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
my $map_system_status = {
|
||||
1 => 'unknown',
|
||||
2 => 'normal',
|
||||
3 => 'warning',
|
||||
4 => 'minor',
|
||||
5 => 'major',
|
||||
6 => 'critical',
|
||||
7 => 'unmanaged',
|
||||
8 => 'restricted',
|
||||
9 => 'testing',
|
||||
10 => 'disabled'
|
||||
};
|
||||
|
||||
my $map_communication_status = {
|
||||
1 => 'unknown',
|
||||
2 => 'normal',
|
||||
3 => 'interrupt'
|
||||
};
|
||||
|
||||
sub status_custom_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"system status: '%s' - communication status: '%s'",
|
||||
$self->{result_values}->{system_status},
|
||||
$self->{result_values}->{communication_status}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'system', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{system} = [
|
||||
{
|
||||
label => 'status',
|
||||
unknown_default => '%{system_status} =~ /unknown|unmanaged|restricted|testing|disabled/i || %{communication_status} =~ /unknown/i',
|
||||
warning_default => '%{system_status} =~ /warning|minor/i',
|
||||
critical_default => '%{system_status} =~ /major|critical/i || %{communication_status} =~ /interrupt/i',
|
||||
type => 2,
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'system_status' },
|
||||
{ name => 'communication_status' }
|
||||
],
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_output => $self->can('status_custom_output')
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'voltage', nlabel => 'system.voltage.volt',
|
||||
set => {
|
||||
key_values => [ { name => 'voltage' } ],
|
||||
output_template => 'voltage: %.2fV',
|
||||
perfdatas => [ { template => '%.2f', unit => 'V' } ]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'current', nlabel => 'system.current.ampere',
|
||||
set => {
|
||||
key_values => [ { name => 'current' } ],
|
||||
output_template => 'current: %.2fA',
|
||||
perfdatas => [ { template => '%.2f', unit => 'A' } ]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'used-capacity', nlabel => 'system.used.capacity.percentage',
|
||||
set => {
|
||||
key_values => [ { name => 'used_capacity' } ],
|
||||
output_template => 'used capacity: %.2f%%',
|
||||
perfdatas => [ { template => '%.2f', min => 0, max => 100, unit => '%' } ]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_systemStatus = '.1.3.6.1.4.1.6302.2.1.2.1.0';
|
||||
my $oid_systemVoltage = '.1.3.6.1.4.1.6302.2.1.2.2.0';
|
||||
my $oid_systemCurrent = '.1.3.6.1.4.1.6302.2.1.2.3.0';
|
||||
my $oid_systemUsedCapacity = '.1.3.6.1.4.1.6302.2.1.2.4.0';
|
||||
my $oid_psStatusCommunication = '.1.3.6.1.4.1.6302.2.1.2.8.0';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_systemStatus,
|
||||
$oid_systemVoltage,
|
||||
$oid_systemCurrent,
|
||||
$oid_systemUsedCapacity,
|
||||
$oid_psStatusCommunication
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{system} = {
|
||||
system_status => $map_system_status->{$snmp_result->{$oid_systemStatus}},
|
||||
communication_status => $map_communication_status->{$snmp_result->{$oid_psStatusCommunication}},
|
||||
voltage => $snmp_result->{$oid_systemVoltage} / 1000,
|
||||
current => $snmp_result->{$oid_systemCurrent} / 1000,
|
||||
used_capacity => $snmp_result->{$oid_systemUsedCapacity}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Define the conditions to match for the status to be UNKNOWN (default: '%{system_status} =~ /unknown|unmanaged|restricted|testing|disabled/i || %{communication_status} =~ /unknown/i').
|
||||
You can use the following variables: %{system_status}, %{communication_status}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING (default: '%{system_status} =~ /warning|minor/i').
|
||||
You can use the following variables: %{system_status}, %{communication_status}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{system_status} =~ /major|critical/i || %{communication_status} =~ /interrupt/i').
|
||||
You can use the following variables: %{system_status}, %{communication_status}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds: voltage (V), current (A), used-capacity (%)
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,167 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::mode::temperature;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub status_custom_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"alarm status %s [type: %s]",
|
||||
$self->{result_values}->{alarm_status},
|
||||
$self->{result_values}->{type}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_temperature_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Probe '" . $options{instance_value}->{name} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'temperatures', type => 1, cb_prefix_output => 'prefix_temperature_output', message_multiple => 'All temperatures are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{temperatures} = [
|
||||
{
|
||||
label => 'alarm-status',
|
||||
unknown_default => '%{alarm_status} =~ /fail/i',
|
||||
warning_default => '%{alarm_status} =~ /low/i',
|
||||
critical_default => '%{alarm_status} =~ /high/i',
|
||||
type => 2,
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'alarm_status' }, { name => 'type' }, { name => 'name' }
|
||||
],
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_output => $self->can('status_custom_output')
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'temperature', nlabel => 'probe.temperature.celsius',
|
||||
set => {
|
||||
key_values => [ { name => 'temperature' }, { name => 'name' } ],
|
||||
output_template => 'temperature: %.2fC',
|
||||
perfdatas => [ { template => '%.2f', unit => 'C', label_extra_instance => 1, instance_use => 'name' } ]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $map_alarm_status = {
|
||||
0 => 'high',
|
||||
1 => 'low',
|
||||
2 => 'fail',
|
||||
3 => 'none'
|
||||
};
|
||||
|
||||
my $map_type = {
|
||||
0 => 'none',
|
||||
1 => 'ambient',
|
||||
2 => 'battery'
|
||||
};
|
||||
|
||||
my $mapping = {
|
||||
temperature => { oid => '.1.3.6.1.4.1.6302.2.1.2.7.3.1.2' },
|
||||
alarm_status => { oid => '.1.3.6.1.4.1.6302.2.1.2.7.3.1.5', map => $map_alarm_status },
|
||||
name => { oid => '.1.3.6.1.4.1.6302.2.1.2.7.3.1.3' },
|
||||
type => { oid => '.1.3.6.1.4.1.6302.2.1.2.7.3.1.4', map => $map_type }
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $mapping->{temperature}->{oid} },
|
||||
{ oid => $mapping->{alarm_status}->{oid} },
|
||||
{ oid => $mapping->{name}->{oid} },
|
||||
{ oid => $mapping->{type}->{oid} }
|
||||
],
|
||||
return_type => 1,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{temperatures} = {};
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{temperature}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $data = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
|
||||
$self->{temperatures}->{$instance} = {
|
||||
temperature => $data->{temperature} / 1000,
|
||||
alarm_status => $data->{alarm_status},
|
||||
name => $data->{name},
|
||||
type => $data->{type}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check temperature.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--unknown-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be UNKNOWN (default: '%{alarm_status} =~ /fail/i').
|
||||
You can use the following variables: %{alarm_status}, %{type}, %{name}
|
||||
|
||||
=item B<--warning-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING (default: '%{alarm_status} =~ /low/i').
|
||||
You can use the following variables: %{alarm_status}, %{type}, %{name}
|
||||
|
||||
=item B<--critical-alarm-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{alarm_status} =~ /high/i').
|
||||
You can use the following variables: %{alarm_status}, %{type}, %{name}
|
||||
|
||||
=item B<--warning-temperature> B<--critical-temperature>
|
||||
|
||||
Thresholds: temperature (C)
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,79 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::mode::uptime;
|
||||
|
||||
use base qw(snmp_standard::mode::uptime);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system uptime.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-uptime>
|
||||
|
||||
Warning threshold.
|
||||
|
||||
=item B<--critical-uptime>
|
||||
|
||||
Critical threshold.
|
||||
|
||||
=item B<--add-sysdesc>
|
||||
|
||||
Display system description.
|
||||
|
||||
=item B<--force-oid>
|
||||
|
||||
Can choose your OID (numeric format only).
|
||||
|
||||
=item B<--check-overload>
|
||||
|
||||
Uptime counter limit is 4294967296 and overflow.
|
||||
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
|
||||
|
||||
=item B<--reboot-window>
|
||||
|
||||
To be used with check-overload option. Time in milliseconds (default: 5000)
|
||||
You increase the chance of not missing a reboot if you decrease that value.
|
||||
|
||||
=item B<--unit>
|
||||
|
||||
Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes,
|
||||
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# Copyright 2023 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package hardware::ups::ees::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{modes} = {
|
||||
'system' => 'hardware::ups::ees::snmp::mode::system',
|
||||
'battery' => 'hardware::ups::ees::snmp::mode::battery',
|
||||
'input' => 'hardware::ups::ees::snmp::mode::input',
|
||||
'temperature' => 'hardware::ups::ees::snmp::mode::temperature',
|
||||
'rectifier' => 'hardware::ups::ees::snmp::mode::rectifier',
|
||||
'uptime' => 'hardware::ups::ees::snmp::mode::uptime'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Emerson Energy Systems (Vertiv) in SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue