fix memory snmp new perfdata
This commit is contained in:
parent
092972b8ea
commit
86baa22f34
|
@ -166,13 +166,16 @@ sub compat_threshold_counter {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
foreach ('warning', 'critical') {
|
foreach ('warning', 'critical') {
|
||||||
next if (!defined($options{option_results}->{$_ . '-' . $options{compat}->{th}}) || $options{option_results}->{$_ . '-' . $options{compat}->{th}} eq '');
|
foreach my $th (@{$options{compat}->{th}}) {
|
||||||
|
next if (!defined($options{option_results}->{$_ . '-' . $th->[0]}) || $options{option_results}->{$_ . '-' . $th->[0]} eq '');
|
||||||
|
|
||||||
if (defined($options{compat}->{free})) {
|
if (defined($options{compat}->{free})) {
|
||||||
$options{option_results}->{$_ . '-' . $options{compat}->{th} . '-free'} = $options{option_results}->{$_ . '-' . $options{compat}->{th}};
|
$options{option_results}->{$_ . '-' . $th->[1]->{free}} = $options{option_results}->{$_ . '-' . $th->[0]};
|
||||||
$options{option_results}->{$_ . '-' . $options{compat}->{th}} = undef;
|
$options{option_results}->{$_ . '-' . $th->[0]} = undef;
|
||||||
} elsif (defined($options{compat}->{units}) && $options{compat}->{units} eq '%') {
|
} elsif (defined($options{compat}->{units}) && $options{compat}->{units} eq '%') {
|
||||||
$options{option_results}->{$_ . '-' . $options{compat}->{th} . '-prct'} = $options{option_results}->{$_ . '-' . $options{compat}->{th}};
|
$options{option_results}->{$_ . '-' . $th->[1]->{prct}} = $options{option_results}->{$_ . '-' . $th->[0]};
|
||||||
$options{option_results}->{$_ . '-' . $options{compat}->{th}} = undef;
|
$options{option_results}->{$_ . '-' . $th->[0]} = undef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,8 +184,18 @@ sub check_options {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
# Compatibility
|
# Compatibility
|
||||||
$self->compat_threshold_counter(%options, compat => { th => 'usage', units => $options{option_results}->{units}, free => $options{option_results}->{free}});
|
$self->compat_threshold_counter(%options,
|
||||||
$self->compat_threshold_counter(%options, compat => { th => 'swap', units => $options{option_results}->{units}, free => $options{option_results}->{free}});
|
compat => {
|
||||||
|
th => [ ['usage', { free => 'usage-free', prct => 'usage-prct'} ], [ 'memory-usage-bytes', { free => 'memory-free-bytes', prct => 'memory-usage-percentage' } ] ],
|
||||||
|
units => $options{option_results}->{units}, free => $options{option_results}->{free}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$self->compat_threshold_counter(%options,
|
||||||
|
compat => {
|
||||||
|
th => [ ['swap', { free => 'swap-free', prct => 'swap-prct' } ], [ 'swap-usage-bytes', { free => 'swap-free-bytes', prct => 'swap-usage-percentage' } ] ],
|
||||||
|
units => $options{option_results}->{units}, free => $options{option_results}->{free}
|
||||||
|
}
|
||||||
|
);
|
||||||
$self->SUPER::check_options(%options);
|
$self->SUPER::check_options(%options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue