feat(skyhigh-webgateway): new snmp plugin forked from McAfee plugin (#5299)

Co-authored-by: Lucie Dubrunfaut <ldubrunfaut@CNTR-PORT-A198>

Refs: CTOR-454
This commit is contained in:
Lucie Dubrunfaut 2024-12-03 08:44:50 +01:00 committed by GitHub
parent 7c63a1a8d0
commit 24caa22517
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 1281 additions and 0 deletions

View File

@ -0,0 +1,7 @@
{
"dependencies": [
"libdigest-md5-perl",
"libsnmp-perl",
"libdatetime-perl"
]
}

View File

@ -0,0 +1,10 @@
{
"pkg_name": "centreon-plugin-Applications-Antivirus-Skyhigh-Webgateway-Snmp",
"pkg_summary": "Centreon Plugin to monitor Sky High Web Gateway application using SNMP",
"plugin_name": "centreon_skyhigh_webgateway_snmp.pl",
"files": [
"centreon/plugins/script_snmp.pm",
"centreon/plugins/snmp.pm",
"apps/antivirus/skyhigh/webgateway/snmp/"
]
}

View File

@ -0,0 +1,7 @@
{
"dependencies": [
"perl(SNMP)",
"perl(Digest::MD5)",
"perl(DateTime)"
]
}

View File

@ -0,0 +1,111 @@
#
# Copyright 2024 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::skyhigh::webgateway::snmp::mode::clients;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 }
];
$self->{maps_counters}->{global} = [
{ label => 'clients', nlabel => 'clients.connected.count', set => {
key_values => [ { name => 'stClientCount' } ],
output_template => 'Connected clients: %d',
perfdatas => [
{ label => 'connected_clients', template => '%d',
min => 0, unit => 'clients' }
]
}
},
{ label => 'sockets', nlabel => 'sockets.connected.count', set => {
key_values => [ { name => 'stConnectedSockets' } ],
output_template => 'Open network sockets: %d',
perfdatas => [
{ label => 'open_sockets', template => '%d',
min => 0, unit => 'sockets' }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
my $oid_stClientCount = '.1.3.6.1.4.1.59732.2.7.2.5.2.0';
my $oid_stConnectedSockets = '.1.3.6.1.4.1.59732.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} = {
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-*>
Warning threshold.
Can be: 'clients', 'sockets'.
=item B<--critical-*>
Critical threshold.
Can be: 'clients', 'sockets'.
=back
=cut

View File

@ -0,0 +1,157 @@
#
# Copyright 2024 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::skyhigh::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', nlabel => 'connections.legitimate.persecond', set => {
key_values => [ { name => 'stConnectionsLegitimate', per_second => 1 } ],
output_template => 'Legitimate: %d',
perfdatas => [
{ label => 'legitimate_connections', template => '%d', min => 0, unit => 'connections/s' }
]
}
},
{ label => 'blocked', nlabel => 'connections.blocked.persecond', set => {
key_values => [ { name => 'stConnectionsBlocked', per_second => 1 } ],
output_template => 'Blocked: %d',
perfdatas => [
{ label => 'blocked_connections', template => '%d', min => 0, unit => 'connections/s' }
]
}
},
{ label => 'blocked-by-am', nlabel => 'connections.antimalware.blocked.persecond', set => {
key_values => [ { name => 'stBlockedByAntiMalware', per_second => 1 } ],
output_template => 'Blocked by Anti Malware: %d',
perfdatas => [
{ label => 'blocked_by_am', template => '%d', min => 0, unit => 'connections/s' }
]
}
},
{ label => 'blocked-by-mf', nlabel => 'connections.mediafilter.blocked.persecond', set => {
key_values => [ { name => 'stBlockedByMediaFilter', per_second => 1 } ],
output_template => 'Blocked by Media Filter: %d',
perfdatas => [
{ label => 'blocked_by_mf', template => '%d', min => 0, unit => 'connections/s' }
]
}
},
{ label => 'blocked-by-uf', nlabel => 'connections.urlfilter.blocked.persecond', set => {
key_values => [ { name => 'stBlockedByURLFilter', per_second => 1 } ],
output_template => 'Blocked by URL Filter: %d',
perfdatas => [
{ label => 'blocked_by_uf', 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;
$options{options}->add_options(arguments => {
});
return $self;
}
my $oid_stConnectionsLegitimate = '.1.3.6.1.4.1.59732.2.7.2.1.3.0';
my $oid_stBlockedByAntiMalware = '.1.3.6.1.4.1.59732.2.7.2.1.4.0';
my $oid_stConnectionsBlocked = '.1.3.6.1.4.1.59732.2.7.2.1.5.0';
my $oid_stBlockedByMediaFilter = '.1.3.6.1.4.1.59732.2.7.2.1.6.0';
my $oid_stBlockedByURLFilter = '.1.3.6.1.4.1.59732.2.7.2.1.7.0';
sub manage_selection {
my ($self, %options) = @_;
$self->{cache_name} = 'skyhigh_' . $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} = {
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-*>
Warning threshold.
Can be: 'legitimate', 'blocked', 'blocked-by-am' for blocked by anti malware ,
'blocked-by-mf' for blocked by media Filter, 'blocked-by-uf' for blocked by URL filter.
=item B<--critical-*>
Critical threshold.
Can be: 'legitimate', 'blocked', 'blocked-by-am' for blocked by anti malware ,
'blocked-by-mf' for blocked by media Filter, 'blocked-by-uf' for blocked by URL filter.
=back
=cut

View File

@ -0,0 +1,157 @@
#
# Copyright 2024 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::skyhigh::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', nlabel => 'malwares.detected.persecond', set => {
key_values => [ { name => 'stMalwareDetected', per_second => 1 } ],
output_template => 'Malware detected (per sec): %d',
perfdatas => [
{ label => 'malware_detected', template => '%d', min => 0, unit => 'detections/s' }
]
}
}
];
$self->{maps_counters}->{categories} = [
{ label => 'category', nlabel => 'category.malwares.detected.persecond', set => {
key_values => [ { name => 'stCategoryCount', per_second => 1 }, { name => 'stCategoryName' } ],
output_template => 'detections (per sec): %d',
perfdatas => [
{ label => 'category', template => '%d',
min => 0, unit => 'detections/s', label_extra_instance => 1,
instance_use => 'stCategoryName' }
]
}
}
];
}
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;
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
my $oid_stMalwareDetected = '.1.3.6.1.4.1.59732.2.7.2.1.2.0';
my $mapping = {
stCategoryName => { oid => '.1.3.6.1.4.1.59732.2.7.2.1.10.1.1' },
stCategoryCount => { oid => '.1.3.6.1.4.1.59732.2.7.2.1.10.1.2' },
};
my $oid_stCategoriesEntry = '.1.3.6.1.4.1.59732.2.7.2.1.10.1';
sub manage_selection {
my ($self, %options) = @_;
$self->{cache_name} = 'skyhigh_' . $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} = {
stMalwareDetected => $results->{$oid_stMalwareDetected},
};
$self->{categories} = {};
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-*>
Warning threshold.
Can be: 'malware-detected', 'category'
=item B<--critical-*>
Critical threshold.
Can be: 'malware-detected', 'category'
=back
=cut

View File

@ -0,0 +1,150 @@
#
# Copyright 2024 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::skyhigh::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', nlabel => 'ftp.traffic.client2proxy.bitspersecond', set => {
key_values => [ { name => 'stFtpBytesFromClient', per_second => 1 } ],
output_template => 'from client to proxy: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'ftp_traffic_client_to_proxy', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'server-to-proxy', nlabel => 'ftp.traffic.server2proxy.bitspersecond', set => {
key_values => [ { name => 'stFtpBytesFromServer', per_second => 1 } ],
output_template => 'from server to proxy: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'ftp_traffic_server_to_proxy', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'proxy-to-client', nlabel => 'ftp.traffic.proxy2client.bitspersecond', set => {
key_values => [ { name => 'stFtpBytesToClient', per_second => 1 } ],
output_template => 'from proxy to client: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'ftp_traffic_proxy_to_client', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'proxy-to-server', nlabel => 'ftp.traffic.proxy2server.bitspersecond', set => {
key_values => [ { name => 'stFtpBytesToServer', per_second => 1 } ],
output_template => 'from proxy to server: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'ftp_traffic_proxy_to_server', 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;
$options{options}->add_options(arguments => {
});
return $self;
}
my $oid_stFtpBytesFromClient = '.1.3.6.1.4.1.59732.2.7.2.4.2.0';
my $oid_stFtpBytesFromServer = '.1.3.6.1.4.1.59732.2.7.2.4.3.0';
my $oid_stFtpBytesToClient = '.1.3.6.1.4.1.59732.2.7.2.4.4.0';
my $oid_stFtpBytesToServer = '.1.3.6.1.4.1.59732.2.7.2.4.5.0';
sub manage_selection {
my ($self, %options) = @_;
$self->{cache_name} = 'skyhigh_' . $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} = {
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-*>
Warning threshold.
Can be: 'client-to-proxy', 'server-to-proxy',
'proxy-to-client', 'proxy-to-server'.
=item B<--critical-*>
Critical threshold.
Can be: 'client-to-proxy', 'server-to-proxy',
'proxy-to-client', 'proxy-to-server'.
=back
=cut

View File

@ -0,0 +1,166 @@
#
# Copyright 2024 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::skyhigh::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', nlabel => 'https.requests.persecond', set => {
key_values => [ { name => 'stHttpsRequests', per_second => 1 } ],
output_template => 'HTTPS Requests (per sec): %d',
perfdatas => [
{ label => 'https_requests', template => '%d', min => 0, unit => 'requests/s' }
]
}
}
];
$self->{maps_counters}->{traffics} = [
{ label => 'client-to-proxy', nlabel => 'https.traffic.client2proxy.bitspersecond', set => {
key_values => [ { name => 'stHttpsBytesFromClient', per_second => 1 } ],
output_template => 'from client to proxy: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'https_traffic_client_to_proxy', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'server-to-proxy', nlabel => 'https.traffic.server2proxy.bitspersecond', set => {
key_values => [ { name => 'stHttpsBytesFromServer', per_second => 1 } ],
output_template => 'from server to proxy: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'https_traffic_server_to_proxy', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'proxy-to-client', nlabel => 'https.traffic.proxy2client.bitspersecond', set => {
key_values => [ { name => 'stHttpsBytesToClient', per_second => 1 } ],
output_template => 'from proxy to client: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'https_traffic_proxy_to_client', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'proxy-to-server', nlabel => 'https.traffic.proxy2server.bitspersecond', set => {
key_values => [ { name => 'stHttpsBytesToServer', per_second => 1 } ],
output_template => 'from proxy to server: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'https_traffic_proxy_to_server', 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;
$options{options}->add_options(arguments => {
});
return $self;
}
my $oid_stHttpsRequests = '.1.3.6.1.4.1.59732.2.7.2.3.1.0';
my $oid_stHttpsBytesFromClient = '.1.3.6.1.4.1.59732.2.7.2.3.3.0';
my $oid_stHttpsBytesFromServer = '.1.3.6.1.4.1.59732.2.7.2.3.4.0';
my $oid_stHttpsBytesToClient = '.1.3.6.1.4.1.59732.2.7.2.3.5.0';
my $oid_stHttpsBytesToServer = '.1.3.6.1.4.1.59732.2.7.2.3.6.0';
sub manage_selection {
my ($self, %options) = @_;
$self->{cache_name} = 'skyhigh_' . $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} = {
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-*>
Warning threshold.
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
'proxy-to-client', 'proxy-to-server'.
=item B<--critical-*>
Critical threshold.
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
'proxy-to-client', 'proxy-to-server'.
=back
=cut

View File

@ -0,0 +1,167 @@
#
# Copyright 2024 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::skyhigh::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', nlabel => 'http.requests.persecond', set => {
key_values => [ { name => 'stHttpRequests', per_second => 1 } ],
output_template => 'HTTP Requests (per sec): %d',
perfdatas => [
{ label => 'http_requests', template => '%d', min => 0, unit => 'requests/s' }
]
}
}
];
$self->{maps_counters}->{traffics} = [
{ label => 'client-to-proxy', nlabel => 'http.traffic.client2proxy.bitspersecond', set => {
key_values => [ { name => 'stHttpBytesFromClient', per_second => 1 } ],
output_template => 'from client to proxy: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'http_traffic_client_to_proxy', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'server-to-proxy', nlabel => 'http.traffic.server2proxy.bitspersecond', set => {
key_values => [ { name => 'stHttpBytesFromServer', per_second => 1 } ],
output_template => 'from server to proxy: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'http_traffic_server_to_proxy', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'proxy-to-client', nlabel => 'http.traffic.proxy2client.bitspersecond', set => {
key_values => [ { name => 'stHttpBytesToClient', per_second => 1 } ],
output_template => 'from proxy to client: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'http_traffic_proxy_to_client', template => '%d', min => 0, unit => 'b/s' }
]
}
},
{ label => 'proxy-to-server', nlabel => 'http.traffic.proxy2server.bitspersecond', set => {
key_values => [ { name => 'stHttpBytesToServer', per_second => 1 } ],
output_template => 'from proxy to server: %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ label => 'http_traffic_proxy_to_server', 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;
$options{options}->add_options(arguments => {
});
return $self;
}
my $oid_stHttpRequests = '.1.3.6.1.4.1.59732.2.7.2.2.1.0';
my $oid_stHttpBytesFromClient = '.1.3.6.1.4.1.59732.2.7.2.2.3.0';
my $oid_stHttpBytesFromServer = '.1.3.6.1.4.1.59732.2.7.2.2.4.0';
my $oid_stHttpBytesToClient = '.1.3.6.1.4.1.59732.2.7.2.2.5.0';
my $oid_stHttpBytesToServer = '.1.3.6.1.4.1.59732.2.7.2.2.6.0';
sub manage_selection {
my ($self, %options) = @_;
$self->{cache_name} = 'skyhigh_' . $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} = {
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-*>
Warning threshold.
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
'proxy-to-client', 'proxy-to-server'.
=item B<--critical-*>
Critical threshold.
Can be: 'request', 'client-to-proxy', 'server-to-proxy',
'proxy-to-client', 'proxy-to-server'.
=back
=cut

View File

@ -0,0 +1,104 @@
#
# Copyright 2024 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::skyhigh::webgateway::snmp::mode::system;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 }
];
$self->{maps_counters}->{global} = [
{ label => 'cpu-utilization', nlabel => 'system.cpu.utilization.percentage', set => {
key_values => [ { name => 'cpu_util' } ],
output_template => 'cpu usage: %.2f%%',
perfdatas => [
{ template => '%.2f', unit => '%', min => 0, max => 100 }
]
}
},
{ label => 'dns-resolve-time', nlabel => 'system.dns.resolve.time.milliseconds', set => {
key_values => [ { name => 'dns_time' } ],
output_template => 'time to resolve dns: %sms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
my $oid_stCPULoad = '.1.3.6.1.4.1.59732.2.7.2.5.1.0';
my $oid_stResolveHostViaDNS = '.1.3.6.1.4.1.59732.2.7.2.5.6.0';
sub manage_selection {
my ($self, %options) = @_;
my $results = $options{snmp}->get_leef(
oids => [ $oid_stCPULoad, $oid_stResolveHostViaDNS ],
nothing_quit => 1
);
$self->{global} = {
cpu_util => $results->{$oid_stCPULoad},
dns_time => $results->{$oid_stResolveHostViaDNS}
};
}
1;
__END__
=head1 MODE
Check system.
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
(example: --filter-counters='cpu')
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'cpu-utilization', 'dns-resolve-time'.
=back
=cut

View File

@ -0,0 +1,182 @@
#
# Copyright 2024 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::skyhigh::webgateway::snmp::mode::versions;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::statefile;
use Digest::MD5 qw(md5_hex);
sub custom_version_calc {
my ($self, %options) = @_;
$self->{result_values}->{output} = $options{extra_options}->{output_ref};
$self->{result_values}->{version} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref}};
$self->{result_values}->{timestamp} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref} . '_timestamp'};
$self->{result_values}->{since} = time() - $self->{result_values}->{timestamp};
return 0;
}
sub custom_version_threshold {
my ($self, %options) = @_;
return $self->{perfdata}->threshold_check(
value => $self->{result_values}->{since},
threshold => [
{ label => 'critical-' . $self->{label}, exit_litteral => 'critical' },
{ label => 'warning-' . $self->{label}, exit_litteral => 'warning' }
]
);
}
sub custom_version_output {
my ($self, %options) = @_;
return sprintf(
"%s: %s [Last update: %s]",
$self->{result_values}->{output},
$self->{result_values}->{version},
centreon::plugins::misc::change_seconds(value => $self->{result_values}->{since})
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'dat-version', set => {
key_values => [ { name => 'pMFEDATVersion' }, { name => 'pMFEDATVersion_timestamp' } ],
closure_custom_calc => $self->can('custom_version_calc'),
closure_custom_calc_extra_options => { label_ref => 'pMFEDATVersion', output_ref => 'DAT Version' },
closure_custom_output => $self->can('custom_version_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_version_threshold')
}
},
{ label => 'tsdb-version', set => {
key_values => [ { name => 'pTSDBVersion' }, { name => 'pTSDBVersion_timestamp' } ],
closure_custom_calc => $self->can('custom_version_calc'),
closure_custom_calc_extra_options => { label_ref => 'pTSDBVersion', output_ref => 'TrustedSource Database Version' },
closure_custom_output => $self->can('custom_version_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_version_threshold')
}
},
{ label => 'proactive-version', set => {
key_values => [ { name => 'pAMProactiveVersion' }, { name => 'pAMProactiveVersion_timestamp' } ],
closure_custom_calc => $self->can('custom_version_calc'),
closure_custom_calc_extra_options => { label_ref => 'pAMProactiveVersion', output_ref => 'ProActive Database Version' },
closure_custom_output => $self->can('custom_version_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_version_threshold')
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments => {
});
$self->{cache} = centreon::plugins::statefile->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->{cache}->check_options(%options);
}
my $oid_pMFEDATVersion = '.1.3.6.1.4.1.59732.2.7.1.20.4.0';
my $oid_pAMProactiveVersion = '.1.3.6.1.4.1.59732.2.7.1.20.5.0';
my $oid_pTSDBVersion = '.1.3.6.1.4.1.59732.2.7.1.20.6.0';
sub manage_selection {
my ($self, %options) = @_;
$self->{cache}->read(statefile => 'skyhigh_' . $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')));
my $results = $options{snmp}->get_leef(
oids => [ $oid_pMFEDATVersion, $oid_pAMProactiveVersion, $oid_pTSDBVersion ],
nothing_quit => 1
);
$self->{new_datas} = {
pMFEDATVersion => $results->{$oid_pMFEDATVersion},
pAMProactiveVersion => $results->{$oid_pAMProactiveVersion},
pTSDBVersion => $results->{$oid_pTSDBVersion}
};
foreach my $version (('pMFEDATVersion', 'pAMProactiveVersion', 'pTSDBVersion')) {
next if (!defined($self->{new_datas}->{$version}) || $self->{new_datas}->{$version} eq '');
$self->{new_datas}->{$version . '_timestamp'} = ($self->{new_datas}->{$version} > $self->{cache}->{datas}->{$version}) ? time() : $self->{cache}->{datas}->{$version . '_timestamp'};
$self->{new_datas}->{$version . '_timestamp'} = time() if (!defined($self->{new_datas}->{$version . '_timestamp'}));
}
$self->{global} = { %{$self->{new_datas}} };
$self->{cache}->write(data => $self->{new_datas});
}
1;
__END__
=head1 MODE
Check signature databases versions
(last update is only guessed by version's change,
it does not appear clearly in the MIB).
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
(example: --filter-counters='dat')
=item B<--warning-*>
Warning threshold on last update.
Can be: 'dat-version', 'tsdb-version' for TrustedSource Database Version, 'proactive-version' for ProActive Database Version.
=item B<--critical-*>
Critical threshold on last update.
Can be: 'dat-version', 'tsdb-version' for TrustedSource Database Version, 'proactive-version' for ProActive Database Version.
=back
=cut

View File

@ -0,0 +1,57 @@
#
# Copyright 2024 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::skyhigh::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::skyhigh::webgateway::snmp::mode::clients',
'connections' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::connections',
'detections' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::detections',
'ftp-statistics' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::ftpstatistics',
'http-statistics' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::httpstatistics',
'https-statistics' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::httpsstatistics',
'system' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::system',
'versions' => 'apps::antivirus::skyhigh::webgateway::snmp::mode::versions',
};
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check SkyHigh Security Web Gateway through SNMP.
This product is the successor to McAfee Web Gateway for versions higher than 11.
=cut

View File

@ -28,6 +28,7 @@ aws
AWSCLI
--aws-role-arn
Backbox
blocked-by-uf
--cacert-file
cardtemperature
Centreon
@ -36,6 +37,7 @@ Centreon
CloudWatch
connections-dhcp
connections-dns
cpu-utilization
cpu-utilization-1m
cpu-utilization-5m
cpu-utilization-5s
@ -61,6 +63,7 @@ df
dfsrevent
--display-transform-dst
--display-transform-src
dns-resolve-time
--dyn-mode
-EncodedCommand
ESX
@ -122,6 +125,7 @@ Loggly
machineaccount
--map-speed-dsl
MBean
McAfee
memAvailReal
memBuffer
--memexpiration
@ -199,6 +203,7 @@ scenarii
--scope-datacenter
sfp.temperature
--skip-ssl-check
SkyHigh
SNMP
space-usage-prct
--sql-errors-exit
@ -222,6 +227,7 @@ total-oper-down
total-oper-up
tower-cli
TrendMicro
tsdb-version
UCD
UDP
UninterrupibleSleep