diff --git a/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/deb.json b/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/deb.json new file mode 100644 index 0000000000..aa39449b2b --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libssh-session-perl" + ] +} diff --git a/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/pkg.json b/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/pkg.json new file mode 100644 index 0000000000..ae67e827c3 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/pkg.json @@ -0,0 +1,11 @@ +{ + "pkg_name": "centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh", + "pkg_summary": "Centreon Plugin", + "plugin_name": "centreon_veritas_nba_ssh.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "centreon/plugins/backend/ssh/", + "centreon/plugins/ssh.pm", + "storage/veritas/nba/ssh/" + ] +} diff --git a/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/rpm.json b/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/rpm.json new file mode 100644 index 0000000000..e8b0a6a432 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Storage-Veritas-Nba-Ssh/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(Libssh::Session)" + ] +} diff --git a/src/centreon/plugins/backend/ssh/libssh.pm b/src/centreon/plugins/backend/ssh/libssh.pm index 2c4c37145e..a560d9f5bb 100644 --- a/src/centreon/plugins/backend/ssh/libssh.pm +++ b/src/centreon/plugins/backend/ssh/libssh.pm @@ -162,6 +162,40 @@ sub execute { return ($content, $exit_code); } +sub execute_scenario { + my ($self, %options) = @_; + + if (defined($options{timeout}) && $options{timeout} =~ /(\d+)/) { + $self->{ssh}->options(timeout => $options{timeout}); + } + + $self->connect(hostname => $options{hostname}); + + my $ret = $self->{ssh}->execute_scenario(%{$options{request}}); + + $self->{output}->output_add(long_msg => $ret->{stdout}, debug => 1) if (defined($ret->{stdout})); + $self->{output}->output_add(long_msg => $ret->{stderr}, debug => 1) if (defined($ret->{stderr})); + + my ($content, $exit_code); + if ($ret->{exit} == $self->{constant_cb}->(name => 'SSH_OK')) { + $content = $ret->{stdout}; + $exit_code = $ret->{exit}; + } elsif ($ret->{exit} == $self->{constant_cb}->(name => 'SSH_AGAIN')) { # AGAIN means timeout + $self->{output}->add_option_msg(short_msg => sprintf('command execution timeout')); + $self->{output}->option_exit(); + } else { + $self->{output}->add_option_msg(short_msg => + sprintf( + 'command execution error: %s', + $self->{ssh}->error(GetErrorSession => 1) + ) + ); + $self->{output}->option_exit(); + } + + return ($content, $exit_code); +} + 1; __END__ diff --git a/src/centreon/plugins/backend/ssh/plink.pm b/src/centreon/plugins/backend/ssh/plink.pm index 21562db544..6bded3d72c 100644 --- a/src/centreon/plugins/backend/ssh/plink.pm +++ b/src/centreon/plugins/backend/ssh/plink.pm @@ -106,6 +106,13 @@ sub execute { return ($content, $exit_code); } +sub execute_scenario { + my ($self, %options) = @_; + + $self->{output}->add_option_msg(short_msg => 'Unsupported method for sshcli backend: execute_scenario'); + $self->{output}->option_exit(); +} + 1; __END__ diff --git a/src/centreon/plugins/backend/ssh/sshcli.pm b/src/centreon/plugins/backend/ssh/sshcli.pm index 7a6aadc1c9..8b73878767 100644 --- a/src/centreon/plugins/backend/ssh/sshcli.pm +++ b/src/centreon/plugins/backend/ssh/sshcli.pm @@ -105,6 +105,13 @@ sub execute { return ($content, $exit_code); } +sub execute_scenario { + my ($self, %options) = @_; + + $self->{output}->add_option_msg(short_msg => 'Unsupported method for sshcli backend: execute_scenario'); + $self->{output}->option_exit(); +} + 1; __END__ diff --git a/src/centreon/plugins/ssh.pm b/src/centreon/plugins/ssh.pm index 2d93d8c530..231e39ccdb 100644 --- a/src/centreon/plugins/ssh.pm +++ b/src/centreon/plugins/ssh.pm @@ -30,7 +30,7 @@ sub new { if (!defined($options{noptions}) || $options{noptions} != 1) { $options{options}->add_options(arguments => { - 'ssh-backend:s' => { name => 'ssh_backend', default => 'sshcli' }, + 'ssh-backend:s' => { name => 'ssh_backend' }, 'ssh-port:s' => { name => 'ssh_port' }, 'ssh-priv-key:s' => { name => 'ssh_priv_key' }, 'ssh-username:s' => { name => 'ssh_username' }, @@ -60,6 +60,9 @@ sub new { ); $self->{backend_libssh} = centreon::plugins::backend::ssh::libssh->new(%options); + $self->{default_backend} = defined($options{default_backend}) && $options{default_backend} ne '' ? + $options{default_backend} : 'sshcli'; + $self->{output} = $options{output}; return $self; } @@ -68,12 +71,13 @@ sub check_options { my ($self, %options) = @_; $self->{ssh_backend} = $options{option_results}->{ssh_backend}; + my $default_port = 22; if (defined($options{default_ssh_port}) && $options{default_ssh_port} =~ /\d+/) { $default_port = $options{default_ssh_port}; } $self->{ssh_port} = defined($options{option_results}->{ssh_port}) && $options{option_results}->{ssh_port} =~ /(\d+)/ ? $1 : $default_port; - $self->{ssh_backend} = 'sshcli' + $self->{ssh_backend} = $self->{default_backend} if (!defined($options{option_results}->{ssh_backend}) || $options{option_results}->{ssh_backend} eq ''); if (!defined($self->{'backend_' . $self->{ssh_backend}})) { $self->{output}->add_option_msg(short_msg => 'unknown ssh backend: ' . $self->{ssh_backend}); @@ -100,6 +104,12 @@ sub execute { return $self->{'backend_' . $self->{ssh_backend}}->execute(%options); } +sub execute_scenario { + my ($self, %options) = @_; + + return $self->{'backend_' . $self->{ssh_backend}}->execute_scenario(%options); +} + 1; __END__ diff --git a/src/storage/veritas/nba/ssh/custom/cli.pm b/src/storage/veritas/nba/ssh/custom/cli.pm new file mode 100644 index 0000000000..892ef32807 --- /dev/null +++ b/src/storage/veritas/nba/ssh/custom/cli.pm @@ -0,0 +1,159 @@ +# +# Copyright 2026-Present 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 storage::veritas::nba::ssh::custom::cli; + +use strict; +use warnings; +use centreon::plugins::ssh; +use centreon::plugins::misc; + +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 => { + 'hostname:s' => { name => 'hostname' }, + 'timeout:s' => { name => 'timeout', default => 55 }, + 'command:s' => { name => 'command' }, + 'command-path:s' => { name => 'command_path' }, + 'command-options:s' => { name => 'command_options' } + }); + } + $options{options}->add_help(package => __PACKAGE__, sections => 'SSH OPTIONS', once => 1); + + $self->{output} = $options{output}; + $self->{ssh} = centreon::plugins::ssh->new(%options, default_backend => 'libssh'); + + return $self; +} + +sub set_options { + my ($self, %options) = @_; + + $self->{option_results} = $options{option_results}; +} + +sub set_defaults {} + +sub check_options { + my ($self, %options) = @_; + + if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') { + $self->{ssh}->check_options(option_results => $self->{option_results}); + } + + centreon::plugins::misc::check_security_command( + output => $self->{output}, + command => $self->{option_results}->{command}, + command_options => $self->{option_results}->{command_options}, + command_path => $self->{option_results}->{command_path} + ); + + return 0; +} + +sub execute_scenario { + my ($self, %options) = @_; + + my $content; + if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') { + ($content) = $self->{ssh}->execute_scenario( + hostname => $self->{option_results}->{hostname}, + request => $options{request}, + timeout => $self->{option_results}->{timeout} + ); + } else { + if (!defined($self->{option_results}->{command}) || $self->{option_results}->{command} eq '') { + $self->{output}->add_option_msg(short_msg => 'please set --hostname option for ssh connection (or --command for local)'); + $self->{output}->option_exit(); + } + + ($content) = centreon::plugins::misc::execute( + output => $self->{output}, + options => { timeout => $self->{option_results}->{timeout} }, + command => $self->{option_results}->{command}, + command_path => $self->{option_results}->{command_path}, + command_options => $self->{option_results}->{command_options} + ); + } + + $content =~ s/\x{0d}//g; # carriage return + $content =~ s/\x{08}//g; # backspace + $content =~ s/\x{1b}\x{5b}\x{30}\x{6d}//g; + $content =~ s/\x{1b}\x{5b}\x{31}\x{6d}//g; + + return $content; +} + +1; + +__END__ + +=head1 NAME + +ssh + +=head1 SYNOPSIS + +my ssh + +=head1 SSH OPTIONS + +=over 8 + +=item B<--hostname> + +Hostname to query. + +=item B<--timeout> + +Timeout in seconds for the command (default: 55). + +=item B<--command> + +Command to get information. Used it you have output in a file. + +=item B<--command-path> + +Command path. + +=item B<--command-options> + +Command options. + +=back + +=head1 DESCRIPTION + +B. + +=cut diff --git a/src/storage/veritas/nba/ssh/mode/components/disk.pm b/src/storage/veritas/nba/ssh/mode/components/disk.pm new file mode 100644 index 0000000000..5edbe0a283 --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/components/disk.pm @@ -0,0 +1,72 @@ +# +# 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 storage::veritas::nba::ssh::mode::components::disk; + +use strict; +use warnings; +use centreon::plugins::misc; + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => 'checking disks'); + $self->{components}->{disk} = { name => 'disk', total => 0, skip => 0 }; + return if ($self->check_filter(section => 'disk')); + + while ($self->{result} =~ /Hardware\s+monitor\s+information\s+(.*?)(?=\s+Hardware monitor information|\Z$)/msg) { + my $part = $1; + + next if ($part !~ /NetBackup\s+StorageShelf\s+(\d+)/i); + my $shelf = $1; + + while ($part =~ /^.*?Controller.*?Disk.*?\|(.*?)\|.*?\|.*?\|.*?\|.*?\|.*?\|.*?\|.*?\|(.*?)\|(.*?)\|/mig) { + my ($enclosure, $disk, $state) = (centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($3)); + my $instance = 'shelf' . $shelf . '.' . $enclosure . '.' . $disk; + + next if ($self->check_filter(section => 'disk', instance => $instance)); + $self->{components}->{disk}->{total}++; + + $self->{output}->output_add( + long_msg => sprintf( + "disk '%s' shelf '%s' enclosure '%s' state is %s", + $disk, + $shelf, + $enclosure, + $state + ) + ); + my $exit = $self->get_severity(label => 'default', section => 'disk', instance => $instance, value => $state); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "disk '%s' shelf '%s' enclosure '%s' state is %s", + $disk, $shelf, $enclosure, $state + ) + ); + } + } + } +} + +1; diff --git a/src/storage/veritas/nba/ssh/mode/components/fan.pm b/src/storage/veritas/nba/ssh/mode/components/fan.pm new file mode 100644 index 0000000000..4df64ff751 --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/components/fan.pm @@ -0,0 +1,72 @@ +# +# 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 storage::veritas::nba::ssh::mode::components::fan; + +use strict; +use warnings; +use centreon::plugins::misc; + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => 'checking fans'); + $self->{components}->{fan} = { name => 'fan', total => 0, skip => 0 }; + return if ($self->check_filter(section => 'fan')); + + while ($self->{result} =~ /Hardware\s+monitor\s+information\s+(.*?)(?=\s+Hardware monitor information|\Z$)/msg) { + my $part = $1; + + next if ($part !~ /StorageShelf\s+(\d+)\s+Fan\s+Information/i); + my $shelf = $1; + + while ($part =~ /^.*?Enclosure(.*?)Fan\s+(.*?)\s+\|.*?\|.*?\|.*?\|(.*?)\|/mig) { + my ($enclosure, $fan, $state) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3)); + my $instance = 'shelf' . $shelf . '.' . $enclosure . '.' . $fan; + + next if ($self->check_filter(section => 'fan', instance => $instance)); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add( + long_msg => sprintf( + "fan '%s' shelf '%s' enclosure '%s' state is %s", + $fan, + $shelf, + $enclosure, + $state + ) + ); + my $exit = $self->get_severity(label => 'default', section => 'fan', instance => $instance, value => $state); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "fan '%s' shelf '%s' enclosure '%s' state is %s", + $fan, $shelf, $enclosure, $state + ) + ); + } + } + } +} + +1; diff --git a/src/storage/veritas/nba/ssh/mode/components/psu.pm b/src/storage/veritas/nba/ssh/mode/components/psu.pm new file mode 100644 index 0000000000..0292cb4327 --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/components/psu.pm @@ -0,0 +1,72 @@ +# +# 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 storage::veritas::nba::ssh::mode::components::psu; + +use strict; +use warnings; +use centreon::plugins::misc; + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => 'checking power supplies'); + $self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 }; + return if ($self->check_filter(section => 'psu')); + + while ($self->{result} =~ /Hardware\s+monitor\s+information\s+(.*?)(?=\s+Hardware monitor information|\Z$)/msg) { + my $part = $1; + + next if ($part !~ /StorageShelf\s+(\d+)\s+Power\s+Supply\s+Information/i); + my $shelf = $1; + + while ($part =~ /^.*?Enclosure(.*?)Power\s+Supply\s+(.*?)\s+\|.*?\|(.*?)\|/mig) { + my ($enclosure, $psu, $state) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3)); + my $instance = 'shelf' . $shelf . '.' . $enclosure . '.' . $psu; + + next if ($self->check_filter(section => 'psu', instance => $instance)); + $self->{components}->{psu}->{total}++; + + $self->{output}->output_add( + long_msg => sprintf( + "power supply '%s' shelf '%s' enclosure '%s' state is %s", + $psu, + $shelf, + $enclosure, + $state + ) + ); + my $exit = $self->get_severity(label => 'default', section => 'psu', instance => $instance, value => $state); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "power supply '%s' shelf '%s' enclosure '%s' state is %s", + $psu, $shelf, $enclosure, $state + ) + ); + } + } + } +} + +1; diff --git a/src/storage/veritas/nba/ssh/mode/components/temperature.pm b/src/storage/veritas/nba/ssh/mode/components/temperature.pm new file mode 100644 index 0000000000..608ed61cd2 --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/components/temperature.pm @@ -0,0 +1,99 @@ +# +# 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 storage::veritas::nba::ssh::mode::components::temperature; + +use strict; +use warnings; +use centreon::plugins::misc; + +sub load {} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => 'checking temperatures'); + $self->{components}->{temperature} = { name => 'temperature', total => 0, skip => 0 }; + return if ($self->check_filter(section => 'temperature')); + + while ($self->{result} =~ /Hardware\s+monitor\s+information\s+(.*?)(?=\s+Hardware monitor information|\Z$)/msg) { + my $part = $1; + + next if ($part !~ /StorageShelf\s+(\d+)\s+Temperature\s+Information/i); + my $shelf = $1; + + while ($part =~ /^.*?Enclosure(.*?)Temperature\s+(.*?)\s+\|(.*?)Degrees\s+Celsius.*?\|.*?\|(.*?)\|/mig) { + my ($enclosure, $temp, $read, $state) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3), centreon::plugins::misc::trim($4)); + my $instance = 'shelf' . $shelf . '.' . $enclosure . '.' . $temp; + + next if ($self->check_filter(section => 'temperature', instance => $instance)); + $self->{components}->{temperature}->{total}++; + + $self->{output}->output_add( + long_msg => sprintf( + "temperature '%s' shelf '%s' enclosure '%s' state is %s [current: %s]", + $temp, + $shelf, + $enclosure, + $state, + $read + ) + ); + my $exit = $self->get_severity(label => 'default', section => 'temperature', instance => $instance, value => $state); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "temperature '%s' shelf '%s' enclosure '%s' state is %s", + $temp, $shelf, $enclosure, $state + ) + ); + } + + next if ($read !~ /[0-9]+/); + + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $read); + + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit2, + short_msg => sprintf( + "temperature '%s' shelf '%s' enclosure '%s' is %s degree centigrade", + $temp, + $shelf, + $enclosure, + $read + ) + ); + } + + $self->{output}->perfdata_add( + nlabel => 'hardware.temperature.celsius', + unit => 'C', + instances => ['shelf' . $shelf, $enclosure, $temp], + value => $read, + warning => $warn, + critical => $crit + ); + } + } +} + +1; diff --git a/src/storage/veritas/nba/ssh/mode/hardware.pm b/src/storage/veritas/nba/ssh/mode/hardware.pm new file mode 100644 index 0000000000..4c0f183e40 --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/hardware.pm @@ -0,0 +1,133 @@ +# +# Copyright 2026-Present 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 storage::veritas::nba::ssh::mode::hardware; + +use base qw(centreon::plugins::templates::hardware); + +use strict; +use warnings; + +sub set_system { + my ($self, %options) = @_; + + $self->{cb_hook2} = 'ssh_execute'; + + $self->{thresholds} = { + default => [ + ['ok', 'OK'], + ['.*', 'CRITICAL'] + ] + }; + + $self->{components_path} = 'storage::veritas::nba::ssh::mode::components'; + $self->{components_module} = ['disk', 'fan', 'psu', 'temperature']; +} + +sub ssh_execute { + my ($self, %options) = @_; + + ($self->{result}) = $options{custom}->execute_scenario( + request => { + interactive => 1, + pty => { + rows => 800, + cols => 80 + }, + scenario => [ + { "cmd" => "waitfor", "options" => { "Match" => 'Main_Menu>', "Timeout" => "20" } }, + { "cmd" => "put", "options" => { "String" => "Monitor\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Monitor>', "Timeout" => "5" } }, + { "cmd" => "put", "options" => { "String" => "Hardware ShowHealth StorageShelf all\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'to quit', "Timeout" => "10" } }, + { "cmd" => "put", "options" => { "String" => 'f', "Timeout" => "30" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'to quit', "Timeout" => "10" } }, + { "cmd" => "put", "options" => { "String" => 'q', "Timeout" => "30" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Monitor>', "Timeout" => "10" } }, + { "cmd" => "put", "options" => { "String" => "exit\n", "Timeout" => "5" } }, + { "cmd" => "close" } + ] + } + ); + + $self->{result} =~ s/\x{1b}\x{5b}\x{37}\x{6d}.*?\x{1b}\x{5b}\x{32}\x{37}\x{6d}//mg; # Press 'q' to quit... for previous page +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => {}); + + $self->{commands} = []; + return $self; +} + +1; + +__END__ + +=head1 MODE + +Check harware(disks, fans, power supplies and temperatures). + +=over 8 + +=item B<--component> + +Which component to check (default: '.*'). +Can be: 'disk', 'fan', 'psu', 'temperature'. + +=item B<--filter> + +Exclude the items given as a comma-separated list (example: --filter=temperature). +You can also exclude items from specific instances: --filter=C + +=item B<--no-component> + +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). +Example: --threshold-overload='psu,ok,true' + +=item B<--warning> + +Set warning threshold for 'temperature' (syntax: type,regexp,threshold) +Example: --warning='temperature,.*,50' + +=item B<--critical> + +Set critical threshold for 'temperature' (syntax: type,regexp,threshold) +Example: --critical='temperature,.*,70' + +=item B<--warning-count-*> + +Define the warning threshold for the number of components of one type (replace '*' with the component type). + +=item B<--critical-count-*> + +Define the critical threshold for the number of components of one type (replace '*' with the component type). + +=back + +=cut diff --git a/src/storage/veritas/nba/ssh/mode/liststorages.pm b/src/storage/veritas/nba/ssh/mode/liststorages.pm new file mode 100644 index 0000000000..46c444ead8 --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/liststorages.pm @@ -0,0 +1,128 @@ +# +# Copyright 2026-Present 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 storage::veritas::nba::ssh::mode::liststorages; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +my @labels = ( + 'name', + 'status' +); + +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 ($result) = $options{custom}->execute_scenario( + request => { + interactive => 1, + pty => { + rows => 800, + cols => 80 + }, + scenario => [ + { "cmd" => "waitfor", "options" => { "Match" => 'Main_Menu>', "Timeout" => "30" } }, + { "cmd" => "put", "options" => { "String" => "Manage\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Manage>', "Timeout" => "5" } }, + { "cmd" => "put", "options" => { "String" => "Storage\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Storage>', "Timeout" => "5" } }, + { "cmd" => "put", "options" => { "String" => "Show ALL\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'to quit|Waiting for data', "Timeout" => "20" } }, + { "cmd" => "close" } + ] + } + ); + + my $results = {}; + while ($result =~ /^(.*?)\|.*?\|.*?\|.*?\|.*?\|\s+(Optimal|Degraded|Not\s+Accessible|Not\s+Configured)/mig) { + my ($part_name, $part_status) = (centreon::plugins::misc::trim($1), $2); + $results->{ $part_name } = { + name => $part_name, + status => $part_status + }; + } + + return $results; +} + +sub run { + my ($self, %options) = @_; + + my $results = $self->manage_selection(custom => $options{custom}); + foreach my $instance (sort keys %$results) { + $self->{output}->output_add(long_msg => join('', map("[$_: " . $results->{$instance}->{$_} . ']', @labels))); + } + + $self->{output}->output_add( + severity => 'OK', + short_msg => 'List storages:' + ); + $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 => [ @labels ]); +} + +sub disco_show { + my ($self, %options) = @_; + + my $results = $self->manage_selection(custom => $options{custom}); + foreach (sort keys %$results) { + $self->{output}->add_disco_entry( + %{$results->{$_}} + ); + } +} + +1; + +__END__ + +=head1 MODE + +List storages. + +=over 8 + +=back + +=cut \ No newline at end of file diff --git a/src/storage/veritas/nba/ssh/mode/memory.pm b/src/storage/veritas/nba/ssh/mode/memory.pm new file mode 100644 index 0000000000..1dbcb9240b --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/memory.pm @@ -0,0 +1,195 @@ +# +# Copyright 2026-Present 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 storage::veritas::nba::ssh::mode::memory; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::constants qw(:counters); + +sub custom_memory_output { + my ($self, %options) = @_; + + return sprintf( + 'Ram total: %s %s used (-%s): %s %s (%.2f%%) free: %s %s (%.2f%%) available: %s %s (%.2f%%)', + $self->{perfdata}->change_bytes(value => $self->{result_values}->{total}), + $self->{result_values}->{used_desc}, + $self->{perfdata}->change_bytes(value => $self->{result_values}->{used}), + $self->{result_values}->{prct_used}, + $self->{perfdata}->change_bytes(value => $self->{result_values}->{free}), + $self->{result_values}->{prct_free}, + $self->{perfdata}->change_bytes(value => $self->{result_values}->{available}), + $self->{result_values}->{prct_available}, + + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'memory', type => COUNTER_TYPE_GLOBAL, skipped_code => { NO_VALUE => 1 } } + ]; + + $self->{maps_counters}->{memory} = [ + { label => 'memory-usage', nlabel => 'memory.usage.bytes', set => { + key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'used_desc' }, { name => 'available' }, { name => 'prct_available' } ], + closure_custom_output => $self->can('custom_memory_output'), + perfdatas => [ + { template => '%d', min => 0, max => 'total', unit => 'B' } + ] + } + }, + { label => 'memory-usage-free', nlabel => 'memory.free.bytes', display_ok => 0, set => { + key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'used_desc' }, { name => 'available' }, { name => 'prct_available' } ], + closure_custom_output => $self->can('custom_memory_output'), + perfdatas => [ + { template => '%d', min => 0, max => 'total', unit => 'B' } + ] + } + }, + { label => 'memory-usage-prct', nlabel => 'memory.usage.percentage', display_ok => 0, set => { + key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' }, { name => 'used_desc' }, { name => 'available' }, { name => 'prct_available' } ], + closure_custom_output => $self->can('custom_memory_output'), + perfdatas => [ + { template => '%.2f', min => 0, max => 100, unit => '%' } + ] + } + }, + { label => 'memory-available', nlabel => 'memory.available.bytes', display_ok => 0, set => { + key_values => [ { name => 'available' }, { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'used_desc' }, { name => 'prct_available' } ], + closure_custom_output => $self->can('custom_memory_output'), + perfdatas => [ + { template => '%d', min => 0, max => 'total', unit => 'B' } + ] + } + }, + { label => 'memory-available-prct', nlabel => 'memory.available.percentage', display_ok => 0, set => { + key_values => [ { name => 'prct_available' }, { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' }, { name => 'used_desc' }, { name => 'available' } ], + closure_custom_output => $self->can('custom_memory_output'), + perfdatas => [ + { template => '%.2f', min => 0, max => 100, unit => '%' } + ] + } + }, + { label => 'buffer', nlabel => 'memory.buffer.bytes', set => { + key_values => [ { name => 'buffer' } ], + output_template => 'buffer: %s %s', + output_change_bytes => 1, + perfdatas => [ + { template => '%d', min => 0, unit => 'B' } + ] + } + }, + { label => 'shared', nlabel => 'memory.shared.bytes', set => { + key_values => [ { name => 'shared' } ], + output_template => 'shared: %s %s', + output_change_bytes => 1, + perfdatas => [ + { template => '%d', min => 0, unit => 'B' } + ] + } + } + ]; +} + +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}->execute_scenario( + request => { + interactive => 1, + pty => { + rows => 800, + cols => 80 + }, + scenario => [ + { "cmd" => "waitfor", "options" => { "Match" => 'Main_Menu>', "Timeout" => "30" } }, + { "cmd" => "put", "options" => { "String" => "Monitor\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Monitor>', "Timeout" => "5" } }, + { "cmd" => "put", "options" => { "String" => "MemoryStatus\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Total:', "Timeout" => "10" } }, + { "cmd" => "close" } + ] + } + ); + + # total used free shared buff/cache available + #Mem: 262873544 122588148 3147172 142120 137138224 137563492 + #Swap: 66674684 14492760 52181924 + #Total: 329548228 137080908 55329096 + if ($result !~ /^.*?Mem\s*:\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/mi) { + $self->{output}->add_option_msg(short_msg => 'Some memory informations missing.'); + $self->{output}->option_exit(); + } + + my $total_size = $1 * 1024; + my $free = $3 * 1024; + my $used = $2 * 1024; + my $shared = $4 * 1024; + my $buffer_used = $5 * 1024; + my $available = $6 * 1024; + my $used_desc = 'buffers/cache'; + + $self->{memory} = { + total => $total_size, + used => $used, + free => $free, + prct_used => $used * 100 / $total_size, + prct_free => $free * 100 / $total_size, + used_desc => $used_desc, + available => $available, + prct_available => $available * 100 / $total_size, + buffer => $buffer_used, + shared => $shared + }; +} + +1; + +__END__ + +=head1 MODE + +Check memory + +=over 8 + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'memory-usage' (B), 'memory-usage-free' (B), 'memory-usage-prct' (%), +'memory-available' (B), 'memory-available-prct' (%), 'buffer' (B), 'shared' (B) . + +=back + +=cut \ No newline at end of file diff --git a/src/storage/veritas/nba/ssh/mode/storage.pm b/src/storage/veritas/nba/ssh/mode/storage.pm new file mode 100644 index 0000000000..5c109de9df --- /dev/null +++ b/src/storage/veritas/nba/ssh/mode/storage.pm @@ -0,0 +1,318 @@ +# +# Copyright 2026-Present 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 storage::veritas::nba::ssh::mode::storage; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); +use centreon::plugins::constants qw(:counters); +use centreon::plugins::misc; + +sub custom_status_output { + my ($self, %options) = @_; + + return 'status: ' . $self->{result_values}->{status}; +} + +sub custom_space_usage_output { + my ($self, %options) = @_; + + my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => + $self->{result_values}->{total}); + my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used}); + my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free}); + return sprintf( + 'space usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)', + $total_size_value . " " . $total_size_unit, + $total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used}, + $total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free} + ); +} + +sub partition_long_output { + my ($self, %options) = @_; + + return sprintf( + "checking partition '%s'", + $options{instance_value}->{name} + ); +} + +sub prefix_storage_output { + my ($self, %options) = @_; + + return sprintf( + "partition '%s' ", + $options{instance_value}->{name} + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { + name => 'partitions', + type => COUNTER_TYPE_MULTIPLE, + cb_prefix_output => 'prefix_partition_output', + cb_long_output => 'partition_long_output', + indent_long_output => ' ', + message_multiple => 'All partitions are ok', + group => + [ + { name => 'partition_status', type => COUNTER_MULTIPLE_INSTANCE }, + { name => 'partition_space', type => COUNTER_MULTIPLE_INSTANCE, skipped_code => { NO_VALUE => 1 } } + ] + } + ]; + + $self->{maps_counters}->{partition_space} = [ + { + label => 'partition-space-usage', nlabel => 'partition.space.usage.bytes', set => { + key_values => + [ + { name => 'used' }, + { name => 'free' }, + { name => 'prct_used' }, + { name => 'prct_free' }, + { name => 'total' } + ], + closure_custom_output => $self->can('custom_space_usage_output'), + perfdatas => + [ + { + template => '%d', + min => 0, + max => 'total', + unit => 'B', + cast_int => 1, + label_extra_instance => 1 + } + ] + } + }, + { + label => 'partition-space-usage-free', nlabel => 'partition.space.free.bytes', display_ok => 0, set => { + key_values => + [ + { name => 'free' }, + { name => 'used' }, + { name => 'prct_used' }, + { name => 'prct_free' }, + { name => 'total' } + ], + closure_custom_output => $self->can('custom_space_usage_output'), + perfdatas => + [ + { + template => '%d', + min => 0, + max => 'total', + unit => 'B', + cast_int => 1, + label_extra_instance => 1 + } + ] + } + }, + { + label => 'partition-space-usage-prct', nlabel => 'partition.space.usage.percentage', display_ok => 0, set => { + key_values => + [ + { name => 'prct_used' }, + { name => 'used' }, + { name => 'free' }, + { name => 'prct_free' }, + { name => 'total' } + ], + closure_custom_output => $self->can('custom_space_usage_output'), + perfdatas => + [ + { + template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 + } + ] + } + } + ]; + + $self->{maps_counters}->{partition_status} = [ + { + label => 'partition-status', type => COUNTER_KIND_TEXT, warning_default => '%{status} =~ /Degraded/i', critical_default => '%{status} =~ /Not Accessible/i', set => { + key_values => + [ + { name => 'status' }, + { name => 'partitionName' } + ], + 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 => { + 'include-partition-name:s' => { name => 'include_partition_name', default => '' }, + 'exclude-partition-name:s' => { name => 'exclude_partition_name', default => '' } + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + my ($result) = $options{custom}->execute_scenario( + request => { + interactive => 1, + pty => { + rows => 800, + cols => 80 + }, + scenario => [ + { "cmd" => "waitfor", "options" => { "Match" => 'Main_Menu>', "Timeout" => "30" } }, + { "cmd" => "put", "options" => { "String" => "Manage\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Manage>', "Timeout" => "5" } }, + { "cmd" => "put", "options" => { "String" => "Storage\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'Storage>', "Timeout" => "5" } }, + { "cmd" => "put", "options" => { "String" => "Show ALL\n", "Timeout" => "5" } }, + { "cmd" => "waitfor", "options" => { "Match" => 'to quit|Waiting for data', "Timeout" => "20" } }, + { "cmd" => "close" } + ] + } + ); + + #------------------------------------------------------------------------------- + #Partition | Total | Available | Used | %Used | Status + #------------------------------------------------------------------------------- + #AdvancedDisk | 0 GB | 0 GB | 0 GB | 0 | Not Configured + #CDPGateway | 0 GB | 0 GB | 0 GB | 0 | Not Configured + #Configuration | 100 GB | 98.64 GB | 1.36 GB | 2 | Optimal + #MSDP | 251 TB | 80.49 TB | 170.51 TB | 68 | Optimal + #MSDP Catalog | 798 GB | 788.75 GB | 9.25 GB | 2 | Optimal + #NDMP Log | 750 GB | 634.58 GB | 115.42 GB | 16 | Optimal + #Share | 0 GB | 0 GB | 0 GB | 0 | Not Configured + #Unallocated | 18.44 TB | - | - | - | - + + while ($result =~ /^(.*?)\|.*?\|(.*?)\|(.*?)\|.*?\|\s+(Optimal|Degraded|Not\s+Accessible|Not\s+Configured)/mig) { + my ($part_name, $part_available, $part_used, $part_status) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3), $4); + + next if (centreon::plugins::misc::is_excluded($part_name, $self->{option_results}->{include_partition_name}, $self->{option_results}->{exclude_partition_name})); + + $self->{partitions}->{$part_name} = { + name => $part_name, + partition_status => { + partitionName => $part_name, + status => $part_status + } + }; + + $part_used =~ /^(\S+)\s+(\S+)/; + my $part_used_bytes = centreon::plugins::misc::convert_bytes(value => $1, unit => $2); + $part_available =~ /^(\S+)\s+(\S+)/; + my $part_available_bytes = centreon::plugins::misc::convert_bytes(value => $1, unit => $2); + if (($part_used_bytes + $part_available_bytes) > 0) { + my $total = $part_used_bytes + $part_available_bytes; + $self->{partitions}->{$part_name}->{partition_space} = { + total => $total, + free => $part_available_bytes, + used => $part_used_bytes, + prct_used => ($part_used_bytes * 100) / $total, + prct_free => ($part_available_bytes * 100) / $total + }; + } + } + + if (scalar(keys %{$self->{partitions}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "Couldn't get partition information"); + $self->{output}->option_exit(); + } +} + +1; + +__END__ + +=head1 MODE + +Check storages. + +=over 8 + +=item B<--filter-counters> + +Define which counters (filtered by regular expression) should be monitored. +Can be : partition-space-usage partition-space-usage-free partition-space-usage-prct +Example: --filter-counters='partition-status' + +=item B<--include-partition-name> + +Include partition names (regexp). + +=item B<--exclude-partition-name> + +Exclude partition names (regexp). + +=item B<--warning-status> + +Define the conditions to match for the status to be WARNING (default: C<'%{status} =~ /Degraded/i'>). +You can use the following variables: C<%{status}>, C<%{partitionName}> + +=item B<--critical-status> + +Define the conditions to match for the status to be CRITICAL (default: C<'%{status} =~ /Not Accessible/i'>). +You can use the following variables: C<%{status}>, C<%{partitionName}> + +=item B<--warning-partition-space-usage> + +Warning threshold for partition space usage in bytes. + +=item B<--critical-partition-space-usage> + +Critical threshold for partition space usage in bytes. + +=item B<--warning-partition-space-usage-free> + +Warning threshold for partition free space usage in bytes. + +=item B<--critical-partition-space-usage-free> + +Critical threshold for partition free space usage in bytes. + +=item B<--warning-partition-space-usage-prct> + +Warning threshold for partition space usage in percent. + +=item B<--critical-partition-space-usage-prct> + +Critical threshold for partition space usage in percent. + +=back + +=cut diff --git a/src/storage/veritas/nba/ssh/plugin.pm b/src/storage/veritas/nba/ssh/plugin.pm new file mode 100644 index 0000000000..e48a148a78 --- /dev/null +++ b/src/storage/veritas/nba/ssh/plugin.pm @@ -0,0 +1,51 @@ +# +# Copyright 2026-Present 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 storage::veritas::nba::ssh::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} = { + 'hardware' => 'storage::veritas::nba::ssh::mode::hardware', + 'list-storages' => 'storage::veritas::nba::ssh::mode::liststorages', + 'memory' => 'storage::veritas::nba::ssh::mode::memory', + 'storage' => 'storage::veritas::nba::ssh::mode::storage' + }; + + $self->{custom_modes}->{ssh} = 'storage::veritas::nba::ssh::custom::cli'; + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Veritas Netbackup Appliance in SSH. + +=cut