From e670dbaacd8c89377ace428a4665880052541212 Mon Sep 17 00:00:00 2001 From: itoussies <65223458+itoussies@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:52:21 +0200 Subject: [PATCH 01/18] fix(azure-cloud-eventgrid): fix help threshold (#4992) --- src/cloud/azure/integration/eventgrid/mode/events.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cloud/azure/integration/eventgrid/mode/events.pm b/src/cloud/azure/integration/eventgrid/mode/events.pm index 1c0ba09a16..600da7968f 100644 --- a/src/cloud/azure/integration/eventgrid/mode/events.pm +++ b/src/cloud/azure/integration/eventgrid/mode/events.pm @@ -193,7 +193,7 @@ Warning threshold where '*' can be: 'matched-events', 'deadlettered-events', 'unmatched-events', 'dropped-events'. -=item B<--critical-vault-capacity-percentage> +=item B<--critical-*> Critical threshold where '*' can be: 'matched-events', 'deadlettered-events', 'unmatched-events', From 5da7c6f5091f3f0171cc2139092c64cda779e832 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:52:15 +0200 Subject: [PATCH 02/18] [CTOR-38][Plugin] New pack Avigilon camera snmp (#4994) --- .../deb.json | 5 + .../pkg.json | 10 + .../rpm.json | 5 + .../camera/avigilon/snmp/mode/interfaces.pm | 180 ++++++++++++++++++ .../camera/avigilon/snmp/mode/memory.pm | 105 ++++++++++ .../camera/avigilon/snmp/mode/storage.pm | 128 +++++++++++++ .../camera/avigilon/snmp/mode/temperature.pm | 144 ++++++++++++++ .../devices/camera/avigilon/snmp/plugin.pm | 51 +++++ tests/resources/spellcheck/stopwords.t | 4 + .../snmp/hardware-camera-avigilon.snmpwalk | 14 ++ .../devices/camera/avigilon/snmp/memory.robot | 38 ++++ .../camera/avigilon/snmp/storage.robot | 39 ++++ .../camera/avigilon/snmp/temperature.robot | 42 ++++ 13 files changed, 765 insertions(+) create mode 100644 packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/deb.json create mode 100644 packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json create mode 100644 packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/rpm.json create mode 100644 src/hardware/devices/camera/avigilon/snmp/mode/interfaces.pm create mode 100644 src/hardware/devices/camera/avigilon/snmp/mode/memory.pm create mode 100644 src/hardware/devices/camera/avigilon/snmp/mode/storage.pm create mode 100644 src/hardware/devices/camera/avigilon/snmp/mode/temperature.pm create mode 100644 src/hardware/devices/camera/avigilon/snmp/plugin.pm create mode 100644 tests/robot/hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon.snmpwalk create mode 100644 tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot create mode 100644 tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot create mode 100644 tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot diff --git a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/deb.json b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/deb.json new file mode 100644 index 0000000000..5d24d64c45 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libsnmp-perl" + ] +} diff --git a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json new file mode 100644 index 0000000000..5ff32779e1 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json @@ -0,0 +1,10 @@ +{ + "pkg_name": "centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp", + "pkg_summary": "Centreon Plugin to monitor Avigilon camera using SNMP", + "plugin_name": "centreon_camera_avigilon_snmp.pl", + "files": [ + "centreon/plugins/script_snmp.pm", + "centreon/plugins/snmp.pm", + "hardware/devices/camera/avigilon/snmp/" + ] +} diff --git a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/rpm.json b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/rpm.json new file mode 100644 index 0000000000..14e9663069 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(SNMP)" + ] +} diff --git a/src/hardware/devices/camera/avigilon/snmp/mode/interfaces.pm b/src/hardware/devices/camera/avigilon/snmp/mode/interfaces.pm new file mode 100644 index 0000000000..5c30d61aa5 --- /dev/null +++ b/src/hardware/devices/camera/avigilon/snmp/mode/interfaces.pm @@ -0,0 +1,180 @@ +# +# Copyright 2024 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::camera::avigilon::snmp::mode::interfaces; + +use base qw(snmp_standard::mode::interfaces); + +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 interfaces. + +=over 8 + +=item B<--add-global> + +Check global port statistics (by default if no --add-* option is set). + +=item B<--add-status> + +Check interface status. + +=item B<--add-duplex-status> + +Check duplex status (with --warning-status and --critical-status). + +=item B<--add-traffic> + +Check interface traffic. + +=item B<--add-errors> + +Check interface errors. + +=item B<--add-cast> + +Check interface cast. + +=item B<--add-speed> + +Check interface speed. + +=item B<--add-volume> + +Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting). + +=item B<--check-metrics> + +If the expression is true, metrics are checked (default: '%{opstatus} eq "up"'). + +=item B<--warning-status> + +Define the conditions to match for the status to be WARNING. +You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display} + +=item B<--critical-status> + +Define the conditions to match for the status to be CRITICAL (default: '%{admstatus} eq "up" and %{opstatus} ne "up"'). +You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display} + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down', +'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard', +'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast', +'speed' (b/s). + +=item B<--units-traffic> + +Units of thresholds for the traffic (default: 'percent_delta') ('percent_delta', 'bps', 'counter'). + +=item B<--units-errors> + +Units of thresholds for errors/discards (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter'). + +=item B<--units-cast> + +Units of thresholds for communication types (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter'). + +=item B<--nagvis-perfdata> + +Display traffic perfdata to be compatible with NagVis widget. + +=item B<--interface> + +Set the interface (number expected) example: 1,2,... (empty means 'check all interfaces'). + +=item B<--name> + +Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions. + +=item B<--speed> + +Set interface speed for incoming/outgoing traffic (in Mb). + +=item B<--speed-in> + +Set interface speed for incoming traffic (in Mb). + +=item B<--speed-out> + +Set interface speed for outgoing traffic (in Mb). + +=item B<--map-speed-dsl> + +Get interface speed configuration for interface type 'ADSL' and 'VDSL2'. + +Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name + +E.g: --map-speed-dsl=Et0.835,Et0-vdsl2 + +=item B<--force-counters64> + +Force to use 64 bits counters only. Can be used to improve performance. + +=item B<--force-counters32> + +Force to use 32 bits counters (even in SNMP version 2c and version 3). Should be used when 64 bits counters are buggy. + +=item B<--reload-cache-time> + +Time in minutes before reloading cache file (default: 180). + +=item B<--oid-filter> + +Define the OID to be used to filter interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr). + +=item B<--oid-display> + +Define the OID that will be used to name the interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr). + +=item B<--oid-extra-display> + +Add an OID to display. + +=item B<--display-transform-src> B<--display-transform-dst> + +Modify the interface name displayed by using a regular expression. + +Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens' + +=item B<--show-cache> + +Display cache interface data. + +=back + +=cut diff --git a/src/hardware/devices/camera/avigilon/snmp/mode/memory.pm b/src/hardware/devices/camera/avigilon/snmp/mode/memory.pm new file mode 100644 index 0000000000..5b1d7c64b8 --- /dev/null +++ b/src/hardware/devices/camera/avigilon/snmp/mode/memory.pm @@ -0,0 +1,105 @@ +# +# Copyright 2024 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::camera::avigilon::snmp::mode::memory; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub custom_memory_output { + my ($self, %options) = @_; + + my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total}); + + return sprintf( + 'total system memory available: %s', + $total_value . " " . $total_unit + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'memory', type => 0 } + ]; + + $self->{maps_counters}->{memory} = [ + { label => 'available', nlabel => 'memory.available', set => { + key_values => [{ name => 'total' }], + closure_custom_output => $self->can('custom_memory_output'), + perfdatas => [ + { value => 'total', template => '%d', min => 0, + unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'name' } + ], + } + } + ]; +} + +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_total = '.1.3.6.1.4.1.46202.1.1.1.6.0'; #memAvailable + my $snmp_result = $options{snmp}->get_leef( + oids => [$oid_total], + nothing_quit => 1 + ); + + $self->{memory} = { + total => $snmp_result->{$oid_total} + }; + +} + +1; + +__END__ + +=head1 MODE + +Check system memory available. + +=over 8 + +=item B<--warning-available*> + +Warning threshold for total memory available (B). + +=item B<--critical-available*> + +Critical threshold for total memory available (B). + +=back + +=cut diff --git a/src/hardware/devices/camera/avigilon/snmp/mode/storage.pm b/src/hardware/devices/camera/avigilon/snmp/mode/storage.pm new file mode 100644 index 0000000000..c78037ccb8 --- /dev/null +++ b/src/hardware/devices/camera/avigilon/snmp/mode/storage.pm @@ -0,0 +1,128 @@ +# +# Copyright 2024 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::camera::avigilon::snmp::mode::storage; + +use base qw(centreon::plugins::templates::counter); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); +use centreon::plugins::misc qw(is_empty); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'storage', type => 0 } + ]; + + $self->{maps_counters}->{storage} = [ + { label => 'status', + type => 2, + unknown_default => '%{storage_state} =~ /Unknown/i', + warning_default => '%{storage_state} =~ /insufficientMediaCapacity/i || %{storage_state} =~ /insufficientMediaSpeed/i', + critical_default => '%{storage_state} =~ /mediaNotPresent/i || %{storage_state} =~ /error/i', + set => { + key_values => [{ name => 'storage_state' }], + output_template => 'state of the SD card: %s', + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; +} + +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 $storage_state_mapping = { + 1 => 'mediaNotPresent', + 2 => 'mediaDetected', + 3 => 'existingDataOnMediaDetected', + 4 => 'mediaFormatting', + 5 => 'scanningForRecordings', + 6 => 'readOnly', + 7 => 'readyToRecord', + 8 => 'recording', + 9 => 'errorFormatting', + 10 => 'errorWriting', + 11 => 'insufficientMediaCapacity', + 12 => 'insufficientMediaSpeed', + 13 => 'error' + }; + + my $oid_storage_state = '.1.3.6.1.4.1.46202.1.1.1.5.0'; #storageState + my $snmp_result = $options{snmp}->get_leef( + oids => [$oid_storage_state], + nothing_quit => 1 + ); + + if(centreon::plugins::misc::is_empty($storage_state_mapping->{$snmp_result->{$oid_storage_state}})==0){ + $self->{storage} = { + storage_state => $storage_state_mapping->{$snmp_result->{$oid_storage_state}} + }; + # If state is not in the mapping, return unkown + }else{ + $self->{storage} = { + storage_state => "Unknown" + }; + } +} + +1; + +__END__ + +=head1 MODE + +Check storage state of the SD card. + +=over 8 + +=item B<--unknown-status> + +Define the conditions to match to return a unknown status (default: "%{storage_state} =~ /Unknown/i"). +The condition can be written using the following macros: %{storage_state}. + +=item B<--warning-status> + +Define the conditions to match to return a warning status (default: "%{storage_state} =~ /insufficientMediaCapacity/i || %{storage_state} =~ /insufficientMediaSpeed/i"). +The condition can be written using the following macros: %{storage_state}. + +=item B<--critical-status> + +Define the conditions to match to return a critical status (default: "%{storage_state} =~ /mediaNotPresent/i || %{storage_state} =~ /error/i"). +The condition can be written using the following macros: %{storage_state}. + +=back + +=cut diff --git a/src/hardware/devices/camera/avigilon/snmp/mode/temperature.pm b/src/hardware/devices/camera/avigilon/snmp/mode/temperature.pm new file mode 100644 index 0000000000..13c5ef7904 --- /dev/null +++ b/src/hardware/devices/camera/avigilon/snmp/mode/temperature.pm @@ -0,0 +1,144 @@ +# +# Copyright 2024 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::camera::avigilon::snmp::mode::temperature; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +sub custom_status_output { + my ($self, %options) = @_; + + return sprintf( + "sensor %s [type:%s] status: %s", + $self->{result_values}->{id}, + $self->{result_values}->{type}, + $self->{result_values}->{status} + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'sensors', type => 0 } + ]; + + $self->{maps_counters}->{sensors} = [ + { label => 'temperature', + nlabel => 'sensor.temperature.celsius', + set => { + key_values => [{ name => 'temperature' }], + output_template => 'temperature: %.2f C', + perfdatas => [ + { template => '%s', min => 0, unit => 'C', label_extra_instance => 1, instance_use => 'id' } + ] + } + }, + { label => 'status', + type => 2, + critical_default => '%{status} ne "ok"', + set => { + key_values => [{ name => 'status' }, { name => 'id' }, { name => 'type' }], + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; +} + +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 => { + 'filter-sensor-id:s' => { name => 'filter_id' } + }); + + return $self; +} + +my $state_mapping = { + 1 => 'ok', + 2 => 'failure', + 3 => 'outOfBoundary' +}; + +my $type_mapping = { + 1 => 'mainSensor', +}; + +sub manage_selection { + my ($self, %options) = @_; + + my $oid_type = '.1.3.6.1.4.1.46202.1.1.1.1.1.1'; # tempSensorType: The type of a temperature sensor, i.e. where it is mounted + my $oid_id = '.1.3.6.1.4.1.46202.1.1.1.1.1.2'; # tempSensorId: The unique identifier for a temperature sensor. + my $oid_status = '.1.3.6.1.4.1.46202.1.1.1.1.1.3'; # tempSensorStatus: The status of a temperature sensor. + my $oid_temperature = '.1.3.6.1.4.1.46202.1.1.1.1.1.4'; # tempSensorValue: The temperature as measured in degrees Celsius. + + my $snmp_result = $options{snmp}->get_leef( + oids => [$oid_type, $oid_id, $oid_status, $oid_temperature], + nothing_quit => 1 + ); + + $self->{sensors} = { + id => $snmp_result->{$oid_id}, + type => $type_mapping->{$snmp_result->{$oid_type}}, + status => $state_mapping->{$snmp_result->{$oid_status}}, + temperature => $snmp_result->{$oid_temperature} + }; +} + +1; + +__END__ + +=head1 MODE + +Check temperature sensor state and value. + +=over 8 + +=item B<--warning-status> + +Define the conditions to match to return a warning status. +The condition can be written using the following macros: %{status}. + +=item B<--critical-status> + +Define the conditions to match to return a critical status (default: '%{status} ne "ok"'). +The condition can be written using the following macros: %{status}. + +=item B<--warning-temperature*> + +Warning threshold for temperature (Celsius). + +=item B<--critical-temperature*> + +Critical threshold for temperature (Celsius). + +=back + +=cut diff --git a/src/hardware/devices/camera/avigilon/snmp/plugin.pm b/src/hardware/devices/camera/avigilon/snmp/plugin.pm new file mode 100644 index 0000000000..cbeb03bf49 --- /dev/null +++ b/src/hardware/devices/camera/avigilon/snmp/plugin.pm @@ -0,0 +1,51 @@ +# +# Copyright 2024 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::camera::avigilon::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}} = ( + 'interfaces' => 'hardware::devices::camera::avigilon::snmp::mode::interfaces', + 'memory' => 'hardware::devices::camera::avigilon::snmp::mode::memory', + 'storage' => 'hardware::devices::camera::avigilon::snmp::mode::storage', + 'temperature' => 'hardware::devices::camera::avigilon::snmp::mode::temperature', + 'uptime' => 'snmp_standard::mode::uptime', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Avigilon camera in SNMP. + +=cut diff --git a/tests/resources/spellcheck/stopwords.t b/tests/resources/spellcheck/stopwords.t index c8971c6853..58342508ab 100644 --- a/tests/resources/spellcheck/stopwords.t +++ b/tests/resources/spellcheck/stopwords.t @@ -1,3 +1,4 @@ +--add-sysdesc --display-transform-dst --display-transform-src --exclude-fs @@ -5,6 +6,7 @@ --filter-vdom --force-counters32 --force-counters64 +--force-oid --map-speed-dsl --nagvis-perfdata --oid-display @@ -12,6 +14,7 @@ --oid-filter 2c ADSL +Avigilon Centreon Datacore deltaps @@ -47,6 +50,7 @@ SureBackup topic-messages-inflighted total-oper-down total-oper-up +uptime VDSL2 Veeam WSMAN diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon.snmpwalk b/tests/robot/hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon.snmpwalk new file mode 100644 index 0000000000..7991b71ffa --- /dev/null +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon.snmpwalk @@ -0,0 +1,14 @@ +.1.3.6.1.4.1.46202.1.1.1.1.1.1 = INTEGER: 1 +.1.3.6.1.4.1.46202.1.1.1.1.1.2 = Gauge32: 1 +.1.3.6.1.4.1.46202.1.1.1.1.1.3 = INTEGER: 1 +.1.3.6.1.4.1.46202.1.1.1.1.1.4 = INTEGER: 23 +.1.3.6.1.4.1.46202.1.1.1.2.0 = Gauge32: 163 +.1.3.6.1.4.1.46202.1.1.1.3.0 = Timeticks: (80599046) 9 days, 7:53:10.46 +.1.3.6.1.4.1.46202.1.1.1.4.1.0 = Counter64: 3145223708 +.1.3.6.1.4.1.46202.1.1.1.4.2.0 = Counter64: 1976056200 +.1.3.6.1.4.1.46202.1.1.1.4.3.0 = Gauge32: 11000 +.1.3.6.1.4.1.46202.1.1.1.4.4.0 = Gauge32: 2786000 +.1.3.6.1.4.1.46202.1.1.1.4.5.0 = Gauge32: 2 +.1.3.6.1.4.1.46202.1.1.1.4.6.0 = Gauge32: 100000000 +.1.3.6.1.4.1.46202.1.1.1.5.0 = INTEGER: 1 +.1.3.6.1.4.1.46202.1.1.1.6.0 = Gauge32: 476004 diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot b/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot new file mode 100644 index 0000000000..5456ec47c8 --- /dev/null +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/memory.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Hardware Camera Avigilon memory + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource + +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} +... --plugin=hardware::devices::camera::avigilon::snmp::plugin +... --mode=memory +... --hostname=127.0.0.1 +... --snmp-port=2024 + + +*** Test Cases *** +Avigilon camera Memory ${tc}/3 + [Documentation] Hardware Camera Avigilon Memory + [Tags] hardware avigilon memory + ${command} Catenate + ... ${CMD} + ... --snmp-community=hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon + ... --warning-available='${warning_available}' + ... --critical-available='${critical_available}' + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + + Examples: tc warning_available critical_available expected_result -- + ... 1 ${EMPTY} ${EMPTY} OK: total system memory available: 464.85 KB | 'memory.available'=476004B;;;0; + ... 2 5000 ${EMPTY} WARNING: total system memory available: 464.85 KB | 'memory.available'=476004B;0:5000;;0; + ... 3 ${EMPTY} 5000 CRITICAL: total system memory available: 464.85 KB | 'memory.available'=476004B;;0:5000;0; + diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot b/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot new file mode 100644 index 0000000000..cf19e15975 --- /dev/null +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/storage.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Hardware Camera Avigilon storage + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource + +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} +... --plugin=hardware::devices::camera::avigilon::snmp::plugin +... --mode=storage +... --hostname=127.0.0.1 +... --snmp-port=2024 + + +*** Test Cases *** +Avigilon camera Storage ${tc}/3 + [Documentation] Hardware Camera Avigilon Storage + [Tags] hardware avigilon storage + ${command} Catenate + ... ${CMD} + ... --snmp-community=hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon + ... --warning-status='${warning_status}' + ... --critical-status='${critical_status}' + ... --unknown-status='${unknown_status}' + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + + Examples: tc warning_status critical_status unknown_status expected_result -- + ... 1 ${EMPTY} ${EMPTY} ${EMPTY} OK: state of the SD card: mediaNotPresent + ... 2 \\%\{storage_state\} =~ /mediaNotPresent/ ${EMPTY} ${EMPTY} WARNING: state of the SD card: mediaNotPresent + ... 3 ${EMPTY} \\%\{storage_state\} =~ /mediaNotPresent/ ${EMPTY} CRITICAL: state of the SD card: mediaNotPresent + ... 4 ${EMPTY} ${EMPTY} \\%\{storage_state\} =~ /mediaNotPresent/ UNKNOWN: state of the SD card: mediaNotPresent diff --git a/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot b/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot new file mode 100644 index 0000000000..d4ca5c318f --- /dev/null +++ b/tests/robot/hardware/devices/camera/avigilon/snmp/temperature.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Hardware Camera Avigilon temperature + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource + +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} +... --plugin=hardware::devices::camera::avigilon::snmp::plugin +... --mode=temperature +... --hostname=127.0.0.1 +... --snmp-port=2024 + + +*** Test Cases *** +Avigilon camera Temperature ${tc}/5 + [Documentation] Hardware Camera Avigilon Temperature + [Tags] hardware avigilon temperature + ${command} Catenate + ... ${CMD} + ... --snmp-community=hardware/devices/camera/avigilon/snmp/hardware-camera-avigilon + ... --warning-temperature='${warning_temperature}' + ... --critical-temperature='${critical_temperature}' + ... --warning-status='${warning_status}' + ... --critical-status='${critical_status}' + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n + + Examples: tc warning_temperature critical_temperature warning_status critical_status expected_result -- + ... 1 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: temperature: 23.00 C, sensor 1 [type:mainSensor] status: ok | 'sensor.temperature.celsius'=23C;;;0; + ... 2 20 ${EMPTY} ${EMPTY} ${EMPTY} WARNING: temperature: 23.00 C | 'sensor.temperature.celsius'=23C;0:20;;0; + ... 3 ${EMPTY} 20 ${EMPTY} ${EMPTY} CRITICAL: temperature: 23.00 C | 'sensor.temperature.celsius'=23C;;0:20;0; + ... 4 ${EMPTY} ${EMPTY} \\%\{status\} =~ /ok/ ${EMPTY} WARNING: sensor 1 [type:mainSensor] status: ok | 'sensor.temperature.celsius'=23C;;;0; + ... 5 ${EMPTY} ${EMPTY} ${EMPTY} \\%\{status\} =~ /ok/ CRITICAL: sensor 1 [type:mainSensor] status: ok | 'sensor.temperature.celsius'=23C;;;0; + From 7615cbebe712e701530b78de8d2f34b209543970 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:39:37 +0200 Subject: [PATCH 03/18] [CTOR-38][Plugin] Fix Packaging- New pack Avigilon camera snmp (#4997) --- .../pkg.json | 3 +++ src/hardware/devices/camera/avigilon/snmp/plugin.pm | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json index 5ff32779e1..177b2c3f1c 100644 --- a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json +++ b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json @@ -5,6 +5,9 @@ "files": [ "centreon/plugins/script_snmp.pm", "centreon/plugins/snmp.pm", + "snmp_standard/mode/interfaces.pm", + "snmp_standard/mode/listinterfaces.pm", + "snmp_standard/mode/uptime.pm", "hardware/devices/camera/avigilon/snmp/" ] } diff --git a/src/hardware/devices/camera/avigilon/snmp/plugin.pm b/src/hardware/devices/camera/avigilon/snmp/plugin.pm index cbeb03bf49..5d54719f1c 100644 --- a/src/hardware/devices/camera/avigilon/snmp/plugin.pm +++ b/src/hardware/devices/camera/avigilon/snmp/plugin.pm @@ -30,11 +30,12 @@ sub new { bless $self, $class; %{$self->{modes}} = ( - 'interfaces' => 'hardware::devices::camera::avigilon::snmp::mode::interfaces', - 'memory' => 'hardware::devices::camera::avigilon::snmp::mode::memory', - 'storage' => 'hardware::devices::camera::avigilon::snmp::mode::storage', - 'temperature' => 'hardware::devices::camera::avigilon::snmp::mode::temperature', - 'uptime' => 'snmp_standard::mode::uptime', + 'interfaces' => 'hardware::devices::camera::avigilon::snmp::mode::interfaces', + 'list-interfaces' => 'snmp_standard::mode::listinterfaces', + 'memory' => 'hardware::devices::camera::avigilon::snmp::mode::memory', + 'storage' => 'hardware::devices::camera::avigilon::snmp::mode::storage', + 'temperature' => 'hardware::devices::camera::avigilon::snmp::mode::temperature', + 'uptime' => 'snmp_standard::mode::uptime', ); return $self; From 9c222f4077f22fa12a11c43970f7fa19ac642db0 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:51:16 +0200 Subject: [PATCH 04/18] [CTOR-38][Plugin] Fix Packaging again - New pack Avigilon camera snmp (#4998) --- .../pkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json index 177b2c3f1c..f60cc73775 100644 --- a/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json +++ b/packaging/centreon-plugin-Hardware-Devices-Camera-Avigilon-Snmp/pkg.json @@ -7,6 +7,7 @@ "centreon/plugins/snmp.pm", "snmp_standard/mode/interfaces.pm", "snmp_standard/mode/listinterfaces.pm", + "snmp_standard/mode/resources/", "snmp_standard/mode/uptime.pm", "hardware/devices/camera/avigilon/snmp/" ] From 2e946ff48e0688b21c61dbf986e1dd6241eb0100 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:02:19 +0200 Subject: [PATCH 05/18] [CTOR-26][Plugin] New Pack : oVirt (#4999) --- .../centreon-plugin-Virtualization-Ovirt-Api/deb.json | 4 ++++ .../centreon-plugin-Virtualization-Ovirt-Api/pkg.json | 9 +++++++++ .../centreon-plugin-Virtualization-Ovirt-Api/rpm.json | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 packaging/centreon-plugin-Virtualization-Ovirt-Api/deb.json create mode 100644 packaging/centreon-plugin-Virtualization-Ovirt-Api/pkg.json create mode 100644 packaging/centreon-plugin-Virtualization-Ovirt-Api/rpm.json diff --git a/packaging/centreon-plugin-Virtualization-Ovirt-Api/deb.json b/packaging/centreon-plugin-Virtualization-Ovirt-Api/deb.json new file mode 100644 index 0000000000..9757fe1126 --- /dev/null +++ b/packaging/centreon-plugin-Virtualization-Ovirt-Api/deb.json @@ -0,0 +1,4 @@ +{ + "dependencies": [ + ] +} diff --git a/packaging/centreon-plugin-Virtualization-Ovirt-Api/pkg.json b/packaging/centreon-plugin-Virtualization-Ovirt-Api/pkg.json new file mode 100644 index 0000000000..b71c80afd3 --- /dev/null +++ b/packaging/centreon-plugin-Virtualization-Ovirt-Api/pkg.json @@ -0,0 +1,9 @@ +{ + "pkg_name": "centreon-plugin-Virtualization-Ovirt-Api", + "pkg_summary": "Centreon Plugin to monitor oVirt using API", + "plugin_name": "centreon_ovirt_api.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "apps/virtualization/ovirt/" + ] +} diff --git a/packaging/centreon-plugin-Virtualization-Ovirt-Api/rpm.json b/packaging/centreon-plugin-Virtualization-Ovirt-Api/rpm.json new file mode 100644 index 0000000000..9757fe1126 --- /dev/null +++ b/packaging/centreon-plugin-Virtualization-Ovirt-Api/rpm.json @@ -0,0 +1,4 @@ +{ + "dependencies": [ + ] +} From 3453935f17401b84895583d60b70b57fa75cedc5 Mon Sep 17 00:00:00 2001 From: tuntoja <58987095+tuntoja@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:20:46 +0200 Subject: [PATCH 06/18] enh(promote): handle debian package promotion for multiple distributions (#5004) Co-authored-by: May <110405507+paul-oureib@users.noreply.github.com> --- .github/actions/promote-to-stable/action.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/promote-to-stable/action.yml b/.github/actions/promote-to-stable/action.yml index 9cb76256a7..59bfa01d54 100644 --- a/.github/actions/promote-to-stable/action.yml +++ b/.github/actions/promote-to-stable/action.yml @@ -62,10 +62,13 @@ runs: - name: Promote DEB package to stable if: ${{ contains(fromJSON('["bullseye", "bookworm"]'), inputs.distrib) }} run: | + set -eux + echo "[DEBUG] - Distrib: ${{ inputs.distrib }}" + echo "[DEBUG] - Distrib: ${{ inputs.module }}" echo "[DEBUG] - Get path of testing DEB packages to promote to stable." - SRC_PATHS=$(jf rt s --include-dirs apt-plugins-testing/pool/${{ inputs.module }}/*.deb | jq -r '.[].path') + SRC_PATHS=$(jf rt search --include-dirs apt-plugins-testing/pool/${{ inputs.module }}/*${{ inputs.distrib }}*.deb | jq -r '.[].path') if [[ ${SRC_PATHS[@]} ]]; then for SRC_PATH in ${SRC_PATHS[@]}; do @@ -88,6 +91,11 @@ runs: for ARTIFACT_DL in $(dir|grep -E "*.deb"); do ARCH=$(echo $ARTIFACT_DL | cut -d '_' -f3 | cut -d '.' -f1) + DISTRIB=$(echo $ARTIFACT_DL | cut -d '_' -f2 | cut -d '-' -f2) + if [[ "${{ inputs.distrib }}" != "$DISTRIB" ]]; then + echo "::error::Distrib [$DISTRIB] from package does not match distrib [${{ inputs.distrib }}] from input, aborting promotion." + exit 1 + fi echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH." jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" done From 5605da104a38d3dbb681e385613056ca5e0aa0e0 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:52:38 +0200 Subject: [PATCH 07/18] [CTOR-514] [Plugin] New Pack RRDCached (#5003) --- .../centreon-plugin-Applications-RRDCached/deb.json | 5 +++++ .../centreon-plugin-Applications-RRDCached/pkg.json | 9 +++++++++ .../centreon-plugin-Applications-RRDCached/rpm.json | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 packaging/centreon-plugin-Applications-RRDCached/deb.json create mode 100644 packaging/centreon-plugin-Applications-RRDCached/pkg.json create mode 100644 packaging/centreon-plugin-Applications-RRDCached/rpm.json diff --git a/packaging/centreon-plugin-Applications-RRDCached/deb.json b/packaging/centreon-plugin-Applications-RRDCached/deb.json new file mode 100644 index 0000000000..7eddca63e9 --- /dev/null +++ b/packaging/centreon-plugin-Applications-RRDCached/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libsocket-perl" + ] +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Applications-RRDCached/pkg.json b/packaging/centreon-plugin-Applications-RRDCached/pkg.json new file mode 100644 index 0000000000..e475161074 --- /dev/null +++ b/packaging/centreon-plugin-Applications-RRDCached/pkg.json @@ -0,0 +1,9 @@ +{ + "pkg_name": "centreon-plugin-Applications-RRDCached", + "pkg_summary": "Centreon Plugin to check RRDCached related informations", + "plugin_name": "centreon_rrdcached.pl", + "files": [ + "centreon/plugins/script_simple.pm", + "apps/rrdcached/" + ] +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Applications-RRDCached/rpm.json b/packaging/centreon-plugin-Applications-RRDCached/rpm.json new file mode 100644 index 0000000000..c843a634d8 --- /dev/null +++ b/packaging/centreon-plugin-Applications-RRDCached/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(IO::Socket)" + ] +} \ No newline at end of file From 45dfba82ad0f633c77ae005be51eb6b3dff96a4f Mon Sep 17 00:00:00 2001 From: tuntoja <58987095+tuntoja@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:55:59 +0200 Subject: [PATCH 08/18] fix(promote): fix pattern used for promote upload (#5006) --- .github/actions/promote-to-stable/action.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/actions/promote-to-stable/action.yml b/.github/actions/promote-to-stable/action.yml index 59bfa01d54..105085cba8 100644 --- a/.github/actions/promote-to-stable/action.yml +++ b/.github/actions/promote-to-stable/action.yml @@ -89,13 +89,8 @@ runs: jf rt download $ARTIFACT --flat done - for ARTIFACT_DL in $(dir|grep -E "*.deb"); do + for ARTIFACT_DL in $(dir -1|grep -E "*${{ inputs.distrib }}*.deb"); do ARCH=$(echo $ARTIFACT_DL | cut -d '_' -f3 | cut -d '.' -f1) - DISTRIB=$(echo $ARTIFACT_DL | cut -d '_' -f2 | cut -d '-' -f2) - if [[ "${{ inputs.distrib }}" != "$DISTRIB" ]]; then - echo "::error::Distrib [$DISTRIB] from package does not match distrib [${{ inputs.distrib }}] from input, aborting promotion." - exit 1 - fi echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH." jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" done From 8e068359bd8e230d6fa59a11ef4080ca44cd6506 Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Thu, 2 May 2024 11:11:03 +0200 Subject: [PATCH 09/18] ci(plugins-tests) Use docker to install and test each plugins Co-authored-by: May <110405507+paul-oureib@users.noreply.github.com> REF:CTOR-474 --- .github/actions/test-plugins/action.yml | 28 ++++ .../Dockerfile.packaging-plugins-alma8 | 0 .../Dockerfile.packaging-plugins-alma9 | 0 .../Dockerfile.packaging-plugins-bookworm | 0 .../Dockerfile.packaging-plugins-bullseye | 0 .../Dockerfile.packaging-plugins-centos7 | 0 .../Dockerfile.packaging-plugins-jammy | 0 .../testing/Dockerfile.testing-plugins-alma8 | 68 +++++++++ .../testing/Dockerfile.testing-plugins-alma9 | 67 +++++++++ .../Dockerfile.testing-plugins-bookworm | 48 +++++++ .../Dockerfile.testing-plugins-bullseye | 47 +++++++ .../testing/Dockerfile.testing-plugins-jammy | 45 ++++++ .github/scripts/process-plugins.py | 2 +- .github/scripts/test-all-plugins.py | 133 ++++++++++++++++++ .../docker-builder-packaging-plugins.yml | 6 +- .../docker-builder-testing-plugins.yml | 73 ++++++++++ .github/workflows/plugins.yml | 51 ++++++- .github/workflows/tests-functional.yml | 76 ---------- .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 .../deb.json | 0 .../pkg.json | 0 .../rpm.json | 0 69 files changed, 562 insertions(+), 82 deletions(-) create mode 100644 .github/actions/test-plugins/action.yml rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-alma8 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-alma9 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-bookworm (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-bullseye (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-centos7 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-jammy (100%) create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-alma8 create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-alma9 create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-bookworm create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-bullseye create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-jammy create mode 100644 .github/scripts/test-all-plugins.py create mode 100644 .github/workflows/docker-builder-testing-plugins.yml delete mode 100644 .github/workflows/tests-functional.yml rename packaging/{centreon-plugin-Applications-Antivirus-Clamav-Ssh => centreon-plugin-Applications-Clamav-Ssh}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Antivirus-Clamav-Ssh => centreon-plugin-Applications-Clamav-Ssh}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Antivirus-Clamav-Ssh => centreon-plugin-Applications-Clamav-Ssh}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Cassandra-Jmx => centreon-plugin-Applications-Database-Cassandra-Jmx}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Cassandra-Jmx => centreon-plugin-Applications-Database-Cassandra-Jmx}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Cassandra-Jmx => centreon-plugin-Applications-Database-Cassandra-Jmx}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Couchdb-Restapi => centreon-plugin-Applications-Database-Couchdb-Restapi}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Couchdb-Restapi => centreon-plugin-Applications-Database-Couchdb-Restapi}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Databases-Couchdb-Restapi => centreon-plugin-Applications-Database-Couchdb-Restapi}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Netbackup-SSH => centreon-plugin-Applications-Netbackup-Ssh}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Netbackup-SSH => centreon-plugin-Applications-Netbackup-Ssh}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Netbackup-SSH => centreon-plugin-Applications-Netbackup-Ssh}/rpm.json (100%) rename packaging/{centreon-plugin-Applications-Pacemaker-SSH => centreon-plugin-Applications-Pacemaker-Ssh}/deb.json (100%) rename packaging/{centreon-plugin-Applications-Pacemaker-SSH => centreon-plugin-Applications-Pacemaker-Ssh}/pkg.json (100%) rename packaging/{centreon-plugin-Applications-Pacemaker-SSH => centreon-plugin-Applications-Pacemaker-Ssh}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-DataFactory-Factory-Api => centreon-plugin-Cloud-Azure-DataFactory-Factories-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-DataFactory-Factory-Api => centreon-plugin-Cloud-Azure-DataFactory-Factories-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-DataFactory-Factory-Api => centreon-plugin-Cloud-Azure-DataFactory-Factories-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mariadb-Api => centreon-plugin-Cloud-Azure-Database-MariaDB-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mariadb-Api => centreon-plugin-Cloud-Azure-Database-MariaDB-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mariadb-Api => centreon-plugin-Cloud-Azure-Database-MariaDB-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mysql-Api => centreon-plugin-Cloud-Azure-Database-MySQL-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mysql-Api => centreon-plugin-Cloud-Azure-Database-MySQL-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-Mysql-Api => centreon-plugin-Cloud-Azure-Database-MySQL-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-SqlManagedInstance => centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-SqlManagedInstance => centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Database-SqlManagedInstance => centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Devtools-Appconfiguration => centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Devtools-Appconfiguration => centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Devtools-Appconfiguration => centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api => centreon-plugin-Cloud-Azure-Integration-EventGrid-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api => centreon-plugin-Cloud-Azure-Integration-EventGrid-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api => centreon-plugin-Cloud-Azure-Integration-EventGrid-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Network-TrafficManager => centreon-plugin-Cloud-Azure-Network-TrafficManager-Api}/deb.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Network-TrafficManager => centreon-plugin-Cloud-Azure-Network-TrafficManager-Api}/pkg.json (100%) rename packaging/{centreon-plugin-Cloud-Azure-Network-TrafficManager => centreon-plugin-Cloud-Azure-Network-TrafficManager-Api}/rpm.json (100%) rename packaging/{centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp => centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp => centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp => centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Os10-Snmp => centreon-plugin-Network-Dell-Os10-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Os10-Snmp => centreon-plugin-Network-Dell-Os10-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Os10-Snmp => centreon-plugin-Network-Dell-Os10-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Xseries-Snmp => centreon-plugin-Network-Dell-Xseries-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Xseries-Snmp => centreon-plugin-Network-Dell-Xseries-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Switchs-Dell-Xseries-Snmp => centreon-plugin-Network-Dell-Xseries-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp => centreon-plugin-Network-Juniper-Mag-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp => centreon-plugin-Network-Juniper-Mag-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp => centreon-plugin-Network-Juniper-Mag-Snmp}/rpm.json (100%) rename packaging/{centreon-plugin-Network-Sonus-Sbc-Snmp => centreon-plugin-Network-Sonus-SBC-Snmp}/deb.json (100%) rename packaging/{centreon-plugin-Network-Sonus-Sbc-Snmp => centreon-plugin-Network-Sonus-SBC-Snmp}/pkg.json (100%) rename packaging/{centreon-plugin-Network-Sonus-Sbc-Snmp => centreon-plugin-Network-Sonus-SBC-Snmp}/rpm.json (100%) diff --git a/.github/actions/test-plugins/action.yml b/.github/actions/test-plugins/action.yml new file mode 100644 index 0000000000..84aab55c97 --- /dev/null +++ b/.github/actions/test-plugins/action.yml @@ -0,0 +1,28 @@ +name: "test-plugins" +description: "Test plugin that are passed as parameters" +inputs: + cache-key: + description: "The packaged plugin's cache key" + required: true + plugin-list: + description: "List of plugins to install from the cache" + required: true + package-extension: + description: "Either 'rpm' or 'deb'. Needed to determine the package manager command (dnf or apt-get)." + required: true + +runs: + using: "composite" + steps: + + - name: get the cached plugin + uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 + with: + path: ./*.${{ inputs.package-extension }} + key: ${{ inputs.cache-key }} + fail-on-cache-miss: true + + - name: Install, test and remove plugin + shell: bash + run: | + python3 .github/scripts/test-all-plugins.py ${{ inputs.package-extension }} ${{ inputs.plugin-list }} diff --git a/.github/docker/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-alma8 rename to .github/docker/packaging/Dockerfile.packaging-plugins-alma8 diff --git a/.github/docker/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-alma9 rename to .github/docker/packaging/Dockerfile.packaging-plugins-alma9 diff --git a/.github/docker/Dockerfile.packaging-plugins-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-bookworm rename to .github/docker/packaging/Dockerfile.packaging-plugins-bookworm diff --git a/.github/docker/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-bullseye rename to .github/docker/packaging/Dockerfile.packaging-plugins-bullseye diff --git a/.github/docker/Dockerfile.packaging-plugins-centos7 b/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-centos7 rename to .github/docker/packaging/Dockerfile.packaging-plugins-centos7 diff --git a/.github/docker/Dockerfile.packaging-plugins-jammy b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-jammy rename to .github/docker/packaging/Dockerfile.packaging-plugins-jammy diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 new file mode 100644 index 0000000000..47c2ffdba0 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -0,0 +1,68 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:8 + +RUN bash -e <> /etc/yum.repos.d/centreon-plugins.repo + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +dnf clean all + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 new file mode 100644 index 0000000000..6761366c85 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -0,0 +1,67 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:9 + +RUN bash -e <> /etc/yum.repos.d/centreon-plugins.repo + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +dnf clean all + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm new file mode 100644 index 0000000000..2ff56f473d --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -0,0 +1,48 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bookworm + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +apt-get clean + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bullseye b/.github/docker/testing/Dockerfile.testing-plugins-bullseye new file mode 100644 index 0000000000..72c2b2ec6a --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-bullseye @@ -0,0 +1,47 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bullseye + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +apt-get clean + + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-jammy b/.github/docker/testing/Dockerfile.testing-plugins-jammy new file mode 100644 index 0000000000..9df67d9d98 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-jammy @@ -0,0 +1,45 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/ubuntu:jammy + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +mkdir -p /var/lib/centreon/centplugins/ +chmod 777 /var/lib/centreon/centplugins/ + +apt-get clean + +EOF diff --git a/.github/scripts/process-plugins.py b/.github/scripts/process-plugins.py index f4c80badbd..336ccd4353 100644 --- a/.github/scripts/process-plugins.py +++ b/.github/scripts/process-plugins.py @@ -43,7 +43,7 @@ packaging_path = re.search('.*\/(centreon-plugin-.*)\/pkg.json', filepath).group(1) if not packaging_path == packaging["pkg_name"]: - packaging_path = packaging_path + "=>" + packaging["pkg_name"] + packaging_path = packaging["pkg_name"] directory_path = re.search('^(.+)\/pkg.json', filepath).group(1) diff --git a/.github/scripts/test-all-plugins.py b/.github/scripts/test-all-plugins.py new file mode 100644 index 0000000000..176e7eaba0 --- /dev/null +++ b/.github/scripts/test-all-plugins.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python3 +import subprocess +import sys +import os +import json + + +def get_tests_folders(plugin_name): + folder_list = [] + pkg_file = open("./packaging/" + plugin_name + "/pkg.json") + packaging = json.load(pkg_file) + for file in packaging["files"]: # loop on "files" array in pkg.json file. + if file.endswith("/") and os.path.exists("tests/robot/" + file): # if this is a directory and there is test for it. + folder_list.append("tests/robot/" + file) + return folder_list + + +def get_plugin_full_path(plugin_name): + pkg_file = open("./packaging/" + plugin_name + "/pkg.json") + packaging = json.load(pkg_file) + return "/usr/lib/centreon/plugins/" + packaging["plugin_name"] + + +def test_plugin(plugin_name): + folders_list = get_tests_folders(plugin_name) + print(f"{plugin_name} folders_list : {folders_list}") + if len(folders_list) == 0: + return 0 # no tests present at the moment, but we still have tested the plugin can be installed. + robot_results = subprocess.run("robot -v ''CENTREON_PLUGINS:" + get_plugin_full_path(plugin_name) + " " + " ".join(folders_list), + shell=True, check=False) + return robot_results.returncode + + +def try_command(cmd, error): + return_obj = subprocess.run(cmd, shell=True, check=False) + print(return_obj) + if return_obj.returncode != 0: + print(error) + sys.exit(1) + + +def launch_snmp_sim(): + subprocess.run("useradd snmp", shell=True, check=False) + # we don't want to quit if this fail because it often means the user already exist. + + # this folder seem needed to launch snmp plugins. I didn't reproduce in my env, but without it, + # the first snmp plugin launched by robot prepend the message "Created directory: /var/lib/snmp/cert_indexes". + try_command(cmd="mkdir -p /var/lib/snmp/cert_indexes/", error="can't create /var/lib/snmp/cert_indexes/ dir") + try_command(cmd="chown snmp:snmp -R /var/lib/snmp/cert_indexes/", error="can't set cert_indexes folder permissions") + + snmpsim_cmd = "snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests/robot' &" + try_command(cmd=snmpsim_cmd, error="can't launch snmp sim daemon.") + + +def install_plugin(plugin, archi): + with open('/var/log/robot-plugins-installation-tests.log', "a") as outfile: + if archi == "deb": + outfile.write("apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb\n") + output_status = (subprocess.run( + "apt install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb", + shell=True, check=False, stderr=subprocess.STDOUT, stdout=outfile)).returncode + elif archi == "rpm": + outfile.write("dnf install -y ./" + plugin + "*.rpm\n") + output_status = (subprocess.run("dnf install -y ./" + plugin + "*.rpm", shell=True, check=False, + stderr=subprocess.STDOUT, stdout=outfile)).returncode + else: + print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") + exit(1) + return output_status + + +def remove_plugin(plugin, archi): + with open('/var/log/robot-plugins-installation-tests.log', "a") as outfile: + if archi == "deb": + outfile.write("apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower() + "\n") + output_status = (subprocess.run( + "apt -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' autoremove -y " + plugin.lower(), + shell=True, check=False, stderr=subprocess.STDOUT, stdout=outfile)).returncode + # -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' is an option to force apt to keep the package in + # /var/cache/apt/archives, so it do not re download them for every installation. + # 'autoremove', contrary to 'remove' all dependancy while removing the original package. + + elif archi == "rpm": + outfile.write("dnf remove -y " + plugin + "\n") + output_status = (subprocess.run("dnf remove -y " + plugin, shell=True, check=False, + stderr=subprocess.STDOUT, stdout=outfile)).returncode + else: + print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.") + exit(1) + return output_status + + +if __name__ == '__main__': + print("starting program") + if len(sys.argv) < 2: + print("please provide architecture (deb or rpm) and list of plugin to test as arguments (one plugin name per " + "argument, separated by space)") + sys.exit(1) + + launch_snmp_sim() + archi = sys.argv.pop(1) # expected either deb or rpm. + script_name = sys.argv.pop(0) + + error_install = 0 + error_tests = 0 + error_purge = 0 + nb_plugins = 0 + list_plugin_error = [] + for plugin in sys.argv: + print("plugin : ", plugin) + nb_plugins += 1 + tmp = install_plugin(plugin, archi) + if tmp > 0: + list_plugin_error.append(plugin) + error_install += tmp + tmp = test_plugin(plugin) + if tmp > 0: + list_plugin_error.append(plugin) + error_tests += tmp + tmp = remove_plugin(plugin, archi) + if tmp > 0: + list_plugin_error.append(plugin) + error_purge += tmp + + print(f"{nb_plugins} plugins tested.\n there was {error_install} installation error, {error_tests} test " + f"errors, and {error_purge} removal error list of error : {list_plugin_error}",) + + if error_install != 0 or error_tests != 0 or error_purge != 0: + exit(1) + exit(0) + # the snmpsim daemon is still runing when we exit, as this script is mainly run in a docker on CI, it will be + # cleared up eventually. + # to clear it up manually, use ps -ax | grep snmpsim-command-respond | cut -dp -f1 | sudo xargs kill diff --git a/.github/workflows/docker-builder-packaging-plugins.yml b/.github/workflows/docker-builder-packaging-plugins.yml index f55989d4b5..99cdb0da5e 100644 --- a/.github/workflows/docker-builder-packaging-plugins.yml +++ b/.github/workflows/docker-builder-packaging-plugins.yml @@ -11,11 +11,11 @@ on: - develop paths: - ".github/workflows/docker-builder-packaging-plugins.yml" - - ".github/docker/*" + - ".github/docker/packaging/*" pull_request: paths: - ".github/workflows/docker-builder-packaging-plugins.yml" - - ".github/docker/*" + - ".github/docker/packaging/*" jobs: create-and-push-docker: @@ -68,7 +68,7 @@ jobs: - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 with: - file: .github/docker/Dockerfile.${{ matrix.dockerfile }} + file: .github/docker/packaging/Dockerfile.${{ matrix.dockerfile }} context: . build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" pull: true diff --git a/.github/workflows/docker-builder-testing-plugins.yml b/.github/workflows/docker-builder-testing-plugins.yml new file mode 100644 index 0000000000..9ffc0aaf87 --- /dev/null +++ b/.github/workflows/docker-builder-testing-plugins.yml @@ -0,0 +1,73 @@ +name: docker-builder-testing-plugins + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + branches: + - develop + paths: + - ".github/workflows/docker-builder-testing-plugins.yml" + - ".github/docker/testing/*" + pull_request: + paths: + - ".github/workflows/docker-builder-testing-plugins.yml" + - ".github/docker/testing/*" + +jobs: + create-and-push-docker: + strategy: + matrix: + include: + - runner: ubuntu-22.04 + dockerfile: alma8 + image: alma8 + - runner: ubuntu-22.04 + dockerfile: alma9 + image: alma9 + - runner: ubuntu-22.04 + dockerfile: bullseye + image: bullseye + - runner: ["self-hosted", "collect-arm64"] + dockerfile: bullseye + image: bullseye-arm64 + - runner: ubuntu-22.04 + dockerfile: bookworm + image: bookworm + - runner: ubuntu-22.04 + dockerfile: jammy + image: jammy + + runs-on: ${{ matrix.runner }} + + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Login to Registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + - name: Login to proxy registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }} + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 + with: + file: .github/docker/testing/Dockerfile.testing-plugins-${{ matrix.dockerfile }} + context: . + build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" + pull: true + push: true + tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/testing-plugins-${{ matrix.image }}:latest diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index c5d579dfd6..9a788e960b 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -76,10 +76,10 @@ jobs: PLUGINS="$(python3 .github/scripts/process-plugins.py '${{ steps.filter.outputs.common == 'true' }}')" echo "plugins=$(echo $PLUGINS)" >> $GITHUB_OUTPUT - if [ "$PLUGINS" == '' ]; then echo "::notice::There are no modifications to the plugins packages" fi + shell: bash fatpacker: @@ -243,8 +243,55 @@ jobs: rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }} stability: ${{ needs.get-environment.outputs.stability }} + test-plugins: + needs: [get-environment, get-plugins, package] + strategy: + fail-fast: false + matrix: + distrib: [el8, el9, jammy, bullseye, bookworm] + include: + - package_extension: rpm + image: testing-plugins-alma8 + distrib: el8 + - package_extension: rpm + image: testing-plugins-alma9 + distrib: el9 + - package_extension: deb + image: testing-plugins-bullseye + distrib: bullseye + - package_extension: deb + image: testing-plugins-bookworm + distrib: bookworm + - package_extension: deb + image: testing-plugins-jammy + distrib: jammy + + runs-on: ubuntu-22.04 + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} + credentials: + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - uses: ./.github/actions/test-plugins + with: + cache-key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + package-extension: ${{ matrix.package_extension }} + plugin-list: ${{ needs.get-plugins.outputs.plugins }} + + - name: Upload apt/dnf logs as artifacts if tests failed + if: failure() + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: plugin-installation-${{ matrix.distrib }} + path: /var/log/robot-plugins-installation-tests.log + retention-days: 1 + deliver: - needs: [get-environment, package] + needs: [get-environment, package, test-plugins] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} uses: ./.github/workflows/plugin-delivery.yml with: diff --git a/.github/workflows/tests-functional.yml b/.github/workflows/tests-functional.yml deleted file mode 100644 index b604dc57c0..0000000000 --- a/.github/workflows/tests-functional.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: functional-tests - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -on: - workflow_dispatch: - pull_request: - paths: - - '.github/workflows/tests-functional.yml' - - 'src/**' - - 'tests/functional/**' - - 'tests/resources/mockoon/**' - - 'tests/resources/snmp/**' - -jobs: - functional-tests-with-robot: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Install libs - run: | - sudo apt update - sudo apt-get install -y libcurl4-openssl-dev - sudo apt-get install -qqy snmpsim - - - name: Install Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: 21 - - - name: Install Mockoon CLI - run: npm install -g -D @mockoon/cli@7.0.0 - - - name: Install perl dependencies - uses: shogo82148/actions-setup-perl@28eae78d12c2bba1163aec45d123f6d9228bc307 # v1.29.0 - with: - perl-version: '5.34' - install-modules-with: cpm - install-modules: | - Alien::SNMP - DateTime - Net::Curl::Easy - Paws - Net::SNMP - URI::Encode - XML::LibXML - DBI - DBD::mysql - POSIX - Time::HiRes - JSON::XS - - - name: Install Python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 - with: - python-version: '3.11' - - - name: Install Robot Framework - run: | - pip3.11 install robotframework - pip3.11 install RobotFramework-Examples - shell: bash - - - name: Run Robot Framework tests - run: | - sudo mkdir -p /var/lib/centreon/centplugins/ - sudo chmod 777 /var/lib/centreon/centplugins/ - sudo useradd snmp - sudo mkdir -p /usr/snmpsim/data - sudo cp -r tests/robot/* /usr/snmpsim/data/ - snmpsimd --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp & - robot tests/robot diff --git a/packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/deb.json b/packaging/centreon-plugin-Applications-Clamav-Ssh/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/deb.json rename to packaging/centreon-plugin-Applications-Clamav-Ssh/deb.json diff --git a/packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/pkg.json b/packaging/centreon-plugin-Applications-Clamav-Ssh/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/pkg.json rename to packaging/centreon-plugin-Applications-Clamav-Ssh/pkg.json diff --git a/packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/rpm.json b/packaging/centreon-plugin-Applications-Clamav-Ssh/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Antivirus-Clamav-Ssh/rpm.json rename to packaging/centreon-plugin-Applications-Clamav-Ssh/rpm.json diff --git a/packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/deb.json b/packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/deb.json rename to packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/deb.json diff --git a/packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/pkg.json b/packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/pkg.json rename to packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/pkg.json diff --git a/packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/rpm.json b/packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Cassandra-Jmx/rpm.json rename to packaging/centreon-plugin-Applications-Database-Cassandra-Jmx/rpm.json diff --git a/packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/deb.json b/packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/deb.json rename to packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/deb.json diff --git a/packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/pkg.json b/packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/pkg.json rename to packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/pkg.json diff --git a/packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/rpm.json b/packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Databases-Couchdb-Restapi/rpm.json rename to packaging/centreon-plugin-Applications-Database-Couchdb-Restapi/rpm.json diff --git a/packaging/centreon-plugin-Applications-Netbackup-SSH/deb.json b/packaging/centreon-plugin-Applications-Netbackup-Ssh/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Netbackup-SSH/deb.json rename to packaging/centreon-plugin-Applications-Netbackup-Ssh/deb.json diff --git a/packaging/centreon-plugin-Applications-Netbackup-SSH/pkg.json b/packaging/centreon-plugin-Applications-Netbackup-Ssh/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Netbackup-SSH/pkg.json rename to packaging/centreon-plugin-Applications-Netbackup-Ssh/pkg.json diff --git a/packaging/centreon-plugin-Applications-Netbackup-SSH/rpm.json b/packaging/centreon-plugin-Applications-Netbackup-Ssh/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Netbackup-SSH/rpm.json rename to packaging/centreon-plugin-Applications-Netbackup-Ssh/rpm.json diff --git a/packaging/centreon-plugin-Applications-Pacemaker-SSH/deb.json b/packaging/centreon-plugin-Applications-Pacemaker-Ssh/deb.json similarity index 100% rename from packaging/centreon-plugin-Applications-Pacemaker-SSH/deb.json rename to packaging/centreon-plugin-Applications-Pacemaker-Ssh/deb.json diff --git a/packaging/centreon-plugin-Applications-Pacemaker-SSH/pkg.json b/packaging/centreon-plugin-Applications-Pacemaker-Ssh/pkg.json similarity index 100% rename from packaging/centreon-plugin-Applications-Pacemaker-SSH/pkg.json rename to packaging/centreon-plugin-Applications-Pacemaker-Ssh/pkg.json diff --git a/packaging/centreon-plugin-Applications-Pacemaker-SSH/rpm.json b/packaging/centreon-plugin-Applications-Pacemaker-Ssh/rpm.json similarity index 100% rename from packaging/centreon-plugin-Applications-Pacemaker-SSH/rpm.json rename to packaging/centreon-plugin-Applications-Pacemaker-Ssh/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-DataFactory-Factory-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-DataFactory-Factories-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mariadb-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MariaDB-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-Mysql-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Database-MySQL-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Database-SqlManagedInstance-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/deb.json b/packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/deb.json rename to packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/pkg.json b/packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/rpm.json b/packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Devtools-Appconfiguration/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-DevTools-AppConfiguration-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Integration-Eventgrid-Api/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Integration-EventGrid-Api/rpm.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/deb.json b/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/deb.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/deb.json rename to packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/deb.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/pkg.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/pkg.json rename to packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/pkg.json diff --git a/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/rpm.json similarity index 100% rename from packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager/rpm.json rename to packaging/centreon-plugin-Cloud-Azure-Network-TrafficManager-Api/rpm.json diff --git a/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/deb.json b/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/deb.json rename to packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/deb.json diff --git a/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/pkg.json b/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/pkg.json rename to packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/rpm.json b/packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc3-Snmp/rpm.json rename to packaging/centreon-plugin-Hardware-Sensors-Rittal-Cmc-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/deb.json b/packaging/centreon-plugin-Network-Dell-Os10-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/deb.json rename to packaging/centreon-plugin-Network-Dell-Os10-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/pkg.json b/packaging/centreon-plugin-Network-Dell-Os10-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Dell-Os10-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/rpm.json b/packaging/centreon-plugin-Network-Dell-Os10-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Os10-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Dell-Os10-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/deb.json b/packaging/centreon-plugin-Network-Dell-Xseries-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/deb.json rename to packaging/centreon-plugin-Network-Dell-Xseries-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/pkg.json b/packaging/centreon-plugin-Network-Dell-Xseries-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Dell-Xseries-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/rpm.json b/packaging/centreon-plugin-Network-Dell-Xseries-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Switchs-Dell-Xseries-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Dell-Xseries-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/deb.json b/packaging/centreon-plugin-Network-Juniper-Mag-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/deb.json rename to packaging/centreon-plugin-Network-Juniper-Mag-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/pkg.json b/packaging/centreon-plugin-Network-Juniper-Mag-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Juniper-Mag-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/rpm.json b/packaging/centreon-plugin-Network-Juniper-Mag-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Firewalls-Juniper-Mag-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Juniper-Mag-Snmp/rpm.json diff --git a/packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/deb.json b/packaging/centreon-plugin-Network-Sonus-SBC-Snmp/deb.json similarity index 100% rename from packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/deb.json rename to packaging/centreon-plugin-Network-Sonus-SBC-Snmp/deb.json diff --git a/packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/pkg.json b/packaging/centreon-plugin-Network-Sonus-SBC-Snmp/pkg.json similarity index 100% rename from packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/pkg.json rename to packaging/centreon-plugin-Network-Sonus-SBC-Snmp/pkg.json diff --git a/packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/rpm.json b/packaging/centreon-plugin-Network-Sonus-SBC-Snmp/rpm.json similarity index 100% rename from packaging/centreon-plugin-Network-Sonus-Sbc-Snmp/rpm.json rename to packaging/centreon-plugin-Network-Sonus-SBC-Snmp/rpm.json From 76ae2d567a365c8a9fe09f8c9862b68c0fe00f7e Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Tue, 7 May 2024 10:41:44 +0200 Subject: [PATCH 10/18] [CTOR-566][Plugin] New pack Quanta Restapi (#5019) --- .../deb.json | 5 +++++ .../pkg.json | 9 +++++++++ .../rpm.json | 5 +++++ .../quanta/restapi/mode/webscenariosavailability.pm | 2 +- tests/resources/spellcheck/stopwords.t | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/deb.json create mode 100644 packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/pkg.json create mode 100644 packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/rpm.json diff --git a/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/deb.json b/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/deb.json new file mode 100644 index 0000000000..e8ca247c85 --- /dev/null +++ b/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libdatetime-perl" + ] +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/pkg.json b/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/pkg.json new file mode 100644 index 0000000000..fbc781ff08 --- /dev/null +++ b/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/pkg.json @@ -0,0 +1,9 @@ +{ + "pkg_name": "centreon-plugin-Applications-Monitoring-Quanta-Restapi", + "pkg_summary": "Centreon Plugin to check Quanta.io application probes results.", + "plugin_name": "centreon_monitoring_quanta_restapi.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "apps/monitoring/quanta/restapi" + ] +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/rpm.json b/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/rpm.json new file mode 100644 index 0000000000..45de583855 --- /dev/null +++ b/packaging/centreon-plugin-Applications-Monitoring-Quanta-Restapi/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(DateTime)" + ] +} \ No newline at end of file diff --git a/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm b/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm index f94932bcd5..2f0919e7ca 100644 --- a/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm +++ b/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm @@ -131,7 +131,7 @@ Check web scenario availability metrics. =item B<--scenario-id> -Set ID of the scenario. +Set ID of the scenario (mandatory option). =item B<--timeframe> diff --git a/tests/resources/spellcheck/stopwords.t b/tests/resources/spellcheck/stopwords.t index 58342508ab..af9d793991 100644 --- a/tests/resources/spellcheck/stopwords.t +++ b/tests/resources/spellcheck/stopwords.t @@ -47,6 +47,7 @@ SNMP space-usage-prct SSH SureBackup +timeframe topic-messages-inflighted total-oper-down total-oper-up From 1fb16479659b793865a94d2a9dfa4efed06d5317 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Tue, 7 May 2024 17:53:47 +0200 Subject: [PATCH 11/18] [CTOR-566][Plugin] New pack Quanta Restapi (Fix) (#5021) --- .../monitoring/quanta/restapi/mode/webscenariosavailability.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm b/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm index 2f0919e7ca..04ea400fc1 100644 --- a/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm +++ b/src/apps/monitoring/quanta/restapi/mode/webscenariosavailability.pm @@ -135,7 +135,7 @@ Set ID of the scenario (mandatory option). =item B<--timeframe> -Set timeframe in seconds (default: 14400). +Set timeframe in seconds (default: 900). =item B<--warning-*> B<--critical-*> From 30286395abc7ae5da9e15eb25ebb3ca017002cce Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Tue, 14 May 2024 10:37:40 +0200 Subject: [PATCH 12/18] fix(plugin) cifs,sftp,ftp plugin now check recursively folders (#5015) REF:CTOR-258 --- src/apps/protocols/cifs/mode/filescount.pm | 23 +++++++------ src/apps/protocols/ftp/mode/filescount.pm | 39 ++++++++++++---------- src/apps/protocols/sftp/mode/filescount.pm | 37 ++++++++++---------- 3 files changed, 52 insertions(+), 47 deletions(-) diff --git a/src/apps/protocols/cifs/mode/filescount.pm b/src/apps/protocols/cifs/mode/filescount.pm index 28ae338f7c..88cbf1fc66 100644 --- a/src/apps/protocols/cifs/mode/filescount.pm +++ b/src/apps/protocols/cifs/mode/filescount.pm @@ -106,27 +106,28 @@ sub countFiles { # Cannot list we skip next; } - + # this loop is recursive, when we find a directory we add it to the list used by the for loop. + # max_depth is used to limit the depth we search. + # same behaviour as ftp and sftp protocol. foreach my $file (@$files) { - next if ($file->[0] != SMBC_FILE && $file->[0] != SMBC_DIR); + next if ($file->[0] != SMBC_FILE && $file->[0] != SMBC_DIR); next if ($file->[1] eq '.' || $file->[1] eq '..'); my $name = $dir . '/' . $file->[1]; - - if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' && - $name !~ /$self->{option_results}->{filter_file}/) { - $self->{output}->output_add(long_msg => sprintf("skipping '%s'", $name), debug => 1); - next; - } if ($file->[0] == SMBC_DIR) { if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) { push @$list, { name => $name, level => $level + 1 }; } - } else { - $self->{output}->output_add(long_msg => sprintf("Match '%s'", $name)); - $self->{global}->{detected}++; + next; + } elsif (!centreon::plugins::misc::is_empty($self->{option_results}->{filter_file}) + # if this is a file check the filter_file regex + && $name !~ /$self->{option_results}->{filter_file}/) { + $self->{output}->output_add(long_msg => sprintf("skipping '%s'", $name), debug => 1); + next; } + $self->{output}->output_add(long_msg => sprintf("Match '%s'", $name)); + $self->{global}->{detected}++; } } } diff --git a/src/apps/protocols/ftp/mode/filescount.pm b/src/apps/protocols/ftp/mode/filescount.pm index 3345814fb5..8c186f9aa2 100644 --- a/src/apps/protocols/ftp/mode/filescount.pm +++ b/src/apps/protocols/ftp/mode/filescount.pm @@ -89,7 +89,7 @@ sub run { my $exit_code = $self->{perfdata}->threshold_check(value => $count, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - + $self->{output}->output_add(severity => $exit_code, short_msg => sprintf("Number of files : %s", $count)); $self->{output}->perfdata_add(label => 'files', @@ -105,7 +105,7 @@ sub countFiles { my ($self) = @_; my @listings; my $count = 0; - + if (!defined($self->{option_results}->{directory}) || scalar(@{$self->{option_results}->{directory}}) == 0) { push @listings, [ { name => '.', level => 0 } ]; } else { @@ -121,36 +121,39 @@ sub countFiles { my $hash = pop @$list; my $dir = $hash->{name}; my $level = $hash->{level}; - + if (!(@files = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{ls}->{$self->{ssl_or_not}}->{name}, command_args => [$dir]))) { # Cannot list we skip next; } - + # this loop is recursive, when we find a directory we add it to the list used by the for loop. + # max_depth is used to limit the depth we search. + # same behaviour as cifs(samba) and sftp protocol. foreach my $line (@files) { # IIS: 05-13-15 10:59AM 1184403 test.jpg next if ($line !~ /(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(.*)/ && - $line !~ /^\s*\S+\s*\S+\s*(\S+)\s+(.*)/); + $line !~ /^\s*\S+\s*\S+\s*(\S+)\s+(.*)/); my ($rights, $filename) = ($1, $2); my $bname = basename($filename); next if ($bname eq '.' || $bname eq '..'); my $name = $dir . '/' . $bname; - - if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' && - $name !~ /$self->{option_results}->{filter_file}/) { - $self->{output}->output_add(long_msg => sprintf("Skipping '%s'", $name)); - next; - } - + if ($rights =~ /^(d|)/i) { - if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) { - push @$list, { name => $name, level => $level + 1}; + # in the case of a directory and the max level is not reached yet, we add it to the recursive browsing + if (defined($self->{option_results}->{max_depth}) + && $level + 1 <= $self->{option_results}->{max_depth}) { + push @$list, { name => $name, level => $level + 1 }; } - } else { - $self->{output}->output_add(long_msg => sprintf("Match '%s'", $name)); - $count++; + next; + } elsif (!centreon::plugins::misc::is_empty($self->{option_results}->{filter_file}) + && $name !~ /$self->{option_results}->{filter_file}/) { + $self->{output}->output_add(long_msg => sprintf("Skipping '%s'", $name)); + # in the case of a file that does not match the filter, we skip + next; } - } + $self->{output}->output_add(long_msg => sprintf("Match '%s'", $name)); + $count++; + } } } return $count; diff --git a/src/apps/protocols/sftp/mode/filescount.pm b/src/apps/protocols/sftp/mode/filescount.pm index 6d74c35679..11e6c38534 100644 --- a/src/apps/protocols/sftp/mode/filescount.pm +++ b/src/apps/protocols/sftp/mode/filescount.pm @@ -34,12 +34,12 @@ sub set_counters { $self->{maps_counters}->{global} = [ { label => 'files-detected', nlabel => 'files.detected.count', set => { - key_values => [ { name => 'detected' } ], - output_template => 'number of files: %s', - perfdatas => [ - { template => '%s', min => 0 } - ] - } + key_values => [ { name => 'detected' } ], + output_template => 'number of files: %s', + perfdatas => [ + { template => '%s', min => 0 } + ] + } } ]; } @@ -93,7 +93,7 @@ sub manage_selection { sub countFiles { my ($self, %options) = @_; my @listings; - + foreach my $dir (@{$self->{option_results}->{directory}}) { push @listings, [ { name => $dir, level => 0 } ]; } @@ -111,26 +111,27 @@ sub countFiles { # Cannot list we skip next; } - + # this loop is recursive, when we find a directory we add it to the list used by the for loop. + # max_depth is used to limit the depth we search. + # same behaviour as cifs(samba) and ftp protocol. foreach my $file (@{$rv->{files}}) { next if ($file->{name} eq '.' || $file->{name} eq '..'); my $name = $dir . '/' . $file->{name}; - - if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' && - $name !~ /$self->{option_results}->{filter_file}/) { - $self->{output}->output_add(long_msg => sprintf("skipping '%s'", $name), debug => 1); - next; - } if ($file->{type} == 2) { + # case of a directory if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) { push @$list, { name => $name, level => $level + 1 }; } - } else { - $self->{output}->output_add(long_msg => sprintf("Match '%s'", $name)); - $self->{global}->{detected}++; + next; + } elsif (!centreon::plugins::misc::is_empty($self->{option_results}->{filter_file}) + && $name !~ /$self->{option_results}->{filter_file}/) { + $self->{output}->output_add(long_msg => sprintf("skipping '%s'", $name), debug => 1); + next; } - } + $self->{output}->output_add(long_msg => sprintf("Match '%s'", $name)); + $self->{global}->{detected}++; + } } } } From 531ac59d6b658f3bfb64b647b4939d8cf476ff34 Mon Sep 17 00:00:00 2001 From: omercier <32134301+omercier@users.noreply.github.com> Date: Tue, 14 May 2024 17:00:24 +0200 Subject: [PATCH 13/18] enh(plugin): refactored the RRDcached plugin (#5025) --- .../pkg.json | 4 +- src/apps/rrdcached/custom/tcp.pm | 118 +++++++++ src/apps/rrdcached/custom/unix.pm | 111 ++++++++ src/apps/rrdcached/mode/ping.pm | 118 +++++++++ src/apps/rrdcached/mode/stats.pm | 248 ++++++++---------- src/apps/rrdcached/plugin.pm | 12 +- tests/resources/spellcheck/stopwords.t | 1 + 7 files changed, 471 insertions(+), 141 deletions(-) create mode 100644 src/apps/rrdcached/custom/tcp.pm create mode 100644 src/apps/rrdcached/custom/unix.pm create mode 100644 src/apps/rrdcached/mode/ping.pm diff --git a/packaging/centreon-plugin-Applications-RRDCached/pkg.json b/packaging/centreon-plugin-Applications-RRDCached/pkg.json index e475161074..eac5a9a45e 100644 --- a/packaging/centreon-plugin-Applications-RRDCached/pkg.json +++ b/packaging/centreon-plugin-Applications-RRDCached/pkg.json @@ -3,7 +3,7 @@ "pkg_summary": "Centreon Plugin to check RRDCached related informations", "plugin_name": "centreon_rrdcached.pl", "files": [ - "centreon/plugins/script_simple.pm", + "centreon/plugins/script_custom.pm", "apps/rrdcached/" ] -} \ No newline at end of file +} diff --git a/src/apps/rrdcached/custom/tcp.pm b/src/apps/rrdcached/custom/tcp.pm new file mode 100644 index 0000000000..533f70f105 --- /dev/null +++ b/src/apps/rrdcached/custom/tcp.pm @@ -0,0 +1,118 @@ +# Copyright 2024 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 apps::rrdcached::custom::tcp; +use strict; +use warnings; +use IO::Socket; + +sub new { + my ($class, %options) = @_; + my $self = {}; + bless $self, $class; + + # Check if an output option is available + if (!defined($options{output})) { + print "Class Custom: Need to specify 'output' argument.\n"; + exit 3; + } + # Check if options are available + if (!defined($options{options})) { + $options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument."); + $options{output}->option_exit(); + } + + if (!defined($options{noptions})) { + # Adding options legacy from appsmetrics.pm in single mode + $options{options}->add_options(arguments => { + 'hostname:s' => { name => 'hostname', default => '127.0.0.1' }, + 'port:s' => { name => 'port', default => 42217 }, + 'timeout:s' => { name => 'timeout', default => 5 } + }); + } + # Adding Help structure to the object + $options{options}->add_help(package => __PACKAGE__, sections => 'RRDCACHED TCP OPTIONS', once => 1); + # Adding output structure to the object + $self->{output} = $options{output}; + + return $self; +} + +sub set_options { + my ($self, %options) = @_; + + $self->{option_results} = $options{option_results}; +} + +sub set_defaults {} + +sub check_options { + my ($self, %options) = @_; + + return 0; +} + +sub connect { + my ($self, %options) = @_; + + my $socket = IO::Socket::INET->new( + PeerHost => $self->{option_results}->{hostname}, + PeerPort => $self->{option_results}->{port}, + Timeout => $self->{option_results}->{timeout}, + Proto => 'tcp', + ); + + return $socket; +} + +1; + +__END__ + +=head1 NAME + +TCP socket custom mode. + +=head1 SYNOPSIS + +RRDcached access via TCP socket. + +=head1 RRDCACHED TCP OPTIONS + +=over 8 + +=item B<--hostname> + +Hostname to connect to. + +=item B<--port> + +TCP port (default: 42217) + +=item B<--timeout> + +Connection timeout. + +=back + +=head1 DESCRIPTION + +B. + +=cut diff --git a/src/apps/rrdcached/custom/unix.pm b/src/apps/rrdcached/custom/unix.pm new file mode 100644 index 0000000000..1aa341e9bd --- /dev/null +++ b/src/apps/rrdcached/custom/unix.pm @@ -0,0 +1,111 @@ +# Copyright 2024 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 apps::rrdcached::custom::unix; +use strict; +use warnings; +use IO::Socket; + +sub new { + my ($class, %options) = @_; + my $self = {}; + bless $self, $class; + + # Check if an output option is available + if (!defined($options{output})) { + print "Class Custom: Need to specify 'output' argument.\n"; + exit 3; + } + # Check if options are available + if (!defined($options{options})) { + $options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument."); + $options{output}->option_exit(); + } + + if (!defined($options{noptions})) { + $options{options}->add_options(arguments => { + 'socket-path:s' => { name => 'socket_path', default => '/var/rrdtool/rrdcached/rrdcached.sock' }, + 'timeout:s' => { name => 'timeout', default => 5 } + }); + } + # Adding the custom mode's help to the object + $options{options}->add_help(package => __PACKAGE__, sections => 'RRDCACHED UNIX SOCKET OPTIONS', once => 1); + # Adding output structure to the object + $self->{output} = $options{output}; + + return $self; +} + +sub set_options { + my ($self, %options) = @_; + + $self->{option_results} = $options{option_results}; +} + +sub set_defaults {} + +sub check_options { + my ($self, %options) = @_; + + return 0; +} + +sub connect { + my ($self, %options) = @_; + + my $socket = IO::Socket::UNIX->new( + Type => SOCK_STREAM(), + Peer => $self->{option_results}->{socket_path}, + Timeout => $self->{option_results}->{timeout}, + ); + + return $socket; +} + +1; + +__END__ + +=head1 NAME + +UNIX socket custom mode. + +=head1 SYNOPSIS + +RRDcached access via UNIX socket. + +=head1 RRDCACHED UNIX SOCKET OPTIONS + +=over 8 + +=item B<--socket-path> + +Path to the UNIX socket (default is /var/rrdtool/rrdcached/rrdcached.sock). + +=item B<--timeout> + +Connection timeout. + +=back + +=head1 DESCRIPTION + +B. + +=cut diff --git a/src/apps/rrdcached/mode/ping.pm b/src/apps/rrdcached/mode/ping.pm new file mode 100644 index 0000000000..7facb69cd6 --- /dev/null +++ b/src/apps/rrdcached/mode/ping.pm @@ -0,0 +1,118 @@ +# +# Copyright 2024 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 apps::rrdcached::mode::ping; + +use strict; +use warnings; +use IO::Socket; + +use base qw(centreon::plugins::templates::counter); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +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 set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { + name => 'global', + type => 0 + } + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'response', + type => 2, + critical_default => '%{response} !~ /PONG/', + set => { + key_values => [ { name => 'response' } ], + output_template => 'response: %s', + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; +} + +sub manage_selection { + my ($self, %options) = @_; + + my $ping_answered = 'no response'; + + # open the socket of either type TCP/UNIX + my $socket = $options{custom}->connect(); + # exit if we cannot connect/open it + if (!defined($socket) or !$socket->connected()) { + $self->{output}->output_add(severity => 'CRITICAL', short_msg => "Can't connect to socket, is rrdcached running ? is your socket path/address:port correct ?"); + $self->{output}->display(); + $self->{output}->exit(); + } + + # send the PING command and receive the response + $socket->send("PING\n"); + SOCKETREAD: + while (my $data = <$socket>) { + chomp $data; + # store the response + $ping_answered = $data; + $self->{output}->output_add(long_msg => sprintf("Received response - %s", $data)); + # only one line is expected so we can quit immediately + $socket->send("QUIT\n"); + close($socket); + # exit the while loop + last SOCKETREAD; + } + + $self->{global} = { + response => $ping_answered + }; +} + +1; + +__END__ + +=head1 MODE + +Check if the RRDcached daemon is answering to the basic PING command. + +=item B<--warning-response> + +Define the conditions to match for the status to be WARNING. You can use the variable '%{response}'. + +=item B<--critical-response> + +Define the conditions to match for the status to be CRITICAL. You can use the variable '%{response}'. +Default: '%{response} !~ /PONG/'. + +=over 8 + +=back diff --git a/src/apps/rrdcached/mode/stats.pm b/src/apps/rrdcached/mode/stats.pm index 10d56baa3b..327594076f 100644 --- a/src/apps/rrdcached/mode/stats.pm +++ b/src/apps/rrdcached/mode/stats.pm @@ -20,131 +20,130 @@ package apps::rrdcached::mode::stats; -use base qw(centreon::plugins::mode); - use strict; use warnings; use IO::Socket; +use base qw(centreon::plugins::templates::counter); + sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); bless $self, $class; - - $options{options}->add_options(arguments => - { - "host:s" => { name => 'host', default => '127.0.0.1' }, - "port:s" => { name => 'port', default => '42217' }, - "unix-socket-path:s" => { name => 'unix_socket_path', default => '/var/rrdtool/rrdcached/rrdcached.sock' }, - "warning-update:s" => { name => 'warning_update', default => '3000' }, - "critical-update:s" => { name => 'critical_update', default => '5000' }, - "warning-queue:s" => { name => 'warning_queue', default => '70' }, - "critical-queue:s" => { name => 'critical_queue', default => '100' }, - "socket-type:s" => { name => 'socket_type', default => 'unix' }, - }); + + $options{options}->add_options(arguments => {}); + return $self; } -sub check_options { +sub set_counters { my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (($self->{perfdata}->threshold_validate(label => 'warning-update', value => $self->{option_results}->{warning_update})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning-update threshold '" . $self->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical-update', value => $self->{option_results}->{critical_update})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{critical} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'warning-queue', value => $self->{option_results}->{warning_queue})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning-queue threshold '" . $self->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical-queue', value => $self->{option_results}->{critical_queue})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical-queue threshold '" . $self->{critical} . "'."); - $self->{output}->option_exit(); - } + + $self->{maps_counters_type} = [ + { + name => 'global', + type => 0 + } + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'queue-length', + nlabel => 'rrdcached.queue-length', + set => { + key_values => [ { name => 'queue_length' } ], + output_template => 'queue length: %s', + perfdatas => [ + { + template => '%d', + min => 0 + } + ] + } + }, + { + label => 'waiting-updates', + nlabel => 'rrdcached.waiting-updates', + set => { + key_values => [ { name => 'waiting_updates' } ], + output_template => 'waiting updates: %s', + perfdatas => [ + { + template => '%d', + min => 0 + } + ] + } + } + ]; } -sub run { +sub manage_selection { my ($self, %options) = @_; + my $data; - my @stat; - my @tab; - my $queueLenght; - my $socket; - - if ($self->{option_results}->{socket_type} eq 'tcp') { - $socket = IO::Socket::INET->new( - PeerHost => $self->{option_results}->{host}, - PeerPort => $self->{option_results}->{port}, - Proto => 'tcp', - ); - } else { - my $SOCK_PATH = $self->{option_results}->{unix_socket_path}; - $socket = IO::Socket::UNIX->new( - Type => SOCK_STREAM(), - Peer => $SOCK_PATH, - ); - } - - if (!defined($socket)) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Can't connect to socket, is rrdcached running ? is your socket path/address:port correct ?"); + my %raw_data; + + # open the socket of either type TCP/UNIX + my $socket = $options{custom}->connect(); + + # exit if we cannot connect/open it + if (!defined($socket) or !$socket->connected()) { + $self->{output}->output_add(severity => 'CRITICAL', short_msg => "Can't connect to socket, is RRDcached running + ? Is your socket path or address:port correct ?"); $self->{output}->display(); $self->{output}->exit(); - } else { - $socket->send("STATS\n"); - while ($data = <$socket>) { - if ($data =~ /(\d+) Statistics follow/) { - my $stats_number = $1; - if ($stats_number < 9) { - $self->{output}->output_add(severity => 'UNKNOWN', - short_msg => "Stats available are incomplete, check rrdcached daemon (try again if few moments)"); - $self->{output}->display(); - $self->{output}->exit(); - } - } - next if $data !~ m/(^UpdatesR|Data|Queue)/; - push @tab,$data; + } + + # send the STATS command and receive the response + $socket->send("STATS\n"); + SOCKETREAD: + while ($data = <$socket>) { + chomp $data; + # there should be at least 9 statistics in the response + if ($data =~ /(\d+) Statistics follow/) { + my $stats_number = $1; + if ($stats_number < 9) { + $self->{output}->output_add( + severity => 'UNKNOWN', + short_msg => "The returned statistics are incomplete. Try again later or check that the service is up."); + $self->{output}->display(); + $self->{output}->exit(); + } + next SOCKETREAD; + } + + # parse the stats as "Key: value" lines + if (my ($key, $value) = $data =~ m/^([^:]+):\s*([\d]+)$/) { + $raw_data{$key} = $value; + $self->{output}->output_add(long_msg => "Received data - $key: $value"); + } else { + $self->{output}->output_add(long_msg => "Skipping data - $data"); + next SOCKETREAD; + } + # once all the expected data has been received, we can quit the command and close the socket + if (defined($raw_data{QueueLength}) and defined($raw_data{UpdatesReceived}) and defined($raw_data{DataSetsWritten})) { $socket->send("QUIT\n"); - - } - - close($socket); - - foreach my $line (@tab) { - my ($key, $value) = split (/:\s*/, $line,2); - push @stat, $value; - $self->{output}->output_add(long_msg => sprintf("%s = %i", $key, $value)); + close($socket); + last SOCKETREAD; } - chomp($stat[0]); - my $updatesNotWritten = $stat[1] - $stat[2]; - - my $exit1 = $self->{perfdata}->threshold_check(value => $updatesNotWritten, threshold => [ { label => 'critical-update', 'exit_litteral' => 'critical' }, { label => 'warning-update', exit_litteral => 'warning' } ]); - my $exit2 = $self->{perfdata}->threshold_check(value => $stat[0], threshold => [ { label => 'critical-queue', 'exit_litteral' => 'critical' }, { label => 'warning-queue', exit_litteral => 'warning' } ]); - - my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); - - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("RRDCached has %i updates waiting and %i node(s) in queue", $updatesNotWritten, $stat[0])); - - $self->{output}->perfdata_add(label => 'QueueLenght', unit => 'nodes', - value => $stat[0], - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), - min => 0); - - $self->{output}->perfdata_add(label => 'UpdatesWaiting', unit => 'updates', - value => $updatesNotWritten, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), - min => 0); - + } + + # just in case... + if (!defined($raw_data{QueueLength}) or !defined($raw_data{UpdatesReceived}) or !defined($raw_data{DataSetsWritten})) { + # all the data have not been gathered despite the socket's answer is finished + close($socket) if $socket->connected(); + # exit with unknown status + $self->{output}->output_add(severity => 'UNKNOWN', short_msg => "The returned statistics are incomplete. Try again later."); $self->{output}->display(); $self->{output}->exit(); - } + } + # at this point, we should have the needed data, let's store it to our counter + $self->{global} = { + queue_length => $raw_data{QueueLength}, + waiting_updates => $raw_data{UpdatesReceived} - $raw_data{DataSetsWritten} + }; } 1; @@ -153,46 +152,25 @@ __END__ =head1 MODE -Check Updates cache of rrdcached daemon (compute delta between UpdatesReceived and DataSetsWritten from the rrdcached socket STATS command) +Check if the cache of RRDcached daemon's queue is too long or if it has too many updates waiting (difference between +UpdatesReceived and DataSetsWritten from the rrdcached socket STATS command). =over 8 -=item B<--tcp> - -Specify this option if TCP socket is used - -=item B<--host> - -Host where the socket is (should be set if --tcp is used) (default: 127.0.0.1) +=item B<--warning-rrdcached-waiting-updates> -=item B<--port> +Warning threshold for cached RRD updates (one update can include several values). -Port where the socket is listening (default: 42217) +=item B<--critical-rrdcached-waiting-updates> -=item B<--unix> +Critical threshold for cached RRD updates (one update can include several values). -Specify this option if UNIX socket is used +=item B<--warning-rrdcached-queue-length> -=item B<--socket-path> +Warning threshold for the number of nodes currently enqueued in the update queue. -Path to the socket (should be set if --unix is used) (default is /var/rrdtool/rrdcached/rrdcached.sock) +=item B<--critical-rrdcached-queue-length> -=item B<--warning-update> - -Warning number of cached RRD updates (One update can include several values) - -=item B<--critical-update> - -Critical number of cached RRD updates (One update can include several values) - -=item B<--warning-queue> - -Warning number of nodes in rrdcached queue - -=item B<--critical-queue> - -Critical number of nodes in rrdcached queue +Critical threshold for the number of nodes currently enqueued in the update queue. =back - -=cut diff --git a/src/apps/rrdcached/plugin.pm b/src/apps/rrdcached/plugin.pm index 3f3765bb0c..a59d49d90d 100644 --- a/src/apps/rrdcached/plugin.pm +++ b/src/apps/rrdcached/plugin.pm @@ -22,7 +22,7 @@ package apps::rrdcached::plugin; use strict; use warnings; -use base qw(centreon::plugins::script_simple); +use base qw(centreon::plugins::script_custom); sub new { my ($class, %options) = @_; @@ -30,9 +30,13 @@ sub new { bless $self, $class; $self->{version} = '0.1'; - %{$self->{modes}} = ( + $self->{modes} = { 'stats' => 'apps::rrdcached::mode::stats', - ); + 'ping' => 'apps::rrdcached::mode::ping' + }; + + $self->{custom_modes}->{tcp} = 'apps::rrdcached::custom::tcp'; + $self->{custom_modes}->{unix} = 'apps::rrdcached::custom::unix'; return $self; } @@ -43,6 +47,6 @@ __END__ =head1 PLUGIN DESCRIPTION -Check RRDCached related informations +Check RRDCached status and statistics. =cut diff --git a/tests/resources/spellcheck/stopwords.t b/tests/resources/spellcheck/stopwords.t index af9d793991..3f61349847 100644 --- a/tests/resources/spellcheck/stopwords.t +++ b/tests/resources/spellcheck/stopwords.t @@ -42,6 +42,7 @@ perfdata powershell proto queue-messages-inflighted +RRDCached Sansymphony SNMP space-usage-prct From 799aa4e2b58f2950f4467d01ca2e43ebf4dcddb3 Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Wed, 15 May 2024 15:30:30 +0200 Subject: [PATCH 14/18] ci(plugin) update JSON::Path dep on alma8 to same version as other OS Alma8 don't provide Exporter::shiny in a recent enough version (provide 1.000000 instead of 1.002002) so we must build this dep. REF:CTOR-525 --- .../docker/packaging/Dockerfile.packaging-plugins-alma8 | 2 +- .../docker/packaging/Dockerfile.packaging-plugins-alma9 | 2 +- .../packaging/Dockerfile.packaging-plugins-bookworm | 2 +- .../packaging/Dockerfile.packaging-plugins-bullseye | 2 +- .../docker/packaging/Dockerfile.packaging-plugins-centos7 | 2 +- .../docker/packaging/Dockerfile.packaging-plugins-jammy | 2 +- .github/docker/testing/Dockerfile.testing-plugins-alma8 | 2 +- .github/docker/testing/Dockerfile.testing-plugins-alma9 | 2 +- .../docker/testing/Dockerfile.testing-plugins-bookworm | 2 +- .../docker/testing/Dockerfile.testing-plugins-bullseye | 2 +- .github/docker/testing/Dockerfile.testing-plugins-jammy | 2 +- .github/workflows/perl-cpan-libraries.yml | 4 ++++ .github/workflows/perl-json-path.yml | 8 ++------ 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 index 11c2ec593b..c8f2f43e77 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/almalinux:8 diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 index bdd7f8d725..bb4edb2293 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/almalinux:9 diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm index caf7d402a9..476a9875cc 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/debian:bookworm diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye index a8cef0424f..413aff6151 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/debian:bullseye diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 b/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 index 78561500f4..3fd80dd488 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/centos:7 diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-jammy b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy index 234348e1fc..26579efcdb 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-jammy +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/ubuntu:jammy diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 index 47c2ffdba0..22d2d9c07a 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma8 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/almalinux:8 diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 index 6761366c85..d5cead3a20 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma9 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/almalinux:9 diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm index 2ff56f473d..95ae97a301 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bookworm +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/debian:bookworm diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bullseye b/.github/docker/testing/Dockerfile.testing-plugins-bullseye index 72c2b2ec6a..982506b7d5 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bullseye +++ b/.github/docker/testing/Dockerfile.testing-plugins-bullseye @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/debian:bullseye diff --git a/.github/docker/testing/Dockerfile.testing-plugins-jammy b/.github/docker/testing/Dockerfile.testing-plugins-jammy index 9df67d9d98..eb2a5920dc 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-jammy +++ b/.github/docker/testing/Dockerfile.testing-plugins-jammy @@ -1,4 +1,4 @@ -ARG REGISTRY_URL +ARG REGISTRY_URL=docker.io FROM ${REGISTRY_URL}/ubuntu:jammy diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 16ba4b17c8..396a5f57ac 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -53,6 +53,7 @@ jobs: "Digest::MD5::File", "Digest::SHA1", "Email::Send::SMTP::Gmail", + "Exporter::Shiny", "EV", "FFI::CheckLib", "FFI::Platypus", @@ -121,6 +122,8 @@ jobs: version: "0.022" - name: "Device::Modbus::TCP::Client" version: "0.026" + - name: "Exporter::Shiny" + build_distribs: el8 - name: "EV" - name: "FFI::CheckLib" - name: "FFI::Platypus" @@ -140,6 +143,7 @@ jobs: use_dh_make_perl: "false" version: "0.01" rpm_dependencies: "zeromq" + name: package ${{ matrix.distrib }} ${{ matrix.name }} container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest diff --git a/.github/workflows/perl-json-path.yml b/.github/workflows/perl-json-path.yml index f3206b70b1..d128646f97 100644 --- a/.github/workflows/perl-json-path.yml +++ b/.github/workflows/perl-json-path.yml @@ -69,11 +69,8 @@ jobs: dnf install -y cpanminus gcc fi - if [ "${{ matrix.distrib }}" = "el8" ]; then - cpanm -v -l /tmp JSON::Path@0.5 - else - cpanm -v -l /tmp JSON::Path@1.0.4 - fi + cpanm -v -l /tmp JSON::Path@1.0.4 + shell: bash - name: Set package name and paths according to distrib @@ -90,7 +87,6 @@ jobs: else NAME="perl-JSON-Path" if [ "${{ matrix.distrib }}" = "el8" ]; then - VERSION="0.5" # https://github.com/centreon/centreon-plugins/issues/4540 PERL_VENDORLIB="/usr/local/share/perl5" else PERL_VENDORLIB="/usr/local/share/perl5/$PERL_VERSION" From 73428460ca055c323ef2c3003e0da2fec3f72548 Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Wed, 15 May 2024 16:25:24 +0200 Subject: [PATCH 15/18] CTOR-320-community-pr-fix-status-mapping-on-citrix-psu (#5022) Co-authored-by: omercier <32134301+omercier@users.noreply.github.com> --- .../netscaler/snmp/mode/components/psu.pm | 31 ++++-- .../citrix/netscaler/snmp/mode/health.pm | 12 +- tests/resources/spellcheck/stopwords.t | 3 + .../mode/components/netscaler-health.robot | 36 ++++++ .../mode/components/psu-citrix-v13.snmpwalk | 104 ++++++++++++++++++ 5 files changed, 175 insertions(+), 11 deletions(-) create mode 100644 tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot create mode 100644 tests/robot/network/citrix/netscaler/snmp/mode/components/psu-citrix-v13.snmpwalk diff --git a/src/network/citrix/netscaler/snmp/mode/components/psu.pm b/src/network/citrix/netscaler/snmp/mode/components/psu.pm index 6d5f3ff009..f9d79f630b 100644 --- a/src/network/citrix/netscaler/snmp/mode/components/psu.pm +++ b/src/network/citrix/netscaler/snmp/mode/components/psu.pm @@ -23,23 +23,34 @@ package network::citrix::netscaler::snmp::mode::components::psu; use strict; use warnings; -my %map_psu_status = ( - 0 => 'not supported', - 1 => 'not present', - 2 => 'failed', - 3 => 'normal', -); -my $mapping = { - sysHealthCounterName => { oid => '.1.3.6.1.4.1.5951.4.1.1.41.7.1.1' }, - sysHealthCounterValue => { oid => '.1.3.6.1.4.1.5951.4.1.1.41.7.1.2', map => \%map_psu_status }, -}; my $oid_nsSysHealthEntry = '.1.3.6.1.4.1.5951.4.1.1.41.7.1'; sub load {} sub check { my ($self) = @_; + my %map_psu_status; + + if (!$self->{option_results}->{alternative_status_mapping}) { + %map_psu_status = ( + 0 => 'not supported', + 1 => 'not present', + 2 => 'failed', + 3 => 'normal', + ); + } else { + %map_psu_status = ( + 0 => 'normal', + 1 => 'not present', + 2 => 'failed', + 3 => 'not supported', + ); + } + my $mapping = { + sysHealthCounterName => { oid => '.1.3.6.1.4.1.5951.4.1.1.41.7.1.1' }, + sysHealthCounterValue => { oid => '.1.3.6.1.4.1.5951.4.1.1.41.7.1.2', map => \%map_psu_status }, + }; $self->{output}->output_add(long_msg => "Checking power supplies"); $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; diff --git a/src/network/citrix/netscaler/snmp/mode/health.pm b/src/network/citrix/netscaler/snmp/mode/health.pm index 62cf1cb42b..42a86f0033 100644 --- a/src/network/citrix/netscaler/snmp/mode/health.pm +++ b/src/network/citrix/netscaler/snmp/mode/health.pm @@ -69,7 +69,7 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $options{options}->add_options(arguments => {}); + $options{options}->add_options(arguments => { "alternative-status-mapping:s" => { name => 'alternative_status_mapping', default => '' }}); return $self; } @@ -119,6 +119,16 @@ Example: --warning='temperature,.,30' Set critical threshold for 'temperature', 'fanspeed', 'voltage'(syntax: type,regexp,threshold) Example: --critical='temperature,.*,40' +=item B<--alternative-status-mapping> + +Depending on the Netscaler product, the translation of OID .1.3.6.1.4.1.5951.4.1.1.41.7.1.2 may diverge. The default interpretation of this OID is: + +0 => not supported, 1 => not present, 2 => failed, 3 => normal. + +With this option set to '1', the OID will be interpreted otherwise: + +0 => normal, 1 => not present, 2 => failed, 3 => not supported. + =back =cut diff --git a/tests/resources/spellcheck/stopwords.t b/tests/resources/spellcheck/stopwords.t index 3f61349847..6b95c44b2e 100644 --- a/tests/resources/spellcheck/stopwords.t +++ b/tests/resources/spellcheck/stopwords.t @@ -20,6 +20,7 @@ Datacore deltaps df eth +fanspeed Fortigate Fortinet ifAlias @@ -33,6 +34,7 @@ IpAddr license-instances-usage-prct MBean NagVis +Netscaler OID oneaccess-sys-mib out-bcast @@ -41,6 +43,7 @@ out-ucast perfdata powershell proto +psu queue-messages-inflighted RRDCached Sansymphony diff --git a/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot b/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot new file mode 100644 index 0000000000..06e56300b0 --- /dev/null +++ b/tests/robot/network/citrix/netscaler/snmp/mode/components/netscaler-health.robot @@ -0,0 +1,36 @@ +*** Settings *** +Documentation Network citrix netscaler health + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource + +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::citrix::netscaler::snmp::plugin + +*** Test Cases *** +check psu components ${tc}/2 + [Documentation] mib don't seem set on the meaning of .1.3.6.1.4.1.5951.4.1.1.41.7.1.2, some client report 0 = normal and other 0 = not supported. + [Tags] network citrix snmp + ${command} Catenate + ... ${CMD} + ... --mode=health + ... --hostname='127.0.0.1' + ... --snmp-port='2024' + ... --snmp-community='network/citrix/netscaler/snmp/mode/components/${community}' + ... --component=psu + ... --alternative-status-mapping='${alternative_status_mapping}' + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n + + Examples: tc alternative_status_mapping community expected_result -- + ... 1 true psu-citrix-v13 OK: All 4 components are ok [4/4 psus]. | 'count_psu'=4;;;; + ... 2 ${EMPTY} psu-citrix-v13 UNKNOWN: Power supply '1' status is 'not supported' - Power supply '2' status is 'not supported' - Power supply '3' status is 'not supported' - Power supply '4' status is 'not supported' | 'count_psu'=4;;;; + + diff --git a/tests/robot/network/citrix/netscaler/snmp/mode/components/psu-citrix-v13.snmpwalk b/tests/robot/network/citrix/netscaler/snmp/mode/components/psu-citrix-v13.snmpwalk new file mode 100644 index 0000000000..f71bd4a90f --- /dev/null +++ b/tests/robot/network/citrix/netscaler/snmp/mode/components/psu-citrix-v13.snmpwalk @@ -0,0 +1,104 @@ +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.9.68.105.115.107.48.83.105.122.101 = STRING: "Disk0Size" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.9.68.105.115.107.48.85.115.101.100 = STRING: "Disk0Used" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.9.68.105.115.107.49.83.105.122.101 = STRING: "Disk1Size" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.9.68.105.115.107.49.85.115.101.100 = STRING: "Disk1Used" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.10.68.105.115.107.48.65.118.97.105.108 = STRING: "Disk0Avail" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.10.68.105.115.107.49.65.118.97.105.108 = STRING: "Disk1Avail" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.11.68.105.115.107.48.69.114.114.111.114.115 = STRING: "Disk0Errors" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.11.68.105.115.107.48.80.117.115.97.103.101 = STRING: "Disk0Pusage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.11.68.105.115.107.49.69.114.114.111.114.115 = STRING: "Disk1Errors" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.11.68.105.115.107.49.80.117.115.97.103.101 = STRING: "Disk1Pusage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.12.67.80.85.70.97.110.48.83.112.101.101.100 = STRING: "CPUFan0Speed" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.12.67.80.85.70.97.110.49.83.112.101.101.100 = STRING: "CPUFan1Speed" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.13.65.117.120.105.108.105.97.114.121.70.97.110.48 = STRING: "AuxiliaryFan0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.13.65.117.120.105.108.105.97.114.121.70.97.110.49 = STRING: "AuxiliaryFan1" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.13.65.117.120.105.108.105.97.114.121.70.97.110.50 = STRING: "AuxiliaryFan2" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.13.65.117.120.105.108.105.97.114.121.70.97.110.51 = STRING: "AuxiliaryFan3" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.14.65.117.120.105.108.105.97.114.121.77.105.115.99.48 = STRING: "AuxiliaryMisc0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.14.65.117.120.105.108.105.97.114.121.77.105.115.99.49 = STRING: "AuxiliaryMisc1" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.14.66.97.116.116.101.114.121.86.111.108.116.97.103.101 = STRING: "BatteryVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.14.83.121.115.116.101.109.70.97.110.83.112.101.101.100 = STRING: "SystemFanSpeed" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.14.86.111.108.116.97.103.101.83.101.110.115.111.114.50 = STRING: "VoltageSensor2" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.15.67.80.85.48.67.111.114.101.86.111.108.116.97.103.101 = STRING: "CPU0CoreVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.15.67.80.85.48.84.101.109.112.101.114.97.116.117.114.101 = STRING: "CPU0Temperature" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.15.67.80.85.49.67.111.114.101.86.111.108.116.97.103.101 = STRING: "CPU1CoreVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.15.67.80.85.49.84.101.109.112.101.114.97.116.117.114.101 = STRING: "CPU1Temperature" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.15.83.121.115.116.101.109.70.97.110.49.83.112.101.101.100 = STRING: "SystemFan1Speed" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.15.83.121.115.116.101.109.70.97.110.50.83.112.101.101.100 = STRING: "SystemFan2Speed" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.16.73.110.116.101.108.67.80.85.86.116.116.80.111.119.101.114 = STRING: "IntelCPUVttPower" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.48 = STRING: "AuxiliaryVoltage0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.49 = STRING: "AuxiliaryVoltage1" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.50 = STRING: "AuxiliaryVoltage2" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.51 = STRING: "AuxiliaryVoltage3" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.52 = STRING: "AuxiliaryVoltage4" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.53 = STRING: "AuxiliaryVoltage5" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.54 = STRING: "AuxiliaryVoltage6" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.55 = STRING: "AuxiliaryVoltage7" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.18.43.53.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "+5.0VSupplyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.18.45.53.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "-5.0VSupplyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.18.80.111.119.101.114.83.117.112.112.108.121.49.83.116.97.116.117.115 = STRING: "PowerSupply1Status" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.18.80.111.119.101.114.83.117.112.112.108.121.50.83.116.97.116.117.115 = STRING: "PowerSupply2Status" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.18.80.111.119.101.114.83.117.112.112.108.121.51.83.116.97.116.117.115 = STRING: "PowerSupply3Status" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.18.80.111.119.101.114.83.117.112.112.108.121.52.83.116.97.116.117.115 = STRING: "PowerSupply4Status" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.19.43.49.50.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "+12.0VSupplyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.19.45.49.50.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "-12.0VSupplyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.19.73.110.116.101.114.110.97.108.84.101.109.112.101.114.97.116.117.114.101 = STRING: "InternalTemperature" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.48 = STRING: "AuxiliaryTemperature0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.49 = STRING: "AuxiliaryTemperature1" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.50 = STRING: "AuxiliaryTemperature2" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.51 = STRING: "AuxiliaryTemperature3" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.21.77.97.105.110.51.46.51.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "Main3.3VSupplyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.24.83.116.97.110.100.98.121.51.46.51.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "Standby3.3VSupplyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.1.27.80.111.119.101.114.83.117.112.112.108.121.53.118.83.116.97.110.100.98.121.86.111.108.116.97.103.101 = STRING: "PowerSupply5vStandbyVoltage" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.9.68.105.115.107.48.83.105.122.101 = STRING: "1585" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.9.68.105.115.107.48.85.115.101.100 = STRING: "697" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.9.68.105.115.107.49.83.105.122.101 = STRING: "14179" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.9.68.105.115.107.49.85.115.101.100 = STRING: "6658" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.10.68.105.115.107.48.65.118.97.105.108 = STRING: "761" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.10.68.105.115.107.49.65.118.97.105.108 = STRING: "6386" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.11.68.105.115.107.48.69.114.114.111.114.115 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.11.68.105.115.107.48.80.117.115.97.103.101 = STRING: "47" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.11.68.105.115.107.49.69.114.114.111.114.115 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.11.68.105.115.107.49.80.117.115.97.103.101 = STRING: "51" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.12.67.80.85.70.97.110.48.83.112.101.101.100 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.12.67.80.85.70.97.110.49.83.112.101.101.100 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.13.65.117.120.105.108.105.97.114.121.70.97.110.48 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.13.65.117.120.105.108.105.97.114.121.70.97.110.49 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.13.65.117.120.105.108.105.97.114.121.70.97.110.50 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.13.65.117.120.105.108.105.97.114.121.70.97.110.51 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.14.65.117.120.105.108.105.97.114.121.77.105.115.99.48 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.14.65.117.120.105.108.105.97.114.121.77.105.115.99.49 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.14.66.97.116.116.101.114.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.14.83.121.115.116.101.109.70.97.110.83.112.101.101.100 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.14.86.111.108.116.97.103.101.83.101.110.115.111.114.50 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.15.67.80.85.48.67.111.114.101.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.15.67.80.85.48.84.101.109.112.101.114.97.116.117.114.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.15.67.80.85.49.67.111.114.101.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.15.67.80.85.49.84.101.109.112.101.114.97.116.117.114.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.15.83.121.115.116.101.109.70.97.110.49.83.112.101.101.100 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.15.83.121.115.116.101.109.70.97.110.50.83.112.101.101.100 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.16.73.110.116.101.108.67.80.85.86.116.116.80.111.119.101.114 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.48 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.49 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.50 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.51 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.52 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.53 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.54 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.17.65.117.120.105.108.105.97.114.121.86.111.108.116.97.103.101.55 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.18.43.53.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.18.45.53.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.18.80.111.119.101.114.83.117.112.112.108.121.49.83.116.97.116.117.115 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.18.80.111.119.101.114.83.117.112.112.108.121.50.83.116.97.116.117.115 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.18.80.111.119.101.114.83.117.112.112.108.121.51.83.116.97.116.117.115 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.18.80.111.119.101.114.83.117.112.112.108.121.52.83.116.97.116.117.115 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.19.43.49.50.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.19.45.49.50.46.48.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.19.73.110.116.101.114.110.97.108.84.101.109.112.101.114.97.116.117.114.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.48 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.49 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.50 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.21.65.117.120.105.108.105.97.114.121.84.101.109.112.101.114.97.116.117.114.101.51 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.21.77.97.105.110.51.46.51.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.24.83.116.97.110.100.98.121.51.46.51.86.83.117.112.112.108.121.86.111.108.116.97.103.101 = STRING: "0" +.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.27.80.111.119.101.114.83.117.112.112.108.121.53.118.83.116.97.110.100.98.121.86.111.108.116.97.103.101 = STRING: "0" \ No newline at end of file From 10d004a7b31e01e2020cfc080c866341d763cc14 Mon Sep 17 00:00:00 2001 From: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> Date: Thu, 16 May 2024 10:24:19 +0200 Subject: [PATCH 16/18] fix(plugin) Json PATH lib - CTOR-525 (#5027) --- src/apps/protocols/http/plugin.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/protocols/http/plugin.pm b/src/apps/protocols/http/plugin.pm index cb2e328c7a..05039da294 100644 --- a/src/apps/protocols/http/plugin.pm +++ b/src/apps/protocols/http/plugin.pm @@ -26,7 +26,7 @@ use base qw(centreon::plugins::script_simple); sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; $self->{modes} = { From 8fc448251dc3bc11baddda04cc93220524f345fa Mon Sep 17 00:00:00 2001 From: pkippes Date: Thu, 16 May 2024 14:46:55 +0200 Subject: [PATCH 17/18] Empty-Commit From e4a6de7aeda37df7f2d662a49d28654284ef2fa5 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 16 May 2024 16:37:43 +0200 Subject: [PATCH 18/18] fix(docker): add ruby-devel as required by npfm for perl-cpan builds --- .github/workflows/perl-cpan-libraries.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 396a5f57ac..94ea3fa2ce 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -164,7 +164,7 @@ jobs: dnf module reset -y ruby dnf module enable -y ruby:3.1 - dnf install -y ruby + dnf install -y ruby ruby-devel shell: bash - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }}