fix(linux/local): storage mode calc (#2957)
This commit is contained in:
parent
0e85d2332f
commit
09407c878d
|
@ -89,8 +89,8 @@ sub custom_usage_calc {
|
|||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'};
|
||||
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'};
|
||||
$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}->{free} = $options{new_datas}->{$self->{instance} . '_free'};
|
||||
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / ($self->{result_values}->{used} + $self->{result_values}->{free});
|
||||
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
|
||||
|
||||
return 0;
|
||||
|
@ -105,7 +105,7 @@ sub set_counters {
|
|||
|
||||
$self->{maps_counters}->{disks} = [
|
||||
{ label => 'usage', set => {
|
||||
key_values => [ { name => 'display' }, { name => 'used' }, { name => 'total' } ],
|
||||
key_values => [ { name => 'display' }, { name => 'used' }, { name => 'free' }, { name => 'total' } ],
|
||||
closure_custom_calc => $self->can('custom_usage_calc'),
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
|
||||
|
@ -159,8 +159,14 @@ sub manage_selection {
|
|||
next if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
||||
$mount !~ /$self->{option_results}->{filter_mountpoint}/);
|
||||
|
||||
$size *= 1024;
|
||||
$self->{disks}->{$mount} = { display => $mount, fs => $fs, type => $type, total => $size, used => $used * 1024 };
|
||||
$self->{disks}->{$mount} = {
|
||||
display => $mount,
|
||||
fs => $fs,
|
||||
type => $type,
|
||||
total => $size * 1024,
|
||||
used => $used * 1024,
|
||||
free => $available * 1024
|
||||
};
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{disks}}) <= 0) {
|
||||
|
|
Loading…
Reference in New Issue