(plugin) storage::emc::clariion - fix total defect (#4126)

This commit is contained in:
qgarnier 2023-01-04 10:52:32 +00:00 committed by GitHub
parent 6d548492a8
commit 0a3c2c1ab0
9 changed files with 185 additions and 160 deletions

View File

@ -30,7 +30,7 @@ my %states = (
['^enabled$' , 'OK'], ['^enabled$' , 'OK'],
['^disabling$' , 'CRITICAL'], ['^disabling$' , 'CRITICAL'],
['^disabled$' , 'CRITICAL'], ['^disabled$' , 'CRITICAL'],
['^.*$' , 'CRITICAL'], ['^.*$' , 'CRITICAL']
], ],
write_cache => [ write_cache => [
['^enabled$' , 'OK'], ['^enabled$' , 'OK'],
@ -39,11 +39,11 @@ my %states = (
['^initializing$' , 'WARNING'], ['^initializing$' , 'WARNING'],
['^dumping$' , 'CRITICAL'], ['^dumping$' , 'CRITICAL'],
['^frozen$' , 'CRITICAL'], ['^frozen$' , 'CRITICAL'],
['^.*$' , 'CRITICAL'], ['^.*$' , 'CRITICAL']
], ],
write_mirror => [ write_mirror => [
['^yes$' , 'OK'], ['^yes$' , 'OK'],
['^.*$' , 'CRITICAL'], ['^.*$' , 'CRITICAL']
], ],
); );
@ -52,13 +52,12 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'cache-command:s' => { name => 'cache_command', default => 'getcache' },
"cache-command:s" => { name => 'cache_command', default => 'getcache' }, 'cache-options:s' => { name => 'cache_options', default => '-pdp -state -mirror' },
"cache-options:s" => { name => 'cache_options', default => '-pdp -state -mirror' }, 'threshold-overload:s@' => { name => 'threshold_overload' },
"threshold-overload:s@" => { name => 'threshold_overload' }, 'warning:s' => { name => 'warning' },
"warning:s" => { name => 'warning', }, 'critical:s' => { name => 'critical' }
"critical:s" => { name => 'critical', },
}); });
return $self; return $self;
@ -121,13 +120,15 @@ sub run {
#SP Read Cache State Enabled #SP Read Cache State Enabled
#SP Write Cache State Enabled #SP Write Cache State Enabled
#Write Cache Mirrored: YES #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; chomp $response;
my ($read_cache_state, $write_cache_state); my ($read_cache_state, $write_cache_state);
if ($response !~ /^SP Read Cache State(\s+|:\s+)(.*)/im) { if ($response !~ /^SP Read Cache State(\s+|:\s+)(.*)/im) {
$self->{output}->output_add(severity => 'UNKNOWN', $self->{output}->output_add(
short_msg => 'Cannot find cache informations.'); severity => 'UNKNOWN',
short_msg => 'Cannot find cache informations.'
);
$self->{output}->display(); $self->{output}->display();
$self->{output}->exit(); $self->{output}->exit();
} }
@ -145,32 +146,37 @@ sub run {
$dirty_prct = $1; $dirty_prct = $1;
} }
$self->{output}->output_add(severity => $self->get_severity(value => $read_cache_state, $self->{output}->output_add(
label => 'read_cache'), severity => $self->get_severity(value => $read_cache_state, label => 'read_cache'),
short_msg => sprintf("Read cache state is '%s'", short_msg => sprintf("Read cache state is '%s'", $read_cache_state)
$read_cache_state)); );
$self->{output}->output_add(severity => $self->get_severity(value => $write_cache_state, $self->{output}->output_add(
label => 'write_cache'), severity => $self->get_severity(value => $write_cache_state, label => 'write_cache'),
short_msg => sprintf("Write cache state is '%s'", short_msg => sprintf("Write cache state is '%s'", $write_cache_state));
$write_cache_state));
if (defined($write_cache_mirror)) { if (defined($write_cache_mirror)) {
$self->{output}->output_add(severity => $self->get_severity(value => $write_cache_mirror, $self->{output}->output_add(
label => 'write_mirror'), severity => $self->get_severity(value => $write_cache_mirror, label => 'write_mirror'),
short_msg => sprintf("Write cache mirror is '%s'", short_msg => sprintf("Write cache mirror is '%s'", $write_cache_mirror)
$write_cache_mirror)); );
} }
if (defined($dirty_prct)) { if (defined($dirty_prct)) {
my $exit = $self->{perfdata}->threshold_check(value => $dirty_prct, my $exit = $self->{perfdata}->threshold_check(
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); 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)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Dirty Cache Pages is %s %%", $dirty_prct)); severity => $exit,
short_msg => sprintf("Dirty Cache Pages is %s %%", $dirty_prct)
);
} }
$self->{output}->perfdata_add(label => 'dirty_cache', unit => '%', $self->{output}->perfdata_add(
label => 'dirty_cache', unit => '%',
value => $dirty_prct, value => $dirty_prct,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0, max => 100); min => 0, max => 100
);
} }
$self->{output}->display(); $self->{output}->display();

