mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
parent
c38671738c
commit
1b5de2d360
@ -113,14 +113,6 @@ sub print_usage () {
|
|||||||
print " --vsphere vsphere name (default: none)\n";
|
print " --vsphere vsphere name (default: none)\n";
|
||||||
print " -u (--usage) What to check. The list and args (required)\n";
|
print " -u (--usage) What to check. The list and args (required)\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "'datastore-iops':\n";
|
|
||||||
print " --datastore Datastore name to check (required)\n";
|
|
||||||
print " -w (--warning) Warning Threshold (default none)\n";
|
|
||||||
print " -c (--critical) Critical Threshold (default none)\n";
|
|
||||||
print " --filter Use regexp for --datastore option (can check multiples datastores at once)\n";
|
|
||||||
print " --skip-errors Status OK if a datastore is not accessible (when you checks multiples)\n";
|
|
||||||
print " --details-value Only display VMs with iops higher than the following value (permits to see VMs with high values) (default 50)\n";
|
|
||||||
print "\n";
|
|
||||||
print "'datastore-snapshots':\n";
|
print "'datastore-snapshots':\n";
|
||||||
print " --datastore Datastore name to check (required)\n";
|
print " --datastore Datastore name to check (required)\n";
|
||||||
print " -w (--warning) Warning Threshold in bytes for all snapshots (default none)\n";
|
print " -w (--warning) Warning Threshold in bytes for all snapshots (default none)\n";
|
||||||
@ -130,18 +122,6 @@ sub print_usage () {
|
|||||||
print " --filter Use regexp for --datastore option (can check multiples datastores at once)\n";
|
print " --filter Use regexp for --datastore option (can check multiples datastores at once)\n";
|
||||||
print " --skip-errors Status OK if not enough permissions or others errors (when you checks multiples)\n";
|
print " --skip-errors Status OK if not enough permissions or others errors (when you checks multiples)\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "'datastoreshost':\n";
|
|
||||||
print " -e (--esx-host) Esx Host to check (required)\n";
|
|
||||||
print " -w (--warning) Warning Threshold in ms (latency) (default none)\n";
|
|
||||||
print " -c (--critical) Critical Threshold in ms (latency) (default none)\n";
|
|
||||||
print " --datastore Datastores to check (can use a regexp with --filter)\n";
|
|
||||||
print " --filter Use regexp for --datastore option (can check multiples datastores at once)\n";
|
|
||||||
print "\n";
|
|
||||||
print "'datastoresvm':\n";
|
|
||||||
print " --vm VM to check (required)\n";
|
|
||||||
print " -w (--warning) Warning Threshold in IOPS (default none)\n";
|
|
||||||
print " -c (--critical) Critical Threshold in IOPS (default none)\n";
|
|
||||||
print "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub print_help () {
|
sub print_help () {
|
||||||
|
211
connectors/vmware/src/centreon/esxd/cmddatastorehost.pm
Normal file
211
connectors/vmware/src/centreon/esxd/cmddatastorehost.pm
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
|
||||||
|
package centreon::esxd::cmddatastorehost;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use File::Basename;
|
||||||
|
use centreon::esxd::common;
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my $class = shift;
|
||||||
|
my $self = {};
|
||||||
|
$self->{logger} = shift;
|
||||||
|
$self->{commandName} = 'datastorehost';
|
||||||
|
|
||||||
|
bless $self, $class;
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub getCommandName {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->{commandName};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub checkArgs {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($options{arguments}->{esx_hostname}) && $options{arguments}->{esx_hostname} eq "") {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: esx hostname cannot be null");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (defined($options{arguments}->{datastore_name}) && $options{arguments}->{datastore_name} eq "") {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: datastore name cannot be null");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (defined($options{arguments}->{disconnect_status}) &&
|
||||||
|
$options{manager}->{output}->is_litteral_status(status => $options{arguments}->{disconnect_status}) == 0) {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: wrong value for disconnect status '" . $options{arguments}->{disconnect_status} . "'");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
foreach my $label (('warning', 'critical')) {
|
||||||
|
if (($options{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label})) == 0) {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: wrong value for $label value '" . $options{arguments}->{$label} . "'.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub initArgs {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
foreach (keys %{$options{arguments}}) {
|
||||||
|
$self->{$_} = $options{arguments}->{$_};
|
||||||
|
}
|
||||||
|
$self->{manager} = centreon::esxd::common::init_response();
|
||||||
|
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||||
|
foreach my $label (('warning', 'critical')) {
|
||||||
|
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_connector {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{obj_esxd} = $options{connector};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
if (!($self->{obj_esxd}->{perfcounter_speriod} > 0)) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Can't retrieve perf counters");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %filters = ();
|
||||||
|
my $multiple = 0;
|
||||||
|
if (defined($self->{esx_hostname}) && !defined($self->{filter})) {
|
||||||
|
$filters{name} = qr/^\Q$self->{esx_hostname}\E$/;
|
||||||
|
} elsif (!defined($self->{esx_hostname})) {
|
||||||
|
$filters{name} = qr/.*/;
|
||||||
|
} else {
|
||||||
|
$filters{name} = qr/$self->{esx_hostname}/;
|
||||||
|
}
|
||||||
|
my @properties = ('name', 'config.fileSystemVolume.mountInfo', 'runtime.connectionState');
|
||||||
|
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||||
|
return if (!defined($result));
|
||||||
|
|
||||||
|
if (scalar(@$result) > 1) {
|
||||||
|
$multiple = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %uuid_list = ();
|
||||||
|
#my %disk_name = ();
|
||||||
|
my $query_perfs = [];
|
||||||
|
my $ds_regexp;
|
||||||
|
if (defined($self->{datastore_name}) && !defined($self->{filter_datastore})) {
|
||||||
|
$ds_regexp = qr/^\Q$self->{datastore_name}\E$/;
|
||||||
|
} elsif (!defined($self->{datastore_name})) {
|
||||||
|
$ds_regexp = qr/.*/;
|
||||||
|
} else {
|
||||||
|
$ds_regexp = qr/$self->{datastore_name}/;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $entity_view (@$result) {
|
||||||
|
next if (centreon::esxd::common::host_state(connector => $self->{obj_esxd},
|
||||||
|
hostname => $entity_view->{name},
|
||||||
|
state => $entity_view->{'runtime.connectionState'}->val,
|
||||||
|
status => $self->{disconnect_status},
|
||||||
|
multiple => $multiple) == 0);
|
||||||
|
|
||||||
|
my $instances = [];
|
||||||
|
foreach (@{$entity_view->{'config.fileSystemVolume.mountInfo'}}) {
|
||||||
|
if ($_->volume->isa('HostVmfsVolume')) {
|
||||||
|
next if ($_->volume->name !~ /$ds_regexp/);
|
||||||
|
|
||||||
|
$uuid_list{$_->volume->uuid} = $_->volume->name;
|
||||||
|
push @$instances, $_->volume->uuid;
|
||||||
|
# Not need. We are on Datastore level (not LUN level)
|
||||||
|
#foreach my $extent (@{$_->volume->extent}) {
|
||||||
|
# $disk_name{$extent->diskName} = $_->volume->name;
|
||||||
|
#}
|
||||||
|
}
|
||||||
|
if ($_->volume->isa('HostNasVolume')) {
|
||||||
|
next if ($_->volume->name !~ /$ds_regexp/);
|
||||||
|
|
||||||
|
$uuid_list{basename($_->mountInfo->path)} = $_->volume->name;
|
||||||
|
push @$instances, basename($_->mountInfo->path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(@$instances) > 0) {
|
||||||
|
push @$query_perfs, {
|
||||||
|
entity => $entity_view,
|
||||||
|
metrics => [
|
||||||
|
{label => 'datastore.totalReadLatency.average', instances => $instances},
|
||||||
|
{label => 'datastore.totalWriteLatency.average', instances => $instances}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(@$query_perfs) == 0) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Can't get a single datastore.");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Vsphere >= 4.1
|
||||||
|
# You get counters even if datastore is disconnect...
|
||||||
|
my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd},
|
||||||
|
undef,
|
||||||
|
$query_perfs,
|
||||||
|
$self->{obj_esxd}->{perfcounter_speriod},
|
||||||
|
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||||
|
return if (centreon::esxd::common::performance_errors($self->{obj_esxd}, $values) == 1);
|
||||||
|
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => sprintf("All Datastore latencies are ok"));
|
||||||
|
foreach my $entity_view (@$result) {
|
||||||
|
next if (centreon::esxd::common::is_connected(state => $entity_view->{'runtime.connectionState'}->val) == 0);
|
||||||
|
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||||
|
|
||||||
|
my $checked = {};
|
||||||
|
foreach (keys %{$values->{$entity_value}}) {
|
||||||
|
my ($id, $uuid) = split /:/;
|
||||||
|
next if (defined($checked->{$uuid}));
|
||||||
|
$checked->{$uuid} = 1;
|
||||||
|
|
||||||
|
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{obj_esxd}->{perfcounter_cache}->{'datastore.totalReadLatency.average'}->{'key'} . ":" . $uuid}[0]));
|
||||||
|
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{obj_esxd}->{perfcounter_cache}->{'datastore.totalWriteLatency.average'}->{'key'} . ":" . $uuid}[0]));
|
||||||
|
|
||||||
|
my $exit = $self->{manager}->{perfdata}->threshold_check(value => $read_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
$self->{manager}->{output}->output_add(long_msg => sprintf("'%s' read on '%s' is %s ms",
|
||||||
|
$entity_view->{name}, $uuid_list{$uuid}, $read_counter));
|
||||||
|
if (!$self->{manager}->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("'%s' read on '%s' is %s ms",
|
||||||
|
$entity_view->{name}, $uuid_list{$uuid}, $read_counter));
|
||||||
|
}
|
||||||
|
$exit = $self->{manager}->{perfdata}->threshold_check(value => $write_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
$self->{manager}->{output}->output_add(long_msg => sprintf("'%s' write on '%s' is %s ms",
|
||||||
|
$entity_view->{name}, $uuid_list{$uuid}, $write_counter));
|
||||||
|
if (!$self->{manager}->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("'%s' write on '%s' is %s ms",
|
||||||
|
$entity_view->{name}, $uuid_list{$uuid}, $write_counter));
|
||||||
|
}
|
||||||
|
|
||||||
|
my $extra_label = '';
|
||||||
|
$extra_label = '_' . $entity_view->{name} if ($multiple == 1);
|
||||||
|
$self->{manager}->{output}->perfdata_add(label => 'trl' . $extra_label . '_' . $uuid_list{$uuid}, unit => 'ms',
|
||||||
|
value => $read_counter,
|
||||||
|
warning => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0);
|
||||||
|
$self->{manager}->{output}->perfdata_add(label => 'twl' . $extra_label . '_' . $uuid_list{$uuid}, unit => 'ms',
|
||||||
|
value => $write_counter,
|
||||||
|
warning => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -1,180 +0,0 @@
|
|||||||
|
|
||||||
package centreon::esxd::cmddatastoreshost;
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use File::Basename;
|
|
||||||
use centreon::esxd::common;
|
|
||||||
|
|
||||||
sub new {
|
|
||||||
my $class = shift;
|
|
||||||
my $self = {};
|
|
||||||
$self->{logger} = shift;
|
|
||||||
$self->{obj_esxd} = shift;
|
|
||||||
$self->{commandName} = 'datastoreshost';
|
|
||||||
|
|
||||||
bless $self, $class;
|
|
||||||
return $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub getCommandName {
|
|
||||||
my $self = shift;
|
|
||||||
return $self->{commandName};
|
|
||||||
}
|
|
||||||
|
|
||||||
sub checkArgs {
|
|
||||||
my $self = shift;
|
|
||||||
my ($lhost, $filter, $warn, $crit) = @_;
|
|
||||||
|
|
||||||
if (!defined($lhost) || $lhost eq "") {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: need host name");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (defined($warn) && $warn ne "" && $warn !~ /^-?(?:\d+\.?|\.\d)\d*\z/) {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: warn threshold must be a positive number");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (defined($crit) && $crit ne "" && $crit !~ /^-?(?:\d+\.?|\.\d)\d*\z/) {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: crit threshold must be a positive number");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (defined($warn) && defined($crit) && $warn ne "" && $crit ne "" && $warn > $crit) {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: warn threshold must be lower than crit threshold");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub initArgs {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{lhost} = $_[0];
|
|
||||||
$self->{filter} = (defined($_[1]) && $_[1] == 1) ? 1 : 0;
|
|
||||||
$self->{warn} = (defined($_[2]) ? $_[2] : '');
|
|
||||||
$self->{crit} = (defined($_[3]) ? $_[3] : '');
|
|
||||||
$self->{ds} = (defined($_[4]) ? $_[4] : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
sub run {
|
|
||||||
my $self = shift;
|
|
||||||
my $filter_ok = 0;
|
|
||||||
|
|
||||||
if (!($self->{obj_esxd}->{perfcounter_speriod} > 0)) {
|
|
||||||
my $status = centreon::esxd::common::errors_mask(0, 'UNKNOWN');
|
|
||||||
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|Can't retrieve perf counters.\n");
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
my %filters = ('name' => $self->{lhost});
|
|
||||||
my @properties = ('config.fileSystemVolume.mountInfo', 'runtime.connectionState');
|
|
||||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
|
||||||
if (!defined($result)) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
|
||||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
|
||||||
|
|
||||||
my %uuid_list = ();
|
|
||||||
#my %disk_name = ();
|
|
||||||
my $instances = [];
|
|
||||||
if ($self->{ds} eq '') {
|
|
||||||
$instances = ['*'];
|
|
||||||
}
|
|
||||||
foreach (@{$$result[0]->{'config.fileSystemVolume.mountInfo'}}) {
|
|
||||||
if ($_->volume->isa('HostVmfsVolume')) {
|
|
||||||
if ($self->{ds} ne '') {
|
|
||||||
if ($self->{filter} == 0 && $_->volume->name !~ /^\Q$self->{ds}\E$/) {
|
|
||||||
next;
|
|
||||||
} elsif ($self->{filter} == 1 && $_->volume->name !~ /$self->{ds}/) {
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter_ok = 1;
|
|
||||||
$uuid_list{$_->volume->uuid} = $_->volume->name;
|
|
||||||
push @$instances, $_->volume->uuid;
|
|
||||||
# Not need. We are on Datastore level (not LUN level)
|
|
||||||
#foreach my $extent (@{$_->volume->extent}) {
|
|
||||||
# $disk_name{$extent->diskName} = $_->volume->name;
|
|
||||||
#}
|
|
||||||
}
|
|
||||||
if ($_->volume->isa('HostNasVolume')) {
|
|
||||||
if ($self->{ds} ne '') {
|
|
||||||
if ($self->{filter} == 0 && $_->volume->name !~ /^\Q$self->{ds}\E$/) {
|
|
||||||
next;
|
|
||||||
} elsif ($self->{filter} == 1 && $_->volume->name !~ /$self->{ds}/) {
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter_ok = 1;
|
|
||||||
$uuid_list{basename($_->mountInfo->path)} = $_->volume->name;
|
|
||||||
push @$instances, basename($_->mountInfo->path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($self->{ds} ne '' and $filter_ok == 0) {
|
|
||||||
my $status = centreon::esxd::common::errors_mask(0, 'UNKNOWN');
|
|
||||||
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status). "|Can't get a datastore with the filter '$self->{ds}'.\n");
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Vsphere >= 4.1
|
|
||||||
# You get counters even if datastore is disconnect...
|
|
||||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd},
|
|
||||||
$result,
|
|
||||||
[{'label' => 'datastore.totalReadLatency.average', 'instances' => $instances},
|
|
||||||
{'label' => 'datastore.totalWriteLatency.average', 'instances' => $instances}],
|
|
||||||
$self->{obj_esxd}->{perfcounter_speriod});
|
|
||||||
return if (centreon::esxd::common::performance_errors($self->{obj_esxd}, $values) == 1);
|
|
||||||
|
|
||||||
my $status = 0; # OK
|
|
||||||
my $output = '';
|
|
||||||
my $output_append = '';
|
|
||||||
my $output_warning = '';
|
|
||||||
my $output_warning_append = '';
|
|
||||||
my $output_critical = '';
|
|
||||||
my $output_critical_append = '';
|
|
||||||
my $perfdata = '';
|
|
||||||
foreach (keys %uuid_list) {
|
|
||||||
if (defined($values->{$self->{obj_esxd}->{perfcounter_cache}->{'datastore.totalReadLatency.average'}->{'key'} . ":" . $_}) and
|
|
||||||
defined($values->{$self->{obj_esxd}->{perfcounter_cache}->{'datastore.totalWriteLatency.average'}->{'key'} . ":" . $_})) {
|
|
||||||
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$self->{obj_esxd}->{perfcounter_cache}->{'datastore.totalReadLatency.average'}->{'key'} . ":" . $_}[0]));
|
|
||||||
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$self->{obj_esxd}->{perfcounter_cache}->{'datastore.totalWriteLatency.average'}->{'key'} . ":" . $_}[0]));
|
|
||||||
if (defined($self->{crit}) && $self->{crit} ne "" && ($read_counter >= $self->{crit})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_critical, \$output_critical_append, ", ",
|
|
||||||
"read on '" . $uuid_list{$_} . "' is $read_counter ms");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'CRITICAL');
|
|
||||||
} elsif (defined($self->{warn}) && $self->{warn} ne "" && ($read_counter >= $self->{warn})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_warning, \$output_warning_append, ", ",
|
|
||||||
"read on '" . $uuid_list{$_} . "' is $read_counter ms");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'WARNING');
|
|
||||||
}
|
|
||||||
if (defined($self->{crit}) && $self->{crit} ne "" && ($write_counter >= $self->{crit})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_critical, \$output_critical_append, ", ",
|
|
||||||
"write on '" . $uuid_list{$_} . "' is $write_counter ms");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'CRITICAL');
|
|
||||||
} elsif (defined($self->{warn}) && $self->{warn} ne "" && ($write_counter >= $self->{warn})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_warning, \$output_warning_append, ", ",
|
|
||||||
"write on '" . $uuid_list{$_} . "' is $write_counter ms");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'WARNING');
|
|
||||||
}
|
|
||||||
|
|
||||||
$perfdata .= " 'trl_" . $uuid_list{$_} . "'=" . $read_counter . "ms 'twl_" . $uuid_list{$_} . "'=" . $write_counter . 'ms';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output_critical ne "") {
|
|
||||||
$output .= $output_append . "CRITICAL - Latency counter: $output_critical";
|
|
||||||
$output_append = ". ";
|
|
||||||
}
|
|
||||||
if ($output_warning ne "") {
|
|
||||||
$output .= $output_append . "WARNING - Latency counter: $output_warning";
|
|
||||||
}
|
|
||||||
if ($status == 0) {
|
|
||||||
$output = "All Datastore latency counters are ok";
|
|
||||||
}
|
|
||||||
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|$output|$perfdata\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
@ -1,171 +0,0 @@
|
|||||||
|
|
||||||
package centreon::esxd::cmddatastoresvm;
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use centreon::esxd::common;
|
|
||||||
|
|
||||||
sub new {
|
|
||||||
my $class = shift;
|
|
||||||
my $self = {};
|
|
||||||
$self->{logger} = shift;
|
|
||||||
$self->{obj_esxd} = shift;
|
|
||||||
$self->{commandName} = 'datastoresvm';
|
|
||||||
|
|
||||||
bless $self, $class;
|
|
||||||
return $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub getCommandName {
|
|
||||||
my $self = shift;
|
|
||||||
return $self->{commandName};
|
|
||||||
}
|
|
||||||
|
|
||||||
sub checkArgs {
|
|
||||||
my $self = shift;
|
|
||||||
my ($lvm, $warn, $crit) = @_;
|
|
||||||
|
|
||||||
if (!defined($lvm) || $lvm eq "") {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: need vm name");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (defined($warn) && $warn ne "" && $warn !~ /^-?(?:\d+\.?|\.\d)\d*\z/) {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: warn threshold must be a positive number");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (defined($crit) && $crit ne "" && $crit !~ /^-?(?:\d+\.?|\.\d)\d*\z/) {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: crit threshold must be a positive number");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (defined($warn) && defined($crit) && $warn ne "" && $crit ne "" && $warn > $crit) {
|
|
||||||
$self->{logger}->writeLogError("ARGS error: warn threshold must be lower than crit threshold");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub initArgs {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{lvm} = $_[0];
|
|
||||||
$self->{warn} = (defined($_[1]) ? $_[1] : '');
|
|
||||||
$self->{crit} = (defined($_[2]) ? $_[2] : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
sub run {
|
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
if (!($self->{obj_esxd}->{perfcounter_speriod} > 0)) {
|
|
||||||
my $status = centreon::esxd::common::errors_mask(0, 'UNKNOWN');
|
|
||||||
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|Can't retrieve perf counters.\n");
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
my %filters = ('name' => $self->{lvm});
|
|
||||||
my @properties = ('datastore', 'runtime.connectionState', 'runtime.powerState');
|
|
||||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'VirtualMachine', \%filters, \@properties);
|
|
||||||
if (!defined($result)) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return if (centreon::esxd::common::vm_state($self->{obj_esxd}, $self->{lvm},
|
|
||||||
$$result[0]->{'runtime.connectionState'}->val,
|
|
||||||
$$result[0]->{'runtime.powerState'}->val) == 0);
|
|
||||||
|
|
||||||
my @ds_array = ();
|
|
||||||
foreach my $entity_view (@$result) {
|
|
||||||
if (defined $entity_view->datastore) {
|
|
||||||
@ds_array = (@ds_array, @{$entity_view->datastore});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@properties = ('info');
|
|
||||||
my $result2 = centreon::esxd::common::get_views($self->{obj_esxd}, \@ds_array, \@properties);
|
|
||||||
if (!defined($result2)) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#my %uuid_list = ();
|
|
||||||
my %disk_name = ();
|
|
||||||
my %datastore_lun = ();
|
|
||||||
foreach (@$result2) {
|
|
||||||
if ($_->info->isa('VmfsDatastoreInfo')) {
|
|
||||||
#$uuid_list{$_->volume->uuid} = $_->volume->name;
|
|
||||||
# Not need. We are on Datastore level (not LUN level)
|
|
||||||
foreach my $extent (@{$_->info->vmfs->extent}) {
|
|
||||||
$disk_name{$extent->diskName} = $_->info->vmfs->name;
|
|
||||||
if (!defined($datastore_lun{$_->info->vmfs->name})) {
|
|
||||||
%{$datastore_lun{$_->info->vmfs->name}} = ('disk.numberRead.summation' => 0, 'disk.numberWrite.summation' => 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if ($_->info->isa('NasDatastoreInfo')) {
|
|
||||||
# Zero disk Info
|
|
||||||
#}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Vsphere >= 4.1
|
|
||||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd},
|
|
||||||
$result,
|
|
||||||
[{'label' => 'disk.numberRead.summation', 'instances' => ['*']},
|
|
||||||
{'label' => 'disk.numberWrite.summation', 'instances' => ['*']}],
|
|
||||||
$self->{obj_esxd}->{perfcounter_speriod});
|
|
||||||
return if (centreon::esxd::common::performance_errors($self->{obj_esxd}, $values) == 1);
|
|
||||||
|
|
||||||
foreach (keys %$values) {
|
|
||||||
my ($id, $disk_name) = split(/:/);
|
|
||||||
|
|
||||||
# RDM Disk. We skip. Don't know how to manage it right now.
|
|
||||||
if (!defined($disk_name{$disk_name})) {
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
$datastore_lun{$disk_name{$disk_name}}{$self->{obj_esxd}->{perfcounter_cache_reverse}->{$id}} += $values->{$_}[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
my $status = 0; # OK
|
|
||||||
my $output = '';
|
|
||||||
my $output_append = '';
|
|
||||||
my $output_warning = '';
|
|
||||||
my $output_warning_append = '';
|
|
||||||
my $output_critical = '';
|
|
||||||
my $output_critical_append = '';
|
|
||||||
my $perfdata = '';
|
|
||||||
foreach (keys %datastore_lun) {
|
|
||||||
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($datastore_lun{$_}{'disk.numberRead.summation'} / $self->{obj_esxd}->{perfcounter_speriod}));
|
|
||||||
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($datastore_lun{$_}{'disk.numberWrite.summation'} / $self->{obj_esxd}->{perfcounter_speriod}));
|
|
||||||
|
|
||||||
if (defined($self->{crit}) && $self->{crit} ne "" && ($read_counter >= $self->{crit})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_critical, \$output_critical_append, ", ",
|
|
||||||
"read iops on '" . $_ . "' is $read_counter");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'CRITICAL');
|
|
||||||
} elsif (defined($self->{warn}) && $self->{warn} ne "" && ($read_counter >= $self->{warn})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_warning, \$output_warning_append, ", ",
|
|
||||||
"read iops on '" . $_ . "' is $read_counter");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'WARNING');
|
|
||||||
}
|
|
||||||
if (defined($self->{crit}) && $self->{crit} ne "" && ($write_counter >= $self->{crit})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_critical, \$output_critical_append, ", ",
|
|
||||||
"write iops on '" . $_ . "' is $write_counter");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'CRITICAL');
|
|
||||||
} elsif (defined($self->{warn}) && $self->{warn} ne "" && ($write_counter >= $self->{warn})) {
|
|
||||||
centreon::esxd::common::output_add(\$output_warning, \$output_warning_append, ", ",
|
|
||||||
"write iops '" . $_ . "' is $write_counter");
|
|
||||||
$status = centreon::esxd::common::errors_mask($status, 'WARNING');
|
|
||||||
}
|
|
||||||
|
|
||||||
$perfdata .= " 'riops_" . $_ . "'=" . $read_counter . "iops 'wiops_" . $_ . "'=" . $write_counter . 'iops';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($output_critical ne "") {
|
|
||||||
$output .= $output_append . "CRITICAL - $output_critical";
|
|
||||||
$output_append = ". ";
|
|
||||||
}
|
|
||||||
if ($output_warning ne "") {
|
|
||||||
$output .= $output_append . "WARNING - $output_warning";
|
|
||||||
}
|
|
||||||
if ($status == 0) {
|
|
||||||
$output = "All Datastore IOPS counters are ok";
|
|
||||||
}
|
|
||||||
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|$output|$perfdata\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
227
connectors/vmware/src/centreon/esxd/cmddatastorevm.pm
Normal file
227
connectors/vmware/src/centreon/esxd/cmddatastorevm.pm
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
|
||||||
|
package centreon::esxd::cmddatastorevm;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::esxd::common;
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my $class = shift;
|
||||||
|
my $self = {};
|
||||||
|
$self->{logger} = shift;
|
||||||
|
$self->{commandName} = 'datastorevm';
|
||||||
|
|
||||||
|
bless $self, $class;
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub getCommandName {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->{commandName};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub checkArgs {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($options{arguments}->{vm_hostname}) && $options{arguments}->{vm_hostname} eq "") {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: vm hostname cannot be null");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (defined($options{arguments}->{datastore_name}) && $options{arguments}->{datastore_name} eq "") {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: datastore name cannot be null");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (defined($options{arguments}->{disconnect_status}) &&
|
||||||
|
$options{manager}->{output}->is_litteral_status(status => $options{arguments}->{disconnect_status}) == 0) {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: wrong value for disconnect status '" . $options{arguments}->{disconnect_status} . "'");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (defined($options{arguments}->{nopoweredon_status}) &&
|
||||||
|
$options{manager}->{output}->is_litteral_status(status => $options{arguments}->{nopoweredon_status}) == 0) {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: wrong value for nopoweredon status '" . $options{arguments}->{nopoweredon_status} . "'");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
foreach my $label (('warning', 'critical')) {
|
||||||
|
if (($options{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label})) == 0) {
|
||||||
|
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Argument error: wrong value for $label value '" . $options{arguments}->{$label} . "'.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub initArgs {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
foreach (keys %{$options{arguments}}) {
|
||||||
|
$self->{$_} = $options{arguments}->{$_};
|
||||||
|
}
|
||||||
|
$self->{manager} = centreon::esxd::common::init_response();
|
||||||
|
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||||
|
foreach my $label (('warning', 'critical')) {
|
||||||
|
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_connector {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{obj_esxd} = $options{connector};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
if (!($self->{obj_esxd}->{perfcounter_speriod} > 0)) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Can't retrieve perf counters");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %filters = ();
|
||||||
|
my $multiple = 0;
|
||||||
|
if (defined($self->{vm_hostname}) && !defined($self->{filter})) {
|
||||||
|
$filters{name} = qr/^\Q$self->{vm_hostname}\E$/;
|
||||||
|
} elsif (!defined($self->{vm_hostname})) {
|
||||||
|
$filters{name} = qr/.*/;
|
||||||
|
} else {
|
||||||
|
$filters{name} = qr/$self->{vm_hostname}/;
|
||||||
|
}
|
||||||
|
my @properties = ('name', 'datastore', 'runtime.connectionState', 'runtime.powerState');
|
||||||
|
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'VirtualMachine', \%filters, \@properties);
|
||||||
|
return if (!defined($result));
|
||||||
|
|
||||||
|
if (scalar(@$result) > 1) {
|
||||||
|
$multiple = 1;
|
||||||
|
}
|
||||||
|
my $ds_regexp;
|
||||||
|
if (defined($self->{datastore_name}) && !defined($self->{filter_datastore})) {
|
||||||
|
$ds_regexp = qr/^\Q$self->{datastore_name}\E$/;
|
||||||
|
} elsif (!defined($self->{datastore_name})) {
|
||||||
|
$ds_regexp = qr/.*/;
|
||||||
|
} else {
|
||||||
|
$ds_regexp = qr/$self->{datastore_name}/;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $mapped_datastore = {};
|
||||||
|
my @ds_array = ();
|
||||||
|
foreach my $entity_view (@$result) {
|
||||||
|
next if (centreon::esxd::common::vm_state(connector => $self->{obj_esxd},
|
||||||
|
hostname => $entity_view->{name},
|
||||||
|
state => $entity_view->{'runtime.connectionState'}->val,
|
||||||
|
power => $entity_view->{'runtime.powerState'}->val,
|
||||||
|
status => $self->{disconnect_status},
|
||||||
|
powerstatus => $self->{nopoweredon_status},
|
||||||
|
multiple => $multiple) == 0);
|
||||||
|
if (defined($entity_view->datastore)) {
|
||||||
|
foreach (@{$entity_view->datastore}) {
|
||||||
|
if (!defined($mapped_datastore->{$_->value})) {
|
||||||
|
push @ds_array, $_;
|
||||||
|
$mapped_datastore->{$_->value} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@properties = ('info');
|
||||||
|
my $result2 = centreon::esxd::common::get_views($self->{obj_esxd}, \@ds_array, \@properties);
|
||||||
|
return if (!defined($result2));
|
||||||
|
|
||||||
|
#my %uuid_list = ();
|
||||||
|
my %disk_name = ();
|
||||||
|
my %datastore_lun = ();
|
||||||
|
foreach (@$result2) {
|
||||||
|
if ($_->info->isa('VmfsDatastoreInfo')) {
|
||||||
|
#$uuid_list{$_->volume->uuid} = $_->volume->name;
|
||||||
|
# Not need. We are on Datastore level (not LUN level)
|
||||||
|
foreach my $extent (@{$_->info->vmfs->extent}) {
|
||||||
|
$disk_name{$extent->diskName} = $_->info->vmfs->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if ($_->info->isa('NasDatastoreInfo')) {
|
||||||
|
# Zero disk Info
|
||||||
|
#}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Vsphere >= 4.1
|
||||||
|
# We don't filter. To filter we'll need to get disk from vms
|
||||||
|
my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd},
|
||||||
|
$result,
|
||||||
|
[{'label' => 'disk.numberRead.summation', 'instances' => ['*']},
|
||||||
|
{'label' => 'disk.numberWrite.summation', 'instances' => ['*']}],
|
||||||
|
$self->{obj_esxd}->{perfcounter_speriod},
|
||||||
|
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||||
|
return if (centreon::esxd::common::performance_errors($self->{obj_esxd}, $values) == 1);
|
||||||
|
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => sprintf("All Datastore IOPS counters are ok"));
|
||||||
|
my $finded = 0;
|
||||||
|
foreach my $entity_view (@$result) {
|
||||||
|
next if (centreon::esxd::common::is_connected(state => $entity_view->{'runtime.connectionState'}->val) == 0 &&
|
||||||
|
centreon::esxd::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||||
|
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||||
|
|
||||||
|
$finded |= 1;
|
||||||
|
my %datastore_lun = ();
|
||||||
|
foreach (keys %{$values->{$entity_value}}) {
|
||||||
|
my ($id, $disk_name) = split /:/;
|
||||||
|
|
||||||
|
# RDM Disk. We skip. Don't know how to manage it right now.
|
||||||
|
next if (!defined($disk_name{$disk_name}));
|
||||||
|
# We skip datastore not filtered
|
||||||
|
next if ($disk_name{$disk_name} !~ /$ds_regexp/);
|
||||||
|
$datastore_lun{$disk_name{$disk_name}} = { 'disk.numberRead.summation' => 0,
|
||||||
|
'disk.numberWrite.summation' => 0 } if (!defined($datastore_lun{$disk_name{$disk_name}}));
|
||||||
|
$datastore_lun{$disk_name{$disk_name}}->{$self->{obj_esxd}->{perfcounter_cache_reverse}->{$id}} += $values->{$entity_value}->{$_}[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (sort keys %datastore_lun) {
|
||||||
|
$finded |= 2;
|
||||||
|
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($datastore_lun{$_}{'disk.numberRead.summation'} / $self->{obj_esxd}->{perfcounter_speriod}));
|
||||||
|
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($datastore_lun{$_}{'disk.numberWrite.summation'} / $self->{obj_esxd}->{perfcounter_speriod}));
|
||||||
|
|
||||||
|
my $exit = $self->{manager}->{perfdata}->threshold_check(value => $read_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
$self->{manager}->{output}->output_add(long_msg => sprintf("'%s' read iops on '%s' is %s",
|
||||||
|
$entity_view->{name}, $_, $read_counter));
|
||||||
|
if (!$self->{manager}->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("'%s' read iops on '%s' is %s",
|
||||||
|
$entity_view->{name}, $_, $read_counter));
|
||||||
|
}
|
||||||
|
$exit = $self->{manager}->{perfdata}->threshold_check(value => $write_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
|
$self->{manager}->{output}->output_add(long_msg => sprintf("'%s' write iops on '%s' is %s",
|
||||||
|
$entity_view->{name}, $_, $write_counter));
|
||||||
|
if (!$self->{manager}->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("'%s' write iops on '%s' is %s",
|
||||||
|
$entity_view->{name}, $_, $write_counter));
|
||||||
|
}
|
||||||
|
|
||||||
|
my $extra_label = '';
|
||||||
|
$extra_label = '_' . $entity_view->{name} if ($multiple == 1);
|
||||||
|
$self->{manager}->{output}->perfdata_add(label => 'riops' . $extra_label . '_' . $_, unit => 'iops',
|
||||||
|
value => $read_counter,
|
||||||
|
warning => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0);
|
||||||
|
$self->{manager}->{output}->perfdata_add(label => 'wiops' . $extra_label . '_' . $_, unit => 'iops',
|
||||||
|
value => $write_counter,
|
||||||
|
warning => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($finded & 2) == 0) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||||
|
short_msg => "Can't get a single datastore.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -34,9 +34,9 @@ my @load_modules = (
|
|||||||
'centreon::esxd::cmdcpuvm',
|
'centreon::esxd::cmdcpuvm',
|
||||||
'centreon::esxd::cmddatastoreio',
|
'centreon::esxd::cmddatastoreio',
|
||||||
'centreon::esxd::cmddatastoreiops',
|
'centreon::esxd::cmddatastoreiops',
|
||||||
'centreon::esxd::cmddatastoreshost',
|
'centreon::esxd::cmddatastorehost',
|
||||||
'centreon::esxd::cmddatastoresnapshots',
|
'centreon::esxd::cmddatastoresnapshots',
|
||||||
'centreon::esxd::cmddatastoresvm',
|
'centreon::esxd::cmddatastorevm',
|
||||||
'centreon::esxd::cmddatastoreusage',
|
'centreon::esxd::cmddatastoreusage',
|
||||||
'centreon::esxd::cmdgetmap',
|
'centreon::esxd::cmdgetmap',
|
||||||
'centreon::esxd::cmdhealthhost',
|
'centreon::esxd::cmdhealthhost',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user