From 91cf2210614145ee112861e59b281ef5e19fa42f Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 2 Jan 2020 16:28:40 +0100 Subject: [PATCH] add phoenixtec power plugin snmp --- .../common/xppc/snmp/mode/batterystatus.pm | 176 ++++++++++++++++++ centreon/common/xppc/snmp/mode/environment.pm | 157 ++++++++++++++++ centreon/common/xppc/snmp/mode/inputlines.pm | 110 +++++++++++ centreon/common/xppc/snmp/mode/outputlines.pm | 168 +++++++++++++++++ hardware/ups/hp/snmp/mode/outputlines.pm | 8 +- hardware/ups/phoenixtec/snmp/plugin.pm | 50 +++++ 6 files changed, 665 insertions(+), 4 deletions(-) create mode 100644 centreon/common/xppc/snmp/mode/batterystatus.pm create mode 100644 centreon/common/xppc/snmp/mode/environment.pm create mode 100644 centreon/common/xppc/snmp/mode/inputlines.pm create mode 100644 centreon/common/xppc/snmp/mode/outputlines.pm create mode 100644 hardware/ups/phoenixtec/snmp/plugin.pm diff --git a/centreon/common/xppc/snmp/mode/batterystatus.pm b/centreon/common/xppc/snmp/mode/batterystatus.pm new file mode 100644 index 000000000..199767cb8 --- /dev/null +++ b/centreon/common/xppc/snmp/mode/batterystatus.pm @@ -0,0 +1,176 @@ +# +# Copyright 2019 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 centreon::common::xppc::snmp::mode::batterystatus; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc); + +sub custom_status_output { + my ($self, %options) = @_; + + my $msg = sprintf("battery status is '%s'", $self->{result_values}->{status}); + return $msg; +} + +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 => 'status' } ], + closure_custom_calc => \&catalog_status_calc, + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold, + } + }, + { label => 'charge-remaining', , nlabel => 'battery.charge.remaining.percent', set => { + key_values => [ { name => 'upsSmartBatteryCapacity' } ], + output_template => 'remaining capacity: %s %%', + perfdatas => [ + { value => 'upsSmartBatteryCapacity_absolute', template => '%s', min => 0, max => 100, unit => '%' }, + ], + } + }, + { label => 'charge-remaining-minutes', nlabel => 'battery.charge.remaining.minutes', display_ok => 0, set => { + key_values => [ { name => 'upsSmartBatteryRunTimeRemaining' } ], + output_template => 'remaining time: %s minutes', + perfdatas => [ + { value => 'upsSmartBatteryRunTimeRemaining_absolute', template => '%s', min => 0, unit => 'm' }, + ], + } + }, + { label => 'voltage', nlabel => 'battery.voltage.volt', display_ok => 0, set => { + key_values => [ { name => 'upsSmartBatteryVoltage', no_value => 0 } ], + output_template => 'voltage: %s V', + perfdatas => [ + { value => 'upsSmartBatteryVoltage_absolute', template => '%s', unit => 'V' }, + ], + } + }, + { label => 'temperature', nlabel => 'battery.temperature.celsius', display_ok => 0, set => { + key_values => [ { name => 'upsSmartBatteryTemperature', no_value => 0 } ], + output_template => 'temperature: %s C', + perfdatas => [ + { value => 'upsSmartBatteryTemperature_absolute', template => '%s', unit => 'C' }, + ], + } + }, + ]; +} + +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 => { + 'unknown-status:s' => { name => 'unknown_status', default => '%{status} =~ /unknown/i' }, + 'warning-status:s' => { name => 'warning_status', default => '%{status} =~ /low/i' }, + 'critical-status:s' => { name => 'critical_status', default => '' }, + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + $self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']); +} + +my $map_battery_status = { + 1 => 'unknown', 2 => 'normal', 3 => 'low' +}; + +my $mapping = { + batteryNormal => { oid => '.1.3.6.1.4.1.935.1.1.1.2.1.1', map => $map_battery_status }, + upsSmartBatteryVoltage => { oid => '.1.3.6.1.4.1.935.1.1.1.2.2.2' }, # in dV + upsSmartBatteryTemperature => { oid => '.1.3.6.1.4.1.935.1.1.1.2.2.3' }, # in tenth of celsius + upsSmartBatteryRunTimeRemaining => { oid => '.1.3.6.1.4.1.935.1.1.1.2.2.4' }, # in seconds + upsSmartBatteryCapacity => { oid => '.1.3.6.1.4.1.935.1.1.1.2.2.1' }, +}; + +sub manage_selection { + my ($self, %options) = @_; + + my $snmp_result = $options{snmp}->get_leef( + oids => [ map($_->{oid} . '.0', values(%$mapping)) ], + nothing_quit => 1 + ); + + my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => '0'); + $result->{upsSmartBatteryVoltage} = defined($result->{upsSmartBatteryVoltage}) ? $result->{upsSmartBatteryVoltage} * 0.1 : 0; + $result->{upsSmartBatteryTemperature} = defined($result->{upsSmartBatteryTemperature}) ? $result->{upsSmartBatteryTemperature} * 0.1 : 0; + $result->{upsSmartBatteryRunTimeRemaining} = + defined($result->{upsSmartBatteryRunTimeRemaining}) && $result->{upsSmartBatteryRunTimeRemaining} != 0 ? int($result->{upsSmartBatteryRunTimeRemaining} / 60) : undef; + $result->{status} = $result->{batteryNormal}; + + $self->{global} = $result; +} + +1; + +__END__ + +=head1 MODE + +Check battery status. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='status|current' + +=item B<--unknown-status> + +Set unknown threshold for status (Default: '%{status} =~ /unknown/i'). +Can used special variables like: %{status}. + +=item B<--warning-status> + +Set warning threshold for status (Default: '%{status} =~ /low/i'). +Can used special variables like: %{status}. + +=item B<--critical-status> + +Set critical threshold for status (Default: ''). +Can used special variables like: %{status}. + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: Can be: 'charge-remaining' (%), 'charge-remaining-minutes', +'temperature' (C), 'voltage' (V). + +=back + +=cut diff --git a/centreon/common/xppc/snmp/mode/environment.pm b/centreon/common/xppc/snmp/mode/environment.pm new file mode 100644 index 000000000..ef4a844d3 --- /dev/null +++ b/centreon/common/xppc/snmp/mode/environment.pm @@ -0,0 +1,157 @@ +# +# Copyright 2019 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::hp::snmp::mode::environment; + +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 => 'internal-temperature', nlabel => 'environment.internal.temperature.celsius', set => { + key_values => [ { name => 'internal_temperature' } ], + output_template => 'internal temperature: %.2f C', + perfdatas => [ + { value => 'internal_temperature_absolute', template => '%.2f', + min => 0, unit => 'C' }, + ], + } + }, + { label => 'internal-humidity', nlabel => 'environment.internal.humidity.percentage', set => { + key_values => [ { name => 'internal_humidity' } ], + output_template => 'internal humidity: %.2f %%', + perfdatas => [ + { value => 'internal_humidity_absolute', template => '%.2f', + min => 0, max => 100, unit => '%' }, + ], + } + }, + { label => 'remote-temperature', nlabel => 'environment.remote.temperature.celsius', set => { + key_values => [ { name => 'remote_temperature' } ], + output_template => 'remote temperature: %.2f C', + perfdatas => [ + { value => 'remote_temperature_absolute', template => '%.2f', + min => 0, unit => 'C' }, + ], + } + }, + { label => 'remote-humidity', nlabel => 'environment.remote.humidity.percentage', set => { + key_values => [ { name => 'internal_humidity' } ], + output_template => 'remote humidity: %.2f %%', + perfdatas => [ + { value => 'remote_humidity_absolute', 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; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + my $oids = { + upsEnvAmbientTemp => '.1.3.6.1.4.1.232.165.3.6.1.0', + upsEnvAmbientLowerLimit => '.1.3.6.1.4.1.232.165.3.6.2.0', + upsEnvAmbientUpperLimit => '.1.3.6.1.4.1.232.165.3.6.3.0', + upsEnvAmbientHumidity => '.1.3.6.1.4.1.232.165.3.6.4.0', + upsEnvRemoteTemp => '.1.3.6.1.4.1.232.165.3.6.5.0', + upsEnvRemoteHumidity => '.1.3.6.1.4.1.232.165.3.6.6.0', + upsEnvRemoteTempLowerLimit => '.1.3.6.1.4.1.232.165.3.6.9.0', + upsEnvRemoteTempUpperLimit => '.1.3.6.1.4.1.232.165.3.6.10.0', + upsEnvRemoteHumidityLowerLimit => '.1.3.6.1.4.1.232.165.3.6.11.0', + upsEnvRemoteHumidityUpperLimit => '.1.3.6.1.4.1.232.165.3.6.12.0', + }; + my $snmp_result = $options{snmp}->get_leef( + oids => [ values %$oids ], + nothing_quit => 1 + ); + + $self->{global} = { + internal_temperature => defined($snmp_result->{$oids->{upsEnvAmbientTemp}}) && $snmp_result->{$oids->{upsEnvAmbientTemp}} ne '' && $snmp_result->{$oids->{upsEnvAmbientTemp}} != 0 ? + $snmp_result->{$oids->{upsEnvAmbientTemp}} : undef, + internal_humidity => defined($snmp_result->{$oids->{upsEnvAmbientHumidity}}) && $snmp_result->{$oids->{upsEnvAmbientHumidity}} ne '' && $snmp_result->{$oids->{upsEnvAmbientHumidity}} != 0 ? + $snmp_result->{$oids->{upsEnvAmbientHumidity}} : undef, + remote_temperature => defined($snmp_result->{$oids->{upsEnvRemoteTemp}}) && $snmp_result->{$oids->{upsEnvRemoteTemp}} ne '' && $snmp_result->{$oids->{upsEnvRemoteTemp}} != 0 ? + $snmp_result->{$oids->{upsEnvRemoteTemp}} : undef, + remote_humidity => defined($snmp_result->{$oids->{upsEnvRemoteHumidity}}) && $snmp_result->{$oids->{upsEnvRemoteHumidity}} ne '' && $snmp_result->{$oids->{upsEnvRemoteHumidity}} != 0 ? + $snmp_result->{$oids->{upsEnvRemoteHumidity}} : undef, + }; + + if (!defined($self->{option_results}->{'critical-environment-internal-temperature-celsius'}) || $self->{option_results}->{'critical-environment-internal-temperature-celsius'} eq '') { + my $crit_val = ''; + $crit_val = $snmp_result->{$oids->{upsEnvAmbientLowerLimit}} . ':' + if (defined($snmp_result->{$oids->{upsEnvAmbientLowerLimit}}) && + $snmp_result->{$oids->{upsEnvAmbientLowerLimit}} ne '' && $snmp_result->{$oids->{upsEnvAmbientLowerLimit}} != 0); + $crit_val .= $snmp_result->{$oids->{upsEnvAmbientUpperLimit}} + if (defined($snmp_result->{$oids->{upsEnvAmbientUpperLimit}}) && + $snmp_result->{$oids->{upsEnvAmbientUpperLimit}} ne '' && $snmp_result->{$oids->{upsEnvAmbientUpperLimit}} != 0); + $self->{perfdata}->threshold_validate(label => 'critical-environment-internal-temperature-celsius', value => $crit_val); + } + + if (!defined($self->{option_results}->{'critical-environment-remote-temperature-celsius'}) || $self->{option_results}->{'critical-environment-remote-temperature-celsius'} eq '') { + my $crit_val = ''; + $crit_val = $snmp_result->{$oids->{upsEnvRemoteTempLowerLimit}} . ':' + if (defined($snmp_result->{$oids->{upsEnvRemoteTempLowerLimit}}) && + $snmp_result->{$oids->{upsEnvRemoteTempLowerLimit}} ne '' && $snmp_result->{$oids->{upsEnvRemoteTempLowerLimit}} != 0); + $crit_val .= $snmp_result->{$oids->{upsEnvRemoteTempUpperLimit}} + if (defined($snmp_result->{$oids->{upsEnvRemoteTempUpperLimit}}) && + $snmp_result->{$oids->{upsEnvRemoteTempUpperLimit}} ne '' && $snmp_result->{$oids->{upsEnvRemoteTempUpperLimit}} != 0); + $self->{perfdata}->threshold_validate(label => 'critical-environment-remote-temperature-celsius', value => $crit_val); + } +} + +1; + +__END__ + +=head1 MODE + +Check environment. + +=over 8 + +=item B<--warning-*> B<--critical-*> + +Can be: 'internal-temperature', 'internal-humidity', +'remote-temperature', 'remote-humidity'. + +=back + +=cut diff --git a/centreon/common/xppc/snmp/mode/inputlines.pm b/centreon/common/xppc/snmp/mode/inputlines.pm new file mode 100644 index 000000000..842f082e2 --- /dev/null +++ b/centreon/common/xppc/snmp/mode/inputlines.pm @@ -0,0 +1,110 @@ +# +# Copyright 2019 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 centreon::common::xppc::snmp::mode::inputlines; + +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, cb_prefix_output => 'prefix_global_output', skipped_code => { -10 => 1 } }, + ]; + + $self->{maps_counters}->{global} = [ + { label => 'frequence', nlabel => 'lines.input.frequence.hertz', set => { + key_values => [ { name => 'upsSmartInputFrequency', no_value => 0 } ], + output_template => 'frequence: %.2f Hz', + perfdatas => [ + { value => 'upsSmartInputFrequency_absolute', template => '%.2f', + unit => 'Hz' }, + ], + } + }, + { label => 'voltage', nlabel => 'lines.input.voltage.volt', set => { + key_values => [ { name => 'upsSmartInputLineVoltage', no_value => 0 } ], + output_template => 'voltage: %s V', + perfdatas => [ + { value => 'upsSmartInputLineVoltage_absolute', template => '%s', + unit => 'V' }, + ], + } + }, + ]; +} + +sub prefix_global_output { + my ($self, %options) = @_; + + return 'Input lines '; +} + +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; +} + +my $mapping = { + upsSmartInputLineVoltage => { oid => '.1.3.6.1.4.1.935.1.1.1.3.2.1' }, # in dV + upsSmartInputFrequency => { oid => '.1.3.6.1.4.1.935.1.1.1.3.2.4' }, # in tenth of Hz +}; + +sub manage_selection { + my ($self, %options) = @_; + + my $snmp_result = $options{snmp}->get_leef( + oids => [ map($_->{oid} . '.0', values(%$mapping)) ], + nothing_quit => 1 + ); + + my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => '0'); + $result->{upsSmartInputLineVoltage} = defined($result->{upsSmartInputLineVoltage}) ? $result->{upsSmartInputLineVoltage} * 0.1 : 0; + $result->{upsSmartInputFrequency} = defined($result->{upsSmartInputFrequency}) ? $result->{upsSmartInputFrequency} * 0.1 : 0; + $self->{global} = $result; +} + +1; + +__END__ + +=head1 MODE + +Check input lines metrics. + +=over 8 + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'frequence', 'voltage'. + +=back + +=cut diff --git a/centreon/common/xppc/snmp/mode/outputlines.pm b/centreon/common/xppc/snmp/mode/outputlines.pm new file mode 100644 index 000000000..3785fe681 --- /dev/null +++ b/centreon/common/xppc/snmp/mode/outputlines.pm @@ -0,0 +1,168 @@ +# +# Copyright 2019 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 centreon::common::xppc::snmp::mode::outputlines; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc); + +sub custom_status_output { + my ($self, %options) = @_; + + return sprintf("status is '%s'", $self->{result_values}->{status}); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, cb_prefix_output => 'prefix_global_output', skipped_code => { -10 => 1 } }, + ]; + + $self->{maps_counters}->{global} = [ + { label => 'status', threshold => 0, set => { + key_values => [ { name => 'status' } ], + closure_custom_calc => \&catalog_status_calc, + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold, + } + }, + { label => 'load', nlabel => 'lines.output.load.percentage', set => { + key_values => [ { name => 'upsSmartOutputLoad', no_value => -1 } ], + output_template => 'load: %.2f %%', + perfdatas => [ + { value => 'upsSmartOutputLoad_absolute', template => '%.2f', min => 0, max => 100 }, + ], + } + }, + { label => 'frequence', nlabel => 'lines.output.frequence.hertz', set => { + key_values => [ { name => 'upsSmartOutputFrequency', no_value => 0 } ], + output_template => 'frequence: %.2f Hz', + perfdatas => [ + { value => 'upsSmartOutputFrequency_absolute', template => '%.2f', unit => 'Hz' }, + ], + } + }, + { label => 'voltage', nlabel => 'lines.output.voltage.volt', set => { + key_values => [ { name => 'upsSmartOutputVoltage', no_value => 0 } ], + output_template => 'voltage: %s V', + perfdatas => [ + { value => 'upsSmartOutputVoltage_absolute', template => '%s', + unit => 'V' }, + ], + } + }, + ]; +} + +sub prefix_global_output { + my ($self, %options) = @_; + + return 'Output lines '; +} + +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 => { + 'unknown-status:s' => { name => 'unknown_status', default => '%{status} =~ /unknown/i' }, + 'warning-status:s' => { name => 'warning_status', default => '%{status} =~ /rebooting|onBypass/i' }, + 'critical-status:s' => { name => 'critical_status', default => '%{status} =~ /onBattery/i' }, + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + $self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']); +} + +my $map_status = { + 1 => 'unknown', 2 => 'onLine', + 3 => 'onBattery', 4 => 'onBoost', + 5 => 'sleeping', 6 => 'onBypass', + 7 => 'rebooting', 8 => 'standBy', + 9 => 'onBuck', +}; + +my $mapping = { + upsBaseOutputStatus => { oid => '.1.3.6.1.4.1.935.1.1.1.4.1.1', map => $map_status }, + upsSmartOutputVoltage => { oid => '.1.3.6.1.4.1.935.1.1.1.4.2.1' }, # in dV + upsSmartOutputFrequency => { oid => '.1.3.6.1.4.1.935.1.1.1.4.2.2' }, # in tenth of Hz + upsSmartOutputLoad => { oid => '.1.3.6.1.4.1.935.1.1.1.4.2.3' }, # in % +}; + +sub manage_selection { + my ($self, %options) = @_; + + my $snmp_result = $options{snmp}->get_leef( + oids => [ map($_->{oid} . '.0', values(%$mapping)) ], + nothing_quit => 1 + ); + + my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => '0'); + $result->{upsSmartOutputFrequency} = defined($result->{upsSmartOutputFrequency}) ? $result->{upsSmartOutputFrequency} * 0.1 : 0; + $result->{upsSmartOutputVoltage} = defined($result->{upsSmartOutputVoltage}) ? $result->{upsSmartOutputVoltage} * 0.1 : 0; + $result->{status} = $result->{upsBaseOutputStatus}; + + $self->{global} = $result; +} +1; + +__END__ + +=head1 MODE + +Check output lines metrics. + +=over 8 + +=item B<--unknown-status> + +Set unknown threshold for status (Default: '%{status} =~ /unknown/i'). +Can used special variables like: %{status}. + +=item B<--warning-status> + +Set warning threshold for status (Default: '%{status} =~ /rebooting|onBypass/i'). +Can used special variables like: %{status}. + +=item B<--critical-status> + +Set critical threshold for status (Default: '%{status} =~ /onBattery/i'). +Can used special variables like: %{status}. + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'load', 'voltage', 'current', 'power'. + +=back + +=cut diff --git a/hardware/ups/hp/snmp/mode/outputlines.pm b/hardware/ups/hp/snmp/mode/outputlines.pm index 242051cf4..8cdb3ca0e 100644 --- a/hardware/ups/hp/snmp/mode/outputlines.pm +++ b/hardware/ups/hp/snmp/mode/outputlines.pm @@ -79,7 +79,7 @@ sub set_counters { }, { label => 'voltage', nlabel => 'line.output.voltage.volt', set => { key_values => [ { name => 'upsOutputVoltage', no_value => 0 } ], - output_template => 'Voltage: %s V', + output_template => 'voltage: %s V', perfdatas => [ { value => 'upsOutputVoltage_absolute', template => '%s', unit => 'V', label_extra_instance => 1 }, @@ -191,17 +191,17 @@ Check output lines metrics. =item B<--unknown-source> Set unknown threshold for status (Default: ''). -Can used special variables like: %{status}. +Can used special variables like: %{source}. =item B<--warning-source> Set warning threshold for status (Default: ''). -Can used special variables like: %{status}. +Can used special variables like: %{source}. =item B<--critical-source> Set critical threshold for status (Default: '%{source} !~ /normal/i'). -Can used special variables like: %{status}. +Can used special variables like: %{source}. =item B<--warning-*> B<--critical-*> diff --git a/hardware/ups/phoenixtec/snmp/plugin.pm b/hardware/ups/phoenixtec/snmp/plugin.pm new file mode 100644 index 000000000..1a91f1bf8 --- /dev/null +++ b/hardware/ups/phoenixtec/snmp/plugin.pm @@ -0,0 +1,50 @@ +# +# Copyright 2019 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::phoenixtec::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}} = ( + 'battery-status' => 'centreon::common::xppc::snmp::mode::batterystatus', + 'input-lines' => 'centreon::common::xppc::snmp::mode::inputlines', + 'output-lines' => 'centreon::common::xppc::snmp::mode::outputlines', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Phoenixtec Power UPS in SNMP. + +=cut