From 9b79fc5b352c11cab8d9bc7053895c5b45bed46a Mon Sep 17 00:00:00 2001 From: qgarnier Date: Fri, 28 Apr 2023 10:08:48 +0200 Subject: [PATCH] (plugin) network::keysight::nvos::restapi - new (#4387) --- .../deb.json | 5 + .../pkg.json | 9 + .../rpm.json | 5 + .../keysight/nvos/restapi/custom/api.pm | 212 +++++++++++++ .../nvos/restapi/mode/dynamicfilters.pm | 193 ++++++++++++ .../keysight/nvos/restapi/mode/hardware.pm | 200 ++++++++++++ .../nvos/restapi/mode/listdynamicfilters.pm | 114 +++++++ .../keysight/nvos/restapi/mode/listports.pm | 124 ++++++++ .../keysight/nvos/restapi/mode/ports.pm | 291 ++++++++++++++++++ .../keysight/nvos/restapi/mode/time.pm | 193 ++++++++++++ .../keysight/nvos/restapi/mode/uptime.pm | 146 +++++++++ src/network/keysight/nvos/restapi/plugin.pm | 54 ++++ 12 files changed, 1546 insertions(+) create mode 100644 packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/deb.json create mode 100644 packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/pkg.json create mode 100644 packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/rpm.json create mode 100644 src/network/keysight/nvos/restapi/custom/api.pm create mode 100644 src/network/keysight/nvos/restapi/mode/dynamicfilters.pm create mode 100644 src/network/keysight/nvos/restapi/mode/hardware.pm create mode 100644 src/network/keysight/nvos/restapi/mode/listdynamicfilters.pm create mode 100644 src/network/keysight/nvos/restapi/mode/listports.pm create mode 100644 src/network/keysight/nvos/restapi/mode/ports.pm create mode 100644 src/network/keysight/nvos/restapi/mode/time.pm create mode 100644 src/network/keysight/nvos/restapi/mode/uptime.pm create mode 100644 src/network/keysight/nvos/restapi/plugin.pm diff --git a/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/deb.json b/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/deb.json new file mode 100644 index 000000000..8133a85e5 --- /dev/null +++ b/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libdatetime-perl" + ] +} diff --git a/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/pkg.json b/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/pkg.json new file mode 100644 index 000000000..a17089c7d --- /dev/null +++ b/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/pkg.json @@ -0,0 +1,9 @@ +{ + "pkg_name": "centreon-plugin-Network-Keysight-Nvos-Restapi", + "pkg_summary": "Centreon Plugin to monitor Keysight NVOS using RestAPI", + "plugin_name": "centreon_keysight_nvos_restapi.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "network/keysight/nvos/restapi/" + ] +} diff --git a/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/rpm.json b/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/rpm.json new file mode 100644 index 000000000..e9dff7552 --- /dev/null +++ b/packaging/centreon-plugin-Network-Keysight-Nvos-Restapi/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(DateTime)" + ] +} diff --git a/src/network/keysight/nvos/restapi/custom/api.pm b/src/network/keysight/nvos/restapi/custom/api.pm new file mode 100644 index 000000000..ec694c9b7 --- /dev/null +++ b/src/network/keysight/nvos/restapi/custom/api.pm @@ -0,0 +1,212 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::custom::api; + +use strict; +use warnings; +use centreon::plugins::http; +use JSON::XS; + +sub new { + my ($class, %options) = @_; + my $self = {}; + bless $self, $class; + + if (!defined($options{output})) { + print "Class Custom: Need to specify 'output' argument.\n"; + exit 3; + } + 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 => { + 'api-username:s' => { name => 'api_username' }, + 'api-password:s' => { name => 'api_password' }, + 'hostname:s' => { name => 'hostname' }, + 'port:s' => { name => 'port' }, + 'proto:s' => { name => 'proto' }, + 'timeout:s' => { name => 'timeout' }, + 'unknown-http-status:s' => { name => 'unknown_http_status' }, + 'warning-http-status:s' => { name => 'warning_http_status' }, + 'critical-http-status:s' => { name => 'critical_http_status' } + }); + } + $options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1); + + $self->{output} = $options{output}; + $self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl'); + + return $self; +} + +sub set_options { + my ($self, %options) = @_; + + $self->{option_results} = $options{option_results}; +} + +sub set_defaults {} + +sub check_options { + my ($self, %options) = @_; + + $self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : ''; + $self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 8000; + $self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https'; + $self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 50; + $self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : ''; + $self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : ''; + $self->{unknown_http_status} = (defined($self->{option_results}->{unknown_http_status})) ? $self->{option_results}->{unknown_http_status} : '%{http_code} < 200 or %{http_code} >= 300'; + $self->{warning_http_status} = (defined($self->{option_results}->{warning_http_status})) ? $self->{option_results}->{warning_http_status} : ''; + $self->{critical_http_status} = (defined($self->{option_results}->{critical_http_status})) ? $self->{option_results}->{critical_http_status} : ''; + + if ($self->{hostname} eq '') { + $self->{output}->add_option_msg(short_msg => "Need to specify --hostname option."); + $self->{output}->option_exit(); + } + if ($self->{api_username} eq '') { + $self->{output}->add_option_msg(short_msg => "Need to specify --api-username option."); + $self->{output}->option_exit(); + } + if ($self->{api_password} eq '') { + $self->{output}->add_option_msg(short_msg => "Need to specify --api-password option."); + $self->{output}->option_exit(); + } + + return 0; +} + +sub build_options_for_httplib { + my ($self, %options) = @_; + + $self->{option_results}->{hostname} = $self->{hostname}; + $self->{option_results}->{timeout} = $self->{timeout}; + $self->{option_results}->{port} = $self->{port}; + $self->{option_results}->{proto} = $self->{proto}; + $self->{option_results}->{timeout} = $self->{timeout}; + $self->{option_results}->{credentials} = 1; + $self->{option_results}->{basic} = 1; + $self->{option_results}->{username} = $self->{api_username}; + $self->{option_results}->{password} = $self->{api_password}; +} + +sub settings { + my ($self, %options) = @_; + + return if (defined($self->{settings_done})); + $self->build_options_for_httplib(); + $self->{http}->add_header(key => 'Accept', value => 'application/json'); + $self->{http}->set_options(%{$self->{option_results}}); + $self->{settings_done} = 1; +} + +sub get_hostname { + my ($self, %options) = @_; + + return $self->{hostname}; +} + +sub get_port { + my ($self, %options) = @_; + + return $self->{port}; +} + +sub request_api { + my ($self, %options) = @_; + + $self->settings(); + my $content = $self->{http}->request( + method => $options{method}, + url_path => $options{endpoint}, + get_param => $options{get_param}, + query_form_post => $options{query_form_post}, + header => $options{header}, + unknown_status => $self->{unknown_http_status}, + warning_status => $self->{warning_http_status}, + critical_status => $self->{critical_http_status} + ); + + if ($self->{http}->get_code() < 200 || $self->{http}->get_code() >= 300) { + $self->{output}->add_option_msg(short_msg => "API error [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']"); + $self->{output}->option_exit(); + } + + my $decoded; + eval { + $decoded = JSON::XS->new->utf8->decode($content); + }; + if ($@) { + $self->{output}->add_option_msg(short_msg => "Cannot decode response (add --debug option to display returned content)"); + $self->{output}->option_exit(); + } + + return $decoded; +} + +1; + +__END__ + +=head1 NAME + +Keysight NVOS API + +=head1 REST API OPTIONS + +Keysight NVOS API + +=over 8 + +=item B<--hostname> + +Set hostname. + +=item B<--port> + +Port used (Default: 8000) + +=item B<--proto> + +Specify https if needed (Default: 'https') + +=item B<--api-username> + +API username. + +=item B<--api-password> + +API password. + +=item B<--timeout> + +Set timeout in seconds (Default: 50). + +=back + +=head1 DESCRIPTION + +B. + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/dynamicfilters.pm b/src/network/keysight/nvos/restapi/mode/dynamicfilters.pm new file mode 100644 index 000000000..3c5034cfd --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/dynamicfilters.pm @@ -0,0 +1,193 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::dynamicfilters; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); + +sub df_long_output { + my ($self, %options) = @_; + + return sprintf( + "checking dynamic filter '%s'", + $options{instance_value}->{name} + ); +} + +sub prefix_df_output { + my ($self, %options) = @_; + + return sprintf( + "dynamic filter '%s' ", + $options{instance_value}->{name} + ); +} + +sub prefix_traffic_output { + my ($self, %options) = @_; + + return 'traffic '; +} + +sub prefix_packet_output { + my ($self, %options) = @_; + + return 'packets '; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'df', type => 3, cb_prefix_output => 'prefix_df_output', cb_long_output => 'df_long_output', + indent_long_output => ' ', message_multiple => 'All dynamic filters are ok', + group => [ + { name => 'traffic', type => 0, cb_prefix_output => 'prefix_traffic_output', skipped_code => { -10 => 1 } }, + { name => 'packet', type => 0, cb_prefix_output => 'prefix_packet_output', skipped_code => { -10 => 1 } } + ] + } + ]; + + $self->{maps_counters}->{traffic} = [ + { label => 'traffic-pass', nlabel => 'dynamic_filter.traffic.pass.bytespersecond', set => { + key_values => [ { name => 'traffic_pass', per_second => 1 } ], + output_template => 'pass: %.2f %s/s', + output_change_bytes => 1, + perfdatas => [ + { template => '%.2f', unit => 'B/s', min => 0, label_extra_instance => 1 } + ] + } + }, + { label => 'traffic-insp', nlabel => 'dynamic_filter.traffic.insp.bytespersecond', set => { + key_values => [ { name => 'traffic_insp', per_second => 1 } ], + output_template => 'insp: %.2f %s/s', + output_change_bytes => 1, + perfdatas => [ + { template => '%.2f', unit => 'B/s', min => 0, label_extra_instance => 1 } + ] + } + } + ]; + + $self->{maps_counters}->{packet} = [ + { label => 'packets-denied', nlabel => 'dynamic_filter.packets.denied.count', set => { + key_values => [ { name => 'packets_denied', diff => 1 } ], + output_template => 'denied: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + }, + { label => 'packets-pass', nlabel => 'dynamic_filter.packets.pass.count', set => { + key_values => [ { name => 'packets_pass', diff => 1 } ], + output_template => 'pass: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + }, + { label => 'packets-insp', nlabel => 'dynamic_filter.packets.insp.count', set => { + key_values => [ { name => 'packets_insp', diff => 1 } ], + output_template => 'insp: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' } + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + my $result = $options{custom}->request_api( + method => 'POST', + endpoint => '/api/stats/', + query_form_post => '', + header => ['Content-Type: application/json'], + ); + + $self->{df} = {}; + foreach (@{$result->{stats_snapshot}}) { + next if ($_->{type} ne 'Dynamic Filter'); + + next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $_->{default_name} !~ /$self->{option_results}->{filter_name}/); + + $self->{df}->{ $_->{default_name} } = { + name => $_->{default_name}, + traffic => { + traffic_pass => $_->{df_total_pass_count_bytes}, + traffic_insp => $_->{df_total_insp_count_bytes} + }, + packet => { + packets_denied => $_->{df_total_deny_count_packets}, + packets_insp => $_->{df_total_insp_count_packets}, + packets_pass => $_->{df_total_pass_count_packets} + } + }; + } + + $self->{cache_name} = 'keysight_nvos_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' . $options{custom}->get_port() . '_' . + md5_hex( + (defined($self->{option_results}->{filter_counters}) ? $self->{option_results}->{filter_counters} : '') . '_' . + (defined($self->{option_results}->{filter_name}) ? $self->{option_results}->{filter_name} : '') + ); +} + +1; + +__END__ + +=head1 MODE + +Check dynamic filters. + +=over 8 + +=item B<--filter-name> + +Filter dynamic filters by name (can be a regexp). + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'traffic-out-prct', 'traffic-out', 'packets-out', 'packets-dropped', +'packets-pass', 'packets-insp'. + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/hardware.pm b/src/network/keysight/nvos/restapi/mode/hardware.pm new file mode 100644 index 000000000..a533c82ce --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/hardware.pm @@ -0,0 +1,200 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::hardware; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +sub prefix_psu_output { + my ($self, %options) = @_; + + return "power supply '" . $options{instance} . "' "; +} + +sub prefix_temperature_output { + my ($self, %options) = @_; + + return "temperature '" . $options{instance} . "' "; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'temperatures', type => 1, cb_prefix_output => 'prefix_temperature_output', skipped_code => { -10 => 1 } }, + { name => 'fan', type => 0, skipped_code => { -10 => 1 } }, + { name => 'psus', type => 1, cb_prefix_output => 'prefix_psu_output', message_multiple => 'all power supplies are ok', skipped_code => { -10 => 1 } } + ]; + + $self->{maps_counters}->{temperatures} = [ + { + label => 'temperature-status', + type => 2, + unknown_default => '%{status} eq "unknown"', + warning_default => '%{status} eq "warn"', + critical_default => '%{status} eq "hot"', + set => { + key_values => [ { name => 'status' }, { name => 'class' } ], + output_template => 'status: %s', + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + }, + { label => 'temperature', nlabel => 'hardware.temperature.celsius', set => { + key_values => [ { name => 'reading' }, { name => 'class' } ], + output_template => 'reading: %s C', + closure_custom_perfdata => sub { + my ($self, %options) = @_; + + $self->{output}->perfdata_add( + nlabel => $self->{nlabel}, + unit => 'C', + instances => $self->{result_values}->{class}, + value => $self->{result_values}->{reading}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}) + ); + } + } + } + ]; + + $self->{maps_counters}->{fan} = [ + { label => 'fans-failed', nlabel => 'fans.failed.count', set => { + key_values => [ { name => 'failed' } ], + output_template => 'number of failed fans: %s', + perfdatas => [ + { template => '%s', min => 0 } + ] + } + } + ]; + + $self->{maps_counters}->{psus} = [ + { label => 'psu-status', type => 2, critical_default => '%{status} eq "bad"', set => { + key_values => [ { name => 'status' }, { name => 'name' } ], + output_template => 'status: %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 $result = $options{custom}->request_api( + endpoint => '/api/system', + get_param => ['properties=power_module_a,power_module_b,temperature_readings,fan_failure_count'] + ); + if (!defined($result->{power_module_a})) { + $self->{output}->add_option_msg(short_msg => "Cannot find hardware informations"); + $self->{output}->option_exit(); + } + + $self->{temperatures} = {}; + foreach (@{$result->{temperature_readings}}) { + $self->{temperatures}->{ $_->{temperature_sensor}->{id}->{module_class} } = { + class => $_->{temperature_sensor}->{id}->{module_class}, + status => lc($_->{temperature_status}), + reading => $_->{temperature} + }; + } + + # -1 means: unsupported + if ($result->{fan_failure_count} > -1) { + $self->{fan} = { failed => $result->{fan_failure_count} }; + } + + $self->{psus} = { + power_module_a => { + name => 'power_module_a', + status => lc($result->{power_module_a}->{power_supply_status}) + }, + power_module_b => { + name => 'power_module_b', + status => lc($result->{power_module_b}->{power_supply_status}) + } + }; +} + +1; + +__END__ + +=head1 MODE + +Check hardware. + +=over 8 + +=item B<--unknown-temperature-status> + +Set unknown threshold for status (Default : '%{status} eq "unknown"'). +Can used special variables like: %{status}, %{class} + +=item B<--warning-temperature-status> + +Set warning threshold for status (Default : '%{status} eq "warn"'). +Can used special variables like: %{status}, %{class} + +=item B<--critical-temperature-status> + +Set critical threshold for status (Default: '%{status} eq "hot"'); +Can used special variables like: %{status}, %{class} + +=item B<--unknown-psu-status> + +Set unknown threshold for status. +Can used special variables like: %{status}, %{name} + +=item B<--warning-psu-status> + +Set warning threshold for status. +Can used special variables like: %{status}, %{name} + +=item B<--critical-status> + +Set critical threshold for status (Default: '%{status} eq "bad"'); +Can used special variables like: %{status}, %{name} + +=item B<--warning-*> B<--critical-*> + +Thresholds. Can be: +'temperature', 'fans-failed'. + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/listdynamicfilters.pm b/src/network/keysight/nvos/restapi/mode/listdynamicfilters.pm new file mode 100644 index 000000000..ce27dc665 --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/listdynamicfilters.pm @@ -0,0 +1,114 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::listdynamicfilters; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => {}); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $df = $options{custom}->request_api( + method => 'POST', + endpoint => '/api/stats/', + query_form_post => '', + header => ['Content-Type: application/json'], + ); + + my $results = []; + foreach (@{$df->{stats_snapshot}}) { + next if ($_->{type} ne 'Dynamic Filter'); + + push @$results, { + name => $_->{default_name} + }; + } + + return $results; +} + +sub run { + my ($self, %options) = @_; + + my $results = $self->manage_selection(%options); + foreach (@$results) { + $self->{output}->output_add( + long_msg => sprintf( + '[name: %s]', + $_->{name} + ) + ); + } + + $self->{output}->output_add( + severity => 'OK', + short_msg => 'List dynamic filters:' + ); + + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); + $self->{output}->exit(); +} + +sub disco_format { + my ($self, %options) = @_; + + $self->{output}->add_disco_format(elements => ['name', 'type', 'folder', 'application', 'ctm', 'status']); +} + +sub disco_show { + my ($self, %options) = @_; + + my $results = $self->manage_selection(%options); + foreach (@$results) { + $self->{output}->add_disco_entry(%$_); + } +} + +1; + +__END__ + +=head1 MODE + +List dynamic filters. + +=over 8 + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/listports.pm b/src/network/keysight/nvos/restapi/mode/listports.pm new file mode 100644 index 000000000..b209c9379 --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/listports.pm @@ -0,0 +1,124 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::listports; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => {}); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $ports = $options{custom}->request_api( + method => 'POST', + endpoint => '/api/stats/', + query_form_post => '', + header => ['Content-Type: application/json'], + ); + + my $results = []; + foreach (@{$ports->{stats_snapshot}}) { + next if ($_->{type} ne 'Port'); + + my $info = $options{custom}->request_api( + method => 'GET', + endpoint => '/api/ports/' . $_->{default_name}, + get_param => ['properties=enabled,license_status,link_status'] + ); + + push @$results, { + name => $_->{default_name}, + adminStatus => $info->{enabled} =~ /true|1/i ? 'enabled' : 'disabled', + operationalStatus => $info->{link_status}->{link_up} =~ /true|1/i ? 'up' : 'down' + }; + } + + return $results; +} + +sub run { + my ($self, %options) = @_; + + my $results = $self->manage_selection(%options); + foreach (@$results) { + $self->{output}->output_add( + long_msg => sprintf( + '[name: %s][adminStatus: %s][operationalStatus: %s]', + $_->{name}, + $_->{adminStatus}, + $_->{operationalStatus} + ) + ); + } + + $self->{output}->output_add( + severity => 'OK', + short_msg => 'List ports:' + ); + + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); + $self->{output}->exit(); +} + +sub disco_format { + my ($self, %options) = @_; + + $self->{output}->add_disco_format(elements => ['name', 'type', 'folder', 'application', 'ctm', 'status']); +} + +sub disco_show { + my ($self, %options) = @_; + + my $results = $self->manage_selection(%options); + foreach (@$results) { + $self->{output}->add_disco_entry(%$_); + } +} + +1; + +__END__ + +=head1 MODE + +List ports. + +=over 8 + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/ports.pm b/src/network/keysight/nvos/restapi/mode/ports.pm new file mode 100644 index 000000000..b85b3f691 --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/ports.pm @@ -0,0 +1,291 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::ports; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +sub custom_link_output { + my ($self, %options) = @_; + + return sprintf( + "link operational status: %s [admin: %s]", + $self->{result_values}->{operationalStatus}, + $self->{result_values}->{adminStatus} + ); +} + +sub port_long_output { + my ($self, %options) = @_; + + return sprintf( + "checking port '%s'", + $options{instance_value}->{name} + ); +} + +sub prefix_port_output { + my ($self, %options) = @_; + + return sprintf( + "port '%s' ", + $options{instance_value}->{name} + ); +} + +sub prefix_traffic_output { + my ($self, %options) = @_; + + return 'traffic out: '; +} + +sub prefix_packet_output { + my ($self, %options) = @_; + + return 'packets '; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'ports', type => 3, cb_prefix_output => 'prefix_port_output', cb_long_output => 'port_long_output', + indent_long_output => ' ', message_multiple => 'All ports are ok', + group => [ + { name => 'license', type => 0, skipped_code => { -10 => 1 } }, + { name => 'link', type => 0, skipped_code => { -10 => 1 } }, + { name => 'traffic', type => 0, cb_prefix_output => 'prefix_traffic_output', skipped_code => { -10 => 1 } }, + { name => 'packet', type => 0, cb_prefix_output => 'prefix_packet_output', skipped_code => { -10 => 1 } } + ] + } + ]; + + $self->{maps_counters}->{license} = [ + { + label => 'license-status', + type => 2, + warning_default => '%{status} =~ /invalid_software_version/', + set => { + key_values => [ + { name => 'status' }, { name => 'name' } + ], + output_template => 'license status: %s', + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; + + $self->{maps_counters}->{link} = [ + { + label => 'link-status', + type => 2, + critical_default => '%{adminStatus} eq "enabled" and %{operationalStatus} ne "up"', + set => { + key_values => [ + { name => 'adminStatus' }, { name => 'operationalStatus' } , { name => 'name' } + ], + closure_custom_output => $self->can('custom_link_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; + + $self->{maps_counters}->{traffic} = [ + { label => 'traffic-out-prct', nlabel => 'port.traffic.out.percentage', set => { + key_values => [ { name => 'traffic_out_util' } ], + output_template => '%.2f%%', + perfdatas => [ + { template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 } + ] + } + }, + { label => 'traffic-out', nlabel => 'port.traffic.out.bytespersecond', set => { + key_values => [ { name => 'traffic_out', per_second => 1 } ], + output_template => '%.2f %s/s', + output_change_bytes => 1, + perfdatas => [ + { template => '%.2f', unit => 'B/s', min => 0, label_extra_instance => 1 } + ] + } + } + ]; + + $self->{maps_counters}->{packet} = [ + { label => 'packets-out', nlabel => 'port.packets.out.count', set => { + key_values => [ { name => 'packets_out', diff => 1 } ], + output_template => 'out: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + }, + { label => 'packets-dropped', nlabel => 'port.packets.dropped.count', set => { + key_values => [ { name => 'packets_dropped', diff => 1 } ], + output_template => 'dropped: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + }, + { label => 'packets-pass', nlabel => 'port.packets.pass.count', set => { + key_values => [ { name => 'packets_pass', diff => 1 } ], + output_template => 'pass: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + }, + { label => 'packets-insp', nlabel => 'port.packets.insp.count', set => { + key_values => [ { name => 'packets_insp', diff => 1 } ], + output_template => 'insp: %s', + perfdatas => [ + { template => '%s', min => 0, label_extra_instance => 1 } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' } + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + my $result = $options{custom}->request_api( + method => 'POST', + endpoint => '/api/stats/', + query_form_post => '', + header => ['Content-Type: application/json'], + ); + + $self->{ports} = {}; + foreach (@{$result->{stats_snapshot}}) { + next if ($_->{type} ne 'Port'); + + next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $_->{default_name} !~ /$self->{option_results}->{filter_name}/); + + my $info = $options{custom}->request_api( + method => 'GET', + endpoint => '/api/ports/' . $_->{default_name}, + get_param => ['properties=enabled,license_status,link_status'] + ); + + $self->{ports}->{ $_->{default_name} } = { + name => $_->{default_name}, + license => { + name => $_->{default_name}, + status => lc($info->{license_status}), + }, + link => { + name => $_->{default_name}, + adminStatus => $info->{enabled} =~ /true|1/i ? 'enabled' : 'disabled', + operationalStatus => $info->{link_status}->{link_up} =~ /true|1/i ? 'up' : 'down' + }, + traffic => { + traffic_out => $_->{tp_total_tx_count_bytes}, + traffic_out_util => $_->{tp_current_tx_utilization} + }, + packet => { + packets_out => $_->{tp_total_tx_count_packets}, + packets_dropped => $_->{tp_total_drop_count_packets}, + packets_insp => $_->{tp_total_insp_count_packets}, + packets_pass => $_->{tp_total_pass_count_packets} + } + }; + } + + $self->{cache_name} = 'keysight_nvos_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' . $options{custom}->get_port() . '_' . + md5_hex( + (defined($self->{option_results}->{filter_counters}) ? $self->{option_results}->{filter_counters} : '') . '_' . + (defined($self->{option_results}->{filter_name}) ? $self->{option_results}->{filter_name} : '') + ); +} + +1; + +__END__ + +=head1 MODE + +Check ports. + +=over 8 + +=item B<--filter-name> + +Filter ports by name (can be a regexp). + +=item B<--unknown-license-status> + +Set unknown threshold for status. +Can used special variables like: %{status}, %{name} + +=item B<--warning-license-status> + +Set warning threshold for status (Default: '%{status} =~ /invalid_software_version/'). +Can used special variables like: %{status}, %{name} + +=item B<--critical-license-status> + +Set critical threshold for status. +Can used special variables like: %{status}, %{name} + +=item B<--unknown-link-status> + +Set unknown threshold for status. +Can used special variables like: %{adminStatus}, %{operationalStatus}, %{name} + +=item B<--warning-link-status> + +Set warning threshold for status. +Can used special variables like: %{adminStatus}, %{operationalStatus}, %{name} + +=item B<--critical-link-status> + +Set critical threshold for status (Default: '%{adminStatus} eq "enabled" and %{operationalStatus} ne "up"'). +Can used special variables like: %{adminStatus}, %{operationalStatus}, %{name} + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'traffic-out-prct', 'traffic-out', 'packets-out', 'packets-dropped', +'packets-pass', 'packets-insp'. + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/time.pm b/src/network/keysight/nvos/restapi/mode/time.pm new file mode 100644 index 000000000..44c077e9e --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/time.pm @@ -0,0 +1,193 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::time; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::misc; +use DateTime; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +sub custom_usage_output { + my ($self, %options) = @_; + + return sprintf( + 'time offset %d second(s): %s', + $self->{result_values}->{offset}, + $self->{result_values}->{date} + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'offset', type => 0 } + ]; + + $self->{maps_counters}->{offset} = [ + { + label => 'ntp-status', + type => 2, + critical_default => '%{status} !~ /in_reach|in_sync/i', + set => { + key_values => [ { name => 'status' } ], + output_template => 'ntp status: %s', + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + }, + { label => 'offset', nlabel => 'time.offset.seconds', set => { + key_values => [ { name => 'offset' }, { name => 'date' } ], + closure_custom_output => $self->can('custom_usage_output'), + perfdatas => [ + { template => '%d', unit => 's' } + ] + } + } + ]; +} + +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 => { + 'ntp-hostname:s' => { name => 'ntp_hostname' }, + 'ntp-port:s' => { name => 'ntp_port', default => 123 }, + 'timezone:s' => { name => 'timezone' } + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + if (defined($self->{option_results}->{ntp_hostname})) { + centreon::plugins::misc::mymodule_load( + output => $self->{output}, module => 'Net::NTP', + error_msg => "Cannot load module 'Net::NTP'." + ); + } +} + +sub get_target_time { + my ($self, %options) = @_; + + my $result = $options{custom}->request_api( + endpoint => '/api/system', + get_param => ['properties=system_time,ntp_server_status'] + ); + if (!defined($result->{system_time})) { + $self->{output}->add_option_msg(short_msg => "Cannot find time informations"); + $self->{output}->option_exit(); + } + + my $tz = {}; + if (defined($self->{option_results}->{timezone}) && $self->{option_results}->{timezone} ne '') { + $tz = centreon::plugins::misc::set_timezone(name => $self->{option_results}->{timezone}); + } + + my $dt = DateTime->from_epoch(epoch => $result->{system_time} / 1000, %$tz); + + return ($dt->epoch(), $dt->iso8601(), $result->{ntp_server_status}); +} + +sub manage_selection { + my ($self, %options) = @_; + + my ($distant_time, $remote_date, $ntp_status) = $self->get_target_time(%options); + + my $ref_time; + if (defined($self->{option_results}->{ntp_hostname}) && $self->{option_results}->{ntp_hostname} ne '') { + my %ntp; + + eval { + %ntp = Net::NTP::get_ntp_response($self->{option_results}->{ntp_hostname}, $self->{option_results}->{ntp_port}); + }; + if ($@) { + $self->{output}->add_option_msg(short_msg => "Couldn't connect to ntp server: " . $@); + $self->{output}->option_exit(); + } + + $ref_time = $ntp{'Transmit Timestamp'}; + } else { + $ref_time = time(); + } + + my $offset = $distant_time - $ref_time; + $self->{offset} = { + status => lc($ntp_status), + offset => sprintf('%d', $offset), + date => $remote_date + }; +} + +1; + +__END__ + +=head1 MODE + +Check time offset of server with ntp server. Use local time if ntp-host option is not set. + +=over 8 + +=item B<--unknown-ntp-status> + +=item B<--warning-ntp-status> + +=item B<--critical-ntp-status> + +Set thresholds for status (Default critical: '%{status} !~ /in_reach|in_sync/i') + + +Can used special variables like: %{status} + +=item B<--warning-offset> + +Time offset warning threshold (in seconds). + +=item B<--critical-offset> + +Time offset critical Threshold (in seconds). + +=item B<--ntp-hostname> + +Set the ntp hostname (if not set, localtime is used). + +=item B<--ntp-port> + +Set the ntp port (Default: 123). + +=item B<--timezone> + +Override the timezone of distant equipment. +Can use format: 'Europe/London' or '+0100'. + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/mode/uptime.pm b/src/network/keysight/nvos/restapi/mode/uptime.pm new file mode 100644 index 000000000..1a07d8e90 --- /dev/null +++ b/src/network/keysight/nvos/restapi/mode/uptime.pm @@ -0,0 +1,146 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::mode::uptime; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use POSIX; +use centreon::plugins::misc; + +my $unitdiv = { s => 1, w => 604800, d => 86400, h => 3600, m => 60 }; +my $unitdiv_long = { s => 'seconds', w => 'weeks', d => 'days', h => 'hours', m => 'minutes' }; + +sub custom_uptime_output { + my ($self, %options) = @_; + + return sprintf( + 'System uptime is: %s', + centreon::plugins::misc::change_seconds(value => $self->{result_values}->{uptime}, start => 'd') + ); +} + +sub custom_uptime_perfdata { + my ($self, %options) = @_; + + $self->{output}->perfdata_add( + nlabel => 'system.uptime.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} }, + value => floor($self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }), + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}), + min => 0 + ); +} + +sub custom_uptime_threshold { + my ($self, %options) = @_; + + return $self->{perfdata}->threshold_check( + value => floor($self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }), + threshold => [ + { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, + { label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' }, + { label => 'unknown-'. $self->{thlabel}, exit_litteral => 'unknown' } + ] + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0 } + ]; + + $self->{maps_counters}->{global} = [ + { label => 'uptime', set => { + key_values => [ { name => 'uptime' } ], + closure_custom_output => $self->can('custom_uptime_output'), + closure_custom_perfdata => $self->can('custom_uptime_perfdata'), + closure_custom_threshold_check => $self->can('custom_uptime_threshold') + } + } + ]; +} + +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 => { + 'unit:s' => { name => 'unit', default => 's' } + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + if ($self->{option_results}->{unit} eq '' || !defined($unitdiv->{$self->{option_results}->{unit}})) { + $self->{option_results}->{unit} = 's'; + } +} + +sub manage_selection { + my ($self, %options) = @_; + + my $result = $options{custom}->request_api( + endpoint => '/api/system', + get_param => ['properties=ready_time'] + ); + if (!defined($result->{ready_time})) { + $self->{output}->add_option_msg(short_msg => "Cannot find uptime information"); + $self->{output}->option_exit(); + } + + $self->{global} = { uptime => time() - ($result->{ready_time} / 1000) }; +} + +1; + +__END__ + +=head1 MODE + +Check system uptime. + +=over 8 + +=item B<--warning-uptime> + +Threshold warning. + +=item B<--critical-uptime> + +Threshold critical. + +=item B<--unit> + +Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes, +'h' for hours, 'd' for days, 'w' for weeks. Default is seconds + +=back + +=cut diff --git a/src/network/keysight/nvos/restapi/plugin.pm b/src/network/keysight/nvos/restapi/plugin.pm new file mode 100644 index 000000000..47e6b70b5 --- /dev/null +++ b/src/network/keysight/nvos/restapi/plugin.pm @@ -0,0 +1,54 @@ +# +# Copyright 2023 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 network::keysight::nvos::restapi::plugin; + +use strict; +use warnings; +use base qw(centreon::plugins::script_custom); + +sub new { + my ( $class, %options ) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{modes} = { + 'dynamic-filters' => 'network::keysight::nvos::restapi::mode::dynamicfilters', + 'hardware' => 'network::keysight::nvos::restapi::mode::hardware', + 'list-dynamic-filters' => 'network::keysight::nvos::restapi::mode::listdynamicfilters', + 'list-ports' => 'network::keysight::nvos::restapi::mode::listports', + 'ports' => 'network::keysight::nvos::restapi::mode::ports', + 'time' => 'network::keysight::nvos::restapi::mode::time', + 'uptime' => 'network::keysight::nvos::restapi::mode::uptime' + }; + + $self->{custom_modes}->{api} = 'network::keysight::nvos::restapi::custom::api'; + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Keysight Network Visibility Operating System (NVOS) using rest API. + +=cut