From f493a01d43ce7d7a538d8455255bbb21142f6dc1 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Tue, 19 Dec 2017 13:59:18 +0100 Subject: [PATCH] purestorage restapi: finish --- storage/purestorage/restapi/custom/api.pm | 6 ++++++ storage/purestorage/restapi/mode/alarms.pm | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/storage/purestorage/restapi/custom/api.pm b/storage/purestorage/restapi/custom/api.pm index e7f3a59bf..06c51709a 100644 --- a/storage/purestorage/restapi/custom/api.pm +++ b/storage/purestorage/restapi/custom/api.pm @@ -107,6 +107,12 @@ sub check_options { return 0; } +sub get_connection_infos { + my ($self, %options) = @_; + + return $self->{hostname} . '_' . $self->{http}->get_port(); +} + sub build_options_for_httplib { my ($self, %options) = @_; diff --git a/storage/purestorage/restapi/mode/alarms.pm b/storage/purestorage/restapi/mode/alarms.pm index 5fb82a8d6..31d2ad3e1 100644 --- a/storage/purestorage/restapi/mode/alarms.pm +++ b/storage/purestorage/restapi/mode/alarms.pm @@ -67,7 +67,7 @@ sub custom_status_calc { $self->{result_values}->{category} = $options{new_datas}->{$self->{instance} . '_category'}; $self->{result_values}->{code} = $options{new_datas}->{$self->{instance} . '_code'}; - $self->{result_values}->{severity} = $options{new_datas}->{$self->{instance} . '_severity'}; + $self->{result_values}->{severity} = $options{new_datas}->{$self->{instance} . '_current_severity'}; $self->{result_values}->{component_name} = $options{new_datas}->{$self->{instance} . '_component_name'}; $self->{result_values}->{opened} = $options{new_datas}->{$self->{instance} . '_opened'}; $self->{result_values}->{event} = $options{new_datas}->{$self->{instance} . '_event'}; @@ -86,7 +86,7 @@ sub set_counters { $self->{maps_counters}->{alarm} = [ { label => 'status', threshold => 0, set => { - key_values => [ { name => 'category' }, { name => 'code' }, { name => 'severity' }, { name => 'opened' }, { name => 'event' }, { name => 'component_name' } ], + key_values => [ { name => 'category' }, { name => 'code' }, { name => 'current_severity' }, { name => 'opened' }, { name => 'event' }, { name => 'component_name' } ], closure_custom_calc => $self->can('custom_status_calc'), closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, @@ -146,7 +146,7 @@ sub manage_selection { my $last_time; if (defined($self->{option_results}->{memory})) { - $self->{statefile_cache}->read(statefile => 'cache_purestorage_' . $self->{mode} . '_' . $self->{option_results}->{region}); + $self->{statefile_cache}->read(statefile => 'cache_purestorage_' . $self->{mode} . '_' . $options{custom}->get_connection_infos()); $last_time = $self->{statefile_cache}->get(name => 'last_time'); }