add mcafee web gateway plugin
This commit is contained in:
parent
1cff42084d
commit
32e8139de4
|
@ -0,0 +1,120 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::mode::clients;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'clients', set => {
|
||||
key_values => [ { name => 'stClientCount' } ],
|
||||
output_template => 'Connected clients: %d',
|
||||
perfdatas => [
|
||||
{ label => 'connected_clients', value => 'stClientCount_absolute', template => '%d',
|
||||
min => 0, unit => 'clients' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'sockets', set => {
|
||||
key_values => [ { name => 'stConnectedSockets' } ],
|
||||
output_template => 'Open network sockets: %d',
|
||||
perfdatas => [
|
||||
{ label => 'open_sockets', value => 'stConnectedSockets_absolute', template => '%d',
|
||||
min => 0, unit => 'sockets' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-counters:s" => { name => 'filter_counters', default => '' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $oid_stClientCount = '.1.3.6.1.4.1.1230.2.7.2.5.2.0';
|
||||
my $oid_stConnectedSockets = '.1.3.6.1.4.1.1230.2.7.2.5.3.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $options{snmp}->get_leef(oids => [ $oid_stClientCount, $oid_stConnectedSockets ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
|
||||
$self->{global} = {
|
||||
stClientCount => $results->{$oid_stClientCount},
|
||||
stConnectedSockets => $results->{$oid_stConnectedSockets},
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check connected clients and open network sockets.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
(Example: --filter-counters='clients')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'clients', 'sockets'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'clients', 'sockets'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,172 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::mode::connections;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_connection_output' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'legitimate', set => {
|
||||
key_values => [ { name => 'stConnectionsLegitimate', diff => 1 } ],
|
||||
output_template => 'Legitimate: %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'legitimate_connections', value => 'stConnectionsLegitimate_per_second', template => '%d',
|
||||
min => 0, unit => 'connections/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'blocked', set => {
|
||||
key_values => [ { name => 'stConnectionsBlocked', diff => 1 } ],
|
||||
output_template => 'Blocked: %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'blocked_connections', value => 'stConnectionsBlocked_per_second', template => '%d',
|
||||
min => 0, unit => 'connections/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'blocked-by-am', set => {
|
||||
key_values => [ { name => 'stBlockedByAntiMalware', diff => 1 } ],
|
||||
output_template => 'Blocked by Anti Malware: %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'blocked_by_am', value => 'stBlockedByAntiMalware_per_second', template => '%d',
|
||||
min => 0, unit => 'connections/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'blocked-by-mf', set => {
|
||||
key_values => [ { name => 'stBlockedByMediaFilter', diff => 1 } ],
|
||||
output_template => 'Blocked by Media Filter: %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'blocked_by_mf', value => 'stBlockedByMediaFilter_per_second', template => '%d',
|
||||
min => 0, unit => 'connections/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'blocked-by-uf', set => {
|
||||
key_values => [ { name => 'stBlockedByURLFilter', diff => 1 } ],
|
||||
output_template => 'Blocked by URL Filter: %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'blocked_by_uf', value => 'stBlockedByURLFilter_per_second', template => '%d',
|
||||
min => 0, unit => 'connections/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_connection_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Connections (per sec) ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-counters:s" => { name => 'filter_counters', default => '' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $oid_stConnectionsLegitimate = '.1.3.6.1.4.1.1230.2.7.2.1.3.0';
|
||||
my $oid_stBlockedByAntiMalware = '.1.3.6.1.4.1.1230.2.7.2.1.4.0';
|
||||
my $oid_stConnectionsBlocked = '.1.3.6.1.4.1.1230.2.7.2.1.5.0';
|
||||
my $oid_stBlockedByMediaFilter = '.1.3.6.1.4.1.1230.2.7.2.1.6.0';
|
||||
my $oid_stBlockedByURLFilter = '.1.3.6.1.4.1.1230.2.7.2.1.7.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{cache_name} = "mcafee_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
|
||||
my $results = $options{snmp}->get_leef(oids => [ $oid_stConnectionsLegitimate, $oid_stBlockedByAntiMalware,
|
||||
$oid_stConnectionsBlocked, $oid_stBlockedByMediaFilter,
|
||||
$oid_stBlockedByURLFilter ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
|
||||
$self->{global} = {
|
||||
stConnectionsLegitimate => $results->{$oid_stConnectionsLegitimate},
|
||||
stBlockedByAntiMalware => $results->{$oid_stBlockedByAntiMalware},
|
||||
stConnectionsBlocked => $results->{$oid_stConnectionsBlocked},
|
||||
stBlockedByMediaFilter => $results->{$oid_stBlockedByMediaFilter},
|
||||
stBlockedByURLFilter => $results->{$oid_stBlockedByURLFilter},
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check connections statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
(Example: --filter-counters='blocked')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'legitimate', 'blocked', 'blocked-by-am',
|
||||
'blocked-by-mf', 'blocked-by-uf'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'legitimate', 'blocked', 'blocked-by-am',
|
||||
'blocked-by-mf', 'blocked-by-uf'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,170 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::mode::detections;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'categories', type => 1, cb_prefix_output => 'prefix_categories_output',
|
||||
message_multiple => 'All categories are ok' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'malware-detected', set => {
|
||||
key_values => [ { name => 'stMalwareDetected', diff => 1 } ],
|
||||
output_template => 'Malware detected (per sec): %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'malware_detected', value => 'stMalwareDetected_per_second', template => '%d',
|
||||
min => 0, unit => 'detections/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
$self->{maps_counters}->{categories} = [
|
||||
{ label => 'category', set => {
|
||||
key_values => [ { name => 'stCategoryCount', diff => 1 }, { name => 'stCategoryName' } ],
|
||||
output_template => 'detections (per sec): %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'category', value => 'stCategoryCount_per_second', template => '%d',
|
||||
min => 0, unit => 'detections/s', label_extra_instance => 1,
|
||||
instance_use => 'stCategoryName_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_categories_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Category '" . $options{instance_value}->{stCategoryName} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"filter-counters:s" => { name => 'filter_counters', default => '' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $oid_stMalwareDetected = '.1.3.6.1.4.1.1230.2.7.2.1.2.0';
|
||||
|
||||
my $mapping = {
|
||||
stCategoryName => { oid => '.1.3.6.1.4.1.1230.2.7.2.1.10.1.1' },
|
||||
stCategoryCount => { oid => '.1.3.6.1.4.1.1230.2.7.2.1.10.1.2' },
|
||||
};
|
||||
my $oid_stCategoriesEntry = '.1.3.6.1.4.1.1230.2.7.2.1.10.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{cache_name} = "mcafee_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
|
||||
my $results = $options{snmp}->get_leef(oids => [ $oid_stMalwareDetected ], nothing_quit => 1);
|
||||
|
||||
my $results2 = $options{snmp}->get_table(oid => $oid_stCategoriesEntry, nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{categories} = {};
|
||||
|
||||
$self->{global} = {
|
||||
stMalwareDetected => $results->{$oid_stMalwareDetected},
|
||||
};
|
||||
|
||||
foreach my $oid (keys %{$results2}) {
|
||||
next if ($oid !~ /^$mapping->{stCategoryName}->{oid}\.(\d+)/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $results2, instance => $instance);
|
||||
|
||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||
$result->{stCategoryName} !~ /$self->{option_results}->{filter_name}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{stCategoryName} . "': no matching filter name.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{categories}->{$result->{stCategoryName}} = {
|
||||
stCategoryName => $result->{stCategoryName},
|
||||
stCategoryCount => $result->{stCategoryCount},
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{categories}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No categories found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check detections statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter category name (can be a regexp).
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
(Example: --filter-counters='^(?!(category)$)')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'malware-detected', 'category'
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'malware-detected', 'category'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,163 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::mode::ftpstatistics;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'traffics', type => 0, cb_prefix_output => 'prefix_traffic_output' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{traffics} = [
|
||||
{ label => 'client-to-proxy', set => {
|
||||
key_values => [ { name => 'stFtpBytesFromClient', diff => 1 } ],
|
||||
output_template => 'from client to proxy: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'ftp_traffic_client_to_proxy', value => 'stFtpBytesFromClient_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'server-to-proxy', set => {
|
||||
key_values => [ { name => 'stFtpBytesFromServer', diff => 1 } ],
|
||||
output_template => 'from server to proxy: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'ftp_traffic_server_to_proxy', value => 'stFtpBytesFromServer_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'proxy-to-client', set => {
|
||||
key_values => [ { name => 'stFtpBytesToClient', diff => 1 } ],
|
||||
output_template => 'from proxy to client: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'ftp_traffic_proxy_to_client', value => 'stFtpBytesToClient_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'proxy-to-server', set => {
|
||||
key_values => [ { name => 'stFtpBytesToServer', diff => 1 } ],
|
||||
output_template => 'from proxy to server: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'ftp_traffic_proxy_to_server', value => 'stFtpBytesToServer_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_traffic_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "FTP Traffic ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-counters:s" => { name => 'filter_counters', default => '' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $oid_stFtpBytesFromClient = '.1.3.6.1.4.1.1230.2.7.2.4.2.0';
|
||||
my $oid_stFtpBytesFromServer = '.1.3.6.1.4.1.1230.2.7.2.4.3.0';
|
||||
my $oid_stFtpBytesToClient = '.1.3.6.1.4.1.1230.2.7.2.4.4.0';
|
||||
my $oid_stFtpBytesToServer = '.1.3.6.1.4.1.1230.2.7.2.4.5.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{cache_name} = "mcafee_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
|
||||
my $results = $options{snmp}->get_leef(oids => [ $oid_stFtpBytesFromClient, $oid_stFtpBytesFromServer,
|
||||
$oid_stFtpBytesToClient, $oid_stFtpBytesToServer ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{traffics} = {};
|
||||
|
||||
$self->{traffics} = {
|
||||
stFtpBytesFromClient => $results->{$oid_stFtpBytesFromClient} * 8,
|
||||
stFtpBytesFromServer => $results->{$oid_stFtpBytesFromServer} * 8,
|
||||
stFtpBytesToClient => $results->{$oid_stFtpBytesToClient} * 8,
|
||||
stFtpBytesToServer => $results->{$oid_stFtpBytesToServer} * 8,
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check FTP statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
(Example: --filter-counters='^proxy')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'client-to-proxy', 'server-to-proxy',
|
||||
'proxy-to-client', 'proxy-to-server'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'client-to-proxy', 'server-to-proxy',
|
||||
'proxy-to-client', 'proxy-to-server'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,182 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::mode::httpsstatistics;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'traffics', type => 0, cb_prefix_output => 'prefix_traffic_output' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'requests', set => {
|
||||
key_values => [ { name => 'stHttpsRequests', diff => 1 } ],
|
||||
output_template => 'HTTPS Requests (per sec): %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'https_requests', value => 'stHttpsRequests_per_second', template => '%d',
|
||||
min => 0, unit => 'requests/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
$self->{maps_counters}->{traffics} = [
|
||||
{ label => 'client-to-proxy', set => {
|
||||
key_values => [ { name => 'stHttpsBytesFromClient', diff => 1 } ],
|
||||
output_template => 'from client to proxy: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'https_traffic_client_to_proxy', value => 'stHttpsBytesFromClient_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'server-to-proxy', set => {
|
||||
key_values => [ { name => 'stHttpsBytesFromServer', diff => 1 } ],
|
||||
output_template => 'from server to proxy: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'https_traffic_server_to_proxy', value => 'stHttpsBytesFromServer_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'proxy-to-client', set => {
|
||||
key_values => [ { name => 'stHttpsBytesToClient', diff => 1 } ],
|
||||
output_template => 'from proxy to client: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'https_traffic_proxy_to_client', value => 'stHttpsBytesToClient_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'proxy-to-server', set => {
|
||||
key_values => [ { name => 'stHttpsBytesToServer', diff => 1 } ],
|
||||
output_template => 'from proxy to server: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'https_traffic_proxy_to_server', value => 'stHttpsBytesToServer_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_traffic_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "HTTPS Traffic ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-counters:s" => { name => 'filter_counters', default => '' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $oid_stHttpsRequests = '.1.3.6.1.4.1.1230.2.7.2.3.1.0';
|
||||
my $oid_stHttpsBytesFromClient = '.1.3.6.1.4.1.1230.2.7.2.3.3.0';
|
||||
my $oid_stHttpsBytesFromServer = '.1.3.6.1.4.1.1230.2.7.2.3.4.0';
|
||||
my $oid_stHttpsBytesToClient = '.1.3.6.1.4.1.1230.2.7.2.3.5.0';
|
||||
my $oid_stHttpsBytesToServer = '.1.3.6.1.4.1.1230.2.7.2.3.6.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{cache_name} = "mcafee_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
|
||||
my $results = $options{snmp}->get_leef(oids => [ $oid_stHttpsRequests, $oid_stHttpsBytesFromClient,
|
||||
$oid_stHttpsBytesFromServer, $oid_stHttpsBytesToClient,
|
||||
$oid_stHttpsBytesToServer ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{traffics} = {};
|
||||
|
||||
$self->{global} = {
|
||||
stHttpsRequests => $results->{$oid_stHttpsRequests},
|
||||
};
|
||||
$self->{traffics} = {
|
||||
stHttpsBytesFromClient => $results->{$oid_stHttpsBytesFromClient} * 8,
|
||||
stHttpsBytesFromServer => $results->{$oid_stHttpsBytesFromServer} * 8,
|
||||
stHttpsBytesToClient => $results->{$oid_stHttpsBytesToClient} * 8,
|
||||
stHttpsBytesToServer => $results->{$oid_stHttpsBytesToServer} * 8,
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check HTTPS statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
(Example: --filter-counters='^proxy')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
|
||||
'proxy-to-client', 'proxy-to-server'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
|
||||
'proxy-to-client', 'proxy-to-server'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,182 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::mode::httpstatistics;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'traffics', type => 0, cb_prefix_output => 'prefix_traffic_output' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'requests', set => {
|
||||
key_values => [ { name => 'stHttpRequests', diff => 1 } ],
|
||||
output_template => 'HTTP Requests (per sec): %d',
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'http_requests', value => 'stHttpRequests_per_second', template => '%d',
|
||||
min => 0, unit => 'requests/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
$self->{maps_counters}->{traffics} = [
|
||||
{ label => 'client-to-proxy', set => {
|
||||
key_values => [ { name => 'stHttpBytesFromClient', diff => 1 } ],
|
||||
output_template => 'from client to proxy: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'http_traffic_client_to_proxy', value => 'stHttpBytesFromClient_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'server-to-proxy', set => {
|
||||
key_values => [ { name => 'stHttpBytesFromServer', diff => 1 } ],
|
||||
output_template => 'from server to proxy: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'http_traffic_server_to_proxy', value => 'stHttpBytesFromServer_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'proxy-to-client', set => {
|
||||
key_values => [ { name => 'stHttpBytesToClient', diff => 1 } ],
|
||||
output_template => 'from proxy to client: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'http_traffic_proxy_to_client', value => 'stHttpBytesToClient_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'proxy-to-server', set => {
|
||||
key_values => [ { name => 'stHttpBytesToServer', diff => 1 } ],
|
||||
output_template => 'from proxy to server: %s %s/s',
|
||||
output_change_bytes => 2,
|
||||
per_second => 1,
|
||||
perfdatas => [
|
||||
{ label => 'http_traffic_proxy_to_server', value => 'stHttpBytesToServer_per_second', template => '%d',
|
||||
min => 0, unit => 'b/s' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_traffic_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "HTTP Traffic ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-counters:s" => { name => 'filter_counters', default => '' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
my $oid_stHttpRequests = '.1.3.6.1.4.1.1230.2.7.2.2.1.0';
|
||||
my $oid_stHttpBytesFromClient = '.1.3.6.1.4.1.1230.2.7.2.2.3.0';
|
||||
my $oid_stHttpBytesFromServer = '.1.3.6.1.4.1.1230.2.7.2.2.4.0';
|
||||
my $oid_stHttpBytesToClient = '.1.3.6.1.4.1.1230.2.7.2.2.5.0';
|
||||
my $oid_stHttpBytesToServer = '.1.3.6.1.4.1.1230.2.7.2.2.6.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{cache_name} = "mcafee_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||
|
||||
my $results = $options{snmp}->get_leef(oids => [ $oid_stHttpRequests, $oid_stHttpBytesFromClient,
|
||||
$oid_stHttpBytesFromServer, $oid_stHttpBytesToClient,
|
||||
$oid_stHttpBytesToServer ],
|
||||
nothing_quit => 1);
|
||||
|
||||
$self->{global} = {};
|
||||
$self->{traffics} = {};
|
||||
|
||||
$self->{global} = {
|
||||
stHttpRequests => $results->{$oid_stHttpRequests},
|
||||
};
|
||||
$self->{traffics} = {
|
||||
stHttpBytesFromClient => $results->{$oid_stHttpBytesFromClient} * 8,
|
||||
stHttpBytesFromServer => $results->{$oid_stHttpBytesFromServer} * 8,
|
||||
stHttpBytesToClient => $results->{$oid_stHttpBytesToClient} * 8,
|
||||
stHttpBytesToServer => $results->{$oid_stHttpBytesToServer} * 8,
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check HTTP statistics.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
(Example: --filter-counters='^proxy')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
|
||||
'proxy-to-client', 'proxy-to-server'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
|
||||
'proxy-to-client', 'proxy-to-server'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::antivirus::mcafee::webgateway::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'clients' => 'apps::antivirus::mcafee::webgateway::snmp::mode::clients',
|
||||
'connections' => 'apps::antivirus::mcafee::webgateway::snmp::mode::connections',
|
||||
'detections' => 'apps::antivirus::mcafee::webgateway::snmp::mode::detections',
|
||||
'ftp-statistics' => 'apps::antivirus::mcafee::webgateway::snmp::mode::ftpstatistics',
|
||||
'http-statistics' => 'apps::antivirus::mcafee::webgateway::snmp::mode::httpstatistics',
|
||||
'https-statistics' => 'apps::antivirus::mcafee::webgateway::snmp::mode::httpsstatistics',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check McAfee Web Gateway through SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue