This commit is contained in:
garnier-quentin 2020-06-02 16:59:06 +02:00
parent a373c63f29
commit e588cd63da
3 changed files with 20 additions and 24 deletions

View File

@ -33,7 +33,7 @@ sub new {
$options{options}->add_options(arguments => {
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical' },
'units:s' => { name => 'units', default => 'absolute' },
'units:s' => { name => 'units', default => 'absolute' }
});
return $self;
@ -93,6 +93,7 @@ sub run {
);
$self->{output}->perfdata_add(
label => 'connections', unit => 'con',
nlabel => 'connections.active.count',
value => $result->{$oid_fwNumCom},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),

View File

@ -46,38 +46,38 @@ sub set_counters {
$self->{maps_counters_type} = [
{ name => 'memory', type => 0, cb_prefix_output => 'prefix_memory_output' },
{ name => 'swap', type => 0, cb_prefix_output => 'prefix_swap_output' },
{ name => 'swap', type => 0, cb_prefix_output => 'prefix_swap_output', skipped_code => { -10 => 1 } },
{ name => 'malloc', type => 0, skipped_code => { -10 => 1 } },
];
$self->{maps_counters}->{memory} = [
{ label => 'memory', set => {
{ label => 'memory', nlabel => 'memory.usage.bytes', set => {
key_values => [ { name => 'prct_used'}, { name => 'used' }, { name => 'free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
threshold_use => 'prct_used',
perfdatas => [
{ label => 'memory', value => 'used', template => '%.2f', threshold_total => 'total', cast_int => 1,
min => 0, max => 'total', unit => 'B' },
],
{ label => 'memory', value => 'used', template => '%s', threshold_total => 'total', cast_int => 1,
min => 0, max => 'total', unit => 'B' }
]
}
},
}
];
$self->{maps_counters}->{swap} = [
{ label => 'swap', set => {
{ label => 'swap', nlabel => 'swap.usage.bytes', set => {
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
threshold_use => 'prct_used',
perfdatas => [
{ label => 'swap', value => 'used', template => '%.2f', threshold_total => 'total', cast_int => 1,
min => 0, max => 'total', unit => 'B' },
],
{ label => 'swap', value => 'used', template => '%s', threshold_total => 'total', cast_int => 1,
min => 0, max => 'total', unit => 'B' }
]
}
},
}
];
$self->{maps_counters}->{malloc} = [
{ label => 'failed-malloc', set => {
{ label => 'failed-malloc', nlabel => 'memory.allocations.failed.persecond', set => {
key_values => [ { name => 'failed_mallocs', per_second => 1 } ],
output_template => 'Failed memory allocations %.2f/s',
perfdatas => [
@ -165,17 +165,12 @@ Check memory, swap usage and failed memory allocations per sec
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^(failed-malloc)$'
Example: --filter-counters='failed-malloc'
=item B<--warning-*>
=item B<--warning-*> B<--critical-*>
Threshold warning.
Can be: 'memory', 'swap', 'failed-malloc'
=item B<--critical-*>
Threshold critical.
Can be: 'memory', 'swap', 'failed-malloc'
Thresholds.
Can be: 'memory' (%), 'swap' (%), 'failed-malloc'
=back

View File

@ -30,7 +30,7 @@ sub new {
bless $self, $class;
$self->{version} = '0.5';
%{$self->{modes}} = (
$self->{modes} = {
'connections' => 'network::checkpoint::snmp::mode::connections',
'cpu' => 'network::checkpoint::snmp::mode::cpu',
'disk' => 'network::checkpoint::snmp::mode::disk',
@ -44,7 +44,7 @@ sub new {
'vpn-status' => 'network::checkpoint::snmp::mode::vpnstatus',
'vrrp-status' => 'snmp_standard::mode::vrrp',
'vsx' => 'network::checkpoint::snmp::mode::vsx'
);
};
return $self;
}