add counter ironport proxy-usage

This commit is contained in:
garnier-quentin 2020-01-28 17:37:00 +01:00
parent c731846a22
commit 136ef71936
1 changed files with 38 additions and 26 deletions

View File

@ -54,50 +54,60 @@ sub set_counters {
key_values => [ { name => 'cacheClientRequests', diff => 1 }, { name => 'cacheClientHits', diff => 1 } ], key_values => [ { name => 'cacheClientRequests', diff => 1 }, { name => 'cacheClientHits', diff => 1 } ],
closure_custom_calc => $self->can('custom_data_calc'), closure_custom_calc => $self->can('custom_data_calc'),
closure_custom_calc_extra_options => { hit_ref => 'cacheClientHits', total_ref => 'cacheClientRequests' }, closure_custom_calc_extra_options => { hit_ref => 'cacheClientHits', total_ref => 'cacheClientRequests' },
output_template => 'client hits rate : %.2f %%', output_use => 'hits_prct', threshold_use => 'hits_prct', output_template => 'client hits rate: %.2f %%', output_use => 'hits_prct', threshold_use => 'hits_prct',
perfdatas => [ perfdatas => [
{ label => 'client_http_hits_rate', value => 'hits_prct', template => '%.2f', min => 0, max => 100, unit => '%' }, { value => 'hits_prct', template => '%.2f', min => 0, max => 100, unit => '%' },
], ],
} }
}, },
{ label => 'client-http-errors', display_ok => 0, nlabel => 'client.http.errors.count', set => { { label => 'client-http-errors', display_ok => 0, nlabel => 'client.http.errors.count', set => {
key_values => [ { name => 'cacheClientErrors', diff => 1 } ], key_values => [ { name => 'cacheClientErrors', diff => 1 } ],
output_template => 'client errors : %s', output_template => 'client errors: %s',
perfdatas => [ perfdatas => [
{ label => 'client_http_errors', value => 'cacheClientErrors_absolute', template => '%s', { value => 'cacheClientErrors_absolute', template => '%s',
min => 0 }, min => 0 },
], ],
} }
}, },
{ label => 'client-http-traffic-in', display_ok => 0, nlabel => 'client.http.traffic.in.bitspersecond', set => { { label => 'client-http-traffic-in', display_ok => 0, nlabel => 'client.http.traffic.in.bitspersecond', set => {
key_values => [ { name => 'cacheClientInKb', diff => 1 } ], key_values => [ { name => 'cacheClientInKb', diff => 1 } ],
output_template => 'client traffic in : %s %s/s', output_template => 'client traffic in: %s %s/s',
per_second => 1, output_change_bytes => 2, per_second => 1, output_change_bytes => 2,
perfdatas => [ perfdatas => [
{ label => 'client_http_traffic_in', value => 'cacheClientInKb_per_second', template => '%s', { value => 'cacheClientInKb_per_second', template => '%s',
min => 0, unit => 'b/s' }, min => 0, unit => 'b/s' },
], ],
} }
}, },
{ label => 'client-http-traffic-out', display_ok => 0, nlabel => 'client.http.traffic.out.bitspersecond', set => { { label => 'client-http-traffic-out', display_ok => 0, nlabel => 'client.http.traffic.out.bitspersecond', set => {
key_values => [ { name => 'cacheClientOutKb', diff => 1 } ], key_values => [ { name => 'cacheClientOutKb', diff => 1 } ],
output_template => 'client traffic Out : %s %s/s', output_template => 'client traffic out: %s %s/s',
per_second => 1, output_change_bytes => 2, per_second => 1, output_change_bytes => 2,
perfdatas => [ perfdatas => [
{ label => 'client_http_traffic_out', value => 'cacheClientOutKb_per_second', template => '%s', { value => 'cacheClientOutKb_per_second', template => '%s',
min => 0, unit => 'b/s' }, min => 0, unit => 'b/s' },
], ],
} }
}, },
{ label => 'total-con-clients', nlabel => 'client.http.total.connections.count', set => { { label => 'total-con-clients', nlabel => 'client.http.total.connections.count', set => {
key_values => [ { name => 'cacheClientTotalConns' } ], key_values => [ { name => 'cacheClientTotalConns' } ],
output_template => 'total number of clients : %s', output_template => 'total number of clients: %s',
perfdatas => [ perfdatas => [
{ label => 'total_con_clients', value => 'cacheClientTotalConns_absolute', template => '%s', { value => 'cacheClientTotalConns_absolute', template => '%s',
min => 0 }, min => 0 },
], ],
} }
}, },
{ label => 'client-http-requests', display_ok => 0, nlabel => 'client.http.requests.persecond', set => {
key_values => [ { name => 'cacheClientRequests', diff => 1 } ],
output_template => 'client requests: %.2f/s',
per_second => 1,
perfdatas => [
{ value => 'cacheClientRequests_per_second', template => '%.2f',
min => 0, unit => '/s' },
],
}
},
]; ];
$self->{maps_counters}->{global_icp} = [ $self->{maps_counters}->{global_icp} = [
@ -105,9 +115,9 @@ sub set_counters {
key_values => [ { name => 'cacheClientICPRequests', diff => 1 }, { name => 'cacheClientICPHits', diff => 1 } ], key_values => [ { name => 'cacheClientICPRequests', diff => 1 }, { name => 'cacheClientICPHits', diff => 1 } ],
closure_custom_calc_extra_options => { hit_ref => 'cacheClientICPHits', total_ref => 'cacheClientICPRequests' }, closure_custom_calc_extra_options => { hit_ref => 'cacheClientICPHits', total_ref => 'cacheClientICPRequests' },
closure_custom_calc => $self->can('custom_data_calc'), closure_custom_calc => $self->can('custom_data_calc'),
output_template => 'client hits rate : %.2f %%', output_use => 'hits_prct', threshold_use => 'hits_prct', output_template => 'client hits rate: %.2f %%', output_use => 'hits_prct', threshold_use => 'hits_prct',
perfdatas => [ perfdatas => [
{ label => 'client_icp_hits_rate', value => 'hits_prct', template => '%.2f', min => 0, max => 100, unit => '%' }, { value => 'hits_prct', template => '%.2f', min => 0, max => 100, unit => '%' },
], ],
} }
}, },
@ -116,29 +126,29 @@ sub set_counters {
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'http-mean-time', nlabel => 'http.response.mean.time.milliseconds', set => { { label => 'http-mean-time', nlabel => 'http.response.mean.time.milliseconds', set => {
key_values => [ { name => 'cacheMeanRespTime' } ], key_values => [ { name => 'cacheMeanRespTime' } ],
output_template => 'http mean response time : %s ms', output_template => 'http mean response time: %s ms',
perfdatas => [ perfdatas => [
{ label => 'http_mean_time', value => 'cacheMeanRespTime_absolute', template => '%s', { value => 'cacheMeanRespTime_absolute', template => '%s',
min => 0, unit => 'ms' }, min => 0, unit => 'ms' },
], ],
} }
}, },
{ label => 'server-traffic-in', display_ok => 0, nlabel => 'server.traffic.in.bitspersecond', set => { { label => 'server-traffic-in', display_ok => 0, nlabel => 'server.traffic.in.bitspersecond', set => {
key_values => [ { name => 'cacheServerInKb', diff => 1 } ], key_values => [ { name => 'cacheServerInKb', diff => 1 } ],
output_template => 'server traffic in : %s %s/s', output_template => 'server traffic in: %s %s/s',
per_second => 1, output_change_bytes => 2, per_second => 1, output_change_bytes => 2,
perfdatas => [ perfdatas => [
{ label => 'server_traffic_in', value => 'cacheServerInKb_per_second', template => '%s', { value => 'cacheServerInKb_per_second', template => '%s',
min => 0, unit => 'b/s' }, min => 0, unit => 'b/s' },
], ],
} }
}, },
{ label => 'server-traffic-out', display_ok => 0, nlabel => 'server.traffic.out.bitspersecond', set => { { label => 'server-traffic-out', display_ok => 0, nlabel => 'server.traffic.out.bitspersecond', set => {
key_values => [ { name => 'cacheServerOutKb', diff => 1 } ], key_values => [ { name => 'cacheServerOutKb', diff => 1 } ],
output_template => 'server traffic Out : %s %s/s', output_template => 'server traffic out: %s %s/s',
per_second => 1, output_change_bytes => 2, per_second => 1, output_change_bytes => 2,
perfdatas => [ perfdatas => [
{ label => 'server_traffic_out', value => 'cacheServerOutKb_per_second', template => '%s', { value => 'cacheServerOutKb_per_second', template => '%s',
min => 0, unit => 'b/s' }, min => 0, unit => 'b/s' },
], ],
} }
@ -149,13 +159,13 @@ sub set_counters {
sub prefix_http_output { sub prefix_http_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "http "; return 'http ';
} }
sub prefix_icp_output { sub prefix_icp_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "icp "; return 'icp ';
} }
sub new { sub new {
@ -187,7 +197,9 @@ sub manage_selection {
); );
my $snmp_result = $options{snmp}->get_leef(oids => [ my $snmp_result = $options{snmp}->get_leef(oids => [
values %oids values %oids
], nothing_quit => 1); ],
nothing_quit => 1
);
$self->{global_http} = { $self->{global_http} = {
cacheClientRequests => $snmp_result->{$oids{cacheClientRequests}}, cacheClientRequests => $snmp_result->{$oids{cacheClientRequests}},
@ -228,9 +240,9 @@ Example: --filter-counters='http'
=item B<--warning-*> B<--critical-*> =item B<--warning-*> B<--critical-*>
Threshold warning. Thresholds.
Can be: 'client-http-hits-rate', 'client-http-errors', 'client-http-traffic-in', Can be: 'client-http-hits-rate', 'client-http-errors', 'client-http-traffic-in',
'client-http-traffic-out', 'total-con-clients', 'client-icp-hits-rate', 'client-http-traffic-out', 'client-http-requests', 'total-con-clients', 'client-icp-hits-rate',
'server-traffic-in', 'server-traffic-out', 'http-mean-time'. 'server-traffic-in', 'server-traffic-out', 'http-mean-time'.
=back =back