remove useless code

This commit is contained in:
garnier-quentin 2019-12-30 11:59:35 +01:00
parent 023d7b7e05
commit 60feb006af
2 changed files with 41 additions and 44 deletions

View File

@ -95,8 +95,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
$options{options}->add_options(arguments => {
});
return $self;
@ -116,18 +115,25 @@ sub manage_selection {
my $oid_pop3Hits = '.1.3.6.1.4.1.21067.2.1.2.9.1.0';
my $oid_imapHits = '.1.3.6.1.4.1.21067.2.1.2.9.2.0';
my $oid_smtpHits = '.1.3.6.1.4.1.21067.2.1.2.9.3.0';
my $result = $options{snmp}->get_leef(oids => [$oid_liveUsers, $oid_httpHits, $oid_ftpHits, $oid_pop3Hits,
$oid_imapHits, $oid_smtpHits], nothing_quit => 1);
my $result = $options{snmp}->get_leef(
oids => [
$oid_liveUsers, $oid_httpHits, $oid_ftpHits, $oid_pop3Hits,
$oid_imapHits, $oid_smtpHits
],
nothing_quit => 1
);
$self->{cache_name} = "cyberoam_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
$self->{global} = { live_users => $result->{$oid_liveUsers},
$self->{global} = {
live_users => $result->{$oid_liveUsers},
http_hits => $result->{$oid_httpHits},
ftp_hits => $result->{$oid_ftpHits},
pop3_hits => $result->{$oid_pop3Hits},
imap_hits => $result->{$oid_imapHits},
smtp_hits => $result->{$oid_smtpHits} };
smtp_hits => $result->{$oid_smtpHits}
};
}
1;

View File

@ -33,6 +33,7 @@ sub set_counters {
{ name => 'global', type => 0 },
{ name => 'sea_msg', type => 1, cb_prefix_output => 'prefix_seamsg_output', message_multiple => 'All messages are ok' },
];
$self->{maps_counters}->{global} = [
{ label => 'queue', set => {
key_values => [ { name => 'queue' } ],
@ -95,9 +96,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-type:s" => { name => 'filter_type' },
$options{options}->add_options(arguments => {
'filter-type:s' => { name => 'filter_type' },
});
return $self;
@ -115,12 +115,6 @@ my $oid_seaStatisticsQueuedMessages = '.1.3.6.1.4.1.2604.1.1.1.5';
sub manage_selection {
my ($self, %options) = @_;
my $oid_liveUsers = '.1.3.6.1.4.1.21067.2.1.2.6.0';
my $oid_httpHits = '.1.3.6.1.4.1.21067.2.1.2.7.0';
my $oid_ftpHits = '.1.3.6.1.4.1.21067.2.1.2.8.0';
my $oid_pop3Hits = '.1.3.6.1.4.1.21067.2.1.2.9.1.0';
my $oid_imapHits = '.1.3.6.1.4.1.21067.2.1.2.9.2.0';
my $oid_smtpHits = '.1.3.6.1.4.1.21067.2.1.2.9.3.0';
my $results = $options{snmp}->get_table(oid => $oid_sophosStatisticsEmail, nothing_quit => 1);
$self->{cache_name} = "sophos_es_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
@ -142,8 +136,10 @@ sub manage_selection {
next;
}
$self->{sea_msg}->{lc($result->{counterType})} = { display => lc($result->{counterType}),
in => $result->{counterInbound}, out => $result->{counterOutbound}
$self->{sea_msg}->{lc($result->{counterType})} = {
display => lc($result->{counterType}),
in => $result->{counterInbound},
out => $result->{counterOutbound}
};
$self->{global}->{total_in} += $result->{counterInbound};
@ -170,14 +166,9 @@ Filter message type (can be a regexp).
Only display some counters (regexp can be used).
Example: --filter-counters='queue'
=item B<--warning-*>
Threshold warning.
=item B<--critical-*>
Threshold critical.
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: queue, total-msg-in, total-msg-out, msg-in, msg-out.
=back