| 1 |
# |
| 2 |
# Copyright 2024 Centreon (http://www.centreon.com/) |
| 3 |
# |
| 4 |
# Centreon is a full-fledged industry-strength solution that meets |
| 5 |
# the needs in IT infrastructure and application monitoring for |
| 6 |
# service performance. |
| 7 |
# |
| 8 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 |
# you may not use this file except in compliance with the License. |
| 10 |
# You may obtain a copy of the License at |
| 11 |
# |
| 12 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 13 |
# |
| 14 |
# Unless required by applicable law or agreed to in writing, software |
| 15 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 16 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 |
# See the License for the specific language governing permissions and |
| 18 |
# limitations under the License. |
| 19 |
# |
| 20 |
|
| 21 |
package hardware::ups::ees::snmp::mode::input; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::counter); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
|
| 28 |
sub set_counters { |
| 29 |
my ($self, %options) = @_; |
| 30 |
|
| 31 |
$self->{maps_counters_type} = [ |
| 32 |
{ name => 'input', type => 0 } |
| 33 |
]; |
| 34 |
|
| 35 |
$self->{maps_counters}->{input} = [ |
| 36 |
{ |
| 37 |
label => 'line-a', nlabel => 'lineA.input.voltage.volt', |
| 38 |
set => { |
| 39 |
key_values => [ { name => 'lineA' } ], |
| 40 |
output_template => 'line A voltage: %.2fV', |
| 41 |
perfdatas => [ { template => '%.2f', unit => 'V' } ] |
| 42 |
} |
| 43 |
}, |
| 44 |
{ |
| 45 |
label => 'line-b', nlabel => 'lineB.input.voltage.volt', |
| 46 |
set => { |
| 47 |
key_values => [ { name => 'lineB' } ], |
| 48 |
output_template => 'line B voltage: %.2fV', |
| 49 |
perfdatas => [ { template => '%.2f', unit => 'V' } ] |
| 50 |
} |
| 51 |
}, |
| 52 |
{ |
| 53 |
label => 'line-c', nlabel => 'lineC.input.voltage.volt', |
| 54 |
set => { |
| 55 |
key_values => [ { name => 'lineC' } ], |
| 56 |
output_template => 'line C voltage: %.2fV', |
| 57 |
perfdatas => [ { template => '%.2f', unit => 'V' } ] |
| 58 |
} |
| 59 |
} |
| 60 |
]; |
| 61 |
} |
| 62 |
|
| 63 |
sub new { |
| 64 |
my ($class, %options) = @_; |
| 65 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); |
| 66 |
bless $self, $class; |
| 67 |
|
| 68 |
$options{options}->add_options(arguments => {}); |
| 69 |
|
| 70 |
return $self; |
| 71 |
} |
| 72 |
|
| 73 |
sub manage_selection { |
| 74 |
my ($self, %options) = @_; |
| 75 |
|
| 76 |
my $oid_psInputLineAVoltage = '.1.3.6.1.4.1.6302.2.1.2.6.1.0'; |
| 77 |
my $oid_psInputLineBVoltage = '.1.3.6.1.4.1.6302.2.1.2.6.2.0'; |
| 78 |
my $oid_psInputLineCVoltage = '.1.3.6.1.4.1.6302.2.1.2.6.3.0'; |
| 79 |
|
| 80 |
my $snmp_result = $options{snmp}->get_leef( |
| 81 |
oids => [ |
| 82 |
$oid_psInputLineAVoltage, |
| 83 |
$oid_psInputLineBVoltage, |
| 84 |
$oid_psInputLineCVoltage, |
| 85 |
], |
| 86 |
nothing_quit => 1 |
| 87 |
); |
| 88 |
|
| 89 |
$self->{input} = { |
| 90 |
lineA => $snmp_result->{$oid_psInputLineAVoltage} / 1000, |
| 91 |
lineB => $snmp_result->{$oid_psInputLineBVoltage} / 1000, |
| 92 |
lineC => $snmp_result->{$oid_psInputLineCVoltage} / 1000, |
| 93 |
}; |
| 94 |
} |
| 95 |
|
| 96 |
1; |
| 97 |
|
| 98 |
__END__ |
| 99 |
|
| 100 |
=head1 MODE |
| 101 |
|
| 102 |
Check input lines. |
| 103 |
|
| 104 |
=over 8 |
| 105 |
|
| 106 |
=item B<--warning-*> B<--critical-*> |
| 107 |
|
| 108 |
Input thresholds in V |
| 109 |
|
| 110 |
Thresholds: line-a, line-c, line-c. |
| 111 |
|
| 112 |
=back |
| 113 |
|
| 114 |
=cut |