mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-24 22:25:02 +02:00
add aeg acm devices plugins (#1147)
This commit is contained in:
parent
510cb88579
commit
f8c98b3834
180
hardware/devices/aeg/acm/snmp/mode/acstatus.pm
Normal file
180
hardware/devices/aeg/acm/snmp/mode/acstatus.pm
Normal file
@ -0,0 +1,180 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::acstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_threshold_output {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("AC plant fail status is '%s'", $self->{result_values}->{status});
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_acFail'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'acFail' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_threshold_output'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /true/i' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_status = (
|
||||
0 => 'false',
|
||||
1 => 'true',
|
||||
);
|
||||
|
||||
my $mapping_acm1000 = {
|
||||
acFail => { oid => '.1.3.6.1.4.1.15416.37.4.1', map => \%map_status },
|
||||
};
|
||||
my $mapping_acmi1000 = {
|
||||
acFail => { oid => '.1.3.6.1.4.1.15416.38.4.1', map => \%map_status },
|
||||
};
|
||||
my $oid_acm1000AcPlant = '.1.3.6.1.4.1.15416.37.4';
|
||||
my $oid_acmi1000AcPlant = '.1.3.6.1.4.1.15416.38.4';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_acm1000AcPlant },
|
||||
{ oid => $oid_acmi1000AcPlant },
|
||||
],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $result_acm1000 = $options{snmp}->map_instance(mapping => $mapping_acm1000, results => $self->{results}->{$oid_acm1000AcPlant}, instance => '0');
|
||||
my $result_acmi1000 = $options{snmp}->map_instance(mapping => $mapping_acmi1000, results => $self->{results}->{$oid_acmi1000AcPlant}, instance => '0');
|
||||
|
||||
foreach my $name (keys %{$mapping_acm1000}) {
|
||||
if (defined($result_acm1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acm1000->{$name};
|
||||
}
|
||||
}
|
||||
foreach my $name (keys %{$mapping_acmi1000}) {
|
||||
if (defined($result_acmi1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check AC plant status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: '').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} =~ /true/i').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
105
hardware/devices/aeg/acm/snmp/mode/alarmsstatus.pm
Normal file
105
hardware/devices/aeg/acm/snmp/mode/alarmsstatus.pm
Normal file
@ -0,0 +1,105 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::alarmsstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(simple|multiple)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
simple => [
|
||||
['true', 'CRITICAL'],
|
||||
['false', 'OK'],
|
||||
['on', 'CRITICAL'],
|
||||
['off', 'OK'],
|
||||
],
|
||||
multiple => [
|
||||
['true', 'CRITICAL'],
|
||||
['false', 'OK'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'hardware::devices::aeg::acm::snmp::mode::components';
|
||||
$self->{components_module} = ['simple', 'multiple'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_performance => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check alarms status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'alarm'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --filter=simple)
|
||||
Can also exclude specific instance: --filter=simple,3
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
|
||||
It used before default thresholds (order stays).
|
||||
Example: --threshold-overload='multiple,2,OK,true'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
300
hardware/devices/aeg/acm/snmp/mode/batterystatus.pm
Normal file
300
hardware/devices/aeg/acm/snmp/mode/batterystatus.pm
Normal file
@ -0,0 +1,300 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::batterystatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_threshold_output {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("Battery charging mode is '%s'", $self->{result_values}->{status});
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_battChargeMode'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'battChargeMode' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_threshold_output'),
|
||||
}
|
||||
},
|
||||
{ label => 'voltage', set => {
|
||||
key_values => [ { name => 'battVoltage' } ],
|
||||
output_template => 'Voltage : %s V',
|
||||
perfdatas => [
|
||||
{ label => 'voltage', value => 'battVoltage_absolute', template => '%s',
|
||||
unit => 'V' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'current', set => {
|
||||
key_values => [ { name => 'battCurrent' } ],
|
||||
output_template => 'Current : %s A',
|
||||
perfdatas => [
|
||||
{ label => 'current', value => 'battCurrent_absolute', template => '%s',
|
||||
min => 0, unit => 'A' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'current1', set => {
|
||||
key_values => [ { name => 'battCurrent1' } ],
|
||||
output_template => 'Current 1 : %s A',
|
||||
perfdatas => [
|
||||
{ label => 'current1', value => 'battCurrent1_absolute', template => '%s',
|
||||
min => 0, unit => 'A' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'current2', set => {
|
||||
key_values => [ { name => 'battCurrent2' } ],
|
||||
output_template => 'Current 2 : %s A',
|
||||
perfdatas => [
|
||||
{ label => 'current2', value => 'battCurrent2_absolute', template => '%s',
|
||||
min => 0, unit => 'A' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'temperature', set => {
|
||||
key_values => [ { name => 'battTemp' } ],
|
||||
output_template => 'Temperature : %s C',
|
||||
perfdatas => [
|
||||
{ label => 'temperature', value => 'battTemp_absolute', template => '%s',
|
||||
unit => 'C'},
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'temperature1', set => {
|
||||
key_values => [ { name => 'battTemp1' } ],
|
||||
output_template => 'Temperature 1 : %s C',
|
||||
perfdatas => [
|
||||
{ label => 'temperature1', value => 'battTemp1_absolute', template => '%s',
|
||||
unit => 'C'},
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'temperature2', set => {
|
||||
key_values => [ { name => 'battTemp2' } ],
|
||||
output_template => 'Temperature 2 : %s C',
|
||||
perfdatas => [
|
||||
{ label => 'temperature2', value => 'battTemp2_absolute', template => '%s',
|
||||
unit => 'C'},
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'amphourmeter', set => {
|
||||
key_values => [ { name => 'battAmpHMeter' } ],
|
||||
output_template => 'Amp Hour Meter : %s %%',
|
||||
perfdatas => [
|
||||
{ label => 'amphourmeter', value => 'battAmpHMeter_absolute', template => '%s',
|
||||
unit => '%'},
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '%{status} =~ /onBattery/i' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /disconnected/i || %{status} =~ /shutdown/i' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_battery_mode = (
|
||||
0 => 'initial',
|
||||
1 => 'float',
|
||||
2 => 'highRate',
|
||||
3 => 'dischargeTest',
|
||||
4 => 'presenceTest',
|
||||
5 => 'disconnected',
|
||||
6 => 'onBattery',
|
||||
7 => 'shutdown',
|
||||
8 => 'fallback',
|
||||
9 => 'inhibited',
|
||||
);
|
||||
|
||||
my $mapping_acm1000 = {
|
||||
battChargeMode => { oid => '.1.3.6.1.4.1.15416.37.1.1', map => \%map_battery_mode },
|
||||
battVoltage => { oid => '.1.3.6.1.4.1.15416.37.1.2', divider => '100' },
|
||||
battCurrent => { oid => '.1.3.6.1.4.1.15416.37.1.3', divider => '100' },
|
||||
battTemp => { oid => '.1.3.6.1.4.1.15416.37.1.4', divider => '100' },
|
||||
battAmpHMeter => { oid => '.1.3.6.1.4.1.15416.37.1.5' },
|
||||
};
|
||||
my $mapping_acmi1000 = {
|
||||
battChargeMode => { oid => '.1.3.6.1.4.1.15416.38.1.1', map => \%map_battery_mode },
|
||||
battVoltage => { oid => '.1.3.6.1.4.1.15416.38.1.2', divider => '100' },
|
||||
battCurrent1 => { oid => '.1.3.6.1.4.1.15416.38.1.4', divider => '100' },
|
||||
battCurrent2 => { oid => '.1.3.6.1.4.1.15416.38.1.5', divider => '100' },
|
||||
battTemp1 => { oid => '.1.3.6.1.4.1.15416.38.1.7', divider => '100' },
|
||||
battTemp2 => { oid => '.1.3.6.1.4.1.15416.38.1.8', divider => '100' },
|
||||
battAmpHMeter => { oid => '.1.3.6.1.4.1.15416.38.1.9' },
|
||||
};
|
||||
my $mapping_acm1d = {
|
||||
battVoltage => { oid => '.1.3.6.1.4.1.15416.29.1.1' },
|
||||
battCurrent => { oid => '.1.3.6.1.4.1.15416.29.1.2' },
|
||||
battTemp => { oid => '.1.3.6.1.4.1.15416.29.1.3' },
|
||||
};
|
||||
my $oid_acm1000Battery = '.1.3.6.1.4.1.15416.37.1';
|
||||
my $oid_acmi1000Battery = '.1.3.6.1.4.1.15416.38.1';
|
||||
my $oid_acm1dBattery = '.1.3.6.1.4.1.15416.29.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_acm1000Battery },
|
||||
{ oid => $oid_acmi1000Battery },
|
||||
{ oid => $oid_acm1dBattery },
|
||||
],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $result_acm1000 = $options{snmp}->map_instance(mapping => $mapping_acm1000, results => $self->{results}->{$oid_acm1000Battery}, instance => '0');
|
||||
my $result_acmi1000 = $options{snmp}->map_instance(mapping => $mapping_acmi1000, results => $self->{results}->{$oid_acmi1000Battery}, instance => '0');
|
||||
my $result_acm1d = $options{snmp}->map_instance(mapping => $mapping_acm1d, results => $self->{results}->{$oid_acm1dBattery}, instance => '0');
|
||||
|
||||
foreach my $name (keys %{$mapping_acm1000}) {
|
||||
if (defined($result_acm1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acm1000->{$name};
|
||||
$self->{global}->{$name} = $result_acm1000->{$name} / $mapping_acm1000->{$name}->{divider} if defined($mapping_acm1000->{$name}->{divider});
|
||||
}
|
||||
}
|
||||
foreach my $name (keys %{$mapping_acmi1000}) {
|
||||
if (defined($result_acmi1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name};
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name} / $mapping_acmi1000->{$name}->{divider} if defined($mapping_acmi1000->{$name}->{divider});
|
||||
}
|
||||
}
|
||||
foreach my $name (keys %{$mapping_acm1d}) {
|
||||
$self->{global}->{$name} = $result_acm1d->{$name} unless (!defined($result_acm1d->{$name}));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check battery charging mode and power statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^status|current$'
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{status} =~ /onBattery/i').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} =~ /disconnected/i || %{status} =~ /shutdown/i').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'voltage', 'current', 'current1', 'current2', 'temperature',
|
||||
'temperature2', 'temperature2', 'amphourmeter'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'voltage', 'current', 'current1', 'current2', 'temperature',
|
||||
'temperature2', 'temperature2', 'amphourmeter'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
82
hardware/devices/aeg/acm/snmp/mode/components/multiple.pm
Normal file
82
hardware/devices/aeg/acm/snmp/mode/components/multiple.pm
Normal file
@ -0,0 +1,82 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::components::multiple;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status_1000 = (0 => 'false', 1 => 'true');
|
||||
|
||||
my $mapping_acm1000 = {
|
||||
label => { oid => '.1.3.6.1.4.1.15416.37.8.2.1.2' },
|
||||
active => { oid => '.1.3.6.1.4.1.15416.37.8.2.1.3', map => \%map_status_1000 },
|
||||
};
|
||||
my $mapping_acmi1000 = {
|
||||
label => { oid => '.1.3.6.1.4.1.15416.38.8.2.1.2' },
|
||||
active => { oid => '.1.3.6.1.4.1.15416.38.8.2.1.3', map => \%map_status_1000 },
|
||||
};
|
||||
|
||||
my $oid_multAlarmTableEntryAcm1000 = '.1.3.6.1.4.1.15416.37.8.2.1';
|
||||
my $oid_multAlarmTableEntryAcmi1000 = '.1.3.6.1.4.1.15416.38.8.2.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_multAlarmTableEntryAcm1000 },
|
||||
{ oid => $oid_multAlarmTableEntryAcmi1000 };
|
||||
}
|
||||
|
||||
sub check_alarms {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$options{entry}}})) {
|
||||
next if ($oid !~ /^$options{mapping}->{label}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $self->{results}->{$options{entry}}, instance => $instance);
|
||||
|
||||
next if (centreon::plugins::misc::trim($result->{label}) eq '');
|
||||
next if ($self->check_filter(section => 'multiple', instance => $instance));
|
||||
$self->{components}->{multiple}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Multiple alarm '%s' status is '%s' [instance = %s]",
|
||||
centreon::plugins::misc::trim($result->{label}),
|
||||
$result->{active}, $instance));
|
||||
|
||||
my $exit = $self->get_severity(section => 'multiple', instance => $instance, value => $result->{active});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Multiple alarm '%s' status is '%s'", centreon::plugins::misc::trim($result->{label}), $result->{active}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking multiple alarms");
|
||||
$self->{components}->{multiple} = {name => 'multiple alarms', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'multiple'));
|
||||
|
||||
check_alarms($self, entry => $oid_multAlarmTableEntryAcm1000, mapping => $mapping_acm1000);
|
||||
check_alarms($self, entry => $oid_multAlarmTableEntryAcmi1000, mapping => $mapping_acmi1000);
|
||||
}
|
||||
|
||||
1;
|
90
hardware/devices/aeg/acm/snmp/mode/components/simple.pm
Normal file
90
hardware/devices/aeg/acm/snmp/mode/components/simple.pm
Normal file
@ -0,0 +1,90 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::components::simple;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status_1000 = (0 => 'false', 1 => 'true');
|
||||
my %map_status_1d = (0 => 'off', 1 => 'on');
|
||||
|
||||
my $mapping_acm1000 = {
|
||||
label => { oid => '.1.3.6.1.4.1.15416.37.8.1.1.2' },
|
||||
active => { oid => '.1.3.6.1.4.1.15416.37.8.1.1.3', map => \%map_status_1000 },
|
||||
};
|
||||
my $mapping_acmi1000 = {
|
||||
label => { oid => '.1.3.6.1.4.1.15416.38.8.1.1.2' },
|
||||
active => { oid => '.1.3.6.1.4.1.15416.38.8.1.1.3', map => \%map_status_1000 },
|
||||
};
|
||||
my $mapping_acm1d = {
|
||||
label => { oid => '.1.3.6.1.4.1.15416.29.8.1.4' },
|
||||
active => { oid => '.1.3.6.1.4.1.15416.29.8.1.3', map => \%map_status_1d },
|
||||
};
|
||||
|
||||
my $oid_simpleAlarmTableEntryAcm1000 = '.1.3.6.1.4.1.15416.37.8.1.1';
|
||||
my $oid_simpleAlarmTableEntryAcmi1000 = '.1.3.6.1.4.1.15416.38.8.1.1';
|
||||
my $oid_simpleAlarmTableEntryAcm1d = '.1.3.6.1.4.1.15416.29.8.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_simpleAlarmTableEntryAcm1000 },
|
||||
{ oid => $oid_simpleAlarmTableEntryAcmi1000 },
|
||||
{ oid => $oid_simpleAlarmTableEntryAcm1d };
|
||||
}
|
||||
|
||||
sub check_alarms {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$options{entry}}})) {
|
||||
next if ($oid !~ /^$options{mapping}->{label}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $self->{results}->{$options{entry}}, instance => $instance);
|
||||
|
||||
next if (centreon::plugins::misc::trim($result->{label}) eq '');
|
||||
next if ($self->check_filter(section => 'simple', instance => $instance));
|
||||
$self->{components}->{simple}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Simple alarm '%s' status is '%s' [instance = %s]",
|
||||
centreon::plugins::misc::trim($result->{label}),
|
||||
$result->{active}, $instance));
|
||||
|
||||
my $exit = $self->get_severity(section => 'simple', instance => $instance, value => $result->{active});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Simple alarm '%s' status is '%s'", centreon::plugins::misc::trim($result->{label}), $result->{active}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking simple alarms");
|
||||
$self->{components}->{simple} = {name => 'simple alarms', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'simple'));
|
||||
|
||||
check_alarms($self, entry => $oid_simpleAlarmTableEntryAcm1000, mapping => $mapping_acm1000);
|
||||
check_alarms($self, entry => $oid_simpleAlarmTableEntryAcmi1000, mapping => $mapping_acmi1000);
|
||||
check_alarms($self, entry => $oid_simpleAlarmTableEntryAcm1d, mapping => $mapping_acm1d);
|
||||
}
|
||||
|
||||
1;
|
160
hardware/devices/aeg/acm/snmp/mode/loadstatus.pm
Normal file
160
hardware/devices/aeg/acm/snmp/mode/loadstatus.pm
Normal file
@ -0,0 +1,160 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::loadstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'voltage', set => {
|
||||
key_values => [ { name => 'loadVoltage' } ],
|
||||
output_template => 'Voltage : %s V',
|
||||
perfdatas => [
|
||||
{ label => 'voltage', value => 'loadVoltage_absolute', template => '%s',
|
||||
unit => 'V' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'current', set => {
|
||||
key_values => [ { name => 'loadCurrent' } ],
|
||||
output_template => 'Current : %s A',
|
||||
perfdatas => [
|
||||
{ label => 'current', value => 'loadCurrent_absolute', template => '%s',
|
||||
min => 0, unit => 'A' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'power', set => {
|
||||
key_values => [ { name => 'loadPower' } ],
|
||||
output_template => 'Power : %s W',
|
||||
perfdatas => [
|
||||
{ label => 'power', value => 'loadPower_absolute', template => '%s',
|
||||
unit => 'w'},
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $mapping_acm1000 = {
|
||||
loadVoltage => { oid => '.1.3.6.1.4.1.15416.37.3.1', divider => '100' },
|
||||
loadCurrent => { oid => '.1.3.6.1.4.1.15416.37.3.2', divider => '100' },
|
||||
loadPower => { oid => '.1.3.6.1.4.1.15416.37.3.3' },
|
||||
};
|
||||
my $mapping_acmi1000 = {
|
||||
loadVoltage => { oid => '.1.3.6.1.4.1.15416.38.3.1', divider => '100' },
|
||||
loadCurrent => { oid => '.1.3.6.1.4.1.15416.38.3.2', divider => '100' },
|
||||
loadPower => { oid => '.1.3.6.1.4.1.15416.38.3.3' },
|
||||
};
|
||||
my $mapping_acm1d = {
|
||||
loadVoltage => { oid => '.1.3.6.1.4.1.15416.29.4.1' },
|
||||
loadCurrent => { oid => '.1.3.6.1.4.1.15416.29.4.2' },
|
||||
};
|
||||
my $oid_acm1000Load = '.1.3.6.1.4.1.15416.37.3';
|
||||
my $oid_acmi1000Load = '.1.3.6.1.4.1.15416.38.3';
|
||||
my $oid_acm1dLoad = '.1.3.6.1.4.1.15416.29.4';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_acm1000Load },
|
||||
{ oid => $oid_acmi1000Load },
|
||||
{ oid => $oid_acm1dLoad },
|
||||
],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $result_acm1000 = $options{snmp}->map_instance(mapping => $mapping_acm1000, results => $self->{results}->{$oid_acm1000Load}, instance => '0');
|
||||
my $result_acmi1000 = $options{snmp}->map_instance(mapping => $mapping_acmi1000, results => $self->{results}->{$oid_acmi1000Load}, instance => '0');
|
||||
my $result_acm1d = $options{snmp}->map_instance(mapping => $mapping_acm1d, results => $self->{results}->{$oid_acm1dLoad}, instance => '0');
|
||||
|
||||
foreach my $name (keys %{$mapping_acm1000}) {
|
||||
if (defined($result_acm1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acm1000->{$name};
|
||||
$self->{global}->{$name} = $result_acm1000->{$name} / $mapping_acm1000->{$name}->{divider} if defined($mapping_acm1000->{$name}->{divider});
|
||||
}
|
||||
}
|
||||
foreach my $name (keys %{$mapping_acmi1000}) {
|
||||
if (defined($result_acmi1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name};
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name} / $mapping_acmi1000->{$name}->{divider} if defined($mapping_acmi1000->{$name}->{divider});
|
||||
}
|
||||
}
|
||||
foreach my $name (keys %{$mapping_acm1d}) {
|
||||
$self->{global}->{$name} = $result_acm1d->{$name} unless (!defined($result_acm1d->{$name}));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check load plant statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^current$'
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'voltage', 'current', 'power'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'voltage', 'current', 'power'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
254
hardware/devices/aeg/acm/snmp/mode/rectifierstatus.pm
Normal file
254
hardware/devices/aeg/acm/snmp/mode/rectifierstatus.pm
Normal file
@ -0,0 +1,254 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::snmp::mode::rectifierstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_threshold_output {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_status}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_status}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("status is '%s'", $self->{result_values}->{status});
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_rectState'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub prefix_rect_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Rectifier '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'rect', type => 1, cb_prefix_output => 'prefix_rect_output', message_multiple => 'All rectifiers are ok', skipped_code => { -10 => 1 } },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'voltage', set => {
|
||||
key_values => [ { name => 'rectVoltage' } ],
|
||||
output_template => 'Voltage : %s V',
|
||||
perfdatas => [
|
||||
{ label => 'voltage', value => 'rectVoltage_absolute', template => '%s',
|
||||
unit => 'V' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'current', set => {
|
||||
key_values => [ { name => 'rectCurrent' } ],
|
||||
output_template => 'Current : %s A',
|
||||
perfdatas => [
|
||||
{ label => 'current', value => 'rectCurrent_absolute', template => '%s',
|
||||
min => 0, unit => 'A' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'faulty-count', set => {
|
||||
key_values => [ { name => 'nbrOfFaultyRect' } ],
|
||||
output_template => 'Faulty rectifiers : %s',
|
||||
perfdatas => [
|
||||
{ label => 'faulty_count', value => 'nbrOfFaultyRect_absolute', template => '%s',
|
||||
min => 0, unit => '' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{rect} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'rectState' }, { name => 'display' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_threshold_output'),
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /ok|notInstalled/i' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$instance_mode = $self;
|
||||
$self->change_macros();
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_status', 'critical_status')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %map_state = (
|
||||
1 => 'ok',
|
||||
255 => 'notInstalled',
|
||||
);
|
||||
|
||||
my $mapping_acm1000 = {
|
||||
rectVoltage => { oid => '.1.3.6.1.4.1.15416.37.2.1', divider => '100' },
|
||||
rectCurrent => { oid => '.1.3.6.1.4.1.15416.37.2.2', divider => '100' },
|
||||
nbrOfFaultyRect => { oid => '.1.3.6.1.4.1.15416.37.2.4' },
|
||||
};
|
||||
my $mapping_acmi1000 = {
|
||||
rectVoltage => { oid => '.1.3.6.1.4.1.15416.38.2.1', divider => '100' },
|
||||
rectCurrent => { oid => '.1.3.6.1.4.1.15416.38.2.2', divider => '100' },
|
||||
nbrOfFaultyRect => { oid => '.1.3.6.1.4.1.15416.38.2.4' },
|
||||
};
|
||||
my $mapping_acm1d = {
|
||||
rectState => { oid => '.1.3.6.1.4.1.15416.29.3.1.2' },
|
||||
};
|
||||
my $oid_acm1000DcPlant = '.1.3.6.1.4.1.15416.37.2';
|
||||
my $oid_acmi1000DcPlant = '.1.3.6.1.4.1.15416.38.2';
|
||||
my $oid_acm1dRectEntry = '.1.3.6.1.4.1.15416.29.3.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{rect} = {};
|
||||
$self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_acm1000DcPlant },
|
||||
{ oid => $oid_acmi1000DcPlant },
|
||||
{ oid => $oid_acm1dRectEntry },
|
||||
],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $result_acm1000 = $options{snmp}->map_instance(mapping => $mapping_acm1000, results => $self->{results}->{$oid_acm1000DcPlant}, instance => '0');
|
||||
my $result_acmi1000 = $options{snmp}->map_instance(mapping => $mapping_acmi1000, results => $self->{results}->{$oid_acmi1000DcPlant}, instance => '0');
|
||||
|
||||
foreach my $name (keys %{$mapping_acm1000}) {
|
||||
if (defined($result_acm1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acm1000->{$name};
|
||||
$self->{global}->{$name} = $result_acm1000->{$name} / $mapping_acm1000->{$name}->{divider} if defined($mapping_acm1000->{$name}->{divider});
|
||||
}
|
||||
}
|
||||
foreach my $name (keys %{$mapping_acmi1000}) {
|
||||
if (defined($result_acmi1000->{$name})) {
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name};
|
||||
$self->{global}->{$name} = $result_acmi1000->{$name} / $mapping_acmi1000->{$name}->{divider} if defined($mapping_acmi1000->{$name}->{divider});
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $oid (keys %{$self->{results}->{$oid_acm1dRectEntry}}) {
|
||||
next if ($oid !~ /^$mapping_acm1d->{rectState}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
|
||||
$self->{rect}->{$instance} = {
|
||||
rectState => $map_state{$self->{results}->{$oid_acm1dRectEntry}->{$mapping_acm1d->{rectState}->{oid} . '.' . $instance}},
|
||||
display => $instance
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check rectifiers status and statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^status|current$'
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: '').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} !~ /ok|notInstalled/i').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'voltage', 'current', 'faulty-count'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'voltage', 'current', 'faulty-count'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
52
hardware/devices/aeg/acm/snmp/plugin.pm
Normal file
52
hardware/devices/aeg/acm/snmp/plugin.pm
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright 2018 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::devices::aeg::acm::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->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'ac-status' => 'hardware::devices::aeg::acm::snmp::mode::acstatus',
|
||||
'alarms-status' => 'hardware::devices::aeg::acm::snmp::mode::alarmsstatus',
|
||||
'battery-status' => 'hardware::devices::aeg::acm::snmp::mode::batterystatus',
|
||||
'load-status' => 'hardware::devices::aeg::acm::snmp::mode::loadstatus',
|
||||
'rectifier-status' => 'hardware::devices::aeg::acm::snmp::mode::rectifierstatus',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check AEG ACM modules in SNMP.
|
||||
|
||||
=cut
|
Loading…
x
Reference in New Issue
Block a user