(plugin) hardware::ups::himoinsa::snmp::plugin - new (#4053)
* wip * wip * wip
This commit is contained in:
parent
b5cfc3e9e4
commit
08e2ac49b9
|
@ -0,0 +1,116 @@
|
|||
#
|
||||
# Copyright 2022 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::himoinsa::snmp::mode::frequency;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_measure_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Measure '" . $options{instance} . "' frequency ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'measures', type => 1, cb_prefix_output => 'prefix_measure_output', message_multiple => 'All frequency measures are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{measures} = [
|
||||
{ label => 'mains-frequency', nlabel => 'mains.frequency.hertz', set => {
|
||||
key_values => [ { name => 'mainsFreqConm' } ],
|
||||
output_template => 'mains: %.2f Hz',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, unit => 'Hz', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'genset-frequency', nlabel => 'genset.frequency.hertz', set => {
|
||||
key_values => [ { name => 'genFreqConm' } ],
|
||||
output_template => 'genset: %.2f Hz',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, unit => 'Hz', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 = {
|
||||
mainsFreqConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.1' },
|
||||
genFreqConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.8' }
|
||||
};
|
||||
my $oid_conmutationmeasuresEntry = '.1.3.6.1.4.1.41809.1.49.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_conmutationmeasuresEntry,
|
||||
start => $mapping->{mainsFreqConm}->{oid},
|
||||
end => $mapping->{genFreqConm}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{measures} = {};
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$mapping->{genFreqConm}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
|
||||
$self->{measures}->{$instance} = $result;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check mains and genset frequency.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Threshold in Hertz.
|
||||
|
||||
Where '*' can be: 'mains-frequency', 'genset-frequency'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,90 @@
|
|||
#
|
||||
# Copyright 2022 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::himoinsa::snmp::mode::fuellevel;
|
||||
|
||||
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 => 'fuel-level', nlabel => 'fuel.level.percentage', set => {
|
||||
key_values => [ { name => 'fuelLevel' } ],
|
||||
output_template => 'Fuel level: %s%%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => '%', min => 0, max => 100 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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_fuelLevel = '.1.3.6.1.4.1.41809.1.27.0';
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [$oid_fuelLevel], nothing_quit => 1);
|
||||
|
||||
$self->{global} = {
|
||||
fuelLevel => $snmp_result->{$oid_fuelLevel} / 10
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check fuel level.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-fuel-level>
|
||||
|
||||
Warning threshold for fuel level.
|
||||
|
||||
=item B<--critical-fuel-level>
|
||||
|
||||
Critical threshold for fuel level.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,125 @@
|
|||
#
|
||||
# Copyright 2022 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::himoinsa::snmp::mode::phase;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_measure_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Measure '" . $options{instance} . "' current ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'measures', type => 1, cb_prefix_output => 'prefix_measure_output', message_multiple => 'All current measures are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{measures} = [
|
||||
{ label => 'phase1', nlabel => 'phase1.current.ampere', set => {
|
||||
key_values => [ { name => 'ph1AmpConm' } ],
|
||||
output_template => 'phase 1: %s A',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'A', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'phase2', nlabel => 'phase2.current.ampere', set => {
|
||||
key_values => [ { name => 'ph2AmpConm' } ],
|
||||
output_template => 'phase 2: %s A',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'A', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'phase3', nlabel => 'phase3.current.ampere', set => {
|
||||
key_values => [ { name => 'ph3AmpConm' } ],
|
||||
output_template => 'phase 3: %s A',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'A', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 = {
|
||||
ph1AmpConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.15' },
|
||||
ph2AmpConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.15' },
|
||||
ph3AmpConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.16' }
|
||||
};
|
||||
my $oid_conmutationmeasuresEntry = '.1.3.6.1.4.1.41809.1.49.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_conmutationmeasuresEntry,
|
||||
start => $mapping->{ph1AmpConm}->{oid},
|
||||
end => $mapping->{ph3AmpConm}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{measures} = {};
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$mapping->{ph1AmpConm}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
|
||||
$self->{measures}->{$instance} = $result;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check phases current.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Threshold in amperes.
|
||||
|
||||
Where '*' can be: 'phase1', 'phase2", 'phase3'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,314 @@
|
|||
#
|
||||
# Copyright 2022 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::himoinsa::snmp::mode::status;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub status_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'checking component status';
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $self->{result_values}->{display} . " status: " . $self->{result_values}->{status};
|
||||
}
|
||||
|
||||
sub custom_status_commutator_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $self->{result_values}->{display} . ": " . $self->{result_values}->{status};
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'components', type => 3, cb_long_output => 'status_long_output', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'motor-status', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'mode-status', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'transfer-pump-status', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'alarm-status', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'closed-commutator', type => 0, skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{'motor-status'} = [
|
||||
{ label => 'motor-status', type => 2, set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{'mode-status'} = [
|
||||
{ label => 'mode-status', type => 2, set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
closure_custom_output => $self->can('custom_status_commutator_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{'transfer-pump-status'} = [
|
||||
{ label => 'transfer-pump-status', type => 2, set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{'alarm-status'} = [
|
||||
{ label => 'alarm-status', type => 2, warning_default => '%{status} =~ /^alarm/', set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{'closed-commutator'} = [
|
||||
{ label => 'closed-commutator', type => 2, set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
closure_custom_output => $self->can('custom_status_commutator_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
# mapping for CEA7 and CEM7 device
|
||||
my $mapping_motor_status = {
|
||||
0 => 'unknown', 1 => 'running', 2 => 'stopped'
|
||||
};
|
||||
|
||||
my $mapping_mode_status = {
|
||||
0 => 'unknown', 4 => 'auto', 8 => 'manual', 16 => 'test', 32 => 'blocked'
|
||||
};
|
||||
|
||||
my $mapping_transfer_pump_status = {
|
||||
0 => 'off', 64 => 'on'
|
||||
};
|
||||
|
||||
my $mapping_alarm_status = {
|
||||
0 => 'no alarm', 128 => 'alarm'
|
||||
};
|
||||
|
||||
my $mapping_closed_commutator = {
|
||||
0 => 'unknown', 256 => 'mains', 512 => 'genset'
|
||||
};
|
||||
|
||||
# mapping for CEC7 device
|
||||
my $cec7_mapping_alarm_status = {
|
||||
0 => 'no alarm', 1 => 'alarm'
|
||||
};
|
||||
|
||||
my $cec7_mapping_mode_status = {
|
||||
0 => 'unknown', 2 => 'auto', 4 => 'manual', 8 => 'test', 16 => 'blocked'
|
||||
};
|
||||
|
||||
my $cec7_mapping_closed_commutator = {
|
||||
0 => 'unknown', 32 => 'genset', 64 => 'mains'
|
||||
};
|
||||
|
||||
sub get_motor_status {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return ($options{value} & 1) | ($options{value} & 2);
|
||||
}
|
||||
|
||||
sub get_mode_status {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return ($options{value} & 4) | ($options{value} & 8) | ($options{value} & 16)| ($options{value} & 32);
|
||||
}
|
||||
|
||||
sub get_transfer_pump_status {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{value} & 64;
|
||||
}
|
||||
|
||||
sub get_alarm_status {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{value} & 128;
|
||||
}
|
||||
|
||||
sub get_closed_commutator {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return ($options{value} & 256) | ($options{value} & 512);
|
||||
}
|
||||
|
||||
sub get_cec7_alarm_status {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $options{value} & 1;
|
||||
}
|
||||
|
||||
sub get_cec7_mode_status {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return ($options{value} & 2) | ($options{value} & 4) | ($options{value} & 8) | ($options{value} & 16);
|
||||
}
|
||||
|
||||
sub get_cec7_closed_commutator {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return ($options{value} & 32) | ($options{value} & 64);
|
||||
}
|
||||
|
||||
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 $oid_conmutationmeasuresEntry = '.1.3.6.1.4.1.41809.1.46.0';
|
||||
my $oid_cec7_conmutationmeasuresEntry = '.1.3.6.1.4.1.41809.1.55.1.28.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [$oid_conmutationmeasuresEntry], nothing_quit => 1);
|
||||
|
||||
my $motor_status = $self->get_motor_status(value => $snmp_result->{$oid_conmutationmeasuresEntry});
|
||||
my $mode_status = $self->get_mode_status(value => $snmp_result->{$oid_conmutationmeasuresEntry});
|
||||
my $transfer_pump_status = $self->get_transfer_pump_status(value => $snmp_result->{$oid_conmutationmeasuresEntry});
|
||||
my $alarm_status = $self->get_alarm_status(value => $snmp_result->{$oid_conmutationmeasuresEntry});
|
||||
my $closed_commutator = $self->get_closed_commutator(value => $snmp_result->{$oid_conmutationmeasuresEntry});
|
||||
|
||||
$self->{components} = { global => {} };
|
||||
|
||||
$self->{components}->{global}->{'motor-status'} = {
|
||||
status => $mapping_motor_status->{$motor_status},
|
||||
display => 'motor'
|
||||
};
|
||||
|
||||
$self->{components}->{global}->{'mode-status'} = {
|
||||
status => $mapping_mode_status->{$mode_status},
|
||||
display => 'commutator mode'
|
||||
};
|
||||
|
||||
$self->{components}->{global}->{'transfer-pump-status'} = {
|
||||
status => $mapping_transfer_pump_status->{$transfer_pump_status},
|
||||
display => 'transfer pump'
|
||||
};
|
||||
|
||||
$self->{components}->{global}->{'alarm-status'} = {
|
||||
status => $mapping_alarm_status->{$alarm_status},
|
||||
display => 'alarm'
|
||||
};
|
||||
|
||||
$self->{components}->{global}->{'closed-commutator'} = {
|
||||
status => $mapping_closed_commutator->{$closed_commutator},
|
||||
display => 'closed commutator'
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Himoinsa device status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-alarm-status>
|
||||
|
||||
Warning threshold for alarm (Default: '%{status} =~ /^alarm/').
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--critical-alarm-status>
|
||||
|
||||
Critical threshold for alarm.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--warning-motor-status>
|
||||
|
||||
Warning threshold for motor status.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--critical-motor-status>
|
||||
|
||||
Critical threshold for motor status.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--warning-mode-status>
|
||||
|
||||
Warning threshold for commutator mode status.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--critical-mode-status>
|
||||
|
||||
Critical threshold for commutator mode status.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--warning-closed-commutator>
|
||||
|
||||
Warning threshold for commutator currently closed.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--critical-closed-commutator>
|
||||
|
||||
Critical threshold for commutator currently closed.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
For example if you want to get an alert if the closed commutator is mains:
|
||||
|
||||
--critical-closed-commutator='%{status} =~ /mains/i'
|
||||
|
||||
=item B<--warning-transfer-pump-status>
|
||||
|
||||
Warning threshold for transfer pump status.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=item B<--critical-transfer-pump-status>
|
||||
|
||||
Critical threshold for transfer pump status.
|
||||
Can use special variables like: %{status}
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,77 @@
|
|||
#
|
||||
# Copyright 2022 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::himoinsa::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>
|
||||
|
||||
Threshold warning.
|
||||
|
||||
=item B<--critical-uptime>
|
||||
|
||||
Threshold critical.
|
||||
|
||||
=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
|
|
@ -0,0 +1,207 @@
|
|||
#
|
||||
# Copyright 2022 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::himoinsa::snmp::mode::voltage;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_measure_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Measure '" . $options{instance} . "' voltage ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'measures', type => 1, cb_prefix_output => 'prefix_measure_output', message_multiple => 'All voltage measures are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{measures} = [
|
||||
{ label => 'mains-vl12', nlabel => 'mains.vl12.voltage.volt', set => {
|
||||
key_values => [ { name => 'mainsVL12Conm' } ],
|
||||
output_template => 'mains-vl12: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'mains-vl23', nlabel => 'mains.vl23.voltage.volt', set => {
|
||||
key_values => [ { name => 'mainsVL23Conm' } ],
|
||||
output_template => 'mains-vl23: %s V',
|
||||
perfdatas => [
|
||||
{template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'mains-vl13', nlabel => 'mains.vl13.voltage.volt', set => {
|
||||
key_values => [ { name => 'mainsVL13Conm' } ],
|
||||
output_template => 'mains-vl13: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'mains-vl1n', nlabel => 'mains.vl1n.voltage.volt', set => {
|
||||
key_values => [ { name => 'mainsVL1NConm' } ],
|
||||
output_template => 'mains-vl1n: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'mains-vl2n', nlabel => 'mains.vl2n.voltage.volt', set => {
|
||||
key_values => [ { name => 'mainsVL2NConm' } ],
|
||||
output_template => 'mains-vl2n: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'mains-vl3n', nlabel => 'mains.vl3n.voltage.volt', set => {
|
||||
key_values => [ { name => 'mainsVL3NConm' } ],
|
||||
output_template => 'mains-vl3n: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gen-vl12', nlabel => 'gen.vl12.voltage.volt', set => {
|
||||
key_values => [ { name => 'genVL12Conm' } ],
|
||||
output_template => 'gen-vl12: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gen-vl23', nlabel => 'gen.vl23.voltage.volt', set => {
|
||||
key_values => [ { name => 'genVL23Conm' } ],
|
||||
output_template => 'gen-vl23: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gen-vl13', nlabel => 'gen.vl13.voltage.volt', set => {
|
||||
key_values => [ { name => 'genVL13Conm' } ],
|
||||
output_template => 'gen-vl13: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gen-vl1n', nlabel => 'gen.vl1n.voltage.volt', set => {
|
||||
key_values => [ { name => 'genVL1NConm' } ],
|
||||
output_template => 'gen-vl1n: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gen-vl2n', nlabel => 'gen.vl2n.voltage.volt', set => {
|
||||
key_values => [ { name => 'genVL2NConm' } ],
|
||||
output_template => 'gen-vl2n: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gen-vl3n', nlabel => 'gen.vl3n.voltage.volt', set => {
|
||||
key_values => [ { name => 'genVL3NConm' } ],
|
||||
output_template => 'gen-vl3n: %s V',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'V', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 = {
|
||||
mainsVL12Conm => { oid => '.1.3.6.1.4.1.41809.1.49.1.2' },
|
||||
mainsVL23Conm => { oid => '.1.3.6.1.4.1.41809.1.49.1.3' },
|
||||
mainsVL13Conm => { oid => '.1.3.6.1.4.1.41809.1.49.1.4' },
|
||||
mainsVL1NConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.5' },
|
||||
mainsVL2NConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.6' },
|
||||
mainsVL3NConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.7' },
|
||||
genVL12Conm => { oid => '.1.3.6.1.4.1.41809.1.49.1.9' },
|
||||
genVL23Conm => { oid => '.1.3.6.1.4.1.41809.1.49.1.10' },
|
||||
genVL13Conm => { oid => '.1.3.6.1.4.1.41809.1.49.1.11' },
|
||||
genVL1NConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.12' },
|
||||
genVL2NConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.13' },
|
||||
genVL3NConm => { oid => '.1.3.6.1.4.1.41809.1.49.1.14' }
|
||||
};
|
||||
my $oid_conmutationmeasuresEntry = '.1.3.6.1.4.1.41809.1.49.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_conmutationmeasuresEntry,
|
||||
start => $mapping->{mainsVL12Conm}->{oid},
|
||||
end => $mapping->{genVL3NConm}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{measures} = {};
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{mainsVL12Conm}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
|
||||
$self->{measures}->{$instance} = $result;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check voltage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Threshold in volts.
|
||||
|
||||
Where '*' can be: 'mains-vl12', 'mains-vl23', 'mains-vl13', 'mains-vl1n', 'mains-vl2n', 'mains-vl3n',
|
||||
'gen-vl12', 'gen-vl23', 'gen-vl13', 'gen-vl1n', 'gen-vl2n', 'gen-vl3n'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# 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::himoinsa::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} = {
|
||||
'fuel-level' => 'hardware::ups::himoinsa::snmp::mode::fuellevel',
|
||||
'frequency' => 'hardware::ups::himoinsa::snmp::mode::frequency',
|
||||
'phase' => 'hardware::ups::himoinsa::snmp::mode::phase',
|
||||
'status' => 'hardware::ups::himoinsa::snmp::mode::status',
|
||||
'uptime' => 'hardware::ups::himoinsa::snmp::mode::uptime',
|
||||
'voltage' => 'hardware::ups::himoinsa::snmp::mode::voltage'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Himoinsa UPS device through SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue