From 085040fe20ec11dca77a06bbc7826b52a6943e98 Mon Sep 17 00:00:00 2001 From: omercier <32134301+omercier@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:54:37 +0200 Subject: [PATCH] new(packaging): nokia (formerly alcatel) isam snmp plugin (#5087) Co-authored-by: Lucie Dubrunfaut <123162035+lucie-dubrunfaut@users.noreply.github.com> REFS: CTOR-594 --- .../deb.json | 5 +++ .../pkg.json | 14 +++++++ .../rpm.json | 5 +++ .../snmp/mode/components/cardtemperature.pm | 4 +- .../isam/snmp/mode/components/resources.pm | 4 +- .../isam/snmp/mode/components/sfp.pm | 4 +- .../{alcatel => nokia}/isam/snmp/mode/cpu.pm | 4 +- .../isam/snmp/mode/hardware.pm | 21 +++++++---- .../isam/snmp/mode/hubsapusage.pm | 37 +++++++++---------- .../isam/snmp/mode/listhubsap.pm | 4 +- .../isam/snmp/mode/memory.pm | 19 ++++------ .../{alcatel => nokia}/isam/snmp/plugin.pm | 15 ++++---- tests/resources/spellcheck/stopwords.t | 6 +++ 13 files changed, 87 insertions(+), 55 deletions(-) create mode 100644 packaging/centreon-plugin-Network-Nokia-Isam-Snmp/deb.json create mode 100644 packaging/centreon-plugin-Network-Nokia-Isam-Snmp/pkg.json create mode 100644 packaging/centreon-plugin-Network-Nokia-Isam-Snmp/rpm.json rename src/network/{alcatel => nokia}/isam/snmp/mode/components/cardtemperature.pm (95%) rename src/network/{alcatel => nokia}/isam/snmp/mode/components/resources.pm (93%) rename src/network/{alcatel => nokia}/isam/snmp/mode/components/sfp.pm (98%) rename src/network/{alcatel => nokia}/isam/snmp/mode/cpu.pm (98%) rename src/network/{alcatel => nokia}/isam/snmp/mode/hardware.pm (74%) rename src/network/{alcatel => nokia}/isam/snmp/mode/hubsapusage.pm (93%) rename src/network/{alcatel => nokia}/isam/snmp/mode/listhubsap.pm (98%) rename src/network/{alcatel => nokia}/isam/snmp/mode/memory.pm (95%) rename src/network/{alcatel => nokia}/isam/snmp/plugin.pm (68%) diff --git a/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/deb.json b/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/deb.json new file mode 100644 index 0000000000..663aaacebf --- /dev/null +++ b/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libsnmp-perl" + ] +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/pkg.json b/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/pkg.json new file mode 100644 index 0000000000..92f79896d5 --- /dev/null +++ b/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/pkg.json @@ -0,0 +1,14 @@ +{ + "pkg_name": "centreon-plugin-Network-Nokia-Isam-Snmp", + "pkg_summary": "Centreon Plugin to monitor Nokia (formerly Alcatel) Isam devices", + "plugin_name": "centreon_nokia_isam_snmp.pl", + "files": [ + "centreon/plugins/script_snmp.pm", + "centreon/plugins/snmp.pm", + "snmp_standard/mode/interfaces.pm", + "snmp_standard/mode/listinterfaces.pm", + "snmp_standard/mode/resources/", + "snmp_standard/mode/uptime.pm", + "network/nokia/isam/snmp/" + ] +} diff --git a/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/rpm.json b/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/rpm.json new file mode 100644 index 0000000000..418a331fce --- /dev/null +++ b/packaging/centreon-plugin-Network-Nokia-Isam-Snmp/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(SNMP)" + ] +} \ No newline at end of file diff --git a/src/network/alcatel/isam/snmp/mode/components/cardtemperature.pm b/src/network/nokia/isam/snmp/mode/components/cardtemperature.pm similarity index 95% rename from src/network/alcatel/isam/snmp/mode/components/cardtemperature.pm rename to src/network/nokia/isam/snmp/mode/components/cardtemperature.pm index 305b008b51..f6002ec304 100644 --- a/src/network/alcatel/isam/snmp/mode/components/cardtemperature.pm +++ b/src/network/nokia/isam/snmp/mode/components/cardtemperature.pm @@ -18,11 +18,11 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::components::cardtemperature; +package network::nokia::isam::snmp::mode::components::cardtemperature; use strict; use warnings; -use network::alcatel::isam::snmp::mode::components::resources qw($mapping_slot); +use network::nokia::isam::snmp::mode::components::resources qw($mapping_slot); my $oid_eqptBoardThermalSensorActualTemperature = '.1.3.6.1.4.1.637.61.1.23.10.1.2'; diff --git a/src/network/alcatel/isam/snmp/mode/components/resources.pm b/src/network/nokia/isam/snmp/mode/components/resources.pm similarity index 93% rename from src/network/alcatel/isam/snmp/mode/components/resources.pm rename to src/network/nokia/isam/snmp/mode/components/resources.pm index ff71783cfb..8a2ea85cb7 100644 --- a/src/network/alcatel/isam/snmp/mode/components/resources.pm +++ b/src/network/nokia/isam/snmp/mode/components/resources.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::components::resources; +package network::nokia::isam::snmp::mode::components::resources; use strict; use warnings; @@ -34,4 +34,4 @@ $mapping_slot = { eqptBoardInventorySerialNumber => { oid => '.1.3.6.1.4.1.637.61.1.23.3.1.19' }, }; -1; \ No newline at end of file +1; diff --git a/src/network/alcatel/isam/snmp/mode/components/sfp.pm b/src/network/nokia/isam/snmp/mode/components/sfp.pm similarity index 98% rename from src/network/alcatel/isam/snmp/mode/components/sfp.pm rename to src/network/nokia/isam/snmp/mode/components/sfp.pm index f9d9e0b6aa..38f1177754 100644 --- a/src/network/alcatel/isam/snmp/mode/components/sfp.pm +++ b/src/network/nokia/isam/snmp/mode/components/sfp.pm @@ -18,11 +18,11 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::components::sfp; +package network::nokia::isam::snmp::mode::components::sfp; use strict; use warnings; -use network::alcatel::isam::snmp::mode::components::resources qw($mapping_slot); +use network::nokia::isam::snmp::mode::components::resources qw($mapping_slot); my %map_los = (1 => 'los', 2 => 'noLos', 3 => 'notAvailable'); diff --git a/src/network/alcatel/isam/snmp/mode/cpu.pm b/src/network/nokia/isam/snmp/mode/cpu.pm similarity index 98% rename from src/network/alcatel/isam/snmp/mode/cpu.pm rename to src/network/nokia/isam/snmp/mode/cpu.pm index ec4e8f16cf..f4e27e7f98 100644 --- a/src/network/alcatel/isam/snmp/mode/cpu.pm +++ b/src/network/nokia/isam/snmp/mode/cpu.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::cpu; +package network::nokia::isam::snmp::mode::cpu; use base qw(centreon::plugins::templates::counter); @@ -95,7 +95,7 @@ __END__ =head1 MODE -Check CPU usages. +Monitor the CPU usage. =over 8 diff --git a/src/network/alcatel/isam/snmp/mode/hardware.pm b/src/network/nokia/isam/snmp/mode/hardware.pm similarity index 74% rename from src/network/alcatel/isam/snmp/mode/hardware.pm rename to src/network/nokia/isam/snmp/mode/hardware.pm index 32e5cb725f..2c96e04e07 100644 --- a/src/network/alcatel/isam/snmp/mode/hardware.pm +++ b/src/network/nokia/isam/snmp/mode/hardware.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::hardware; +package network::nokia::isam::snmp::mode::hardware; use base qw(centreon::plugins::templates::hardware); @@ -40,7 +40,7 @@ sub set_system { ] }; - $self->{components_path} = 'network::alcatel::isam::snmp::mode::components'; + $self->{components_path} = 'network::nokia::isam::snmp::mode::components'; $self->{components_module} = ['cardtemperature', 'sfp']; } @@ -76,7 +76,7 @@ Check Hardware. =item B<--component> -Which component to check (default: '.*'). +Define which component to check (default: '.*'). Can be: 'cardtemperature', 'sfp'. =item B<--filter> @@ -88,7 +88,6 @@ You can also exclude items from specific instances: --filter=cardtemperature,108 Define the expected status if no components are found (default: critical). - =item B<--threshold-overload> Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). @@ -96,13 +95,19 @@ Example: --threshold-overload='sfp,OK,^los$' =item B<--warning> -Set warning threshold for 'sfp.temperature', 'cardtemperature' (syntax: type,regexp,threshold) -Example: --warning='sfp.temperature,1.1,30' +Define the warning thresholds for an instance of a certain type of sensor. +Syntax: ,,. +Supported types of sensors: 'sfp.temperature', 'cardtemperature'. +Instances are identified by the last two parts of the OID, separated by a period (example: 1.1) and are filtered as a regular expression. +Example: --warning='sfp.temperature,1\.1,30' =item B<--critical> -Set critical threshold for 'sfp.temperature', 'cardtemperature' (syntax: type,regexp,threshold) -Example: --warning='sfp.temperature,1.1,40' +Define the critical thresholds for an instance of a certain type of sensor. +Syntax: ,,. +Supported types of sensors: 'sfp.temperature', 'cardtemperature'. +Instances are identified by the last two parts of the OID, separated by a period (example: 1.1) and are filtered as a regular expression. +Example: --critical='sfp.temperature,1\.1,40' =back diff --git a/src/network/alcatel/isam/snmp/mode/hubsapusage.pm b/src/network/nokia/isam/snmp/mode/hubsapusage.pm similarity index 93% rename from src/network/alcatel/isam/snmp/mode/hubsapusage.pm rename to src/network/nokia/isam/snmp/mode/hubsapusage.pm index 11f5a597b7..336a8551bf 100644 --- a/src/network/alcatel/isam/snmp/mode/hubsapusage.pm +++ b/src/network/nokia/isam/snmp/mode/hubsapusage.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::hubsapusage; +package network::nokia::isam::snmp::mode::hubsapusage; use base qw(centreon::plugins::templates::counter); @@ -334,7 +334,7 @@ sub manage_selection { $self->{output}->option_exit(); } - my $has_cache_file = $self->{statefile_cache}->read(statefile => 'cache_alcatel_isam_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode}); + my $has_cache_file = $self->{statefile_cache}->read(statefile => 'cache_nokia_isam_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode}); my $timestamp_cache = $self->{statefile_cache}->get(name => 'last_timestamp'); if ($has_cache_file == 0 || !defined($timestamp_cache) || ((time() - $timestamp_cache) > (($self->{option_results}->{reload_cache_time}) * 60))) { @@ -404,7 +404,7 @@ sub manage_selection { $self->{output}->option_exit(); } - $self->{cache_name} = 'alcatel_isam_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . + $self->{cache_name} = 'nokia_isam_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' . (defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')); } @@ -415,62 +415,61 @@ __END__ =head1 MODE -Check SAP QoS usage. +Check Service Access Points (SAP) QoS usage. =over 8 =item B<--display-name> -Display name (default: '%{SvcDescription}.%{IfName}.%{SapEncapName}'). -Can also be: %{SapDescription}, %{SapPortId} +Define the name to display (default: '%{SvcDescription}.%{IfName}.%{SapEncapName}'). +Other available macros: %{SapDescription}, %{SapPortId} =item B<--filter-name> -Filter by SAP name (can be a regexp). +Filter by Service Access Point (SAP) name (can be a regexp). =item B<--speed-in> -Set interface speed for incoming traffic (in Mb). +Define the actual maximum incoming traffic speed you can have on the interfaces in megabits per second. =item B<--speed-out> -Set interface speed for outgoing traffic (in Mb). +Define the actual maximum outgoing traffic speed you can have on the interfaces in megabits per second. =item B<--speed-total-in> -Set interface speed for total incoming traffic (in Mb). +Define the actual maximum total incoming traffic speed you can have on the interfaces in megabits per second. =item B<--speed-total-out> -Set interface speed for total outgoing traffic (in Mb). +Define the actual maximum total outgoing traffic speed you can have on the interfaces in megabits per second. =item B<--units-traffic> -Units of thresholds for the traffic (default: '%') ('%', 'b/s'). +Define the unit to use to apply to thresholds (default: '%') ('%', 'b/s'). =item B<--warning-status> -Set warning threshold for ib status. +Define the conditions to match for the status to be WARNING. You can use the following variables: %{admin}, %{status}, %{display} =item B<--critical-status> -Set critical threshold for ib status (default: '%{admin} =~ /up/i and %{status} !~ /up/i'). +Define the conditions to match for the status to be CRITICAL. +Default: '%{admin} =~ /up/i and %{status} !~ /up/i'. You can use the following variables: %{admin}, %{status}, %{display} =item B<--warning-*> -Warning threshold. -Can be: 'total-in-traffic', 'total-out-traffic', 'in-traffic', 'out-traffic'. +Warning thresholds for: 'total-in-traffic', 'total-out-traffic', 'in-traffic', 'out-traffic'. =item B<--critical-*> -Critical threshold. -Can be: 'total-in-traffic', 'total-out-traffic', 'in-traffic', 'out-traffic'. +Critical thresholds for: 'total-in-traffic', 'total-out-traffic', 'in-traffic', 'out-traffic'. =item B<--reload-cache-time> -Time in seconds before reloading cache file (default: 300). +Time in seconds before reloading the cache file (default: 300). =back diff --git a/src/network/alcatel/isam/snmp/mode/listhubsap.pm b/src/network/nokia/isam/snmp/mode/listhubsap.pm similarity index 98% rename from src/network/alcatel/isam/snmp/mode/listhubsap.pm rename to src/network/nokia/isam/snmp/mode/listhubsap.pm index 75274b527a..3483e3fdb0 100644 --- a/src/network/alcatel/isam/snmp/mode/listhubsap.pm +++ b/src/network/nokia/isam/snmp/mode/listhubsap.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::listhubsap; +package network::nokia::isam::snmp::mode::listhubsap; use base qw(centreon::plugins::mode); @@ -137,7 +137,7 @@ __END__ =head1 MODE -List SAP. +List Service Access Points (SAP) for service discovery. =over 8 diff --git a/src/network/alcatel/isam/snmp/mode/memory.pm b/src/network/nokia/isam/snmp/mode/memory.pm similarity index 95% rename from src/network/alcatel/isam/snmp/mode/memory.pm rename to src/network/nokia/isam/snmp/mode/memory.pm index 005f7b6c29..fb605058ef 100644 --- a/src/network/alcatel/isam/snmp/mode/memory.pm +++ b/src/network/nokia/isam/snmp/mode/memory.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::mode::memory; +package network::nokia::isam::snmp::mode::memory; use base qw(centreon::plugins::templates::counter); @@ -159,7 +159,7 @@ sub manage_selection { my $name = $result->{eqptBoardInventorySerialNumber} . '_' . $result->{eqptSlotActualType}; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { - $self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $name . "': not matching filter.", debug => 1); next; } $self->{memory}->{$name} = { display => $name, total => $result->{totalMemSize} * 1024 * 1024, used => $result->{memAbsoluteUsage} * 1024 * 1024 }; @@ -170,7 +170,7 @@ sub manage_selection { my $name = 'SD Card'; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { - $self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $name . "': not matching filter.", debug => 1); } else { $self->{memory}->{$name} = { display => $name, total => $snmp_result->{$oid_asamSwmTotalSpaceOnFileDisk}, used => $snmp_result->{$oid_asamSwmTotalSpaceOnFileDisk} - $snmp_result->{$oid_asamSwmFreeSpaceOnFileDisk} }; @@ -189,17 +189,14 @@ __END__ =head1 MODE -Check memory usages. +Monitor memory usage. =over 8 =item B<--filter-name> -Filter memory name (can be a regexp). - -=item B<--filter-project> - -Filter project name (can be a regexp). +Define which memory component to monitor based on their name. +This option will be treated as a regular expression. =item B<--warning-usage> @@ -211,11 +208,11 @@ Critical threshold. =item B<--units> -Units of thresholds (default: '%') ('%', 'B'). +Define the unit to use to apply to thresholds (default: '%') ('%', 'B'). =item B<--free> -Thresholds are on free space left. +Apply the thresholds on free space left instead of on used space. =back diff --git a/src/network/alcatel/isam/snmp/plugin.pm b/src/network/nokia/isam/snmp/plugin.pm similarity index 68% rename from src/network/alcatel/isam/snmp/plugin.pm rename to src/network/nokia/isam/snmp/plugin.pm index d8437c6e2a..9c31934236 100644 --- a/src/network/alcatel/isam/snmp/plugin.pm +++ b/src/network/nokia/isam/snmp/plugin.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::alcatel::isam::snmp::plugin; +package network::nokia::isam::snmp::plugin; use strict; use warnings; @@ -31,13 +31,14 @@ sub new { $self->{version} = '1.0'; %{$self->{modes}} = ( - 'cpu' => 'network::alcatel::isam::snmp::mode::cpu', - 'hardware' => 'network::alcatel::isam::snmp::mode::hardware', + 'cpu' => 'network::nokia::isam::snmp::mode::cpu', + 'hardware' => 'network::nokia::isam::snmp::mode::hardware', + 'hub-sap-usage' => 'network::nokia::isam::snmp::mode::hubsapusage', 'interfaces' => 'snmp_standard::mode::interfaces', - 'list-hub-sap' => 'network::alcatel::isam::snmp::mode::listhubsap', + 'list-hub-sap' => 'network::nokia::isam::snmp::mode::listhubsap', 'list-interfaces' => 'snmp_standard::mode::listinterfaces', - 'memory' => 'network::alcatel::isam::snmp::mode::memory', - 'hub-sap-usage' => 'network::alcatel::isam::snmp::mode::hubsapusage', + 'memory' => 'network::nokia::isam::snmp::mode::memory', + 'uptime' => 'snmp_standard::mode::uptime', ); return $self; @@ -49,6 +50,6 @@ __END__ =head1 PLUGIN DESCRIPTION -Check Alcatel DSL ISAM Family (also ASAM) in SNMP. +Monitor Nokia (formerly Alcatel) DSL ISAM devices (also ASAM) using SNMP. =cut diff --git a/tests/resources/spellcheck/stopwords.t b/tests/resources/spellcheck/stopwords.t index 6219228ef4..e2257eb37a 100644 --- a/tests/resources/spellcheck/stopwords.t +++ b/tests/resources/spellcheck/stopwords.t @@ -43,12 +43,15 @@ -NoLogo 2c ADSL +ASAM +Alcatel Avigilon Centreon Datacore Fortigate Fortinet HashiCorp +ISAM IpAddr Iwsva Loggly @@ -62,6 +65,7 @@ Nagios Netscaler OID PKCS1 +QoS RRDCached SNMP SSH @@ -76,6 +80,7 @@ VPN WSMAN XPath api.meraki.com +cardtemperature connections-dhcp connections-dns deltaps @@ -104,6 +109,7 @@ powershell.exe proto psu queue-messages-inflighted +sfp.temperature space-usage-prct teampass timeframe