Skip to content

Commit

Permalink
removing a comment and modifying a results
Browse files Browse the repository at this point in the history
  • Loading branch information
sfarouq-ext committed Feb 5, 2025
1 parent f642bea commit 6a6447f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/storage/purestorage/flasharray/v2/restapi/mode/alerts.pm
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ sub manage_selection {

my $last_time;
if (defined($self->{option_results}->{memory})) {
#use Data::Dumper;
#print Dumper($options{custom});
$self->{statefile_cache}->read(statefile => 'purestorage_' . $self->{mode} . '_' . $options{custom}->get_connection_info());
$last_time = $self->{statefile_cache}->get(name => 'last_time');
}
Expand Down
16 changes: 8 additions & 8 deletions tests/storage/purestorage/flasharray/v2/restapi/alerts.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Test Timeout 120s

** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}mokoon.json

#${HOSTNAME} host.docker.internal
#${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::purestorage::flasharray::v2::restapi::plugin
... --hostname=${HOSTNAME}
Expand All @@ -25,11 +26,10 @@ alerts ${tc}
... ${CMD}
... --mode=alerts
... ${extra_options}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Ctn Verify Command Output ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --filter-category='array' CRITICAL: 2 problem(s) detected | 'alerts.detected.count'=2;;;0;
... 2 --warning-status='\\\%{state} = "warning"' CRITICAL: 2 problem(s) detected | 'alerts.detected.count'=2;;;0;
... 3 --critical-status='\\\%{component_name} eq "ch0"' CRITICAL: 1 problem(s) detected | 'alerts.detected.count'=1;;;0;
... 4 --memory=1 CRITICAL: 2 problem(s) detected | 'alerts.detected.count'=2;;;0;
... 5 --warning-status='\\\%{state} ne "closing" and \\\%{severity} =~ /warning/i and \\\%{flagged} and \\\%{code} eq "45"' --filter-category='array' CRITICAL: 2 problem(s) detected | 'alerts.detected.count'=2;;;0;
Examples: tc extra_options expected_result --
... 1 --filter-category='array' CRITICAL: 1 problem(s) detected | 'alerts.detected.count'=1;;;0;
... 2 --warning-status='\\\%{component_name} eq "ct1.eth0"' --filter-category="toto" --insecure --verbose WARNING: 1 problem(s) detected | 'alerts.detected.count'=1;;;0; warning: alert [component: ct1.eth0] [severity: warning] [category: toto] [issue: failure]
... 3 --critical-status='\\\%{component_name} eq "ch0" and \\\%{severity} =~ /critical/i' --filter-category="array" --insecure --verbose CRITICAL: 1 problem(s) detected | 'alerts.detected.count'=1;;;0; critical: alert [component: ch0] [severity: critical] [category: array] [issue: shelf drive failures(s)]
... 4 --memory="" CRITICAL: 1 problem(s) detected | 'alerts.detected.count'=1;;;0;
4 changes: 2 additions & 2 deletions tests/storage/purestorage/flasharray/v2/restapi/mokoon.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"responses": [
{
"uuid": "ad6920b9-8a22-4ffc-b066-936819921ba0",
"body": "{\r\n \"continuation_token\": null,\r\n \"items\": [\r\n {\r\n \"created\": 1737462338078,\r\n \"state\": \"open\",\r\n \"description\": \"(drive:ch0.nvb1): failure Expected: healthy, Actual: failed\",\r\n \"component_type\": \"drive\",\r\n \"name\": \"81204734\",\r\n \"id\": \"5576557655765576557655765576\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"critical\",\r\n \"flagged\": false,\r\n \"updated\": 1738059644723,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0.nvb1\",\r\n \"expected\": \"healthy\",\r\n \"actual\": \"failed\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(drive:ch0.nvb1): failure\",\r\n \"issue\": \"failure\"\r\n },\r\n {\r\n \"created\": 1737464651017,\r\n \"state\": \"open\",\r\n \"description\": \"(shelf:ch0): shelf drive failures(s) Expected: 0, Actual: 1\",\r\n \"component_type\": \"shelf\",\r\n \"name\": \"81204806\",\r\n \"id\": \"f823f823f823f823f823f823f823\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"critical\",\r\n \"flagged\": true,\r\n \"updated\": 1738059644699,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0\",\r\n \"expected\": \"0\",\r\n \"actual\": \"1\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(shelf:ch0): shelf drive failures(s)\",\r\n \"issue\": \"shelf drive failures(s)\"\r\n }\r\n ],\r\n \"more_items_remaining\": false,\r\n \"total_item_count\": null\r\n}",
"body": "{\r\n \"continuation_token\": null,\r\n \"items\": [\r\n {\r\n \"created\": 1737462338078,\r\n \"state\": \"closed\",\r\n \"description\": \"(drive:ch0.nvb1): failure Expected: healthy, Actual: failed\",\r\n \"component_type\": \"drive\",\r\n \"name\": \"81204734\",\r\n \"id\": \"5576557655765576557655765576\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"warning\",\r\n \"flagged\": false,\r\n \"updated\": null,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0.nvb1\",\r\n \"expected\": \"healthy\",\r\n \"actual\": \"failed\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(drive:ch0.nvb1): failure\",\r\n \"issue\": \"failure\"\r\n },\r\n {\r\n \"created\": 1737464651017,\r\n \"state\": \"open\",\r\n \"description\": \"(shelf:ch0): shelf drive failures(s) Expected: 0, Actual: 1\",\r\n \"component_type\": \"shelf\",\r\n \"name\": \"81204806\",\r\n \"id\": \"f823f823f823f823f823f823f823\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"critical\",\r\n \"flagged\": true,\r\n \"updated\": null,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0\",\r\n \"expected\": \"0\",\r\n \"actual\": \"1\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(shelf:ch0): shelf drive failures(s)\",\r\n \"issue\": \"shelf drive failures(s)\"\r\n },\r\n {\r\n \"created\": 1536744300846,\r\n \"description\": \"(hardware:ct1.eth0): failure Expected: , Actual: \",\r\n \"state\": \"closed\",\r\n \"component_type\": \"hardware\",\r\n \"name\": \"10088780\",\r\n \"id\": \"18525aa28bee4eb3a68eb901c1483fea\",\r\n \"category\": \"array\",\r\n \"severity\": \"warning\",\r\n \"code\": 42,\r\n \"flagged\": false,\r\n \"updated\": null,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ct1.eth0\",\r\n \"expected\": \"\",\r\n \"actual\": \"\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0042\",\r\n \"issue\": \"failure\",\r\n \"summary\": \"(hardware:ct1.eth0): failure\"\r\n }\r\n ],\r\n \"more_items_remaining\": false,\r\n \"total_item_count\": null\r\n}",
"latency": 0,
"statusCode": 200,
"label": "",
Expand Down Expand Up @@ -51,7 +51,7 @@
"responses": [
{
"uuid": "31a6a6d7-7c12-4269-9783-14c6e42be22e",
"body": "{\r\n \"continuation_token\": null,\r\n \"items\": [\r\n {\r\n \"created\": 1737462338078,\r\n \"state\": \"open\",\r\n \"description\": \"(drive:ch0.nvb1): failure Expected: healthy, Actual: failed\",\r\n \"component_type\": \"drive\",\r\n \"name\": \"81204734\",\r\n \"id\": \"5576557655765576557655765576\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"critical\",\r\n \"flagged\": false,\r\n \"updated\": 1738059644723,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0.nvb1\",\r\n \"expected\": \"healthy\",\r\n \"actual\": \"failed\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(drive:ch0.nvb1): failure\",\r\n \"issue\": \"failure\"\r\n },\r\n {\r\n \"created\": 1737464651017,\r\n \"state\": \"open\",\r\n \"description\": \"(shelf:ch0): shelf drive failures(s) Expected: 0, Actual: 1\",\r\n \"component_type\": \"shelf\",\r\n \"name\": \"81204806\",\r\n \"id\": \"f823f823f823f823f823f823f823\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"critical\",\r\n \"flagged\": true,\r\n \"updated\": 1738059644699,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0\",\r\n \"expected\": \"0\",\r\n \"actual\": \"1\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(shelf:ch0): shelf drive failures(s)\",\r\n \"issue\": \"shelf drive failures(s)\"\r\n }\r\n ],\r\n \"more_items_remaining\": false,\r\n \"total_item_count\": null\r\n}",
"body": "{\r\n \"continuation_token\": null,\r\n \"items\": [\r\n {\r\n \"created\": 1737462338078,\r\n \"state\": \"closed\",\r\n \"description\": \"(drive:ch0.nvb1): failure Expected: healthy, Actual: failed\",\r\n \"component_type\": \"drive\",\r\n \"name\": \"81204734\",\r\n \"id\": \"5576557655765576557655765576\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"warning\",\r\n \"flagged\": false,\r\n \"updated\": null,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0.nvb1\",\r\n \"expected\": \"healthy\",\r\n \"actual\": \"failed\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(drive:ch0.nvb1): failure\",\r\n \"issue\": \"failure\"\r\n },\r\n {\r\n \"created\": 1737464651017,\r\n \"state\": \"open\",\r\n \"description\": \"(shelf:ch0): shelf drive failures(s) Expected: 0, Actual: 1\",\r\n \"component_type\": \"shelf\",\r\n \"name\": \"81204806\",\r\n \"id\": \"f823f823f823f823f823f823f823\",\r\n \"code\": 60,\r\n \"category\": \"array\",\r\n \"severity\": \"critical\",\r\n \"flagged\": true,\r\n \"updated\": null,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ch0\",\r\n \"expected\": \"0\",\r\n \"actual\": \"1\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0060\",\r\n \"summary\": \"(shelf:ch0): shelf drive failures(s)\",\r\n \"issue\": \"shelf drive failures(s)\"\r\n },\r\n {\r\n \"created\": 1536744300846,\r\n \"description\": \"(hardware:ct1.eth0): failure Expected: , Actual: \",\r\n \"state\": \"closed\",\r\n \"component_type\": \"hardware\",\r\n \"name\": \"10088780\",\r\n \"id\": \"18525aa28bee4eb3a68eb901c1483fea\",\r\n \"category\": \"toto\",\r\n \"severity\": \"warning\",\r\n \"code\": 42,\r\n \"flagged\": false,\r\n \"updated\": null,\r\n \"closed\": null,\r\n \"notified\": null,\r\n \"component_name\": \"ct1.eth0\",\r\n \"expected\": \"\",\r\n \"actual\": \"\",\r\n \"knowledge_base_url\": \"https://support.purestorage.com/?cid=Alert_0042\",\r\n \"issue\": \"failure\",\r\n \"summary\": \"(hardware:ct1.eth0): failure\"\r\n }\r\n ],\r\n \"more_items_remaining\": false,\r\n \"total_item_count\": null\r\n}",
"latency": 0,
"statusCode": 200,
"label": "",
Expand Down

0 comments on commit 6a6447f

Please sign in to comment.