fix squid snmp

This commit is contained in:
garnier-quentin 2019-06-06 14:10:57 +02:00
parent d6f1925a3d
commit 8289fb146e

View File

@ -45,7 +45,7 @@ sub set_counters {
$self->{maps_counters_type} = [ $self->{maps_counters_type} = [
{ name => 'global_http', type => 0, , cb_prefix_output => 'prefix_http_output', skipped_code => { -10 => 1 } }, { name => 'global_http', type => 0, , cb_prefix_output => 'prefix_http_output', skipped_code => { -10 => 1 } },
{ name => 'global_icq', type => 0, , cb_prefix_output => 'prefix_icq_output', skipped_code => { -10 => 1 } }, { name => 'global_icp', type => 0, , cb_prefix_output => 'prefix_icp_output', skipped_code => { -10 => 1 } },
{ name => 'global', type => 0, , cb_prefix_output => 'prefix_server_output', skipped_code => { -10 => 1 } } { name => 'global', type => 0, , cb_prefix_output => 'prefix_server_output', skipped_code => { -10 => 1 } }
]; ];
@ -90,23 +90,23 @@ sub set_counters {
}, },
]; ];
$self->{maps_counters}->{global_icq} = [ $self->{maps_counters}->{global_icp} = [
{ label => 'icq-traffic-in', set => { { label => 'icp-traffic-in', set => {
key_values => [ { name => 'cacheIcpKbRecv', diff => 1 } ], key_values => [ { name => 'cacheIcpKbRecv', diff => 1 } ],
output_template => 'traffic in : %s %s/s', output_template => 'traffic in : %s %s/s',
per_second => 1, output_change_bytes => 2, per_second => 1, output_change_bytes => 2,
perfdatas => [ perfdatas => [
{ label => 'icq_traffic_in', value => 'cacheIcpKbRecv_per_second', template => '%s', { label => 'icp_traffic_in', value => 'cacheIcpKbRecv_per_second', template => '%s',
min => 0, unit => 'b/s' }, min => 0, unit => 'b/s' },
], ],
} }
}, },
{ label => 'icq-traffic-out', set => { { label => 'icp-traffic-out', set => {
key_values => [ { name => 'cacheIcpKbSent', diff => 1 } ], key_values => [ { name => 'cacheIcpKbSent', diff => 1 } ],
output_template => 'traffic Out : %s %s/s', output_template => 'traffic Out : %s %s/s',
per_second => 1, output_change_bytes => 2, per_second => 1, output_change_bytes => 2,
perfdatas => [ perfdatas => [
{ label => 'icq_traffic_out', value => 'cacheIcpKbSent_per_second', template => '%s', { label => 'icp_traffic_out', value => 'cacheIcpKbSent_per_second', template => '%s',
min => 0, unit => 'b/s' }, min => 0, unit => 'b/s' },
], ],
} }
@ -152,10 +152,10 @@ sub prefix_http_output {
return "HTTP "; return "HTTP ";
} }
sub prefix_icq_output { sub prefix_icp_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "ICQ "; return "ICP ";
} }
sub prefix_server_output { sub prefix_server_output {
@ -170,9 +170,8 @@ sub new {
bless $self, $class; bless $self, $class;
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -203,7 +202,7 @@ sub manage_selection {
cacheHttpInKb => $snmp_result->{$oids{cacheHttpInKb}} * 1024 * 8, cacheHttpInKb => $snmp_result->{$oids{cacheHttpInKb}} * 1024 * 8,
cacheHttpOutKb => $snmp_result->{$oids{cacheHttpOutKb}} * 1024 * 8, cacheHttpOutKb => $snmp_result->{$oids{cacheHttpOutKb}} * 1024 * 8,
}; };
$self->{global_icq} = { $self->{global_icp} = {
cacheIcpKbSent => $snmp_result->{$oids{cacheIcpKbSent}} * 1024 * 8, cacheIcpKbSent => $snmp_result->{$oids{cacheIcpKbSent}} * 1024 * 8,
cacheIcpKbRecv => $snmp_result->{$oids{cacheIcpKbRecv}} * 1024 * 8, cacheIcpKbRecv => $snmp_result->{$oids{cacheIcpKbRecv}} * 1024 * 8,
}; };