(plugin) storage::fujitsu::eternus::dx::ssh - use ssh backends (#3967)
* (plugin) storage::fujitsu::eternus::dx::ssh - use ssh backends * wip
This commit is contained in:
parent
659f053768
commit
a23791d3f5
|
@ -110,7 +110,8 @@ sub execute_command {
|
|||
command_path => defined($self->{option_results}->{command_path}) && $self->{option_results}->{command_path} ne '' ? $self->{option_results}->{command_path} : $options{command_path},
|
||||
command_options => $command_options,
|
||||
timeout => $timeout,
|
||||
no_quit => $options{no_quit}
|
||||
no_quit => $options{no_quit},
|
||||
ssh_pipe => $options{ssh_pipe}
|
||||
);
|
||||
} else {
|
||||
($stdout, $exit_code) = centreon::plugins::misc::execute(
|
||||
|
|
|
@ -58,40 +58,21 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"ssh-option:s@" => { name => 'ssh_option' },
|
||||
"ssh-path:s" => { name => 'ssh_path' },
|
||||
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
|
||||
"timeout:s" => { name => 'timeout', default => 30 },
|
||||
"command:s" => { name => 'command', default => 'show' },
|
||||
"command-path:s" => { name => 'command_path' },
|
||||
"command-options:s" => { name => 'command_options', default => 'performance -type cm' },
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
|
||||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stdout = centreon::plugins::misc::execute(
|
||||
output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
ssh_pipe => 1,
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options}
|
||||
my ($stdout) = $options{custom}->execute_command(
|
||||
command => 'show',
|
||||
command_options => "performance -type cm\n",
|
||||
ssh_pipe => 1
|
||||
);
|
||||
|
||||
# Can have 4 columns also.
|
||||
|
||||
#Location Busy Rate(%) Copy Residual Quantity(MB)
|
||||
|
@ -107,13 +88,13 @@ sub manage_selection {
|
|||
foreach (split /\n/, $stdout) {
|
||||
next if ($_ !~ /^(CM.*?)\s{2,}(\d+)\s+\S+/);
|
||||
my ($cpu_name, $cpu_value) = ($1, $2);
|
||||
|
||||
|
||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||
$cpu_name !~ /$self->{option_results}->{filter_name}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $cpu_name . "': no matching filter name.");
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
$self->{cpu}->{$cpu_name} = { display => $cpu_name, usage => $cpu_value };
|
||||
}
|
||||
|
||||
|
@ -131,41 +112,10 @@ __END__
|
|||
|
||||
Check CPUs usage.
|
||||
|
||||
Command used: show performance -type cm
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Hostname to query.
|
||||
|
||||
=item B<--ssh-option>
|
||||
|
||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
||||
|
||||
=item B<--ssh-path>
|
||||
|
||||
Specify ssh command path (default: none)
|
||||
|
||||
=item B<--ssh-command>
|
||||
|
||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Timeout in seconds for the command (Default: 30).
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'show').
|
||||
Can be changed if you have output in a file.
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: 'performance -type cm').
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter by name (regexp can be used).
|
||||
|
|
|
@ -42,7 +42,7 @@ my $thresholds = {
|
|||
['Broken', 'CRITICAL'],
|
||||
['Not Exist', 'CRITICAL'],
|
||||
['Unknown', 'UNKNOWN']
|
||||
],
|
||||
]
|
||||
};
|
||||
|
||||
sub new {
|
||||
|
@ -50,18 +50,10 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"ssh-option:s@" => { name => 'ssh_option' },
|
||||
"ssh-path:s" => { name => 'ssh_path' },
|
||||
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
|
||||
"timeout:s" => { name => 'timeout', default => 30 },
|
||||
"command:s" => { name => 'command', default => 'show' },
|
||||
"command-path:s" => { name => 'command_path' },
|
||||
"command-options:s" => { name => 'command_options', default => 'disks' },
|
||||
"filter:s@" => { name => 'filter' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
"no-component:s" => { name => 'no_component' }
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter:s@' => { name => 'filter' },
|
||||
'threshold-overload:s@' => { name => 'threshold_overload' },
|
||||
'no-component:s' => { name => 'no_component' }
|
||||
});
|
||||
|
||||
$self->{no_components} = undef;
|
||||
|
@ -71,10 +63,6 @@ sub new {
|
|||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
|
||||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$self->{filter} = [];
|
||||
foreach my $val (@{$self->{option_results}->{filter}}) {
|
||||
|
@ -110,12 +98,11 @@ sub check_options {
|
|||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stdout = centreon::plugins::misc::execute(output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
ssh_pipe => 1,
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options});
|
||||
my ($stdout) = $options{custom}->execute_command(
|
||||
command => 'show',
|
||||
command_options => "disks\n",
|
||||
ssh_pipe => 1
|
||||
);
|
||||
|
||||
#Location Status Size Type Speed(rpm) Usage Health(%)
|
||||
#------------- ----------------------------- ------- ------------------- ---------- ------------------- ---------
|
||||
|
@ -136,17 +123,23 @@ sub run {
|
|||
$self->{output}->output_add(long_msg => sprintf("Physical Disk '%s' status is '%s'", $disk_name, $disk_status));
|
||||
my $exit = $self->get_severity(section => 'disk', value => $disk_status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Physical Disk '%s' status is '%s'.", $disk_name, $disk_status));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Physical Disk '%s' status is '%s'.", $disk_name, $disk_status)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %d physical disks are ok.", $total_components));
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => sprintf("All %d physical disks are ok.", $total_components)
|
||||
);
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
$self->{output}->output_add(
|
||||
severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.'
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
|
@ -174,7 +167,7 @@ sub check_filter {
|
|||
sub get_severity {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'UNKNOWN'; # default
|
||||
|
||||
|
||||
if (defined($self->{overload_th}->{$options{section}})) {
|
||||
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||
if ($options{value} =~ /$_->{filter}/i) {
|
||||
|
@ -189,7 +182,7 @@ sub get_severity {
|
|||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
@ -201,41 +194,10 @@ __END__
|
|||
|
||||
Check Physical disks.
|
||||
|
||||
Command used: show disks
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Hostname to query.
|
||||
|
||||
=item B<--ssh-option>
|
||||
|
||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
||||
|
||||
=item B<--ssh-path>
|
||||
|
||||
Specify ssh command path (default: none)
|
||||
|
||||
=item B<--ssh-command>
|
||||
|
||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Timeout in seconds for the command (Default: 30).
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'show').
|
||||
Can be changed if you have output in a file.
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: 'disks').
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list)
|
||||
|
|
|
@ -28,11 +28,11 @@ use centreon::plugins::misc;
|
|||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'port', type => 1, cb_prefix_output => 'prefix_port_output', message_multiple => 'All ports are ok' }
|
||||
];
|
||||
|
||||
|
||||
$self->{maps_counters}->{port} = [
|
||||
{ label => 'read-iops', nlabel => 'port.io.read.usage.iops', set => {
|
||||
key_values => [ { name => 'read_iops' }, { name => 'display' } ],
|
||||
|
@ -84,40 +84,20 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"ssh-option:s@" => { name => 'ssh_option' },
|
||||
"ssh-path:s" => { name => 'ssh_path' },
|
||||
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
|
||||
"timeout:s" => { name => 'timeout', default => 30 },
|
||||
"command:s" => { name => 'command', default => 'show' },
|
||||
"command-path:s" => { name => 'command_path' },
|
||||
"command-options:s" => { name => 'command_options', default => 'performance -type port' },
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
|
||||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stdout = centreon::plugins::misc::execute(
|
||||
output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
ssh_pipe => 1,
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options}
|
||||
my ($stdout) = $options{custom}->execute_command(
|
||||
command => 'show',
|
||||
command_options => "performance -type port\n",
|
||||
ssh_pipe => 1
|
||||
);
|
||||
|
||||
#Location IOPS(IOPS) Throughput(MB/s)
|
||||
|
@ -136,7 +116,7 @@ sub manage_selection {
|
|||
$self->{output}->output_add(long_msg => "Skipping '" . $port_name . "': no matching filter name.");
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
$self->{port}->{$port_name} = {
|
||||
display => $port_name,
|
||||
read_iops => $port_read_iops, write_iops => $port_write_iops,
|
||||
|
@ -159,41 +139,10 @@ __END__
|
|||
|
||||
Check Port statistics.
|
||||
|
||||
Command used: show performance -type port
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Hostname to query.
|
||||
|
||||
=item B<--ssh-option>
|
||||
|
||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
||||
|
||||
=item B<--ssh-path>
|
||||
|
||||
Specify ssh command path (default: none)
|
||||
|
||||
=item B<--ssh-command>
|
||||
|
||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Timeout in seconds for the command (Default: 30).
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'show').
|
||||
Can be changed if you have output in a file.
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: 'performance -type port').
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter by name (regexp can be used).
|
||||
|
|
|
@ -44,18 +44,10 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'hostname:s' => { name => 'hostname' },
|
||||
'ssh-option:s@' => { name => 'ssh_option' },
|
||||
'ssh-path:s' => { name => 'ssh_path' },
|
||||
'ssh-command:s' => { name => 'ssh_command', default => 'ssh' },
|
||||
'timeout:s' => { name => 'timeout', default => 30 },
|
||||
'command:s' => { name => 'command', default => 'show' },
|
||||
'command-path:s' => { name => 'command_path' },
|
||||
'command-options:s' => { name => 'command_options', default => 'enclosure-status -type all' },
|
||||
'filter:s@' => { name => 'filter' },
|
||||
'threshold-overload:s@' => { name => 'threshold_overload' },
|
||||
'no-component:s' => { name => 'no_component' }
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter:s@' => { name => 'filter' },
|
||||
'threshold-overload:s@' => { name => 'threshold_overload' },
|
||||
'no-component:s' => { name => 'no_component' }
|
||||
});
|
||||
|
||||
$self->{no_components} = undef;
|
||||
|
@ -65,10 +57,6 @@ sub new {
|
|||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
|
||||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$self->{filter} = [];
|
||||
foreach my $val (@{$self->{option_results}->{filter}}) {
|
||||
|
@ -104,13 +92,10 @@ sub check_options {
|
|||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stdout = centreon::plugins::misc::execute(
|
||||
output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
ssh_pipe => 1,
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options}
|
||||
my ($stdout) = $options{custom}->execute_command(
|
||||
command => 'show',
|
||||
command_options => "enclosure-status -type all\n",
|
||||
ssh_pipe => 1
|
||||
);
|
||||
|
||||
#Controller Enclosure #0 Information
|
||||
|
@ -242,41 +227,10 @@ __END__
|
|||
|
||||
Check power supplies.
|
||||
|
||||
Command used: show enclosure-status -type all
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Hostname to query.
|
||||
|
||||
=item B<--ssh-option>
|
||||
|
||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
||||
|
||||
=item B<--ssh-path>
|
||||
|
||||
Specify ssh command path (default: none)
|
||||
|
||||
=item B<--ssh-command>
|
||||
|
||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Timeout in seconds for the command (Default: 30).
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'show').
|
||||
Can be changed if you have output in a file.
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: 'enclosure-status -type all').
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list)
|
||||
|
|
|
@ -32,13 +32,6 @@ sub custom_threshold_output {
|
|||
return $self->{instance_mode}->get_severity(section => 'rg', value => $self->{result_values}->{status});
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub custom_usage_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -86,6 +79,12 @@ sub custom_usage_calc {
|
|||
return 0;
|
||||
}
|
||||
|
||||
sub prefix_rg_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Raid Group '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -96,7 +95,6 @@ sub set_counters {
|
|||
$self->{maps_counters}->{rg} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'status' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
output_template => 'Status : %s', output_error_template => 'Status : %s',
|
||||
output_use => 'status',
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
|
@ -114,29 +112,15 @@ sub set_counters {
|
|||
];
|
||||
}
|
||||
|
||||
sub prefix_rg_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Raid Group '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"ssh-option:s@" => { name => 'ssh_option' },
|
||||
"ssh-path:s" => { name => 'ssh_path' },
|
||||
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
|
||||
"timeout:s" => { name => 'timeout', default => 30 },
|
||||
"command:s" => { name => 'command', default => 'show' },
|
||||
"command-path:s" => { name => 'command_path' },
|
||||
"command-options:s" => { name => 'command_options', default => 'raid-groups -csv' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"filter-level:s" => { name => 'filter_level' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'threshold-overload:s@' => { name => 'threshold_overload' },
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'filter-level:s' => { name => 'filter_level' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -146,10 +130,6 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
|
||||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
|
||||
$self->{overload_th} = {};
|
||||
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
|
@ -169,13 +149,10 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stdout = centreon::plugins::misc::execute(
|
||||
output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
ssh_pipe => 1,
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options}
|
||||
my ($stdout) = $options{custom}->execute_command(
|
||||
command => 'show',
|
||||
command_options => "raid-groups -csv\n",
|
||||
ssh_pipe => 1
|
||||
);
|
||||
|
||||
#[RAID Group No.],[RAID Group Name],[RAID Level],[Assigned CM],[Status],[Total Capacity(MB)],[Free Capacity(MB)]
|
||||
|
@ -215,8 +192,8 @@ sub manage_selection {
|
|||
my $thresholds = {
|
||||
rg => [
|
||||
['Available', 'OK'],
|
||||
['Spare in Use', 'WARNING'],
|
||||
],
|
||||
['Spare in Use', 'WARNING']
|
||||
]
|
||||
};
|
||||
|
||||
sub get_severity {
|
||||
|
@ -249,41 +226,10 @@ __END__
|
|||
|
||||
Check raid groups.
|
||||
|
||||
Command used: show raid-groups -csv
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Hostname to query.
|
||||
|
||||
=item B<--ssh-option>
|
||||
|
||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
||||
|
||||
=item B<--ssh-path>
|
||||
|
||||
Specify ssh command path (default: none)
|
||||
|
||||
=item B<--ssh-command>
|
||||
|
||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Timeout in seconds for the command (Default: 30).
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'show').
|
||||
Can be changed if you have output in a file.
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: 'raid-groups -csv').
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,status,regexp)
|
||||
|
|
|
@ -89,7 +89,7 @@ sub set_counters {
|
|||
key_values => [ { name => 'write_response_time' }, { name => 'display' } ],
|
||||
output_template => 'Write Response Time : %d ms',
|
||||
perfdatas => [
|
||||
{ label => 'write_response_time', value => 'write_response_time', template => '%d',
|
||||
{ label => 'write_response_time', template => '%d',
|
||||
unit => 'ms', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
}
|
||||
|
@ -138,40 +138,20 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'hostname:s' => { name => 'hostname' },
|
||||
'ssh-option:s@' => { name => 'ssh_option' },
|
||||
'ssh-path:s' => { name => 'ssh_path' },
|
||||
'ssh-command:s' => { name => 'ssh_command', default => 'ssh' },
|
||||
'timeout:s' => { name => 'timeout', default => 30 },
|
||||
'command:s' => { name => 'command', default => 'show' },
|
||||
'command-path:s' => { name => 'command_path' },
|
||||
'command-options:s' => { name => 'command_options', default => ' performance -type host-io' },
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (defined($self->{option_results}->{hostname}) && $self->{option_results}->{hostname} ne '') {
|
||||
$self->{option_results}->{remote} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stdout = centreon::plugins::misc::execute(
|
||||
output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
ssh_pipe => 1,
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $self->{option_results}->{command_options}
|
||||
my ($stdout) = $options{custom}->execute_command(
|
||||
command => 'show',
|
||||
command_options => "performance -type host-io\n",
|
||||
ssh_pipe => 1
|
||||
);
|
||||
|
||||
#Volume IOPS(IOPS) Throughput(MB/s) Response Time(msec.) Processing Time(msec.) Cache Hit Rate(%)
|
||||
|
@ -201,6 +181,8 @@ sub manage_selection {
|
|||
next;
|
||||
}
|
||||
next if (/----|Name/i);
|
||||
next if (/^CLI>/);
|
||||
|
||||
my $value = centreon::plugins::misc::trim($_);
|
||||
my @matches = split(/\s+/, $value);
|
||||
|
||||
|
@ -211,7 +193,7 @@ sub manage_selection {
|
|||
$self->{output}->output_add(long_msg => "Skipping '" . $matches[1] . "': no matching filter name.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
my %counters = ();
|
||||
for (my $i = 0; $i < scalar(@template_values); $i++) {
|
||||
$counters{$template_values[$i]->{label}} = $matches[$i + 2];
|
||||
|
@ -224,7 +206,7 @@ sub manage_selection {
|
|||
%counters
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (scalar(keys %{$self->{volume}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No volume found.");
|
||||
$self->{output}->option_exit();
|
||||
|
@ -237,57 +219,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check Volume statistics.
|
||||
Check volume statistics.
|
||||
|
||||
Command used: show performance -type host-io
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Hostname to query.
|
||||
|
||||
=item B<--ssh-option>
|
||||
|
||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
||||
|
||||
=item B<--ssh-path>
|
||||
|
||||
Specify ssh command path (default: none)
|
||||
|
||||
=item B<--ssh-command>
|
||||
|
||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Timeout in seconds for the command (Default: 30).
|
||||
|
||||
=item B<--command>
|
||||
|
||||
Command to get information (Default: 'show').
|
||||
Can be changed if you have output in a file.
|
||||
|
||||
=item B<--command-path>
|
||||
|
||||
Command path (Default: none).
|
||||
|
||||
=item B<--command-options>
|
||||
|
||||
Command options (Default: 'performance -type host-io').
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter by name (regexp can be used).
|
||||
|
||||
=item B<--warning-*>
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'read-iops', 'write-iops', 'read-traffic', 'write-traffic',
|
||||
'read-response-time', 'write-response-time', 'read-processing-time', 'write-processing-time',
|
||||
'read-cache-hit-rate', 'write-cache-hit-rate'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Thresholds.
|
||||
Can be: 'read-iops', 'write-iops', 'read-traffic', 'write-traffic',
|
||||
'read-response-time', 'write-response-time', 'read-processing-time', 'write-processing-time',
|
||||
'read-cache-hit-rate', 'write-cache-hit-rate'.
|
||||
|
|
|
@ -22,22 +22,23 @@ package storage::fujitsu::eternus::dx::ssh::plugin;
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_simple);
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'physicaldisk' => 'storage::fujitsu::eternus::dx::ssh::mode::physicaldisk',
|
||||
'psu' => 'storage::fujitsu::eternus::dx::ssh::mode::psu',
|
||||
'raid-groups' => 'storage::fujitsu::eternus::dx::ssh::mode::raidgroups',
|
||||
'volume-stats' => 'storage::fujitsu::eternus::dx::ssh::mode::volumestats',
|
||||
'cpu' => 'storage::fujitsu::eternus::dx::ssh::mode::cpu',
|
||||
'port-stats' => 'storage::fujitsu::eternus::dx::ssh::mode::portstats',
|
||||
);
|
||||
$self->{modes} = {
|
||||
'cpu' => 'storage::fujitsu::eternus::dx::ssh::mode::cpu',
|
||||
'physicaldisk' => 'storage::fujitsu::eternus::dx::ssh::mode::physicaldisk',
|
||||
'port-stats' => 'storage::fujitsu::eternus::dx::ssh::mode::portstats',
|
||||
'psu' => 'storage::fujitsu::eternus::dx::ssh::mode::psu',
|
||||
'raid-groups' => 'storage::fujitsu::eternus::dx::ssh::mode::raidgroups',
|
||||
'volume-stats' => 'storage::fujitsu::eternus::dx::ssh::mode::volumestats'
|
||||
};
|
||||
|
||||
$self->{custom_modes}->{cli} = 'centreon::plugins::script_custom::cli';
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue