Fix #2037
This commit is contained in:
parent
0d8b52c436
commit
d6168f3ac6
|
@ -34,40 +34,40 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{policy} = [
|
||||
{ label => 'current-connections', set => {
|
||||
{ label => 'current-connections', nlabel => 'policy.connections.current.count', set => {
|
||||
key_values => [ { name => 'wgPolicyCurrActiveConns' }, { name => 'display' } ],
|
||||
output_template => 'Current connections : %s',
|
||||
output_template => 'current connections: %s',
|
||||
perfdatas => [
|
||||
{ label => 'current_connections', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'current_connections', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'total-connections', set => {
|
||||
{ label => 'total-connections', nlabel => 'policy.connections.total.count', set => {
|
||||
key_values => [ { name => 'wgPolicyActiveStreams', diff => 1 }, { name => 'display' } ],
|
||||
output_template => 'Total connections : %s',
|
||||
output_template => 'total connections: %s',
|
||||
perfdatas => [
|
||||
{ label => 'total_connections', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'total_connections', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'l3-traffic', set => {
|
||||
{ label => 'l3-traffic', nlabel => 'policy.traffic.l3.bitspersecond', set => {
|
||||
key_values => [ { name => 'wgPolicyL3PackageBytes', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'L3 Traffic : %s %s/s',
|
||||
output_template => 'L3 traffic: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
perfdatas => [
|
||||
{ label => 'traffic_l3', template => '%.2f', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'traffic_l3', template => '%.2f', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'l2-traffic', set => {
|
||||
{ label => 'l2-traffic', nlabel => 'policy.traffic.l2.bitspersecond', set => {
|
||||
key_values => [ { name => 'wgPolicyL2PackageBytes', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'L2 Traffic : %s %s/s',
|
||||
output_template => 'L2 traffic: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
perfdatas => [
|
||||
{ label => 'traffic_l2', template => '%.2f', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'traffic_l2', template => '%.2f', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ my $mapping = {
|
|||
wgPolicyL3PackageBytes => { oid => '.1.3.6.1.4.1.3097.4.2.2.1.3' },
|
||||
wgPolicyActiveStreams => { oid => '.1.3.6.1.4.1.3097.4.2.2.1.12' },
|
||||
wgPolicyCurrActiveConns => { oid => '.1.3.6.1.4.1.3097.4.2.2.1.18' },
|
||||
wgPolicyL2PackageBytes => { oid => '.1.3.6.1.4.1.3097.4.2.2.1.19' },
|
||||
wgPolicyL2PackageBytes => { oid => '.1.3.6.1.4.1.3097.4.2.2.1.19' }
|
||||
};
|
||||
|
||||
my $oid_wgPolicyEntry = '.1.3.6.1.4.1.3097.4.2.2.1';
|
||||
|
@ -108,9 +108,10 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
$self->{policy} = {};
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_wgPolicyEntry,
|
||||
nothing_quit => 1);
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_wgPolicyEntry,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach my $oid (keys %{$snmp_result}) {
|
||||
next if ($oid !~ /^$mapping->{wgPolicyName}->{oid}\.(.*)$/);
|
||||
|
@ -127,8 +128,12 @@ sub manage_selection {
|
|||
if ($result->{wgPolicyCurrActiveConns} == 4294967295) {
|
||||
$result->{wgPolicyCurrActiveConns} = 0;
|
||||
}
|
||||
|
||||
$self->{policy}->{$instance} = { display => $result->{wgPolicyName},
|
||||
|
||||
$result->{wgPolicyL3PackageBytes} *= 8;
|
||||
$result->{wgPolicyL2PackageBytes} *= 8;
|
||||
|
||||
$self->{policy}->{$instance} = {
|
||||
display => $result->{wgPolicyName},
|
||||
%$result
|
||||
};
|
||||
}
|
||||
|
@ -137,8 +142,8 @@ sub manage_selection {
|
|||
$self->{output}->add_option_msg(short_msg => "No policy found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{cache_name} = "watchguard_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
|
||||
$self->{cache_name} = 'watchguard_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
|
||||
}
|
||||
|
|
|
@ -34,32 +34,32 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'connections', set => {
|
||||
{ label => 'connections', nlabel => 'system.connections.current.count', set => {
|
||||
key_values => [ { name => 'connections' } ],
|
||||
output_template => 'Current connections : %s',
|
||||
output_template => 'Current connections: %s',
|
||||
perfdatas => [
|
||||
{ label => 'current_connections', template => '%s', min => 0 },
|
||||
],
|
||||
{ label => 'current_connections', template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'in-traffic', set => {
|
||||
{ label => 'in-traffic', nlabel => 'system.traffic.in.bitspersecond', set => {
|
||||
key_values => [ { name => 'in_traffic', per_second => 1 } ],
|
||||
output_template => 'Traffic In : %s %s/s',
|
||||
output_template => 'Traffic in: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
perfdatas => [
|
||||
{ label => 'traffic_in', template => '%s', min => 0, unit => 'b/s' },
|
||||
],
|
||||
{ label => 'traffic_in', template => '%s', min => 0, unit => 'b/s' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'out-traffic', set => {
|
||||
{ label => 'out-traffic', nlabel => 'system.traffic.out.bitspersecond', set => {
|
||||
key_values => [ { name => 'out_traffic', per_second => 1 } ],
|
||||
output_template => 'Traffic Out : %s %s/s',
|
||||
output_template => 'Traffic out: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
perfdatas => [
|
||||
{ label => 'traffic_out', template => '%s', min => 0, unit => 'b/s' },
|
||||
],
|
||||
{ label => 'traffic_out', template => '%s', min => 0, unit => 'b/s' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -78,20 +78,27 @@ sub manage_selection {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
if ($options{snmp}->is_snmpv1()) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to use SNMP v2c or v3.");
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to use SNMP v2c or v3.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
my $oid_wgSystemTotalSendBytes = '.1.3.6.1.4.1.3097.6.3.8.0';
|
||||
my $oid_wgSystemTotalRecvBytes = '.1.3.6.1.4.1.3097.6.3.9.0';
|
||||
my $oid_wgSystemCurrActiveConns = '.1.3.6.1.4.1.3097.6.3.80.0';
|
||||
my $snmp_result = $options{snmp}->get_leef(oids => [
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_wgSystemTotalSendBytes, $oid_wgSystemTotalRecvBytes, $oid_wgSystemCurrActiveConns
|
||||
], nothing_quit => 1);
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = { out_traffic => $snmp_result->{$oid_wgSystemTotalSendBytes},
|
||||
in_traffic => $snmp_result->{$oid_wgSystemTotalRecvBytes}, connections => $snmp_result->{$oid_wgSystemCurrActiveConns} };
|
||||
$self->{cache_name} = "watchguard_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
$self->{global} = {
|
||||
out_traffic => $snmp_result->{$oid_wgSystemTotalSendBytes} * 8,
|
||||
in_traffic => $snmp_result->{$oid_wgSystemTotalRecvBytes} * 8,
|
||||
connections => $snmp_result->{$oid_wgSystemCurrActiveConns}
|
||||
};
|
||||
|
||||
$self->{cache_name} = 'watchguard_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
}
|
||||
|
||||
|
@ -108,16 +115,11 @@ Check system statistics.
|
|||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^(connections)$'
|
||||
Example: --filter-counters='^connections$'
|
||||
|
||||
=item B<--warning-*>
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'in-traffic', 'out-traffic', 'connections'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Thresholds.
|
||||
Can be: 'in-traffic', 'out-traffic', 'connections'.
|
||||
|
||||
=back
|
||||
|
|
Loading…
Reference in New Issue