remove useless code
This commit is contained in:
parent
023d7b7e05
commit
60feb006af
|
@ -28,7 +28,7 @@ use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_output' },
|
{ name => 'global', type => 0, cb_prefix_output => 'prefix_output' },
|
||||||
];
|
];
|
||||||
|
@ -86,7 +86,7 @@ sub set_counters {
|
||||||
|
|
||||||
sub prefix_output {
|
sub prefix_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return "Requests: ";
|
return "Requests: ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,11 +94,10 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
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_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_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 $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,
|
my $result = $options{snmp}->get_leef(
|
||||||
$oid_imapHits, $oid_smtpHits], nothing_quit => 1);
|
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} . '_' .
|
$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'));
|
(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} = {
|
||||||
http_hits => $result->{$oid_httpHits},
|
live_users => $result->{$oid_liveUsers},
|
||||||
ftp_hits => $result->{$oid_ftpHits},
|
http_hits => $result->{$oid_httpHits},
|
||||||
pop3_hits => $result->{$oid_pop3Hits},
|
ftp_hits => $result->{$oid_ftpHits},
|
||||||
imap_hits => $result->{$oid_imapHits},
|
pop3_hits => $result->{$oid_pop3Hits},
|
||||||
smtp_hits => $result->{$oid_smtpHits} };
|
imap_hits => $result->{$oid_imapHits},
|
||||||
|
smtp_hits => $result->{$oid_smtpHits}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -28,11 +28,12 @@ use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'global', type => 0 },
|
{ name => 'global', type => 0 },
|
||||||
{ name => 'sea_msg', type => 1, cb_prefix_output => 'prefix_seamsg_output', message_multiple => 'All messages are ok' },
|
{ name => 'sea_msg', type => 1, cb_prefix_output => 'prefix_seamsg_output', message_multiple => 'All messages are ok' },
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{global} = [
|
$self->{maps_counters}->{global} = [
|
||||||
{ label => 'queue', set => {
|
{ label => 'queue', set => {
|
||||||
key_values => [ { name => 'queue' } ],
|
key_values => [ { name => 'queue' } ],
|
||||||
|
@ -61,7 +62,7 @@ sub set_counters {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{sea_msg} = [
|
$self->{maps_counters}->{sea_msg} = [
|
||||||
{ label => 'msg-in', set => {
|
{ label => 'msg-in', set => {
|
||||||
key_values => [ { name => 'in', diff => 1 }, { name => 'display' } ],
|
key_values => [ { name => 'in', diff => 1 }, { name => 'display' } ],
|
||||||
|
@ -94,12 +95,11 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'filter-type:s' => { name => 'filter_type' },
|
||||||
"filter-type:s" => { name => 'filter_type' },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,22 +114,16 @@ my $oid_seaStatisticsQueuedMessages = '.1.3.6.1.4.1.2604.1.1.1.5';
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
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);
|
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} . '_' .
|
$self->{cache_name} = "sophos_es_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||||
(defined($self->{option_results}->{filter_type}) ? md5_hex($self->{option_results}->{filter_type}) : md5_hex('all')) . '_' .
|
(defined($self->{option_results}->{filter_type}) ? md5_hex($self->{option_results}->{filter_type}) : md5_hex('all')) . '_' .
|
||||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||||
|
|
||||||
$self->{global} = { total_in => 0, total_out => 0 };
|
$self->{global} = { total_in => 0, total_out => 0 };
|
||||||
$self->{global}->{queue} = defined($results->{$oid_seaStatisticsQueuedMessages}) ? $results->{$oid_seaStatisticsQueuedMessages} : undef;
|
$self->{global}->{queue} = defined($results->{$oid_seaStatisticsQueuedMessages}) ? $results->{$oid_seaStatisticsQueuedMessages} : undef;
|
||||||
|
|
||||||
$self->{sea_msg} = {};
|
$self->{sea_msg} = {};
|
||||||
foreach my $oid (keys %$results) {
|
foreach my $oid (keys %$results) {
|
||||||
next if ($oid !~ /^$mapping->{counterType}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{counterType}->{oid}\.(.*)$/);
|
||||||
|
@ -141,11 +135,13 @@ sub manage_selection {
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{counterType} . "': no matching filter.", debug => 1);
|
$self->{output}->output_add(long_msg => "skipping '" . $result->{counterType} . "': no matching filter.", debug => 1);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{sea_msg}->{lc($result->{counterType})} = { display => lc($result->{counterType}),
|
$self->{sea_msg}->{lc($result->{counterType})} = {
|
||||||
in => $result->{counterInbound}, out => $result->{counterOutbound}
|
display => lc($result->{counterType}),
|
||||||
|
in => $result->{counterInbound},
|
||||||
|
out => $result->{counterOutbound}
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{global}->{total_in} += $result->{counterInbound};
|
$self->{global}->{total_in} += $result->{counterInbound};
|
||||||
$self->{global}->{total_out} += $result->{counterOutbound};
|
$self->{global}->{total_out} += $result->{counterOutbound};
|
||||||
}
|
}
|
||||||
|
@ -170,14 +166,9 @@ Filter message type (can be a regexp).
|
||||||
Only display some counters (regexp can be used).
|
Only display some counters (regexp can be used).
|
||||||
Example: --filter-counters='queue'
|
Example: --filter-counters='queue'
|
||||||
|
|
||||||
=item B<--warning-*>
|
=item B<--warning-*> B<--critical-*>
|
||||||
|
|
||||||
Threshold warning.
|
|
||||||
|
|
||||||
=item B<--critical-*>
|
|
||||||
|
|
||||||
Threshold critical.
|
|
||||||
|
|
||||||
|
Thresholds.
|
||||||
Can be: queue, total-msg-in, total-msg-out, msg-in, msg-out.
|
Can be: queue, total-msg-in, total-msg-out, msg-in, msg-out.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
Loading…
Reference in New Issue