fix indent
This commit is contained in:
parent
093ecd88e4
commit
bd94ae30eb
|
@ -32,8 +32,7 @@ my $cluster_name = '';
|
|||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'status : ' . $self->{result_values}->{status};
|
||||
return $msg;
|
||||
return 'status : ' . $self->{result_values}->{status};
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
|
@ -59,11 +58,13 @@ sub custom_usage_perfdata {
|
|||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $label, unit => 'B',
|
||||
$self->{output}->perfdata_add(
|
||||
label => $label, unit => 'B',
|
||||
value => $value_perf,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
||||
min => 0, max => $self->{result_values}->{total});
|
||||
min => 0, max => $self->{result_values}->{total}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_threshold {
|
||||
|
@ -86,11 +87,12 @@ sub custom_usage_output {
|
|||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
my $msg = sprintf("Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||
return sprintf(
|
||||
'Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
||||
return $msg;
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
|
@ -102,7 +104,6 @@ sub custom_usage_calc {
|
|||
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
|
||||
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
|
||||
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -156,12 +157,11 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||
'critical-status:s' => { name => 'critical_status', default => '' },
|
||||
'units:s' => { name => 'units', default => '%' },
|
||||
'free' => { name => 'free' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -198,9 +198,11 @@ sub manage_selection {
|
|||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_nutanix,
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_nutanix,
|
||||
start => $mapping->{clusterName}->{oid}, end => $mapping->{clusterLatency}->{oid},
|
||||
nothing_quit => 1);
|
||||
nothing_quit => 1
|
||||
);
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => '0');
|
||||
$self->{cluster} = { %$result };
|
||||
$cluster_name = centreon::plugins::misc::trim($result->{clusterName});
|
||||
|
|
|
@ -43,11 +43,13 @@ sub custom_usage_perfdata {
|
|||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
|
||||
$self->{output}->perfdata_add(
|
||||
label => $label . $extra_label, unit => 'B',
|
||||
value => $value_perf,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
||||
min => 0, max => $self->{result_values}->{total});
|
||||
min => 0, max => $self->{result_values}->{total}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_threshold {
|
||||
|
@ -70,11 +72,12 @@ sub custom_usage_output {
|
|||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
my $msg = sprintf("Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||
return sprintf(
|
||||
'Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
||||
return $msg;
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
|
@ -86,7 +89,6 @@ sub custom_usage_calc {
|
|||
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
|
||||
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
|
||||
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -133,9 +135,9 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'units:s' => { name => 'units', default => '%' },
|
||||
'free' => { name => 'free' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -166,8 +168,10 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
$self->{container} = {};
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_citEntry,
|
||||
nothing_quit => 1);
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_citEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{citContainerName}->{oid}\.(.*)$/);
|
||||
|
|
|
@ -30,8 +30,7 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold)
|
|||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'state : ' . $self->{result_values}->{state};
|
||||
return $msg;
|
||||
return 'state : ' . $self->{result_values}->{state};
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
|
@ -59,11 +58,13 @@ sub custom_usage_perfdata {
|
|||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
|
||||
$self->{output}->perfdata_add(
|
||||
label => $label . $extra_label, unit => 'B',
|
||||
value => $value_perf,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
||||
min => 0, max => $self->{result_values}->{total});
|
||||
min => 0, max => $self->{result_values}->{total}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_threshold {
|
||||
|
@ -86,11 +87,12 @@ sub custom_usage_output {
|
|||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
my $msg = sprintf("Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||
return sprintf(
|
||||
'Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
||||
return $msg;
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
|
@ -102,7 +104,6 @@ sub custom_usage_calc {
|
|||
$self->{result_values}->{used} = $self->{result_values}->{total} - $self->{result_values}->{free};
|
||||
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
|
||||
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -165,13 +166,12 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||
'critical-status:s' => { name => 'critical_status', default => '' },
|
||||
'units:s' => { name => 'units', default => '%' },
|
||||
'free' => { name => 'free' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -214,8 +214,10 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
$self->{disk} = {};
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_dstEntry,
|
||||
nothing_quit => 1);
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_dstEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{dstDiskId}->{oid}\.(.*)$/);
|
||||
|
@ -231,8 +233,10 @@ sub manage_selection {
|
|||
|
||||
my $inodes_used;
|
||||
$inodes_used = 100 - ($result->{dstNumFreeInodes} * 100 / $result->{dstNumTotalInodes}) if ($result->{dstNumTotalInodes} > 0);
|
||||
$self->{disk}->{$instance} = { display => $result->{dstDiskId},
|
||||
%$result, inodes_used => $inodes_used,
|
||||
$self->{disk}->{$instance} = {
|
||||
display => $result->{dstDiskId},
|
||||
%$result,
|
||||
inodes_used => $inodes_used
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -35,11 +35,13 @@ sub custom_usage_perfdata {
|
|||
$extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
my %total_options = (total => $self->{result_values}->{total}, cast_int => 1);
|
||||
|
||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
|
||||
$self->{output}->perfdata_add(
|
||||
label => $label . $extra_label, unit => 'B',
|
||||
value => $value_perf,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
||||
min => 0, max => $self->{result_values}->{total});
|
||||
min => 0, max => $self->{result_values}->{total}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_output {
|
||||
|
@ -48,11 +50,12 @@ sub custom_usage_output {
|
|||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
my $msg = sprintf("Memory Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||
return sprintf(
|
||||
'Memory Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
||||
return $msg;
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
|
@ -64,7 +67,6 @@ sub custom_usage_calc {
|
|||
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
|
||||
$self->{result_values}->{used} = $self->{result_values}->{prct_used} * $self->{result_values}->{total} / 100;
|
||||
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -138,7 +140,7 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -172,8 +174,10 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
$self->{hypervisor} = {};
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_hypervisorEntry,
|
||||
nothing_quit => 1);
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_hypervisorEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{hypervisorName}->{oid}\.(.*)$/);
|
||||
|
@ -187,7 +191,8 @@ sub manage_selection {
|
|||
next;
|
||||
}
|
||||
|
||||
$self->{hypervisor}->{$instance} = { display => $result->{hypervisorName},
|
||||
$self->{hypervisor}->{$instance} = {
|
||||
display => $result->{hypervisorName},
|
||||
%$result,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,9 +33,8 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -71,8 +70,10 @@ sub run {
|
|||
$self->{output}->output_add(long_msg => "'" . $name . "'");
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List Containers:');
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List containers:'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -110,4 +111,3 @@ Filter by container name.
|
|||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
@ -41,9 +41,8 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -56,10 +55,14 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $self->{snmp}->get_multiple_table(oids => [
|
||||
my $snmp_result = $self->{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $mapping->{dstDiskId}->{oid} },
|
||||
{ oid => $mapping->{dstState}->{oid} },
|
||||
], return_type => 1, nothing_quit => 1);
|
||||
],
|
||||
return_type => 1,
|
||||
nothing_quit => 1
|
||||
);
|
||||
$self->{disk} = {};
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{dstState}->{oid}\.(.*)$/);
|
||||
|
@ -85,8 +88,10 @@ sub run {
|
|||
$self->{output}->output_add(long_msg => "[disk_id = " . $self->{disk}->{$name}->{dstDiskId} . "] [state = " . $self->{disk}->{$name}->{dstState} . "]");
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List Disks:');
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List disks:'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -103,8 +108,10 @@ sub disco_show {
|
|||
|
||||
$self->manage_selection();
|
||||
foreach my $name (sort keys %{$self->{disk}}) {
|
||||
$self->{output}->add_disco_entry(disk_id => $self->{disk}->{$name}->{dstDiskId},
|
||||
state => $self->{disk}->{$name}->{dstState});
|
||||
$self->{output}->add_disco_entry(
|
||||
disk_id => $self->{disk}->{$name}->{dstDiskId},
|
||||
state => $self->{disk}->{$name}->{dstState}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,4 +132,3 @@ Filter by disk id.
|
|||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -110,4 +109,3 @@ Filter by hypervisor name.
|
|||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -110,4 +109,3 @@ Filter by storage pool name.
|
|||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
@ -36,9 +36,8 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -51,10 +50,14 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $snmp_result = $self->{snmp}->get_multiple_table(oids => [
|
||||
my $snmp_result = $self->{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $mapping->{vmName}->{oid} },
|
||||
{ oid => $mapping->{vmPowerState}->{oid} },
|
||||
], return_type => 1, nothing_quit => 1);
|
||||
],
|
||||
return_type => 1,
|
||||
nothing_quit => 1
|
||||
);
|
||||
$self->{vm} = {};
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{vmPowerState}->{oid}\.(.*)$/);
|
||||
|
@ -80,8 +83,10 @@ sub run {
|
|||
$self->{output}->output_add(long_msg => "[name = " . $self->{vm}->{$name}->{vmName} . "] [state = " . $self->{vm}->{$name}->{vmPowerState} . "]");
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List Virtual Machines:');
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List Virtual Machines:'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -98,8 +103,10 @@ sub disco_show {
|
|||
|
||||
$self->manage_selection();
|
||||
foreach my $name (sort keys %{$self->{vm}}) {
|
||||
$self->{output}->add_disco_entry(name => $self->{vm}->{$name}->{vmName},
|
||||
state => $self->{vm}->{$name}->{vmPowerState});
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $self->{vm}->{$name}->{vmName},
|
||||
state => $self->{vm}->{$name}->{vmPowerState}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,4 +127,3 @@ Filter by virtual machine name.
|
|||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
@ -43,11 +43,13 @@ sub custom_usage_perfdata {
|
|||
$total_options{cast_int} = 1;
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
|
||||
$self->{output}->perfdata_add(
|
||||
label => $label . $extra_label, unit => 'B',
|
||||
value => $value_perf,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
||||
min => 0, max => $self->{result_values}->{total});
|
||||
min => 0, max => $self->{result_values}->{total}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_threshold {
|
||||
|
@ -70,11 +72,12 @@ sub custom_usage_output {
|
|||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
my $msg = sprintf("Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
||||
return sprintf(
|
||||
'Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
||||
return $msg;
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_usage_calc {
|
||||
|
@ -86,7 +89,6 @@ sub custom_usage_calc {
|
|||
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
|
||||
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
|
||||
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -133,9 +135,9 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'units:s' => { name => 'units', default => '%' },
|
||||
'free' => { name => 'free' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -166,8 +168,10 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
$self->{sp} = {};
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_spitEntry,
|
||||
nothing_quit => 1);
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_spitEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{spitStoragePoolName}->{oid}\.(.*)$/);
|
||||
|
@ -181,8 +185,9 @@ sub manage_selection {
|
|||
next;
|
||||
}
|
||||
|
||||
$self->{sp}->{$instance} = { display => $result->{spitStoragePoolName},
|
||||
%$result,
|
||||
$self->{sp}->{$instance} = {
|
||||
display => $result->{spitStoragePoolName},
|
||||
%$result
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -135,8 +135,10 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
$self->{vm} = {};
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_vmEntry,
|
||||
nothing_quit => 1);
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_vmEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{vmName}->{oid}\.(.*)$/);
|
||||
|
@ -152,8 +154,9 @@ sub manage_selection {
|
|||
|
||||
$result->{vmRxBytes} *= 8;
|
||||
$result->{vmTxBytes} *= 8;
|
||||
$self->{vm}->{$instance} = { display => $result->{vmName},
|
||||
%$result,
|
||||
$self->{vm}->{$instance} = {
|
||||
display => $result->{vmName},
|
||||
%$result
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue