This commit is contained in:
garnier-quentin 2021-01-12 08:29:12 +01:00
parent ae4ead2724
commit 590ad9d536
1 changed files with 12 additions and 14 deletions

View File

@ -28,14 +28,14 @@ use warnings;
sub custom_tunnel_output {
my ($self, %options) = @_;
my $msg = sprintf("tunnels total: %s used: %s (%.2f%%) free: %s (%.2f%%)",
return sprintf(
'tunnels total: %s used: %s (%.2f%%) free: %s (%.2f%%)',
$self->{result_values}->{total},
$self->{result_values}->{used},
$self->{result_values}->{prct_used},
$self->{result_values}->{free},
$self->{result_values}->{prct_free}
);
return $msg;
}
sub set_counters {
@ -50,28 +50,26 @@ sub set_counters {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_tunnel_output'),
perfdatas => [
{ value => 'used', template => '%d', min => 0, max => 'total',
cast_int => 1 },
],
{ template => '%d', min => 0, max => 'total', cast_int => 1 }
]
}
},
{ label => 'tunnels-usage-free', display_ok => 0, nlabel => 'globalprotect.tunnels.free.count', set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_tunnel_output'),
perfdatas => [
{ value => 'free', template => '%d', min => 0, max => 'total',
cast_int => 1 },
],
{ template => '%d', min => 0, max => 'total', cast_int => 1 }
]
}
},
{ label => 'tunnels-usage-prct', display_ok => 0, nlabel => 'globalprotect.tunnels.free.percentage', set => {
key_values => [ { name => 'prct_used' } ],
output_template => 'tunnels active used: %.2f %%',
{ label => 'tunnels-usage-prct', display_ok => 0, nlabel => 'globalprotect.tunnels.usage.percentage', set => {
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_tunnel_output'),
perfdatas => [
{ value => 'prct_used', template => '%.2f', min => 0, max => 100, unit => '%' },
],
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
}
];
}