View File

@ -89,8 +89,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {});
});
return $self; return $self;
} }
@ -98,7 +97,7 @@ sub new {
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; 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} = {};
$self->{global}->{read} = $response =~ /^Total Reads:\s*(\d+)/msi ? $1 : undef; $self->{global}->{read} = $response =~ /^Total Reads:\s*(\d+)/msi ? $1 : undef;

View File

@ -44,7 +44,7 @@ my @states = (
['^failed$' , 'CRITICAL'], ['^failed$' , 'CRITICAL'],
['^off$' , 'CRITICAL'], ['^off$' , 'CRITICAL'],
['^unsupported$' , 'CRITICAL'], ['^unsupported$' , 'CRITICAL'],
['^.*$' , 'CRITICAL'], ['^.*$' , 'CRITICAL']
); );
sub custom_threshold_check { sub custom_threshold_check {
@ -93,7 +93,7 @@ sub set_counters {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{maps_counters_type} = [ $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} = [ $self->{maps_counters}->{disk} = [
@ -102,7 +102,7 @@ sub set_counters {
closure_custom_calc => $self->can('custom_state_calc'), closure_custom_calc => $self->can('custom_state_calc'),
closure_custom_output => $self->can('custom_state_output'), closure_custom_output => $self->can('custom_state_output'),
closure_custom_perfdata => sub { return 0; }, 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 => { { label => 'hard-read-errors', set => {
@ -110,8 +110,8 @@ sub set_counters {
output_template => 'Hard Read Errors : %d', output_template => 'Hard Read Errors : %d',
perfdatas => [ perfdatas => [
{ label => 'hard_read_errors', template => '%d', { 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 => { { label => 'hard-write-errors', set => {
@ -119,8 +119,8 @@ sub set_counters {
output_template => 'Hard Write Errors : %d', output_template => 'Hard Write Errors : %d',
perfdatas => [ perfdatas => [
{ label => 'hard_write_errors', template => '%d', { 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 => { { label => 'read-io', set => {
@ -129,8 +129,8 @@ sub set_counters {
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'read_io', template => '%s', { 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 => { { label => 'write-io', set => {
@ -139,8 +139,8 @@ sub set_counters {
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'write_io', template => '%s', { 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 => { { label => 'utils', set => {
@ -149,10 +149,10 @@ sub set_counters {
output_template => 'Utils : %.2f %%', output_use => 'utils', output_template => 'Utils : %.2f %%', output_use => 'utils',
perfdatas => [ perfdatas => [
{ label => 'utils', value => 'utils', template => '%.2f', { 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; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'filter-raidgroupid:s' => { name => 'filter_raidgroupid', }, 'filter-raidgroupid:s' => { name => 'filter_raidgroupid' },
'filter-disk:s' => { name => 'filter_disk', }, 'filter-disk:s' => { name => 'filter_disk' }
}); });
return $self; return $self;
@ -182,7 +182,7 @@ sub manage_selection {
$self->{cache_name} = "cache_clariion_" . $options{custom}->{hostname} . '_' . $options{custom}->{mode} . '_' . $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')); (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 #Bus 1 Enclosure 7 Disk 13
#State: Enabled #State: Enabled

View File

@ -30,9 +30,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {});
{
});
return $self; return $self;
} }
@ -46,16 +44,20 @@ sub run {
my ($self, %options) = @_; my ($self, %options) = @_;
my $clariion = $options{custom}; 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; chomp $response;
if ($response =~ /The array is operating normally/msg) { if ($response =~ /The array is operating normally/msg) {
$self->{output}->output_add(severity => 'ok', $self->{output}->output_add(
short_msg => 'The array is operating normally'); severity => 'ok',
short_msg => 'The array is operating normally'
);
} else { } else {
$self->{output}->output_add(long_msg => $response); $self->{output}->output_add(long_msg => $response);
$self->{output}->output_add(severity => 'critical', $self->{output}->output_add(
short_msg => 'Problem detected (see detailed output for more details'); severity => 'critical',
short_msg => 'Problem detected (see detailed output for more details'
);
} }
$self->{output}->display(); $self->{output}->display();

View File

@ -30,12 +30,12 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'filter-server:s' => { name => 'filter_server' },
"filter-server:s" => { name => 'filter_server' }, 'filter-uid:s' => { name => 'filter_uid' },
"filter-uid:s" => { name => 'filter_uid' }, 'path-status:s@' => { name => 'path_status' }
"path-status:s@" => { name => 'path_status' },
}); });
$self->{total_hba} = 0; $self->{total_hba} = 0;
$self->{total_hba_noskip} = 0; $self->{total_hba_noskip} = 0;
return $self; return $self;
@ -125,12 +125,15 @@ sub check_hba {
next if (defined($filter_uid) && $filter_uid ne '' && $hba_uid !~ /$filter_uid/); next if (defined($filter_uid) && $filter_uid ne '' && $hba_uid !~ /$filter_uid/);
next if (defined($filter_server) && $filter_server ne '' && $server_name !~ /$filter_server/); next if (defined($filter_server) && $filter_server ne '' && $server_name !~ /$filter_server/);
my $exit = $self->{perfdata}->threshold_check(
my $exit = $self->{perfdata}->threshold_check(value => $logged, value => $logged,
threshold => [ { label => 'critical-' . $i, 'exit_litteral' => 'critical' }, { label => 'warning-' . $i, exit_litteral => 'warning' } ]); threshold => [ { label => 'critical-' . $i, 'exit_litteral' => 'critical' }, { label => 'warning-' . $i, exit_litteral => 'warning' } ]
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => "Path connection problem for hba '$hba_uid' server '$server_name'"); severity => $exit,
short_msg => "Path connection problem for hba '$hba_uid' server '$server_name'"
);
} }
last; last;
@ -142,14 +145,17 @@ sub run {
my ($self, %options) = @_; my ($self, %options) = @_;
my $clariion = $options{custom}; my $clariion = $options{custom};
$self->{response} = $clariion->execute_command(cmd => 'getall -hba'); ($self->{response}) = $clariion->execute_command(cmd => 'getall -hba');
chomp $self->{response}; chomp $self->{response};
$self->check_hba(); $self->check_hba();
$self->{output}->output_add(severity => 'OK', $self->{output}->output_add(
short_msg => sprintf("All hba states (%s/%s) are ok.", severity => 'OK',
$self->{total_hba_noskip}, $self->{total_hba}) short_msg => sprintf(
"All hba states (%s/%s) are ok.",
$self->{total_hba_noskip}, $self->{total_hba}
)
); );
$self->{output}->display(); $self->{output}->display();

View File

@ -30,13 +30,12 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ "filter-lunnumber:s" => { name => 'filter_lunnumber' },
"filter-lunnumber:s" => { name => 'filter_lunnumber', }, "filter-lunstate:s" => { name => 'filter_lunstate' },
"filter-lunstate:s" => { name => 'filter_lunstate', }, "filter-drivetype:s" => { name => 'filter_drivetype' },
"filter-drivetype:s" => { name => 'filter_drivetype', }, "filter-raidtype:s" => { name => 'filter_raidtype' },
"filter-raidtype:s" => { name => 'filter_raidtype', }, "filter-raidgroupid:s" => { name => 'filter_raidgroupid' }
"filter-raidgroupid:s" => { name => 'filter_raidgroupid', },
}); });
$self->{result} = {}; $self->{result} = {};
@ -51,7 +50,7 @@ sub check_options {
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; 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; $| = 1;
while ($response =~ /^(LOGICAL UNIT NUMBER.*?\n\n)/imsg) { while ($response =~ /^(LOGICAL UNIT NUMBER.*?\n\n)/imsg) {
@ -117,15 +116,19 @@ sub run {
$self->manage_selection(); $self->manage_selection();
foreach my $num (sort(keys %{$self->{result}})) { foreach my $num (sort(keys %{$self->{result}})) {
$self->{output}->output_add(long_msg => "'" . $num . "' [state = " . $self->{result}->{$num}->{state} . $self->{output}->output_add(
long_msg => "'" . $num . "' [state = " . $self->{result}->{$num}->{state} .
'] [drive type = ' . $self->{result}->{$num}->{drive_type} . '] [drive type = ' . $self->{result}->{$num}->{drive_type} .
'] [raid type = ' . $self->{result}->{$num}->{raid_type} . '] [raid type = ' . $self->{result}->{$num}->{raid_type} .
'] [raid groupid = ' . $self->{result}->{$num}->{raid_groupid} . '] [raid groupid = ' . $self->{result}->{$num}->{raid_groupid} .
']'); ']'
);
} }
$self->{output}->output_add(severity => 'OK', $self->{output}->output_add(
short_msg => 'List LUNs:'); severity => 'OK',
short_msg => 'List LUNs:'
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit(); $self->{output}->exit();
} }
@ -142,11 +145,12 @@ sub disco_show {
$self->manage_selection(); $self->manage_selection();
foreach my $num (sort(keys %{$self->{result}})) { foreach my $num (sort(keys %{$self->{result}})) {
$self->{output}->add_disco_entry(number => $num, $self->{output}->add_disco_entry(
number => $num,
state => $self->{result}->{$num}->{state}, state => $self->{result}->{$num}->{state},
drive_type => $self->{result}->{$num}->{drive_type}, drive_type => $self->{result}->{$num}->{drive_type},
raid_type => $self->{result}->{$num}->{raid_type}, raid_type => $self->{result}->{$num}->{raid_type},
raid_groupid => $self->{result}->{$num}->{raid_groupid}, raid_groupid => $self->{result}->{$num}->{raid_groupid}
); );
} }
} }

View File

@ -30,11 +30,11 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'filter-name:s' => { name => 'filter_name' },
"filter-name:s" => { name => 'filter_name' }, 'filter-id:s' => { name => 'filter_id' }
"filter-id:s" => { name => 'filter_id' },
}); });
$self->{total_port} = 0; $self->{total_port} = 0;
$self->{total_port_noskip} = 0; $self->{total_port_noskip} = 0;
return $self; return $self;
@ -86,9 +86,12 @@ sub check_port {
$error .= $error_append . "link status is '" . $link_status . "'"; $error .= $error_append . "link status is '" . $link_status . "'";
} }
if ($error ne '') { if ($error ne '') {
$self->{output}->output_add(severity => 'CRITICAL', $self->{output}->output_add(
short_msg => sprintf("SP %s port %s: %s.", severity => 'CRITICAL',
$port_name, $port_id, $error) short_msg => sprintf(
"SP %s port %s: %s.",
$port_name, $port_id, $error
)
); );
} }
} }
@ -104,9 +107,12 @@ sub run {
$self->check_port(); $self->check_port();
$self->{output}->output_add(severity => 'OK', $self->{output}->output_add(
short_msg => sprintf("All ports (%s/%s) are ok.", severity => 'OK',
$self->{total_port_noskip}, $self->{total_port}) short_msg => sprintf(
"All ports (%s/%s) are ok.",
$self->{total_port_noskip}, $self->{total_port}
)
); );
$self->{output}->display(); $self->{output}->display();

View File

@ -33,42 +33,42 @@ sub set_system {
$self->{thresholds} = { $self->{thresholds} = {
battery => [ battery => [
['^(Not Ready|Testing|Unknown)$', 'WARNING'], ['^(Not Ready|Testing|Unknown)$', 'WARNING'],
['^(?!(Present|Valid)$)', 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
psu => [ psu => [
['^(?!(Present|Valid)$)', 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
sp => [ sp => [
['^(?!(Present|Valid)$)', 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
cable => [ cable => [
['^(.*Unknown.*)$' => 'WARNING'], ['^(.*Unknown.*)$' => 'WARNING'],
['^(?!(Present|Valid)$)' => 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
cpu => [ cpu => [
['^(?!(Present|Valid)$)' => 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
fan => [ fan => [
['^(?!(Present|Valid)$)' => 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
io => [ io => [
['^(?!(Present|Valid|Empty)$)' => 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
lcc => [ lcc => [
['^(?!(Present|Valid)$)' => 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ],
dimm => [ dimm => [
['^(?!(Present|Valid)$)' => 'CRITICAL'], ['^(Present|Valid|Empty)$', 'OK'],
['.*', 'OK'], ['.*', 'CRITICAL']
], ]
}; };
$self->{components_path} = 'centreon::common::emc::navisphere::mode::spcomponents'; $self->{components_path} = 'centreon::common::emc::navisphere::mode::spcomponents';
@ -78,7 +78,7 @@ sub set_system {
sub navisphere_execute { sub navisphere_execute {
my ($self, %options) = @_; 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}; chomp $self->{response};
} }

View File

@ -30,9 +30,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {});
{
});
return $self; return $self;
} }
@ -46,7 +44,7 @@ sub run {
my ($self, %options) = @_; my ($self, %options) = @_;
my $clariion = $options{custom}; 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_id = 'unknown';
my $sp_agent_rev = 'unknown'; my $sp_agent_rev = 'unknown';
@ -68,10 +66,14 @@ sub run {
my ($memory_value, $memory_unit) = $self->{perfdata}->change_bytes(value => $sp_memory_total); my ($memory_value, $memory_unit) = $self->{perfdata}->change_bytes(value => $sp_memory_total);
$self->{output}->output_add(severity => 'ok', $self->{output}->output_add(
short_msg => sprintf('[SP ID: %s] [Agent Revision: %s] [FLARE Revision: %s] [PROM Revision: %s] [Model: %s, %s] [Memory: %s %s] [Serial Number: %s]', 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_id, $sp_agent_rev, $sp_flare_rev, $sp_prom_rev,
$sp_model, $sp_model_type, $memory_value, $memory_unit, $sp_serial_number)); $sp_model, $sp_model_type, $memory_value, $memory_unit, $sp_serial_number
)
);
$self->{output}->display(); $self->{output}->display();
$self->{output}->exit(); $self->{output}->exit();