From 1c6faf1266e384d92f516d09f771a4759797e6b7 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 15 May 2020 09:21:59 +0200 Subject: [PATCH] fix #2000 --- .../hyperv/2012/local/mode/nodesnapshot.pm | 22 +++++++++++++------ .../checkpoint/snmp/mode/connections.pm | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/centreon-plugins/apps/hyperv/2012/local/mode/nodesnapshot.pm b/centreon-plugins/apps/hyperv/2012/local/mode/nodesnapshot.pm index 0ddde6896..4192abb8c 100644 --- a/centreon-plugins/apps/hyperv/2012/local/mode/nodesnapshot.pm +++ b/centreon-plugins/apps/hyperv/2012/local/mode/nodesnapshot.pm @@ -31,21 +31,22 @@ sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ - { name => 'vm', type => 1, cb_prefix_output => 'prefix_vm_output', message_multiple => 'All VM snapshots are ok', skipped_code => { -10 => 1 } }, + { name => 'vm', type => 1, cb_prefix_output => 'prefix_vm_output', message_multiple => 'All VM snapshots are ok', skipped_code => { -10 => 1 } } ]; + $self->{maps_counters}->{vm} = [ { label => 'snapshot', set => { - key_values => [ { name => 'snapshot' }, { name => 'status' }, { name => 'display' }], + key_values => [ { name => 'snapshot' }, { name => 'status' }, { name => 'display' } ], closure_custom_output => $self->can('custom_snapshot_output'), - closure_custom_perfdata => sub { return 0; }, + closure_custom_perfdata => sub { return 0; } } }, { label => 'backing', set => { - key_values => [ { name => 'backing' }, { name => 'status' }, { name => 'display' }], + key_values => [ { name => 'backing' }, { name => 'status' }, { name => 'display' } ], closure_custom_output => $self->can('custom_backing_output'), - closure_custom_perfdata => sub { return 0; }, + closure_custom_perfdata => sub { return 0; } } - }, + } ]; } @@ -82,7 +83,7 @@ sub new { 'ps-display' => { name => 'ps_display' }, 'filter-vm:s' => { name => 'filter_vm' }, 'filter-note:s' => { name => 'filter_note' }, - 'filter-status:s' => { name => 'filter_status', default => 'running' }, + 'filter-status:s' => { name => 'filter_status', default => 'running' } }); return $self; @@ -161,6 +162,13 @@ sub manage_selection { }; $id++; } + + if (scalar(keys %{$self->{vm}}) <= 0) { + $self->{output}->output_add( + severity => 'OK', + short_msg => 'no snapshot found' + ); + } } 1; diff --git a/centreon-plugins/network/checkpoint/snmp/mode/connections.pm b/centreon-plugins/network/checkpoint/snmp/mode/connections.pm index 46bc69dba..09c74e6e6 100644 --- a/centreon-plugins/network/checkpoint/snmp/mode/connections.pm +++ b/centreon-plugins/network/checkpoint/snmp/mode/connections.pm @@ -92,7 +92,7 @@ sub run { short_msg => sprintf("Connections: %d%s", $result->{$oid_fwNumCom}, $extra) ); $self->{output}->perfdata_add( - label => "connections", unit => 'con', + label => 'connections', unit => 'con', value => $result->{$oid_fwNumCom}, warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),