From ce242c5f4513ec24f00d6c224dbbf7263ee44c2f Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 3 Aug 2016 15:22:58 +0200 Subject: [PATCH] + add state for memory esx --- .../apps/vmware/connector/mode/memoryhost.pm | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/centreon-plugins/apps/vmware/connector/mode/memoryhost.pm b/centreon-plugins/apps/vmware/connector/mode/memoryhost.pm index 9c6919010..09964fecd 100644 --- a/centreon-plugins/apps/vmware/connector/mode/memoryhost.pm +++ b/centreon-plugins/apps/vmware/connector/mode/memoryhost.pm @@ -38,8 +38,10 @@ sub new { "scope-datacenter:s" => { name => 'scope_datacenter' }, "scope-cluster:s" => { name => 'scope_cluster' }, "disconnect-status:s" => { name => 'disconnect_status', default => 'unknown' }, - "warning:s" => { name => 'warning', }, - "critical:s" => { name => 'critical', }, + "warning:s" => { name => 'warning' }, + "critical:s" => { name => 'critical' }, + "warning-state:s" => { name => 'warning_state' }, + "critical-state:s" => { name => 'critical_state' }, }); return $self; } @@ -48,13 +50,13 @@ sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); - if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); + foreach my $label (('warning', 'critical', 'warning_state', 'critical_state')) { + if (($self->{perfdata}->threshold_validate(label => $label, value => $self->{option_results}->{$label})) == 0) { + my ($label_opt) = $label; + $label_opt =~ tr/_/-/; + $self->{output}->add_option_msg(short_msg => "Wrong " . $label_opt . " threshold '" . $self->{option_results}->{$label} . "'."); + $self->{output}->option_exit(); + } } if ($self->{output}->is_litteral_status(status => $self->{option_results}->{disconnect_status}) == 0) { $self->{output}->add_option_msg(short_msg => "Wrong disconnect-status status option '" . $self->{option_results}->{disconnect_status} . "'."); @@ -110,6 +112,14 @@ Threshold warning in percent. Threshold critical in percent. +=item B<--warning-state> + +Threshold warning. For state != 'high': --warning-state=0 + +=item B<--critical-state> + +Threshold critical. For state != 'high': --warning-state=0 + =back =cut