mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
Better error management
git-svn-id: http://svn.merethis.net/centreon-esxd/trunk@77 a5eaa968-4c79-4d68-970d-af6011b5b055
This commit is contained in:
parent
a349a883d8
commit
0dff025c48
@ -107,7 +107,6 @@ sub run {
|
|||||||
my $capacity = $ds->summary->capacity;
|
my $capacity = $ds->summary->capacity;
|
||||||
my $free = $ds->summary->freeSpace;
|
my $free = $ds->summary->freeSpace;
|
||||||
|
|
||||||
|
|
||||||
if ($self->{units} eq 'MB' && $self->{free} == 1) {
|
if ($self->{units} eq 'MB' && $self->{free} == 1) {
|
||||||
$warn_threshold = $capacity - ($self->{warn} * 1024 * 1024);
|
$warn_threshold = $capacity - ($self->{warn} * 1024 * 1024);
|
||||||
$crit_threshold = $capacity - ($self->{crit} * 1024 * 1024);
|
$crit_threshold = $capacity - ($self->{crit} * 1024 * 1024);
|
||||||
|
@ -200,14 +200,14 @@ sub generic_performance_values_historic {
|
|||||||
#maxSample => 1);
|
#maxSample => 1);
|
||||||
}
|
}
|
||||||
my $perfdata = $obj_esxd->{perfmanager_view}->QueryPerf(querySpec => $perf_query_spec);
|
my $perfdata = $obj_esxd->{perfmanager_view}->QueryPerf(querySpec => $perf_query_spec);
|
||||||
if (!$$perfdata[0]) {
|
if (!$$perfdata[0] || !defined($$perfdata[0]->value)) {
|
||||||
$obj_esxd->print_response("-3|Error: Cannot get value for couters. Maybe there is time sync problem (check the esxd server and the target also).\n");
|
$obj_esxd->print_response("-3|Error: Cannot get value for counters. Maybe you have call a wrong instance.\n");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
foreach (@{$$perfdata[0]->value}) {
|
foreach (@{$$perfdata[0]->value}) {
|
||||||
$results{$_->id->counterId . ":" . (defined($_->id->instance) ? $_->id->instance : "")} = $_->value;
|
$results{$_->id->counterId . ":" . (defined($_->id->instance) ? $_->id->instance : "")} = $_->value;
|
||||||
if (!defined($_->value)) {
|
if (!defined($_->value)) {
|
||||||
$obj_esxd->print_response("-3|Error: Cannot get value for couters. Maybe there is time sync problem (check the esxd server and the target also).\n");
|
$obj_esxd->print_response("-3|Error: Cannot get value for counters. Maybe there is time sync problem (check the esxd server and the target also).\n");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ sub get_entities_host {
|
|||||||
sub performance_errors {
|
sub performance_errors {
|
||||||
my ($obj_esxd, $values) = @_;
|
my ($obj_esxd, $values) = @_;
|
||||||
|
|
||||||
# Error counter not available or orther from function
|
# Error counter not available or other from function
|
||||||
return 1 if (!defined($values) || scalar(keys(%$values)) <= 0);
|
return 1 if (!defined($values) || scalar(keys(%$values)) <= 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user