remove useless code

This commit is contained in:
garnier-quentin 2020-06-17 09:03:22 +02:00
parent 7cc56d54e3
commit b182c38aed
4 changed files with 74 additions and 71 deletions

View File

@ -55,7 +55,7 @@ sub set_counters {
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold
}
},
{ label => 'in-traffic', set => {
@ -64,8 +64,8 @@ sub set_counters {
output_template => 'traffic in : %s %s/s',
perfdatas => [
{ label => 'traffic_in', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'out-traffic', set => {
@ -74,8 +74,8 @@ sub set_counters {
output_template => 'traffic out : %s %s/s',
perfdatas => [
{ label => 'traffic_out', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'clients', set => {
@ -83,8 +83,8 @@ sub set_counters {
output_template => 'current client connections : %s',
perfdatas => [
{ label => 'clients', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'cpu', set => {
@ -92,8 +92,8 @@ sub set_counters {
output_template => 'cpu usage : %.2f %%',
perfdatas => [
{ label => 'cpu', template => '%.2f',
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' },
],
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'memory', set => {
@ -101,10 +101,10 @@ sub set_counters {
output_template => 'memory usage : %.2f %%',
perfdatas => [
{ label => 'memory', template => '%.2f',
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' },
],
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
]
}
},
}
];
}
@ -123,7 +123,7 @@ sub new {
'filter-name:s' => { name => 'filter_name' },
'unknown-status:s' => { name => 'unknown_status', default => '' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '%{admin} eq "enable" and %{status} !~ /online/i' },
'critical-status:s' => { name => 'critical_status', default => '%{admin} eq "enable" and %{status} !~ /online/i' }
});
return $self;
@ -146,7 +146,7 @@ my %map_ap_connect_status = (
my $mapping = {
fgWcWtpConfigWtpAdmin => { oid => '.1.3.6.1.4.1.12356.101.14.4.3.1.2', map => \%map_ap_admin },
fgWcWtpConfigWtpName => { oid => '.1.3.6.1.4.1.12356.101.14.4.3.1.3' },
fgWcWtpConfigWtpName => { oid => '.1.3.6.1.4.1.12356.101.14.4.3.1.3' }
};
my $mapping2 = {
@ -155,7 +155,7 @@ my $mapping2 = {
fgWcWtpSessionWtpByteRxCount => { oid => '.1.3.6.1.4.1.12356.101.14.4.4.1.18' },
fgWcWtpSessionWtpByteTxCount => { oid => '.1.3.6.1.4.1.12356.101.14.4.4.1.19' },
fgWcWtpSessionWtpCpuUsage => { oid => '.1.3.6.1.4.1.12356.101.14.4.4.1.20' },
fgWcWtpSessionWtpMemoryUsage => { oid => '.1.3.6.1.4.1.12356.101.14.4.4.1.21' },
fgWcWtpSessionWtpMemoryUsage => { oid => '.1.3.6.1.4.1.12356.101.14.4.4.1.21' }
};
my $oid_fgWcWtpConfigEntry = '.1.3.6.1.4.1.12356.101.14.4.3.1';

View File

@ -38,83 +38,83 @@ sub set_counters {
key_values => [ { name => 'fgIpsIntrusionsDetected', diff => 1 }, { name => 'display' } ],
output_template => 'Intrusions detected : %s',
perfdatas => [
{ label => 'intrusions_detected', value => 'fgIpsIntrusionsDetected', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'intrusions_detected', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'intrusions-blocked', nlabel => 'domain.intrusions.blocked.count', set => {
key_values => [ { name => 'fgIpsIntrusionsBlocked', diff => 1 }, { name => 'display' } ],
output_template => 'Intrusions blocked : %s',
perfdatas => [
{ label => 'intrusions_blocked', value => 'fgIpsIntrusionsBlocked', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'intrusions_blocked', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'crit-sev-detections', nlabel => 'domain.intrusions.detected.critical.severity.count', set => {
key_values => [ { name => 'fgIpsCritSevDetections', diff => 1 }, { name => 'display' } ],
output_template => 'Critical severity intrusions detected : %s',
perfdatas => [
{ label => 'crit_sev_detections', value => 'fgIpsCritSevDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'crit_sev_detections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'high-sev-detections', nlabel => 'domain.intrusions.detected.high.severity.count', set => {
key_values => [ { name => 'fgIpsHighSevDetections', diff => 1 }, { name => 'display' } ],
output_template => 'High severity intrusions detected : %s',
perfdatas => [
{ label => 'high_sev_detections', value => 'fgIpsHighSevDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'high_sev_detections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'med-sev-detections', nlabel => 'domain.intrusions.detected.medium.severity.count', set => {
key_values => [ { name => 'fgIpsMedSevDetections', diff => 1 }, { name => 'display' } ],
output_template => 'Medium severity intrusions detected : %s',
perfdatas => [
{ label => 'med_sev_detections', value => 'fgIpsMedSevDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'med_sev_detections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'low-sev-detections', nlabel => 'domain.intrusions.detected.low.severity.count', set => {
key_values => [ { name => 'fgIpsLowSevDetections', diff => 1 }, { name => 'display' } ],
output_template => 'Low severity intrusions detected : %s',
perfdatas => [
{ label => 'low_sev_detections', value => 'fgIpsLowSevDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'low_sev_detections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'info-sev-detections', nlabel => 'domain.intrusions.detected.info.severity.count', set => {
key_values => [ { name => 'fgIpsInfoSevDetections', diff => 1 }, { name => 'display' } ],
output_template => 'Informational severity intrusions detected : %s',
perfdatas => [
{ label => 'info_sev_detections', value => 'fgIpsInfoSevDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'info_sev_detections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'signature-detections', nlabel => 'domain.intrusions.detected.signature.count', set => {
key_values => [ { name => 'fgIpsSignatureDetections', diff => 1 }, { name => 'display' } ],
output_template => 'Signature intrusions detected : %s',
perfdatas => [
{ label => 'signature_detection', value => 'fgIpsSignatureDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'signature_detection', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'anomaly-detections', nlabel => 'domain.intrusions.detected.anomaly.count', set => {
key_values => [ { name => 'fgIpsAnomalyDetections', diff => 1 }, { name => 'display' } ],
output_template => 'Anomaly intrusions detected : %s',
perfdatas => [
{ label => 'anomaly_detections', value => 'fgIpsAnomalyDetections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'anomaly_detections', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
}
];
}
@ -130,7 +130,7 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'filter-name:s' => { name => 'filter_name' }
});
return $self;
@ -145,7 +145,7 @@ my $mapping = {
fgIpsLowSevDetections => { oid => '.1.3.6.1.4.1.12356.101.9.2.1.1.6' },
fgIpsInfoSevDetections => { oid => '.1.3.6.1.4.1.12356.101.9.2.1.1.7' },
fgIpsSignatureDetections => { oid => '.1.3.6.1.4.1.12356.101.9.2.1.1.8' },
fgIpsAnomalyDetections => { oid => '.1.3.6.1.4.1.12356.101.9.2.1.1.9' },
fgIpsAnomalyDetections => { oid => '.1.3.6.1.4.1.12356.101.9.2.1.1.9' }
};
my $oid_fgIpsStatsEntry = '.1.3.6.1.4.1.12356.101.9.2.1.1';
my $oid_fgVdEntName = '.1.3.6.1.4.1.12356.101.3.2.1.1.2';
@ -155,8 +155,8 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_fgVdEntName},
{ oid => $oid_fgIpsStatsEntry},
{ oid => $oid_fgVdEntName },
{ oid => $oid_fgIpsStatsEntry }
],
nothing_quit => 1
);
@ -176,7 +176,7 @@ sub manage_selection {
$self->{domain}->{$instance} = $result;
$self->{domain}->{$instance}->{display} = $snmp_result->{$oid_fgVdEntName}->{$oid};
}
if (scalar(keys %{$self->{domain}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No domain found.");
$self->{output}->option_exit();

View File

@ -33,7 +33,7 @@ sub set_counters {
{ name => 'av', type => 0, cb_prefix_output => 'prefix_av_output' },
{ name => 'avet', type => 0, cb_prefix_output => 'prefix_avet_output' },
{ name => 'ips', type => 0, cb_prefix_output => 'prefix_ips_output' },
{ name => 'ipset', type => 0, cb_prefix_output => 'prefix_ipset_output' },
{ name => 'ipset', type => 0, cb_prefix_output => 'prefix_ipset_output' }
];
$self->{maps_counters}->{av} = [
@ -43,11 +43,12 @@ sub set_counters {
output_template => "last refresh is: '%s'",
perfdatas => [
{ label => 'av_update', value => 'value',
template => '%d', min => 0, unit => 's' },
],
template => '%d', min => 0, unit => 's' }
]
}
},
}
];
$self->{maps_counters}->{avet} = [
{ label => 'avet', set => {
key_values => [ { name => 'human' }, { name => 'value' } ],
@ -55,11 +56,12 @@ sub set_counters {
output_template => "last refresh is: '%s'",
perfdatas => [
{ label => 'avet_update', value => 'value',
template => '%d', min => 0, unit => 's' },
],
template => '%d', min => 0, unit => 's' }
]
}
},
}
];
$self->{maps_counters}->{ips} = [
{ label => 'ips', set => {
key_values => [ { name => 'human' }, { name => 'value' } ],
@ -67,11 +69,12 @@ sub set_counters {
output_template => "last refresh is: '%s'",
perfdatas => [
{ label => 'ips_update', value => 'value',
template => '%d', min => 0, unit => 's' },
],
template => '%d', min => 0, unit => 's' }
]
}
},
}
];
$self->{maps_counters}->{ipset} = [
{ label => 'ipset', set => {
key_values => [ { name => 'human' }, { name => 'value' } ],
@ -79,10 +82,10 @@ sub set_counters {
output_template => "last refresh is: '%s'",
perfdatas => [
{ label => 'ipset_update', value => 'value',
template => '%d', min => 0, unit => 's' },
],
template => '%d', min => 0, unit => 's' }
]
}
},
}
];
}

View File

@ -39,8 +39,8 @@ sub set_counters {
output_template => 'virus detected: %s',
perfdatas => [
{ label => 'virus_detected', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'virus-detected-psec', nlabel => 'domain.virus.detected.persecond', display_ok => 0, set => {
@ -48,8 +48,8 @@ sub set_counters {
output_template => 'virus detected: %.2f/s',
perfdatas => [
{ label => 'domain.virus.detected.persecond', template => '%.2f',
unit => '/s', min => 0, label_extra_instance => 1, instance_use => 'display' },
],
unit => '/s', min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'virus-blocked', nlabel => 'domain.virus.blocked.count', set => {
@ -57,8 +57,8 @@ sub set_counters {
output_template => 'virus blocked: %s',
perfdatas => [
{ label => 'virus_blocked', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display' },
],
min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'virus-blocked-psec', nlabel => 'domain.virus.blocked.persecond', display_ok => 0, set => {
@ -66,8 +66,8 @@ sub set_counters {
output_template => 'virus blocked: %.2f/s',
perfdatas => [
{ label => 'domain.virus.blocked.persecond', template => '%.2f',
unit => '/s', min => 0, label_extra_instance => 1, instance_use => 'display' },
],
unit => '/s', min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
}
];
@ -85,7 +85,7 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'filter-name:s' => { name => 'filter_name' }
});
return $self;
@ -104,7 +104,7 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_fgVdEntName },
{ oid => $oid_fgAvStatsEntry, end => $mapping->{fgAvVirusBlocked}->{oid} },
{ oid => $oid_fgAvStatsEntry, end => $mapping->{fgAvVirusBlocked}->{oid} }
],
nothing_quit => 1
);