diff --git a/src/hardware/sensors/akcp/snmp/mode/components/buzzer.pm b/src/hardware/sensors/akcp/snmp/mode/components/buzzer.pm new file mode 100644 index 0000000000..115aa93462 --- /dev/null +++ b/src/hardware/sensors/akcp/snmp/mode/components/buzzer.pm @@ -0,0 +1,66 @@ +# +# Copyright 2025 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::sensors::akcp::snmp::mode::components::buzzer; + +use strict; +use warnings; +use hardware::sensors::akcp::snmp::mode::components::resources qw(%map_default1_status); + +my $mapping = { + buzzerDescription => { oid => '.1.3.6.1.4.1.3854.3.5.11.1.2' }, + buzzerStatus => { oid => '.1.3.6.1.4.1.3854.3.5.11.1.6', map => \%map_default1_status }, +}; +my $oid_buzzerEntry = '.1.3.6.1.4.1.3854.3.5.11.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_buzzerEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking buzzers"); + $self->{components}->{buzzer} = {name => 'buzzers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'buzzer')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_buzzerEntry}})) { + next if ($oid !~ /^$mapping->{buzzerStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_buzzerEntry}, instance => $instance); + + next if ($self->check_filter(section => 'buzzer', instance => $instance)); + $self->{components}->{buzzer}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("buzzer '%s' status is '%s' [instance = %s]", + $result->{buzzerDescription}, $result->{buzzerStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default1', section => 'buzzer', value => $result->{buzzerStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Buzzer '%s' status is '%s'", $result->{buzzerDescription}, $result->{buzzerStatus})); + } + } +} + +1; diff --git a/src/hardware/sensors/akcp/snmp/mode/components/securityport.pm b/src/hardware/sensors/akcp/snmp/mode/components/securityport.pm new file mode 100644 index 0000000000..8266e684ee --- /dev/null +++ b/src/hardware/sensors/akcp/snmp/mode/components/securityport.pm @@ -0,0 +1,66 @@ +# +# Copyright 2025 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::sensors::akcp::snmp::mode::components::securityport; + +use strict; +use warnings; +use hardware::sensors::akcp::snmp::mode::components::resources qw(%map_default2_status); + +my $mapping = { + securityPortDescription => { oid => '.1.3.6.1.4.1.3854.3.5.10.1.2' }, + securityPortStatus => { oid => '.1.3.6.1.4.1.3854.3.5.10.1.6', map => \%map_default2_status }, +}; +my $oid_securityPortEntry = '.1.3.6.1.4.1.3854.3.5.10.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_securityPortEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking security ports"); + $self->{components}->{securityport} = {name => 'security ports', total => 0, skip => 0}; + return if ($self->check_filter(section => 'securityport')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_securityPortEntry}})) { + next if ($oid !~ /^$mapping->{securityPortStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_securityPortEntry}, instance => $instance); + + next if ($self->check_filter(section => 'securityport', instance => $instance)); + $self->{components}->{securityport}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("security port '%s' status is '%s' [instance = %s]", + $result->{securityPortDescription}, $result->{securityPortStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default2', section => 'securityport', value => $result->{securityPortStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Security port '%s' status is '%s'", $result->{securityPortDescription}, $result->{securityPortStatus})); + } + } +} + +1; diff --git a/src/hardware/sensors/akcp/snmp/mode/sensors.pm b/src/hardware/sensors/akcp/snmp/mode/sensors.pm index 4f53e67c40..97e20a8ad4 100644 --- a/src/hardware/sensors/akcp/snmp/mode/sensors.pm +++ b/src/hardware/sensors/akcp/snmp/mode/sensors.pm @@ -53,7 +53,7 @@ sub set_system { }; $self->{components_path} = 'hardware::sensors::akcp::snmp::mode::components'; - $self->{components_module} = ['temperature', 'humidity', 'switch', 'serial', 'water']; + $self->{components_module} = ['temperature', 'humidity', 'switch', 'serial', 'water', 'securityport', 'buzzer']; } sub snmp_execute { @@ -86,7 +86,7 @@ Check sensors. =item B<--component> Which component to check (default: '.*'). -Can be: 'temperature', 'humidity', 'switch', 'serial', 'water'. +Can be: 'temperature', 'humidity', 'switch', 'serial', 'water', 'securityport', 'buzzer'. =item B<--filter> diff --git a/tests/resources/spellcheck/stopwords.txt b/tests/resources/spellcheck/stopwords.txt index b753e18874..38858da3fa 100644 --- a/tests/resources/spellcheck/stopwords.txt +++ b/tests/resources/spellcheck/stopwords.txt @@ -271,6 +271,7 @@ Sansymphony SAS scenarii --scope-datacenter +securityport SFOS sfp.temperature SignalR