(plugin) cloud::nutanix::snmp - remove characters (#3905)
* (plugin) cloud::nutanix::snmp - remove characters * (plugin) cloud::nutanix::snmp - remove characters
This commit is contained in:
parent
03204fb20a
commit
85287021d4
|
@ -61,7 +61,6 @@ sub custom_status_output {
|
||||||
"state: '%s'",
|
"state: '%s'",
|
||||||
$self->{result_values}->{state}
|
$self->{result_values}->{state}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_status_calc {
|
sub custom_status_calc {
|
||||||
|
@ -127,7 +126,7 @@ sub custom_usage_output {
|
||||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
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 ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
'usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)',
|
||||||
$total_size_value . " " . $total_size_unit,
|
$total_size_value . " " . $total_size_unit,
|
||||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||||
|
@ -179,18 +178,18 @@ sub set_counters {
|
||||||
},
|
},
|
||||||
{ label => 'inodes', nlabel => 'disk.storage.inodes.usage.percentage', set => {
|
{ label => 'inodes', nlabel => 'disk.storage.inodes.usage.percentage', set => {
|
||||||
key_values => [ { name => 'inodes_used' }, { name => 'display' } ],
|
key_values => [ { name => 'inodes_used' }, { name => 'display' } ],
|
||||||
output_template => 'Inodes Used : %s %%',
|
output_template => 'inodes used: %s %%',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'inodes', template => '%s', unit => '%',
|
{ label => 'inodes', template => '%s', unit => '%',
|
||||||
min => 0, label_extra_instance => 1 }
|
min => 0, label_extra_instance => 1 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'avg-latency', nlabel => 'disk.average.io.latency.microseconds', set => {
|
{ label => 'avg-latency', nlabel => 'disk.average.io.latency.milliseconds', set => {
|
||||||
key_values => [ { name => 'dstAverageLatency' } ],
|
key_values => [ { name => 'dstAverageLatency' } ],
|
||||||
output_template => 'Average Latency : %s µs',
|
output_template => 'average latency: %.3f ms',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'avg_latency', template => '%s', unit => 'µs',
|
{ label => 'avg_latency', template => '%.3f', unit => 'ms',
|
||||||
min => 0, label_extra_instance => 1 }
|
min => 0, label_extra_instance => 1 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -222,11 +221,6 @@ sub new {
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
}
|
|
||||||
|
|
||||||
my %map_state = (1 => 'online', 2 => 'offline');
|
my %map_state = (1 => 'online', 2 => 'offline');
|
||||||
|
|
||||||
my $disk_mapping = {
|
my $disk_mapping = {
|
||||||
|
@ -269,6 +263,8 @@ sub manage_selection {
|
||||||
my $controllervm_instance = $1;
|
my $controllervm_instance = $1;
|
||||||
my $controllervm_result = $options{snmp}->map_instance(mapping => $controllervm_mapping, results => $controllervm_snmp_result, instance => $controllervm_instance);
|
my $controllervm_result = $options{snmp}->map_instance(mapping => $controllervm_mapping, results => $controllervm_snmp_result, instance => $controllervm_instance);
|
||||||
|
|
||||||
|
$controllervm_result->{crtName} = centreon::plugins::misc::trim($controllervm_result->{crtName});
|
||||||
|
|
||||||
if (defined($self->{option_results}->{filter_controllervm}) && $self->{option_results}->{filter_controllervm} ne '' &&
|
if (defined($self->{option_results}->{filter_controllervm}) && $self->{option_results}->{filter_controllervm} ne '' &&
|
||||||
$controllervm_result->{crtName} !~ /$self->{option_results}->{filter_controllervm}/) {
|
$controllervm_result->{crtName} !~ /$self->{option_results}->{filter_controllervm}/) {
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $controllervm_result->{crtName} . "': no matching filter.", debug => 1);
|
$self->{output}->output_add(long_msg => "skipping '" . $controllervm_result->{crtName} . "': no matching filter.", debug => 1);
|
||||||
|
@ -309,6 +305,8 @@ sub manage_selection {
|
||||||
my $inodes_used;
|
my $inodes_used;
|
||||||
$inodes_used = 100 - ($disk_result->{dstNumFreeInodes} * 100 / $disk_result->{dstNumTotalInodes}) if ($disk_result->{dstNumTotalInodes} > 0);
|
$inodes_used = 100 - ($disk_result->{dstNumFreeInodes} * 100 / $disk_result->{dstNumTotalInodes}) if ($disk_result->{dstNumTotalInodes} > 0);
|
||||||
|
|
||||||
|
$disk_result->{dstAverageLatency} /= 1000;
|
||||||
|
|
||||||
$self->{controllervm}->{ $controllervm_name_mapping->{ $disk_result->{dstControllerVMId} } }->{disk}->{ $disk_result->{dstDiskId} } = {
|
$self->{controllervm}->{ $controllervm_name_mapping->{ $disk_result->{dstControllerVMId} } }->{disk}->{ $disk_result->{dstDiskId} } = {
|
||||||
name => $controllervm_name_mapping->{$disk_result->{dstControllerVMId}},
|
name => $controllervm_name_mapping->{$disk_result->{dstControllerVMId}},
|
||||||
display => $disk_result->{dstDiskId},
|
display => $disk_result->{dstDiskId},
|
||||||
|
|
|
@ -63,6 +63,7 @@ sub manage_selection {
|
||||||
return_type => 1,
|
return_type => 1,
|
||||||
nothing_quit => 1
|
nothing_quit => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->{disk} = {};
|
$self->{disk} = {};
|
||||||
foreach my $oid (keys %{$snmp_result}) {
|
foreach my $oid (keys %{$snmp_result}) {
|
||||||
next if ($oid !~ /^$mapping->{dstState}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{dstState}->{oid}\.(.*)$/);
|
||||||
|
@ -75,7 +76,7 @@ sub manage_selection {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{disk}->{$result->{dstDiskId}} = { %{$result} };
|
$self->{disk}->{ $result->{dstDiskId} } = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue