From 1f85378b5c70a3b8e9b007f7e5dbeca153ff3b2c Mon Sep 17 00:00:00 2001 From: qgarnier Date: Thu, 2 Nov 2023 17:56:15 +0100 Subject: [PATCH] (plugin) storage::ibm::storwize::ssh - metric v2 (#4649) --- .../storwize/ssh/mode/components/systemstats.pm | 1 - src/storage/ibm/storwize/ssh/mode/eventlog.pm | 5 +++-- src/storage/ibm/storwize/ssh/mode/hardware.pm | 2 +- src/storage/ibm/storwize/ssh/mode/poolusage.pm | 14 ++++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/storage/ibm/storwize/ssh/mode/components/systemstats.pm b/src/storage/ibm/storwize/ssh/mode/components/systemstats.pm index d6dc46103..a6c234996 100644 --- a/src/storage/ibm/storwize/ssh/mode/components/systemstats.pm +++ b/src/storage/ibm/storwize/ssh/mode/components/systemstats.pm @@ -66,7 +66,6 @@ sub check { ); } $self->{output}->perfdata_add( - label => "sstat", nlabel => 'hardware.systemstats.current.count', instances => $_->{stat_name}, value => $_->{stat_current}, diff --git a/src/storage/ibm/storwize/ssh/mode/eventlog.pm b/src/storage/ibm/storwize/ssh/mode/eventlog.pm index 58c4faf70..5463dcc5e 100644 --- a/src/storage/ibm/storwize/ssh/mode/eventlog.pm +++ b/src/storage/ibm/storwize/ssh/mode/eventlog.pm @@ -28,7 +28,7 @@ use DateTime; sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); bless $self, $class; $options{options}->add_options(arguments => { @@ -101,8 +101,9 @@ sub run { severity => $exit, short_msg => sprintf("%d problem detected (use verbose for more details)", $num_errors) ); + $self->{output}->perfdata_add( - label => 'problems', + nlabel => 'eventlogs.problems.count', value => $num_errors, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), diff --git a/src/storage/ibm/storwize/ssh/mode/hardware.pm b/src/storage/ibm/storwize/ssh/mode/hardware.pm index 6ced5388c..36ccf68f9 100644 --- a/src/storage/ibm/storwize/ssh/mode/hardware.pm +++ b/src/storage/ibm/storwize/ssh/mode/hardware.pm @@ -78,7 +78,7 @@ sub ssh_execute { sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1); bless $self, $class; $options{options}->add_options(arguments => {}); diff --git a/src/storage/ibm/storwize/ssh/mode/poolusage.pm b/src/storage/ibm/storwize/ssh/mode/poolusage.pm index 42f8a247a..e3e61ee92 100644 --- a/src/storage/ibm/storwize/ssh/mode/poolusage.pm +++ b/src/storage/ibm/storwize/ssh/mode/poolusage.pm @@ -35,10 +35,10 @@ sub custom_status_output { sub custom_usage_perfdata { my ($self, %options) = @_; - my $label = 'used'; + my $label = 'pool.space.usage.bytes'; my $value_perf = $self->{result_values}->{used}; if (defined($self->{instance_mode}->{option_results}->{free})) { - $label = 'free'; + $label = 'pool.space.free.bytes'; $value_perf = $self->{result_values}->{free}; } @@ -49,12 +49,14 @@ sub custom_usage_perfdata { } $self->{output}->perfdata_add( - label => $label, unit => 'B', - instances => $self->use_instances(extra_instance => $options{extra_instance}) ? $self->{result_values}->{display} : undef, + nlabel => $label, + unit => 'B', + instances => $self->{result_values}->{display}, value => $value_perf, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}, %total_options), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}, %total_options), - min => 0, max => $self->{result_values}->{total} + min => 0, + max => $self->{result_values}->{total} ); } @@ -141,7 +143,7 @@ sub set_counters { sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); bless $self, $class; $options{options}->add_options(arguments => {