(plugin) storage::emc::clariion - fix total defect (#4126)
This commit is contained in:
parent
6d548492a8
commit
0a3c2c1ab0
|
@ -30,7 +30,7 @@ my %states = (
|
|||
['^enabled$' , 'OK'],
|
||||
['^disabling$' , 'CRITICAL'],
|
||||
['^disabled$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL']
|
||||
],
|
||||
write_cache => [
|
||||
['^enabled$' , 'OK'],
|
||||
|
@ -39,11 +39,11 @@ my %states = (
|
|||
['^initializing$' , 'WARNING'],
|
||||
['^dumping$' , 'CRITICAL'],
|
||||
['^frozen$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL']
|
||||
],
|
||||
write_mirror => [
|
||||
['^yes$' , 'OK'],
|
||||
['^.*$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL']
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -52,14 +52,13 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"cache-command:s" => { name => 'cache_command', default => 'getcache' },
|
||||
"cache-options:s" => { name => 'cache_options', default => '-pdp -state -mirror' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
"warning:s" => { name => 'warning', },
|
||||
"critical:s" => { name => 'critical', },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
'cache-command:s' => { name => 'cache_command', default => 'getcache' },
|
||||
'cache-options:s' => { name => 'cache_options', default => '-pdp -state -mirror' },
|
||||
'threshold-overload:s@' => { name => 'threshold_overload' },
|
||||
'warning:s' => { name => 'warning' },
|
||||
'critical:s' => { name => 'critical' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -116,18 +115,20 @@ sub get_severity {
|
|||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
my $clariion = $options{custom};
|
||||
|
||||
|
||||
#Prct Dirty Cache Pages = 0
|
||||
#SP Read Cache State Enabled
|
||||
#SP Write Cache State Enabled
|
||||
#Write Cache Mirrored: YES
|
||||
my $response = $clariion->execute_command(cmd => $self->{option_results}->{cache_command} . ' ' . $self->{option_results}->{cache_options});
|
||||
my ($response) = $clariion->execute_command(cmd => $self->{option_results}->{cache_command} . ' ' . $self->{option_results}->{cache_options});
|
||||
chomp $response;
|
||||
|
||||
|
||||
my ($read_cache_state, $write_cache_state);
|
||||
if ($response !~ /^SP Read Cache State(\s+|:\s+)(.*)/im) {
|
||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => 'Cannot find cache informations.');
|
||||
$self->{output}->output_add(
|
||||
severity => 'UNKNOWN',
|
||||
short_msg => 'Cannot find cache informations.'
|
||||
);
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -145,32 +146,37 @@ sub run {
|
|||
$dirty_prct = $1;
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => $self->get_severity(value => $read_cache_state,
|
||||
label => 'read_cache'),
|
||||
short_msg => sprintf("Read cache state is '%s'",
|
||||
$read_cache_state));
|
||||
$self->{output}->output_add(severity => $self->get_severity(value => $write_cache_state,
|
||||
label => 'write_cache'),
|
||||
short_msg => sprintf("Write cache state is '%s'",
|
||||
$write_cache_state));
|
||||
$self->{output}->output_add(
|
||||
severity => $self->get_severity(value => $read_cache_state, label => 'read_cache'),
|
||||
short_msg => sprintf("Read cache state is '%s'", $read_cache_state)
|
||||
);
|
||||
$self->{output}->output_add(
|
||||
severity => $self->get_severity(value => $write_cache_state, label => 'write_cache'),
|
||||
short_msg => sprintf("Write cache state is '%s'", $write_cache_state));
|
||||
if (defined($write_cache_mirror)) {
|
||||
$self->{output}->output_add(severity => $self->get_severity(value => $write_cache_mirror,
|
||||
label => 'write_mirror'),
|
||||
short_msg => sprintf("Write cache mirror is '%s'",
|
||||
$write_cache_mirror));
|
||||
$self->{output}->output_add(
|
||||
severity => $self->get_severity(value => $write_cache_mirror, label => 'write_mirror'),
|
||||
short_msg => sprintf("Write cache mirror is '%s'", $write_cache_mirror)
|
||||
);
|
||||
}
|
||||
if (defined($dirty_prct)) {
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $dirty_prct,
|
||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => $dirty_prct,
|
||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]
|
||||
);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Dirty Cache Pages is %s %%", $dirty_prct));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("Dirty Cache Pages is %s %%", $dirty_prct)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(label => 'dirty_cache', unit => '%',
|
||||
value => $dirty_prct,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
min => 0, max => 100);
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'dirty_cache', unit => '%',
|
||||
value => $dirty_prct,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
min => 0, max => 100
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
|
|
|
@ -31,7 +31,7 @@ sub custom_busy_calc {
|
|||
my $diff_busy = ($options{new_datas}->{$self->{instance} . '_busy_ticks'} - $options{old_datas}->{$self->{instance} . '_busy_ticks'});
|
||||
my $total = $diff_busy
|
||||
+ ($options{new_datas}->{$self->{instance} . '_idle_ticks'} - $options{old_datas}->{$self->{instance} . '_idle_ticks'});
|
||||
|
||||
|
||||
if ($total == 0) {
|
||||
$self->{error_msg} = "skipped";
|
||||
return -2;
|
||||
|
@ -89,8 +89,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -98,7 +97,7 @@ sub new {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $response = $options{custom}->execute_command(cmd => 'getcontrol -cbt -busy -write -read -idle');
|
||||
my ($response) = $options{custom}->execute_command(cmd => 'getcontrol -cbt -busy -write -read -idle');
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{global}->{read} = $response =~ /^Total Reads:\s*(\d+)/msi ? $1 : undef;
|
||||
|
|
|
@ -44,7 +44,7 @@ my @states = (
|
|||
['^failed$' , 'CRITICAL'],
|
||||
['^off$' , 'CRITICAL'],
|
||||
['^unsupported$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL'],
|
||||
['^.*$' , 'CRITICAL']
|
||||
);
|
||||
|
||||
sub custom_threshold_check {
|
||||
|
@ -93,7 +93,7 @@ sub set_counters {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'disk', type => 1, cb_prefix_output => 'prefix_disk_output', message_multiple => 'All disks are OK', skipped_code => { -10 => 1 } },
|
||||
{ name => 'disk', type => 1, cb_prefix_output => 'prefix_disk_output', message_multiple => 'All disks are OK', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{disk} = [
|
||||
|
@ -102,7 +102,7 @@ sub set_counters {
|
|||
closure_custom_calc => $self->can('custom_state_calc'),
|
||||
closure_custom_output => $self->can('custom_state_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => $self->can('custom_threshold_check'),
|
||||
closure_custom_threshold_check => $self->can('custom_threshold_check')
|
||||
}
|
||||
},
|
||||
{ label => 'hard-read-errors', set => {
|
||||
|
@ -110,8 +110,8 @@ sub set_counters {
|
|||
output_template => 'Hard Read Errors : %d',
|
||||
perfdatas => [
|
||||
{ label => 'hard_read_errors', template => '%d',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'hard-write-errors', set => {
|
||||
|
@ -119,8 +119,8 @@ sub set_counters {
|
|||
output_template => 'Hard Write Errors : %d',
|
||||
perfdatas => [
|
||||
{ label => 'hard_write_errors', template => '%d',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'read-io', set => {
|
||||
|
@ -129,8 +129,8 @@ sub set_counters {
|
|||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'read_io', template => '%s',
|
||||
min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-io', set => {
|
||||
|
@ -139,8 +139,8 @@ sub set_counters {
|
|||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'write_io', template => '%s',
|
||||
min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'utils', set => {
|
||||
|
@ -149,10 +149,10 @@ sub set_counters {
|
|||
output_template => 'Utils : %.2f %%', output_use => 'utils',
|
||||
perfdatas => [
|
||||
{ label => 'utils', value => 'utils', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -168,8 +168,8 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-raidgroupid:s' => { name => 'filter_raidgroupid', },
|
||||
'filter-disk:s' => { name => 'filter_disk', },
|
||||
'filter-raidgroupid:s' => { name => 'filter_raidgroupid' },
|
||||
'filter-disk:s' => { name => 'filter_disk' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -182,7 +182,7 @@ sub manage_selection {
|
|||
$self->{cache_name} = "cache_clariion_" . $options{custom}->{hostname} . '_' . $options{custom}->{mode} . '_' .
|
||||
(defined($self->{option_results}->{filter_disk}) ? md5_hex($self->{option_results}->{filter_disk}) : md5_hex('all'));
|
||||
|
||||
my $response = $options{custom}->execute_command(cmd => 'getdisk -state -bytrd -bytwrt -hw -hr -busyticks -idleticks -rg');
|
||||
my ($response) = $options{custom}->execute_command(cmd => 'getdisk -state -bytrd -bytwrt -hw -hr -busyticks -idleticks -rg');
|
||||
|
||||
#Bus 1 Enclosure 7 Disk 13
|
||||
#State: Enabled
|
||||
|
@ -211,12 +211,12 @@ sub manage_selection {
|
|||
$self->{output}->output_add(long_msg => "skipping disk '" . $disk_instance . "': no matching filter raid group id", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
my $datas = {};
|
||||
while ($values =~ /^([^\n]*?):(.*?)\n/msgi) {
|
||||
$datas->{centreon::plugins::misc::trim(lc($1))} = centreon::plugins::misc::trim($2);
|
||||
}
|
||||
|
||||
|
||||
$self->{disk}->{$disk_instance} = {
|
||||
display => $disk_instance,
|
||||
state => $datas->{state},
|
||||
|
|
|
@ -30,9 +30,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -45,17 +43,21 @@ sub check_options {
|
|||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
my $clariion = $options{custom};
|
||||
|
||||
my $response = $clariion->execute_command(cmd => 'faults -list', secure_only => 1);
|
||||
|
||||
my ($response) = $clariion->execute_command(cmd => 'faults -list', secure_only => 1);
|
||||
chomp $response;
|
||||
|
||||
|
||||
if ($response =~ /The array is operating normally/msg) {
|
||||
$self->{output}->output_add(severity => 'ok',
|
||||
short_msg => 'The array is operating normally');
|
||||
$self->{output}->output_add(
|
||||
severity => 'ok',
|
||||
short_msg => 'The array is operating normally'
|
||||
);
|
||||
} else {
|
||||
$self->{output}->output_add(long_msg => $response);
|
||||
$self->{output}->output_add(severity => 'critical',
|
||||
short_msg => 'Problem detected (see detailed output for more details');
|
||||
$self->{output}->output_add(
|
||||
severity => 'critical',
|
||||
short_msg => 'Problem detected (see detailed output for more details'
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
|
|
|
@ -30,12 +30,12 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-server:s" => { name => 'filter_server' },
|
||||
"filter-uid:s" => { name => 'filter_uid' },
|
||||
"path-status:s@" => { name => 'path_status' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-server:s' => { name => 'filter_server' },
|
||||
'filter-uid:s' => { name => 'filter_uid' },
|
||||
'path-status:s@' => { name => 'path_status' }
|
||||
});
|
||||
|
||||
$self->{total_hba} = 0;
|
||||
$self->{total_hba_noskip} = 0;
|
||||
return $self;
|
||||
|
@ -121,18 +121,21 @@ sub check_hba {
|
|||
foreach (@{$self->{option_results}->{path_status}}) {
|
||||
my ($warning, $critical, $filter_uid, $filter_server) = split /,/;
|
||||
$i++;
|
||||
|
||||
|
||||
next if (defined($filter_uid) && $filter_uid ne '' && $hba_uid !~ /$filter_uid/);
|
||||
next if (defined($filter_server) && $filter_server ne '' && $server_name !~ /$filter_server/);
|
||||
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $logged,
|
||||
threshold => [ { label => 'critical-' . $i, 'exit_litteral' => 'critical' }, { label => 'warning-' . $i, exit_litteral => 'warning' } ]);
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(
|
||||
value => $logged,
|
||||
threshold => [ { label => 'critical-' . $i, 'exit_litteral' => 'critical' }, { label => 'warning-' . $i, exit_litteral => 'warning' } ]
|
||||
);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => "Path connection problem for hba '$hba_uid' server '$server_name'");
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => "Path connection problem for hba '$hba_uid' server '$server_name'"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
@ -142,15 +145,18 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $clariion = $options{custom};
|
||||
|
||||
$self->{response} = $clariion->execute_command(cmd => 'getall -hba');
|
||||
($self->{response}) = $clariion->execute_command(cmd => 'getall -hba');
|
||||
chomp $self->{response};
|
||||
|
||||
$self->check_hba();
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All hba states (%s/%s) are ok.",
|
||||
$self->{total_hba_noskip}, $self->{total_hba})
|
||||
);
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => sprintf(
|
||||
"All hba states (%s/%s) are ok.",
|
||||
$self->{total_hba_noskip}, $self->{total_hba}
|
||||
)
|
||||
);
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
|
@ -182,4 +188,4 @@ Example: ,@0:1,.*,.* - Means all server must have at least two paths connected.
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -30,14 +30,13 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-lunnumber:s" => { name => 'filter_lunnumber', },
|
||||
"filter-lunstate:s" => { name => 'filter_lunstate', },
|
||||
"filter-drivetype:s" => { name => 'filter_drivetype', },
|
||||
"filter-raidtype:s" => { name => 'filter_raidtype', },
|
||||
"filter-raidgroupid:s" => { name => 'filter_raidgroupid', },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-lunnumber:s" => { name => 'filter_lunnumber' },
|
||||
"filter-lunstate:s" => { name => 'filter_lunstate' },
|
||||
"filter-drivetype:s" => { name => 'filter_drivetype' },
|
||||
"filter-raidtype:s" => { name => 'filter_raidtype' },
|
||||
"filter-raidgroupid:s" => { name => 'filter_raidgroupid' }
|
||||
});
|
||||
|
||||
$self->{result} = {};
|
||||
return $self;
|
||||
|
@ -51,7 +50,7 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $response = $self->{clariion}->execute_command(cmd => 'getlun -uid -state -rg -type -drivetype -capacity');
|
||||
my ($response) = $self->{clariion}->execute_command(cmd => 'getlun -uid -state -rg -type -drivetype -capacity');
|
||||
|
||||
$| = 1;
|
||||
while ($response =~ /^(LOGICAL UNIT NUMBER.*?\n\n)/imsg) {
|
||||
|
@ -117,15 +116,19 @@ sub run {
|
|||
|
||||
$self->manage_selection();
|
||||
foreach my $num (sort(keys %{$self->{result}})) {
|
||||
$self->{output}->output_add(long_msg => "'" . $num . "' [state = " . $self->{result}->{$num}->{state} .
|
||||
'] [drive type = ' . $self->{result}->{$num}->{drive_type} .
|
||||
'] [raid type = ' . $self->{result}->{$num}->{raid_type} .
|
||||
'] [raid groupid = ' . $self->{result}->{$num}->{raid_groupid} .
|
||||
']');
|
||||
$self->{output}->output_add(
|
||||
long_msg => "'" . $num . "' [state = " . $self->{result}->{$num}->{state} .
|
||||
'] [drive type = ' . $self->{result}->{$num}->{drive_type} .
|
||||
'] [raid type = ' . $self->{result}->{$num}->{raid_type} .
|
||||
'] [raid groupid = ' . $self->{result}->{$num}->{raid_groupid} .
|
||||
']'
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List LUNs:');
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List LUNs:'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -142,12 +145,13 @@ sub disco_show {
|
|||
|
||||
$self->manage_selection();
|
||||
foreach my $num (sort(keys %{$self->{result}})) {
|
||||
$self->{output}->add_disco_entry(number => $num,
|
||||
state => $self->{result}->{$num}->{state},
|
||||
drive_type => $self->{result}->{$num}->{drive_type},
|
||||
raid_type => $self->{result}->{$num}->{raid_type},
|
||||
raid_groupid => $self->{result}->{$num}->{raid_groupid},
|
||||
);
|
||||
$self->{output}->add_disco_entry(
|
||||
number => $num,
|
||||
state => $self->{result}->{$num}->{state},
|
||||
drive_type => $self->{result}->{$num}->{drive_type},
|
||||
raid_type => $self->{result}->{$num}->{raid_type},
|
||||
raid_groupid => $self->{result}->{$num}->{raid_groupid}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"filter-id:s" => { name => 'filter_id' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'filter-id:s' => { name => 'filter_id' }
|
||||
});
|
||||
|
||||
$self->{total_port} = 0;
|
||||
$self->{total_port_noskip} = 0;
|
||||
return $self;
|
||||
|
@ -86,10 +86,13 @@ sub check_port {
|
|||
$error .= $error_append . "link status is '" . $link_status . "'";
|
||||
}
|
||||
if ($error ne '') {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("SP %s port %s: %s.",
|
||||
$port_name, $port_id, $error)
|
||||
);
|
||||
$self->{output}->output_add(
|
||||
severity => 'CRITICAL',
|
||||
short_msg => sprintf(
|
||||
"SP %s port %s: %s.",
|
||||
$port_name, $port_id, $error
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,10 +107,13 @@ sub run {
|
|||
|
||||
$self->check_port();
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All ports (%s/%s) are ok.",
|
||||
$self->{total_port_noskip}, $self->{total_port})
|
||||
);
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => sprintf(
|
||||
"All ports (%s/%s) are ok.",
|
||||
$self->{total_port_noskip}, $self->{total_port}
|
||||
)
|
||||
);
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
|
@ -133,4 +139,4 @@ Set SP port ID to check (not set, means 'all').
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -33,52 +33,52 @@ sub set_system {
|
|||
$self->{thresholds} = {
|
||||
battery => [
|
||||
['^(Not Ready|Testing|Unknown)$', 'WARNING'],
|
||||
['^(?!(Present|Valid)$)', 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
psu => [
|
||||
['^(?!(Present|Valid)$)', 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
sp => [
|
||||
['^(?!(Present|Valid)$)', 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
cable => [
|
||||
['^(.*Unknown.*)$' => 'WARNING'],
|
||||
['^(?!(Present|Valid)$)' => 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
cpu => [
|
||||
['^(?!(Present|Valid)$)' => 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
fan => [
|
||||
['^(?!(Present|Valid)$)' => 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
io => [
|
||||
['^(?!(Present|Valid|Empty)$)' => 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
lcc => [
|
||||
['^(?!(Present|Valid)$)' => 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
],
|
||||
dimm => [
|
||||
['^(?!(Present|Valid)$)' => 'CRITICAL'],
|
||||
['.*', 'OK'],
|
||||
],
|
||||
['^(Present|Valid|Empty)$', 'OK'],
|
||||
['.*', 'CRITICAL']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
$self->{components_path} = 'centreon::common::emc::navisphere::mode::spcomponents';
|
||||
$self->{components_module} = ['fan', 'lcc', 'psu', 'battery', 'memory', 'cpu', 'iomodule', 'cable'];
|
||||
}
|
||||
|
||||
sub navisphere_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{response} = $options{custom}->execute_command(cmd => 'getcrus ' . $self->{option_results}->{getcrus_options});
|
||||
|
||||
($self->{response}) = $options{custom}->execute_command(cmd => 'getcrus ' . $self->{option_results}->{getcrus_options});
|
||||
chomp $self->{response};
|
||||
}
|
||||
|
||||
|
@ -86,11 +86,11 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_performance => 1);
|
||||
bless $self, $class;
|
||||
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'getcrus-options:s' => { name => 'getcrus_options', default => '-all' }
|
||||
});
|
||||
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -46,7 +44,7 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $clariion = $options{custom};
|
||||
|
||||
my $response = $clariion->execute_command(cmd => 'getagent -ver -rev -prom -model -type -mem -serial -spid');
|
||||
my ($response) = $clariion->execute_command(cmd => 'getagent -ver -rev -prom -model -type -mem -serial -spid');
|
||||
|
||||
my $sp_id = 'unknown';
|
||||
my $sp_agent_rev = 'unknown';
|
||||
|
@ -68,11 +66,15 @@ sub run {
|
|||
|
||||
my ($memory_value, $memory_unit) = $self->{perfdata}->change_bytes(value => $sp_memory_total);
|
||||
|
||||
$self->{output}->output_add(severity => 'ok',
|
||||
short_msg => sprintf('[SP ID: %s] [Agent Revision: %s] [FLARE Revision: %s] [PROM Revision: %s] [Model: %s, %s] [Memory: %s %s] [Serial Number: %s]',
|
||||
$sp_id, $sp_agent_rev, $sp_flare_rev, $sp_prom_rev,
|
||||
$sp_model, $sp_model_type, $memory_value, $memory_unit, $sp_serial_number));
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'ok',
|
||||
short_msg => sprintf(
|
||||
'[SP ID: %s] [Agent Revision: %s] [FLARE Revision: %s] [PROM Revision: %s] [Model: %s, %s] [Memory: %s %s] [Serial Number: %s]',
|
||||
$sp_id, $sp_agent_rev, $sp_flare_rev, $sp_prom_rev,
|
||||
$sp_model, $sp_model_type, $memory_value, $memory_unit, $sp_serial_number
|
||||
)
|
||||
);
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue