mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-26 23:24:27 +02:00
Evolution #3992
[host] Avoir uniquement l'average totale dans les perfdata git-svn-id: http://svn.merethis.net/centreon-esxd/trunk@43 a5eaa968-4c79-4d68-970d-af6011b5b055
This commit is contained in:
parent
5d11abb2e5
commit
8aa332fa74
@ -19,6 +19,7 @@ my %OPTION = (
|
|||||||
"esxd-host" => undef, "esxd-port" => 5700,
|
"esxd-host" => undef, "esxd-port" => 5700,
|
||||||
"vsphere" => '',
|
"vsphere" => '',
|
||||||
"usage" => undef,
|
"usage" => undef,
|
||||||
|
"light-perfdata" => undef,
|
||||||
"esx-host" => undef,
|
"esx-host" => undef,
|
||||||
"datastore" => undef,
|
"datastore" => undef,
|
||||||
"nic" => undef,
|
"nic" => undef,
|
||||||
@ -39,6 +40,7 @@ GetOptions(
|
|||||||
"e|esx-host=s" => \$OPTION{'esx-host'},
|
"e|esx-host=s" => \$OPTION{'esx-host'},
|
||||||
"vm=s" => \$OPTION{'vm'},
|
"vm=s" => \$OPTION{'vm'},
|
||||||
|
|
||||||
|
"light-perfdata" => \$OPTION{'light-perfdata'},
|
||||||
"datastore=s" => \$OPTION{'datastore'},
|
"datastore=s" => \$OPTION{'datastore'},
|
||||||
"nic=s" => \$OPTION{'nic'},
|
"nic=s" => \$OPTION{'nic'},
|
||||||
|
|
||||||
@ -97,6 +99,7 @@ sub print_usage () {
|
|||||||
print " -e (--esx-host) Esx Host to check (required)\n";
|
print " -e (--esx-host) Esx Host to check (required)\n";
|
||||||
print " -w (--warning) Warning Threshold in percent (default 80)\n";
|
print " -w (--warning) Warning Threshold in percent (default 80)\n";
|
||||||
print " -c (--critical) Critical Threshold in percent (default 90)\n";
|
print " -c (--critical) Critical Threshold in percent (default 90)\n";
|
||||||
|
print " --light-perfdata Display only total average cpu perfdata\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "'nethost':\n";
|
print "'nethost':\n";
|
||||||
print " -e (--esx-host) Esx Host to check (required)\n";
|
print " -e (--esx-host) Esx Host to check (required)\n";
|
||||||
@ -289,11 +292,14 @@ sub cpuhost_check_arg {
|
|||||||
if (!defined($OPTION{'critical'})) {
|
if (!defined($OPTION{'critical'})) {
|
||||||
$OPTION{'critical'} = 90;
|
$OPTION{'critical'} = 90;
|
||||||
}
|
}
|
||||||
|
if (!defined($OPTION{'light-perfdata'})) {
|
||||||
|
$OPTION{'light-perfdata'} = 0;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cpuhost_get_str {
|
sub cpuhost_get_str {
|
||||||
return "cpuhost|" . $OPTION{'vsphere'} . "|" . $OPTION{'esx-host'} . "|" . $OPTION{'warning'} . "|" . $OPTION{'critical'};
|
return "cpuhost|" . $OPTION{'vsphere'} . "|" . $OPTION{'esx-host'} . "|" . $OPTION{'warning'} . "|" . $OPTION{'critical'} . "|" . $OPTION{'light-perfdata'};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub datastoreshost_check_arg {
|
sub datastoreshost_check_arg {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
sub cpuhost_check_args {
|
sub cpuhost_check_args {
|
||||||
my ($host, $warn, $crit) = @_;
|
my ($host, $warn, $crit, $light_perfdata) = @_;
|
||||||
if (!defined($host) || $host eq "") {
|
if (!defined($host) || $host eq "") {
|
||||||
writeLogFile(LOG_ESXD_ERROR, "ARGS error: need hostname\n");
|
writeLogFile(LOG_ESXD_ERROR, "ARGS error: need hostname\n");
|
||||||
return 1;
|
return 1;
|
||||||
@ -23,11 +23,12 @@ sub cpuhost_compute_args {
|
|||||||
my $lhost = $_[0];
|
my $lhost = $_[0];
|
||||||
my $warn = (defined($_[1]) ? $_[1] : 80);
|
my $warn = (defined($_[1]) ? $_[1] : 80);
|
||||||
my $crit = (defined($_[2]) ? $_[2] : 90);
|
my $crit = (defined($_[2]) ? $_[2] : 90);
|
||||||
return ($lhost, $warn, $crit);
|
my $light_perfdata = (defined($_[3]) ? $_[3] : 0);
|
||||||
|
return ($lhost, $warn, $crit, $light_perfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cpuhost_do {
|
sub cpuhost_do {
|
||||||
my ($lhost, $warn, $crit) = @_;
|
my ($lhost, $warn, $crit, $light_perfdata) = @_;
|
||||||
if (!($perfcounter_speriod > 0)) {
|
if (!($perfcounter_speriod > 0)) {
|
||||||
my $status |= $MYERRORS_MASK{'UNKNOWN'};
|
my $status |= $MYERRORS_MASK{'UNKNOWN'};
|
||||||
print_response($ERRORS{$MYERRORS{$status}} . "|Can't retrieve perf counters.\n");
|
print_response($ERRORS{$MYERRORS{$status}} . "|Can't retrieve perf counters.\n");
|
||||||
@ -66,7 +67,7 @@ sub cpuhost_do {
|
|||||||
$cib = -1 if (!defined($cib) || $cib eq "");
|
$cib = -1 if (!defined($cib) || $cib eq "");
|
||||||
$cia <=> $cib} keys %$values) {
|
$cia <=> $cib} keys %$values) {
|
||||||
my ($counter_id, $instance) = split /:/, $id;
|
my ($counter_id, $instance) = split /:/, $id;
|
||||||
if ($instance ne "") {
|
if ($instance ne "" and $light_perfdata != 1) {
|
||||||
$output .= " cpu$instance=" . simplify_number(convert_number($values->{$id}[0]) * 0.01) . "%;;0;100";
|
$output .= " cpu$instance=" . simplify_number(convert_number($values->{$id}[0]) * 0.01) . "%;;0;100";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user