mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-04-07 20:35:27 +02:00
feat(cyberoam): Add modes ha-status, license, list-vpns & vpn-status (#5335)
Add new mode for cyberoam equipment Refs: CTOR-102 Co-authored-by: Roman Morandell <46994680+rmorandell-pgum@users.noreply.github.com> Co-authored-by: omercier <omercier@centreon.com>
This commit is contained in:
parent
9ae01fc81d
commit
900717092f
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
log.html
|
||||
output.xml
|
||||
report.html
|
||||
.editorconfig
|
||||
.idea
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"libsnmp-perl"
|
||||
"libsnmp-perl",
|
||||
"libdatetime-format-strptime-perl"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"perl(SNMP)"
|
||||
"perl(SNMP)",
|
||||
"perl(DateTime::Format::Strptime)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
191
src/network/cyberoam/snmp/mode/hastatus.pm
Normal file
191
src/network/cyberoam/snmp/mode/hastatus.pm
Normal file
@ -0,0 +1,191 @@
|
||||
#
|
||||
# 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 network::cyberoam::snmp::mode::hastatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = "HA is '" . $self->{result_values}->{hastatus} . "' - ";
|
||||
$msg .= "Current HA State: '" . $self->{result_values}->{hastate} . "' - ";
|
||||
$msg .= "Peer HA State: '" . $self->{result_values}->{peer_hastate} . "' - ";
|
||||
$msg .= "HA Port: '" . $self->{result_values}->{ha_port} . "' - ";
|
||||
$msg .= "HA IP: '" . $self->{result_values}->{ha_ip} . "' - ";
|
||||
$msg .= "Peer IP: '" . $self->{result_values}->{ha_peer_ip} . "'";
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'ha', type => 0 },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{ha} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'hastate' },
|
||||
{ name => 'hastatus' },
|
||||
{ name => 'peer_hastate' },
|
||||
{ name => 'ha_port' },
|
||||
{ name => 'ha_ip' },
|
||||
{ name => 'ha_peer_ip' }
|
||||
],
|
||||
default_critical => '%{hastatus} =~ /^enabled$/ && %{hastate} =~ /^faulty$/',
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'no-ha-status:s' => { name => 'no_ha_status', default => 'UNKNOWN' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => [ 'warning_status', 'critical_status' ]);
|
||||
}
|
||||
# snmptranslate -Td .1.3.6.1.4.1.2604.5.1.4.1.0
|
||||
# SFOS-FIREWALL-MIB::sfosHAStatus.0
|
||||
# sfosHAStatus OBJECT-TYPE
|
||||
# -- FROM SFOS-FIREWALL-MIB
|
||||
# -- TEXTUAL CONVENTION HaStatusType
|
||||
# SYNTAX INTEGER {disabled(0), enabled(1)}
|
||||
# MAX-ACCESS read-only
|
||||
# STATUS current
|
||||
# DESCRIPTION " "
|
||||
# ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) sophosMIB(2604) sfosXGMIB(5) sfosXGMIBObjects(1) sfosXGHAStats(4) sfosHAStatus(1) 0 }
|
||||
|
||||
my %map_status = (
|
||||
0 => 'disabled',
|
||||
1 => 'enabled'
|
||||
);
|
||||
|
||||
# snmptranslate -Td .1.3.6.1.4.1.2604.5.1.4.4.0
|
||||
# SFOS-FIREWALL-MIB::sfosDeviceCurrentHAState.0
|
||||
# sfosDeviceCurrentHAState OBJECT-TYPE
|
||||
# -- FROM SFOS-FIREWALL-MIB
|
||||
# -- TEXTUAL CONVENTION HaState
|
||||
# SYNTAX INTEGER {notapplicable(0), auxiliary(1), standAlone(2), primary(3), faulty(4), ready(5)}
|
||||
# MAX-ACCESS read-only
|
||||
# STATUS current
|
||||
# DESCRIPTION "HA State of current Device"
|
||||
# ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) sophosMIB(2604) sfosXGMIB(5) sfosXGMIBObjects(1) sfosXGHAStats(4) sfosDeviceCurrentHAState(4) 0 }
|
||||
|
||||
my %map_state = (
|
||||
0 => 'notapplicable',
|
||||
1 => 'auxiliary',
|
||||
2 => 'standAlone',
|
||||
3 => 'primary',
|
||||
4 => 'faulty',
|
||||
5 => 'ready'
|
||||
);
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_ha_status = '.1.3.6.1.4.1.2604.5.1.4.1.0';
|
||||
my $oid_ha_state = '.1.3.6.1.4.1.2604.5.1.4.4.0';
|
||||
my $oid_peer_ha_state = '.1.3.6.1.4.1.2604.5.1.4.5.0';
|
||||
my $oid_ha_port = '.1.3.6.1.4.1.2604.5.1.4.8.0';
|
||||
my $oid_ha_ip = '.1.3.6.1.4.1.2604.5.1.4.9.0';
|
||||
my $oid_ha_peer_ip = '.1.3.6.1.4.1.2604.5.1.4.10.0';
|
||||
|
||||
$self->{ha} = {};
|
||||
|
||||
my $result = $options{snmp}->get_leef(
|
||||
oids =>
|
||||
[ $oid_ha_status, $oid_ha_state, $oid_peer_ha_state, $oid_ha_port, $oid_ha_ip, $oid_ha_peer_ip ],
|
||||
nothing_quit =>
|
||||
1
|
||||
);
|
||||
|
||||
if ($result->{$oid_ha_status} == 0 or $result->{$oid_ha_state} == 0) {
|
||||
$self->{output}->output_add(
|
||||
severity => $self->{option_results}->{no_ha_status},
|
||||
short_msg => sprintf("Looks like HA is not enabled, or not applicable .."),
|
||||
long_msg => sprintf(
|
||||
"HA Enabled : '%u' HA Status : '%s'",
|
||||
$map_status{$result->{$oid_ha_status}}, $map_status{$result->{$oid_ha_state}}
|
||||
),
|
||||
);
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
$self->{ha} = {
|
||||
hastatus => $map_status{$result->{$oid_ha_status}},
|
||||
hastate => $map_state{$result->{$oid_ha_state}},
|
||||
peer_hastate => $map_state{$result->{$oid_peer_ha_state}},
|
||||
ha_port => $result->{$oid_ha_port},
|
||||
ha_ip => $result->{$oid_ha_ip},
|
||||
ha_peer_ip => $result->{$oid_ha_peer_ip}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check current HA-State.
|
||||
HA-States: notapplicable, auxiliary, standAlone, primary, faulty, ready
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Trigger warning on %{hastatus} or %{hastate} or %{peer_hastate} values.
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Trigger critical on %{hastatus} or %{hastate} or %{peer_hastate} values.
|
||||
(default: '%{hastatus} =~ /^enabled$/ && %{hastate} =~ /^faulty$/').
|
||||
|
||||
=item B<--no-ha-status>
|
||||
|
||||
Status to return when HA not running or not installed (default: 'UNKNOWN').
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
294
src/network/cyberoam/snmp/mode/license.pm
Normal file
294
src/network/cyberoam/snmp/mode/license.pm
Normal file
@ -0,0 +1,294 @@
|
||||
#
|
||||
# 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 network::cyberoam::snmp::mode::license;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use centreon::plugins::misc;
|
||||
use POSIX;
|
||||
use Time::Local;
|
||||
use DateTime::Format::Strptime;
|
||||
|
||||
my $unitdiv = { s => 1, w => 604800, d => 86400, h => 3600, m => 60 };
|
||||
my $unitdiv_long = { s => 'seconds', w => 'weeks', d => 'days', h => 'hours', m => 'minutes' };
|
||||
|
||||
sub custom_expires_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => $self->{nlabel} . '.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
|
||||
unit => $self->{instance_mode}->{option_results}->{unit},
|
||||
instances => $self->{result_values}->{name},
|
||||
value => floor($self->{result_values}->{expires_seconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_expires_threshold {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $self->{perfdata}->threshold_check(
|
||||
value =>
|
||||
floor($self->{result_values}->{expires_seconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
|
||||
threshold =>
|
||||
[
|
||||
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' },
|
||||
{ label => 'unknown-' . $self->{thlabel}, exit_litteral => 'unknown' }
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'status: ' . $self->{result_values}->{status} . ', expires in ' . $self->{result_values}->{expires_human};
|
||||
}
|
||||
|
||||
sub prefix_license_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"License '%s' ",
|
||||
$options{instance_value}->{name}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{
|
||||
name => 'licenses',
|
||||
type => 1,
|
||||
cb_prefix_output => 'prefix_license_output',
|
||||
message_multiple => 'All licenses are ok',
|
||||
skipped_code => { -10 => 1 }
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{licenses} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
critical_default => '%{status} =~ /expired/i',
|
||||
set => {
|
||||
key_values => [ { name => 'name' }, { name => 'status' }, { name => 'expires_human' } ],
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'expires',
|
||||
type => 1,
|
||||
nlabel => 'license.expires',
|
||||
set => {
|
||||
key_values => [ { name => 'expires_seconds' }, { name => 'expires_human' }, { name => 'name' } ],
|
||||
output_template => 'expires in %s',
|
||||
output_use => 'expires_human',
|
||||
closure_custom_perfdata => $self->can('custom_expires_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_expires_threshold')
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
'unit:s' => { name => 'unit', default => 's' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my %map_lic_status = (
|
||||
0 => 'none',
|
||||
1 => 'evaluating',
|
||||
2 => 'notsubscribed',
|
||||
3 => 'subscribed',
|
||||
4 => 'expired',
|
||||
5 => 'deactivated'
|
||||
);
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if ($self->{option_results}->{unit} eq '' || !defined($unitdiv->{$self->{option_results}->{unit}})) {
|
||||
$self->{option_results}->{unit} = 's';
|
||||
}
|
||||
}
|
||||
|
||||
sub add_license {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return if (!defined($options{status}));
|
||||
return if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||
$options{name} !~ /$self->{option_results}->{filter_name}/);
|
||||
|
||||
$self->{licenses}->{ $options{name} } = {
|
||||
name => $options{name},
|
||||
status => $options{status},
|
||||
expires => $options{expires}
|
||||
};
|
||||
|
||||
if (defined($options{expires}) && $options{expires} ne "fail" && $options{status} =~ /subscribed|expired|evaluating/i) {
|
||||
my $strp = DateTime::Format::Strptime->new(
|
||||
pattern => '%b %d %Y',
|
||||
locale => 'en_US',
|
||||
);
|
||||
|
||||
my $dt = $strp->parse_datetime($options{expires});
|
||||
|
||||
$self->{licenses}->{ $options{name} }->{expires_seconds} = $dt->epoch - time();
|
||||
$self->{licenses}->{ $options{name} }->{expires_seconds} = 0 if ($self->{licenses}->{ $options{name} }->{expires_seconds} < 0);
|
||||
$self->{licenses}->{ $options{name} }->{expires_human} = centreon::plugins::misc::change_seconds(
|
||||
value => $self->{licenses}->{ $options{name} }->{expires_seconds}
|
||||
);
|
||||
} else {
|
||||
$self->{licenses}->{ $options{name} }->{expires_human} = "n.d.";
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_base_fw_lic_status = '.1.3.6.1.4.1.2604.5.1.5.1.1.0';# sfosBaseFWLicRegStatus
|
||||
my $oid_base_fw_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.1.2.0';# sfosBaseFWLicExpiryDate
|
||||
my $oid_net_protection_lic_status = '.1.3.6.1.4.1.2604.5.1.5.2.1.0';# sfosNetProtectionLicRegStatus
|
||||
my $oid_net_protection_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.2.2.0';# sfosNetProtectionLicExpiryDate
|
||||
my $oid_web_protection_lic_status = '.1.3.6.1.4.1.2604.5.1.5.3.1.0';# sfosWebProtectionLicRegStatus
|
||||
my $oid_web_protection_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.3.2.0';# sfosWebProtectionLicExpiryDate
|
||||
my $oid_mail_protection_lic_status = '.1.3.6.1.4.1.2604.5.1.5.4.1.0';# sfosMailProtectionLicRegStatus
|
||||
my $oid_mail_protection_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.4.2.0';# sfosMailProtectionLicExpiryDate
|
||||
my $oid_web_server_protection_lic_status = '.1.3.6.1.4.1.2604.5.1.5.5.1';# sfosWebServerProtectionLicRegStatus
|
||||
my $oid_web_server_protection_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.5.2';# sfosWebServerProtectionLicExpiryDate
|
||||
my $oid_sand_storm_lic_status = '.1.3.6.1.4.1.2604.5.1.5.6.1';# sfosSandstromLicRegStatus
|
||||
my $oid_sand_storm_protection_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.6.2';# sfosSandstromLicExpiryDate
|
||||
my $oid_enhanced_support_lic_status = '.1.3.6.1.4.1.2604.5.1.5.7.1';# sfosEnhancedSupportLicRegStatus
|
||||
my $oid_enhanced_support_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.7.2';# sfosEnhancedSupportLicExpiryDate
|
||||
my $oid_enhanced_plus_lic_status = '.1.3.6.1.4.1.2604.5.1.5.8.1';# sfosEnhancedPlusLicRegStatus
|
||||
my $oid_enhanced_plus_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.8.2';# sfosEnhancedPlusLicExpiryDate
|
||||
my $oid_central_orchestra_lic_status = '.1.3.6.1.4.1.2604.5.1.5.9.1';# sfosCentralOrchestrationLicRegStatus
|
||||
my $oid_central_orchestra_lic_expiry_date = '.1.3.6.1.4.1.2604.5.1.5.9.2';# sfosCentralOrchestrationLicExpiryDate
|
||||
|
||||
my $result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_base_fw_lic_status,
|
||||
$oid_base_fw_lic_expiry_date,
|
||||
$oid_net_protection_lic_status,
|
||||
$oid_net_protection_lic_expiry_date,
|
||||
$oid_web_protection_lic_status,
|
||||
$oid_web_protection_lic_expiry_date,
|
||||
$oid_mail_protection_lic_status,
|
||||
$oid_mail_protection_lic_expiry_date,
|
||||
# $oid_web_server_protection_lic_status,
|
||||
# $oid_web_server_protection_lic_expiry_date,
|
||||
# $oid_sand_storm_lic_status,
|
||||
# $oid_sand_storm_protection_lic_expiry_date,
|
||||
# $oid_enhanced_support_lic_status,
|
||||
# $oid_enhanced_support_lic_expiry_date,
|
||||
# $oid_enhanced_plus_lic_status,
|
||||
# $oid_mail_protection_lic_status,
|
||||
# $oid_enhanced_plus_lic_expiry_date,
|
||||
# $oid_central_orchestra_lic_status,
|
||||
# $oid_central_orchestra_lic_expiry_date
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{licenses} = {};
|
||||
$self->add_license(
|
||||
name => 'base_fw',
|
||||
status => $map_lic_status{$result->{$oid_base_fw_lic_status}},
|
||||
expires => $result->{$oid_base_fw_lic_expiry_date}
|
||||
);
|
||||
$self->add_license(
|
||||
name => 'net_protection',
|
||||
status => $map_lic_status{$result->{$oid_net_protection_lic_status}},
|
||||
expires => $result->{$oid_net_protection_lic_expiry_date}
|
||||
);
|
||||
$self->add_license(
|
||||
name => 'web_protection',
|
||||
status => $map_lic_status{$result->{$oid_web_protection_lic_status}},
|
||||
expires => $result->{$oid_web_protection_lic_expiry_date}
|
||||
);
|
||||
$self->add_license(
|
||||
name => 'mail_protection',
|
||||
status => $map_lic_status{$result->{$oid_mail_protection_lic_status}},
|
||||
expires => $result->{$oid_mail_protection_lic_expiry_date}
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check license (SFOS-FIREWALL-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter licenses by name (can be a regexp).
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Define the conditions to match for the status to be WARNING.
|
||||
You can use the following variables: %{name}, %{status}.
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{status} =~ /expired/i').
|
||||
You can use the following variables: %{name}, %{status}.
|
||||
|
||||
=item B<--unit>
|
||||
|
||||
Select the time unit for the expiration thresholds. May be 's' for seconds, 'm' for minutes, 'h' for hours, 'd' for days, 'w' for weeks. Default is seconds.
|
||||
|
||||
=item B<--warning-expires>
|
||||
|
||||
Threshold.
|
||||
Example: C<--unit=w --warning-expires=2:> will result in a WARNING state when one of the licenses expires in less than
|
||||
two weeks.
|
||||
|
||||
=item B<--critical-expires>
|
||||
|
||||
Threshold.
|
||||
Example: C<--unit=w --critical-expires=2:> will result in a CRITICAL state when one of the licenses expires in less than
|
||||
two weeks.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
232
src/network/cyberoam/snmp/mode/listvpns.pm
Normal file
232
src/network/cyberoam/snmp/mode/listvpns.pm
Normal file
@ -0,0 +1,232 @@
|
||||
#
|
||||
# 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 network::cyberoam::snmp::mode::listvpns;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"filter-connection-status:s" => { name => 'filter_connection_status' },
|
||||
"filter-vpn-activated:s" => { name => 'filter_vpn_activated' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $map_connection_status = {
|
||||
0 => 'inactive',
|
||||
1 => 'active',
|
||||
2 => 'partially-active'
|
||||
};
|
||||
|
||||
my $map_vpn_activated = {
|
||||
0 => 'inactive',
|
||||
1 => 'active'
|
||||
};
|
||||
|
||||
my $map_connection_type = {
|
||||
1 => 'host-to-host',
|
||||
2 => 'site-to-site',
|
||||
3 => 'tunnel-interface'
|
||||
};
|
||||
|
||||
my $mapping = {
|
||||
name =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.2' },# sfosIPSecVpnConnName
|
||||
policy =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.4' },# sfosIPSecVpnPolicyUsed
|
||||
description =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.3' },# sfosIPSecVpnConnDes
|
||||
connection_mode =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.5' },# sfosIPSecVpnConnMode
|
||||
connection_type =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.6', map => $map_connection_type },# sfosIPSecVpnConnType
|
||||
connection_status =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.9', map => $map_connection_status },# sfosIPSecVpnConnStatus
|
||||
activated =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.10', map => $map_vpn_activated }# sfosIPSecVpnActivated
|
||||
};
|
||||
# parent oid for all the mapping usage
|
||||
my $oid_bsnAPEntry = '.1.3.6.1.4.1.2604.5.1.6.1.1.1';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_bsnAPEntry,
|
||||
start => $mapping->{name}->{oid},# First oid of the mapping => here : 2
|
||||
end => $mapping->{activated}->{oid}# Last oid of the mapping => here : 23
|
||||
);
|
||||
|
||||
my $results = {};
|
||||
# Iterate for all oids catch in snmp result above
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$mapping->{name}->{oid}\.(.*)$/);
|
||||
my $oid_path = $1;
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $oid_path);
|
||||
|
||||
if (!defined($result->{name}) || $result->{name} eq '') {
|
||||
$self->{output}->output_add(long_msg =>
|
||||
"skipping VPN '$oid_path': cannot get a name. please set it.",
|
||||
debug =>
|
||||
1);
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||
$result->{name} !~ /$self->{option_results}->{filter_name}/) {
|
||||
$self->{output}->output_add(long_msg =>
|
||||
"skipping '" . $result->{name} . "': no matching name filter.",
|
||||
debug =>
|
||||
1);
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{filter_connection_status}) && $self->{option_results}->{filter_connection_status} ne '' &&
|
||||
$result->{connection_status} !~ /$self->{option_results}->{filter_connection_status}/) {
|
||||
$self->{output}->output_add(long_msg =>
|
||||
"skipping '" . $result->{connection_status} . "': no matching connection_status filter.",
|
||||
debug =>
|
||||
1);
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{filter_vpn_activated}) && $self->{option_results}->{filter_vpn_activated} ne '' &&
|
||||
$result->{activated} !~ /$self->{option_results}->{filter_vpn_activated}/) {
|
||||
$self->{output}->output_add(long_msg =>
|
||||
"skipping '" . $result->{activated} . "': no matching activated filter.",
|
||||
debug =>
|
||||
1);
|
||||
next;
|
||||
}
|
||||
|
||||
$results->{$oid_path} = {
|
||||
name => $result->{name},
|
||||
policy => $result->{policy},
|
||||
description => $result->{description},
|
||||
connection_mode => $result->{connection_mode},
|
||||
connection_type => $result->{connection_type},
|
||||
connection_status => $result->{connection_status},
|
||||
activated => $result->{activated}
|
||||
};
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->manage_selection(snmp => $options{snmp});
|
||||
foreach my $oid_path (sort keys %$results) {
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
'[oid_path: %s] [name: %s] [policy: %s] [description: %s] [connection_mode: %s] [connection_type: %s] [connection_status: %s] [activated: %s]',
|
||||
$oid_path,
|
||||
$results->{$oid_path}->{name},
|
||||
$results->{$oid_path}->{policy},
|
||||
$results->{$oid_path}->{description},
|
||||
$results->{$oid_path}->{connection_mode},
|
||||
$results->{$oid_path}->{connection_type},
|
||||
$results->{$oid_path}->{connection_status},
|
||||
$results->{$oid_path}->{activated}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List vpn'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements =>
|
||||
[ 'name', 'policy', 'description', 'connection_mode', 'connection_type', 'connection_status', 'activated' ]);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->manage_selection(snmp => $options{snmp});
|
||||
foreach my $oid_path (sort keys %$results) {
|
||||
$self->{output}->add_disco_entry(
|
||||
name =>
|
||||
$results->{$oid_path}->{name},
|
||||
policy =>
|
||||
$results->{$oid_path}->{policy},
|
||||
description =>
|
||||
$results->{$oid_path}->{description},
|
||||
connection_mode =>
|
||||
$results->{$oid_path}->{connection_mode},
|
||||
connection_type =>
|
||||
$results->{$oid_path}->{connection_type},
|
||||
connection_status =>
|
||||
$results->{$oid_path}->{connection_status},
|
||||
activated =>
|
||||
$results->{$oid_path}->{activated}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List VPN.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Display VPN matching the filter.
|
||||
|
||||
=item B<--filter-connection-status>
|
||||
|
||||
Display VPN matching the filter.
|
||||
|
||||
=item B<--filter-vpn-activated>
|
||||
|
||||
Display VPN matching the filter.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
386
src/network/cyberoam/snmp/mode/vpnstatus.pm
Normal file
386
src/network/cyberoam/snmp/mode/vpnstatus.pm
Normal file
@ -0,0 +1,386 @@
|
||||
#
|
||||
# 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 network::cyberoam::snmp::mode::vpnstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = 'status: ' . $self->{result_values}->{connection_status};
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub prefix_global_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'VPN ';
|
||||
}
|
||||
|
||||
sub vpn_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "checking vpn '" . $options{instance_value}->{display} . "'";
|
||||
}
|
||||
|
||||
sub prefix_vpn_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $output = "VPN '" . $options{instance_value}->{display} . "' ";
|
||||
|
||||
if (defined(($options{instance_value}->{vpn_global}->{description}))
|
||||
&& ($options{instance_value}->{vpn_global}->{description})) {
|
||||
$output .= "($options{instance_value}->{vpn_global}->{description}) ";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{
|
||||
name => 'global',
|
||||
type => 0,
|
||||
cb_prefix_output => 'prefix_global_output'
|
||||
},
|
||||
{
|
||||
name => 'vpn',
|
||||
type => 3,
|
||||
cb_prefix_output => 'prefix_vpn_output',
|
||||
cb_long_output => 'vpn_long_output',
|
||||
indent_long_output => ' ',
|
||||
message_multiple => 'All VPNs are ok',
|
||||
group => [
|
||||
{ name => 'vpn_global', type => 0 }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{
|
||||
label => 'total',
|
||||
type => 1,
|
||||
nlabel => 'vpn.total.count',
|
||||
set => {
|
||||
key_values => [ { name => 'total' } ],
|
||||
output_template => 'total: %s',
|
||||
perfdatas => [
|
||||
{ label => 'total', template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'total-inactive',
|
||||
type => 1,
|
||||
nlabel => 'vpn.inactive.count',
|
||||
set => {
|
||||
key_values => [ { name => 'inactive' } ],
|
||||
output_template => 'inactive: %s',
|
||||
perfdatas => [
|
||||
{ label => 'total_inactive', template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'total-active',
|
||||
type => 1,
|
||||
nlabel => 'vpn.active.count',
|
||||
set => {
|
||||
key_values => [ { name => 'active' } ],
|
||||
output_template => 'active: %s',
|
||||
perfdatas => [
|
||||
{ label => 'total_active', template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
label => 'total-partially-active',
|
||||
type => 1,
|
||||
nlabel => 'vpn.partiallyactive.count',
|
||||
set => {
|
||||
key_values => [ { name => 'partiallyActive' } ],
|
||||
output_template => 'partially active: %s',
|
||||
perfdatas => [
|
||||
{ label => 'total_partially_active', template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{vpn_global} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
critical_default => '%{connection_status} =~ /inactive/',
|
||||
warning_default => '%{connection_status} =~ /partiallyActive/',
|
||||
set => {
|
||||
key_values => [ { name => 'connection_status' }, { name => 'display' }, { name => 'description' } ],
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => sub {return 0;},
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
"filter-vpn-activated:s" => { name => 'filter_vpn_activated' },
|
||||
"filter-connection-mode:s" => { name => 'filter_connection_mode' },
|
||||
"filter-connection-type:s" => { name => 'filter_connection_type' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# SFOS-FIREWALL-MIB::sfosIPSecVpnConnStatus
|
||||
# sfosIPSecVpnConnStatus OBJECT-TYPE
|
||||
# -- FROM SFOS-FIREWALL-MIB
|
||||
# -- TEXTUAL CONVENTION IPSecVPNConnectionStatus
|
||||
# SYNTAX INTEGER {inactive(0), active(1), partially-active(2)}
|
||||
# MAX-ACCESS read-only
|
||||
# STATUS current
|
||||
# DESCRIPTION "Connection status of IPsec tunnel"
|
||||
# ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) sophosMIB(2604) sfosXGMIB(5) sfosXGMIBObjects(1) sfosXGTunnelInfo(6) sfosVPNInfo(1) sfosIPSecVPNConnInfo(1) sfosIPSecVpnTunnelTable(1) sfosIPSecVpnTunnelEntry(1) 9 }
|
||||
my $map_connection_status = {
|
||||
0 => 'inactive',
|
||||
1 => 'active',
|
||||
2 => 'partiallyActive'
|
||||
};
|
||||
|
||||
# SFOS-FIREWALL-MIB::sfosIPSecVpnActivated
|
||||
# sfosIPSecVpnActivated OBJECT-TYPE
|
||||
# -- FROM SFOS-FIREWALL-MIB
|
||||
# -- TEXTUAL CONVENTION IPSecVPNActivationStatus
|
||||
# SYNTAX INTEGER {inactive(0), active(1)}
|
||||
# MAX-ACCESS read-only
|
||||
# STATUS current
|
||||
# DESCRIPTION "Activation status of IPsec tunnel"
|
||||
# ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) sophosMIB(2604) sfosXGMIB(5) sfosXGMIBObjects(1) sfosXGTunnelInfo(6) sfosVPNInfo(1) sfosIPSecVPNConnInfo(1) sfosIPSecVpnTunnelTable(1) sfosIPSecVpnTunnelEntry(1) 10 }
|
||||
my $map_vpn_activated = {
|
||||
0 => 'inactive',
|
||||
1 => 'active'
|
||||
};
|
||||
|
||||
# SFOS-FIREWALL-MIB::sfosIPSecVpnConnType
|
||||
# sfosIPSecVpnConnType OBJECT-TYPE
|
||||
# -- FROM SFOS-FIREWALL-MIB
|
||||
# -- TEXTUAL CONVENTION IPSecVPNConnectionType
|
||||
# SYNTAX INTEGER {host-to-host(1), site-to-site(2), tunnel-interface(3)}
|
||||
# MAX-ACCESS read-only
|
||||
# STATUS current
|
||||
# DESCRIPTION "Connection Type of IPsec Tunnel"
|
||||
# ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) sophosMIB(2604) sfosXGMIB(5) sfosXGMIBObjects(1) sfosXGTunnelInfo(6) sfosVPNInfo(1) sfosIPSecVPNConnInfo(1) sfosIPSecVpnTunnelTable(1) sfosIPSecVpnTunnelEntry(1) 6 }
|
||||
my $map_connection_type = {
|
||||
1 => 'host-to-host',
|
||||
2 => 'site-to-site',
|
||||
3 => 'tunnel-interface'
|
||||
};
|
||||
|
||||
my $mapping = {
|
||||
name => { oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.2' },# sfosIPSecVpnConnName
|
||||
connection_mode => { oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.5' },# sfosIPSecVpnConnMode
|
||||
connection_type => { oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.6', map => $map_connection_type },# sfosIPSecVpnConnType
|
||||
activated => { oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.10', map => $map_vpn_activated }# sfosIPSecVpnActivated
|
||||
};
|
||||
|
||||
my $mapping_stat = {
|
||||
description => { oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.3' },# sfosIPSecVpnConnDes
|
||||
connection_status =>
|
||||
{ oid => '.1.3.6.1.4.1.2604.5.1.6.1.1.1.1.9', map => $map_connection_status }# sfosIPSecVpnConnStatus
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{vpn} = {};
|
||||
$self->{global} = {
|
||||
inactive => 0,
|
||||
active => 0,
|
||||
partiallyActive => 0
|
||||
};
|
||||
|
||||
my $request = [ { oid => $mapping->{name}->{oid} } ];
|
||||
push @$request, { oid => $mapping->{activated}->{oid} }
|
||||
if (defined($self->{option_results}->{filter_vpn_activated}) && $self->{option_results}->{filter_vpn_activated} ne '');
|
||||
|
||||
push @$request, { oid => $mapping->{connection_mode}->{oid} }
|
||||
if (defined($self->{option_results}->{filter_connection_mode}) && $self->{option_results}->{filter_connection_mode} ne '');
|
||||
|
||||
push @$request, { oid => $mapping->{connection_type}->{oid} }
|
||||
if (defined($self->{option_results}->{filter_connection_type}) && $self->{option_results}->{filter_connection_type} ne '');
|
||||
|
||||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => $request,
|
||||
return_type => 1,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (!/^$mapping->{name}->{oid}\.(.*)/);
|
||||
my $instance = $1;
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||
$result->{name} !~ /$self->{option_results}->{filter_name}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{name} . "': not matching name filter.");
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{filter_connection_type}) && $self->{option_results}->{filter_connection_type} ne '' &&
|
||||
$result->{connection_type} !~ /$self->{option_results}->{filter_connection_type}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{connection_type} . "': not matching connection-type filter.");
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{filter_connection_mode}) && $self->{option_results}->{filter_connection_mode} ne '' &&
|
||||
$result->{connection_mode} !~ /$self->{option_results}->{filter_connection_mode}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{connection_mode} . "': not matching connection-mode filter.");
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{filter_vpn_activated}) && $self->{option_results}->{filter_vpn_activated} ne '' &&
|
||||
$result->{activated} !~ /$self->{option_results}->{filter_vpn_activated}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{activated} . "': not matching vpn-activated filter " . $self->{option_results}->{filter_vpn_activated} . ".");
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{vpn}->{ $result->{name} } = {
|
||||
instance => $instance,
|
||||
display => $result->{name},
|
||||
vpn_global => { display => $result->{name} } };
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{vpn}}) <= 0) {
|
||||
$self->{output}->output_add(long_msg => 'no VPN associated');
|
||||
return;
|
||||
}
|
||||
|
||||
$options{snmp}->load(
|
||||
oids => [ map($_->{oid}, values(%$mapping_stat)) ],
|
||||
instances => [ map($_->{instance}, values %{$self->{vpn}}) ],
|
||||
instance_regexp => '^(.*)$'
|
||||
);
|
||||
$snmp_result = $options{snmp}->get_leef();
|
||||
|
||||
foreach (keys %{$self->{vpn}}) {
|
||||
my $result = $options{snmp}->map_instance(
|
||||
mapping => $mapping_stat,
|
||||
results => $snmp_result,
|
||||
instance => $self->{vpn}->{$_}->{instance});
|
||||
|
||||
$self->{global}->{total}++;
|
||||
$self->{global}->{ $result->{connection_status} }++;
|
||||
$self->{vpn}->{$_}->{vpn_global}->{connection_status} = $result->{connection_status};
|
||||
$self->{vpn}->{$_}->{vpn_global}->{description} = $result->{description};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check VPN status.
|
||||
VPN-Connection-Status: inactive, active, partiallyActive
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^total$|^total-normal$'
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter VPN name (can be a regexp).
|
||||
|
||||
=item B<--filter-vpn-activated>
|
||||
|
||||
Filter by the activation status of the VPN (can be a regexp).
|
||||
Values: active, inactive
|
||||
|
||||
=item B<--filter-connection-mode>
|
||||
|
||||
Filter by the connection mode of the VPN (can be a regexp).
|
||||
|
||||
=item B<--connection-type>
|
||||
|
||||
Filter by the connection type of the VPN (can be a regexp).
|
||||
Values: host-to-host, site-to-site, tunnel-interface
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Trigger warning on %{connection_status} values.
|
||||
(default: '%{connection_status} =~ /partiallyActive/').
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Trigger critical on %{connection_status} values.
|
||||
(default: '%{connection_status} =~ /inactive/').
|
||||
|
||||
=item B<--warning-total>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--critical-total>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--warning-total-inactive>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--critical-total-inactive>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--warning-total-partiallyActive>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--critical-total-partiallyActive>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--warning-total-active>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=item B<--critical-total-active>
|
||||
|
||||
Thresholds.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
@ -31,13 +31,17 @@ sub new {
|
||||
|
||||
$self->{version} = '0.1';
|
||||
$self->{modes} = {
|
||||
'cpu' => 'network::cyberoam::snmp::mode::cpu',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'memory' => 'network::cyberoam::snmp::mode::memory',
|
||||
'requests' => 'network::cyberoam::snmp::mode::requests',
|
||||
'services' => 'network::cyberoam::snmp::mode::services',
|
||||
'storage' => 'network::cyberoam::snmp::mode::storage'
|
||||
'cpu' => 'network::cyberoam::snmp::mode::cpu',
|
||||
'ha-status' => 'network::cyberoam::snmp::mode::hastatus',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'license' => 'network::cyberoam::snmp::mode::license',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'list-vpns' => 'network::cyberoam::snmp::mode::listvpns',
|
||||
'memory' => 'network::cyberoam::snmp::mode::memory',
|
||||
'requests' => 'network::cyberoam::snmp::mode::requests',
|
||||
'services' => 'network::cyberoam::snmp::mode::services',
|
||||
'storage' => 'network::cyberoam::snmp::mode::storage',
|
||||
'vpn-status' => 'network::cyberoam::snmp::mode::vpnstatus'
|
||||
};
|
||||
|
||||
return $self;
|
||||
|
32
tests/network/cyberoam/snmp/ha-status.robot
Normal file
32
tests/network/cyberoam/snmp/ha-status.robot
Normal file
@ -0,0 +1,32 @@
|
||||
*** Settings ***
|
||||
Documentation Check Cyberoam equipments in SNMP.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
ha-status ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=ha-status
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=${SNMPCOMMUNITY}
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Verify Command Output ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options SNMPCOMMUNITY expected_result --
|
||||
... 1 ${EMPTY} network/cyberoam/snmp/slim_sophos OK: HA is 'enabled' - Current HA State: 'primary' - Peer HA State: 'auxiliary' - HA Port: 'Anonymized 007' - HA IP: '192.168.42.167' - Peer IP: '192.168.42.23'
|
||||
... 2 --warning-status='\\\%{hastate} ne "down"' network/cyberoam/snmp/slim_sophos WARNING: HA is 'enabled' - Current HA State: 'primary' - Peer HA State: 'auxiliary' - HA Port: 'Anonymized 007' - HA IP: '192.168.42.167' - Peer IP: '192.168.42.23'
|
||||
... 3 --critical-status='\\\%{hastatus} ne "down"' network/cyberoam/snmp/slim_sophos CRITICAL: HA is 'enabled' - Current HA State: 'primary' - Peer HA State: 'auxiliary' - HA Port: 'Anonymized 007' - HA IP: '192.168.42.167' - Peer IP: '192.168.42.23'
|
||||
... 4 --no-ha-status='UNKNOWN' network/cyberoam/snmp/slim_sophos_no_ha UNKNOWN: Looks like HA is not enabled, or not applicable ..
|
34
tests/network/cyberoam/snmp/interfaces.robot
Normal file
34
tests/network/cyberoam/snmp/interfaces.robot
Normal file
File diff suppressed because one or more lines are too long
34
tests/network/cyberoam/snmp/license.robot
Normal file
34
tests/network/cyberoam/snmp/license.robot
Normal file
@ -0,0 +1,34 @@
|
||||
*** Settings ***
|
||||
Documentation Check current HA-State. HA-States: notapplicable, auxiliary, standAlone,primary, faulty, ready.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
ha-status ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=license
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Regexp ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} OK: All licenses are ok \\\\| 'base_fw#license.expires.seconds'=\\\\d+s;;;0; 'net_protection#license.expires.seconds'=\\\\d+s;;;0; 'web_protection#license.expires.seconds'=\\\\d+s;;;0;
|
||||
... 2 --unit=w OK: All licenses are ok \\\\| 'base_fw#license.expires.weeks'=\\\\d+w;;;0; 'net_protection#license.expires.weeks'=\\\\d+w;;;0; 'web_protection#license.expires.weeks'=\\\\d+w;;;0;
|
||||
... 3 --unit=w --warning-expires=0 WARNING: License 'base_fw' expires in.* \\\\| 'base_fw#license.expires.weeks'=\\\\d+w;0:0;;0; 'net_protection#license.expires.weeks'=\\\\d+w;0:0;;0; 'web_protection#license.expires.weeks'=\\\\d+w;0:0;;0;
|
||||
... 4 --unit=w --critical-expires=0 CRITICAL: License 'base_fw' expires in.* \\\\| 'base_fw#license.expires.weeks'=\\\\d+w;;0:0;0; 'net_protection#license.expires.weeks'=\\\\d+w;;0:0;0; 'web_protection#license.expires.weeks'=\\\\d+w;;0:0;0;
|
||||
... 5 --unit=w --warning-expires=1000000: WARNING: License 'base_fw' expires in.* \\\\| 'base_fw#license.expires.weeks'=\\\\d+w;1000000:;;0; 'net_protection#license.expires.weeks'=\\\\d+w;1000000:;;0; 'web_protection#license.expires.weeks'=\\\\d+w;1000000:;;0;
|
||||
... 6 --unit=w --critical-expires=1000000: CRITICAL: License 'base_fw' expires in.* \\\\| 'base_fw#license.expires.weeks'=\\\\d+w;;1000000:;0; 'net_protection#license.expires.weeks'=\\\\d+w;;1000000:;0; 'web_protection#license.expires.weeks'=\\\\d+w;;1000000:;0;
|
40
tests/network/cyberoam/snmp/list-interfaces.robot
Normal file
40
tests/network/cyberoam/snmp/list-interfaces.robot
Normal file
@ -0,0 +1,40 @@
|
||||
*** Settings ***
|
||||
Documentation Check Cyberoam equipments in SNMP.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
list-interfaces ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=list-interfaces
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Verify Command Output ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 071' [speed = ][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 175' [speed = ][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 128' [speed = ][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 037' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 2 --interface=1 List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback]
|
||||
... 3 --name='Anonymized 027' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 071' [speed = ][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 175' [speed = ][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 128' [speed = ][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 037' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 4 --speed=20 List interfaces: 'Anonymized 250' [speed = 20][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 20][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 20][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 20][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 071' [speed = 20][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 073' [speed = 20][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = 20][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = 20][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 20][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 175' [speed = 20][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 128' [speed = 20][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 037' [speed = 20][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 5 --skip-speed0='' --name='Anonymized 232' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] skipping interface 'Anonymized 071': interface speed is 0 and option --skip-speed0 is set 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] skipping interface 'Anonymized 232': interface speed is 0 and option --skip-speed0 is set skipping interface 'Anonymized 191': interface speed is 0 and option --skip-speed0 is set 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd]
|
||||
... 6 --filter-status='up' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] skipping interface 'Anonymized 071': no matching filter status 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] skipping interface 'Anonymized 232': no matching filter status skipping interface 'Anonymized 191': no matching filter status 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] skipping interface 'Anonymized 175': no matching filter status skipping interface 'Anonymized 128': no matching filter status 'Anonymized 037' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 7 --use-adminstatus='down' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] skipping interface 'Anonymized 071': adminstatus is not 'up' and option --use-adminstatus is set 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] skipping interface 'Anonymized 175': adminstatus is not 'up' and option --use-adminstatus is set
|
||||
... 8 --oid-filter='ifName' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 071' [speed = ][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 175' [speed = ][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 128' [speed = ][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 037' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 9 --oid-display='ifDesc' List interfaces: 'Anonymized 147' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 026' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 232' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 093' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 058' [speed = ][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 158' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 160' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 188' [speed = ][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 034' [speed = ][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 029' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 10 --display-transform-src='ens' --display-transform-dst='eth' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 071' [speed = ][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 175' [speed = ][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 128' [speed = ][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 037' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 11 --add-extra-oid='vlan,.1.3.6.1.2.1.31.19,\\\%{instance}\..*' List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][type = ethernetCsmacd] 'Anonymized 071' [speed = ][status = down][id = 13][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 14][type = ethernetCsmacd] 'Anonymized 232' [speed = ][status = down][id = 15][type = ethernetCsmacd] 'Anonymized 191' [speed = ][status = down][id = 16][type = ethernetCsmacd] 'Anonymized 242' [speed = 1000][status = up][id = 17][type = ethernetCsmacd] 'Anonymized 175' [speed = ][status = down][id = 18][type = ethernetCsmacd] 'Anonymized 128' [speed = ][status = down][id = 19][type = ethernetCsmacd] 'Anonymized 037' [speed = ][status = up][id = 2][type = ethernetCsmacd]
|
||||
... 12 --add-mac-address List interfaces: 'Anonymized 250' [speed = 10][status = up][id = 1][macaddress = ][type = softwareLoopback] 'Anonymized 012' [speed = 1000][status = up][id = 10][macaddress = 41:6e:6f:6e:79:6d:69:7a:65:64:20:30:38:34][type = ethernetCsmacd] 'Anonymized 118' [speed = 1000][status = up][id = 11][macaddress = 41:6e:6f:6e:79:6d:69:7a:65:64:20:31:38:34][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 12][macaddress = 41:6e:6f:6e:79:6d:69:7a:65:64:20:30:37:32][type = ethernetCsmacd] 'Anonymized 071' [speed = ][status = down][id = 13][macaddress = 41:6e:6f:6e:79:6d:69:7a:65:64:20:31:31:39][type = ethernetCsmacd] 'Anonymized 073' [speed = 1000][status = up][id = 14][macaddress = 41:6e:6f:6e:79:6d:69:7a:65:64:20:30:31:30][type = ethernetCsmacd]
|
32
tests/network/cyberoam/snmp/list-vpns.robot
Normal file
32
tests/network/cyberoam/snmp/list-vpns.robot
Normal file
@ -0,0 +1,32 @@
|
||||
*** Settings ***
|
||||
Documentation List VPN.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
list-vpns ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=list-vpns
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} List vpn [oid_path: 1] [name: Anonymized 093] [policy: Anonymized 208] [description: Anonymized 022] [connection_mode: Anonymized 245] [connection_type: site-to-site] [connection_status: active] [activated: active] [oid_path: 2] [name: Anonymized 252] [policy: Anonymized 055] [description: Anonymized 070] [connection_mode: Anonymized 123] [connection_type: site-to-site] [connection_status: active] [activated: active] [oid_path: 3] [name: Anonymized 029] [policy: Anonymized 151] [description: Anonymized 157] [connection_mode: Anonymized 055] [connection_type: site-to-site] [connection_status: inactive] [activated: active] [oid_path: 4] [name: Anonymized 132] [policy: Anonymized 089] [description: ] [connection_mode: Anonymized 185] [connection_type: site-to-site] [connection_status: active] [activated: active]
|
||||
... 2 --filter-name='Anonymized 093' List vpn [oid_path: 1] [name: Anonymized 093] [policy: Anonymized 208] [description: Anonymized 022] [connection_mode: Anonymized 245] [connection_type: site-to-site] [connection_status: active] [activated: active]
|
||||
... 3 --filter-connection-status='inactive' List vpn [oid_path: 3] [name: Anonymized 029] [policy: Anonymized 151] [description: Anonymized 157] [connection_mode: Anonymized 055] [connection_type: site-to-site] [connection_status: inactive] [activated: active]
|
||||
... 4 --filter-vpn-activated='active' List vpn [oid_path: 1] [name: Anonymized 093] [policy: Anonymized 208] [description: Anonymized 022] [connection_mode: Anonymized 245] [connection_type: site-to-site] [connection_status: active] [activated: active] [oid_path: 2] [name: Anonymized 252] [policy: Anonymized 055] [description: Anonymized 070] [connection_mode: Anonymized 123] [connection_type: site-to-site] [connection_status: active] [activated: active] [oid_path: 3] [name: Anonymized 029] [policy: Anonymized 151] [description: Anonymized 157] [connection_mode: Anonymized 055] [connection_type: site-to-site] [connection_status: inactive] [activated: active] [oid_path: 4] [name: Anonymized 132] [policy: Anonymized 089] [description: ] [connection_mode: Anonymized 185] [connection_type: site-to-site] [connection_status: active] [activated: active]
|
34
tests/network/cyberoam/snmp/memory.robot
Normal file
34
tests/network/cyberoam/snmp/memory.robot
Normal file
@ -0,0 +1,34 @@
|
||||
*** Settings ***
|
||||
Documentation Check memory usages.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
memory ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=memory
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} OK: Physical memory Total: 7.61 GB Used: 4.41 GB (58.00%) Free: 3.20 GB (42.00%) - Swap memory Total: 7.73 GB Used: 791.10 MB (10.00%) Free: 6.95 GB (90.00%) | 'physical_used'=4738284257.28B;;;0;8169455616 'swap_used'=829528473.6B;;;0;8295284736
|
||||
... 2 --filter-counters='^physical-usage$' OK: Physical memory Total: 7.61 GB Used: 4.41 GB (58.00%) Free: 3.20 GB (42.00%) | 'physical_used'=4738284257.28B;;;0;8169455616
|
||||
... 3 --warning-physical-usage=40 --critical-physical-usage=60 WARNING: Physical memory Total: 7.61 GB Used: 4.41 GB (58.00%) Free: 3.20 GB (42.00%) | 'physical_used'=4738284257.28B;0:3267782246;0:4901673369;0;8169455616 'swap_used'=829528473.6B;;;0;8295284736
|
||||
... 4 --warning-swap-usage=100 --critical-swap-usage=0 CRITICAL: Swap memory Total: 7.73 GB Used: 791.10 MB (10.00%) Free: 6.95 GB (90.00%) | 'physical_used'=4738284257.28B;;;0;8169455616 'swap_used'=829528473.6B;0:8295284736;0:0;0;8295284736
|
||||
... 5 --warning-physical-usage=60 --critical-physical-usage=40 CRITICAL: Physical memory Total: 7.61 GB Used: 4.41 GB (58.00%) Free: 3.20 GB (42.00%) | 'physical_used'=4738284257.28B;0:4901673369;0:3267782246;0;8169455616 'swap_used'=829528473.6B;;;0;8295284736
|
||||
... 6 --warning-swap-usage=0 --critical-swap-usage=100 WARNING: Swap memory Total: 7.73 GB Used: 791.10 MB (10.00%) Free: 6.95 GB (90.00%) | 'physical_used'=4738284257.28B;;;0;8169455616 'swap_used'=829528473.6B;0:0;0:8295284736;0;8295284736
|
39
tests/network/cyberoam/snmp/requests.robot
Normal file
39
tests/network/cyberoam/snmp/requests.robot
Normal file
@ -0,0 +1,39 @@
|
||||
*** Settings ***
|
||||
Documentation Check request statistics.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
requests ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=requests
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
# first run to build cache
|
||||
Run ${command}
|
||||
# second run to control the output
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --filter-counters='' OK: Requests live users: 38, http hits: 0, ftp hits: 0, pop3 hits: 0, imap hits: 0, smtp hits: 0 | 'live_users'=38;;;0; 'http_hits'=0;;;0; 'ftp_hits'=0;;;0; 'pop3_hits'=0;;;0; 'imap_hits'=0;;;0; 'smtp_hits'=0;;;0;
|
||||
... 2 --filter-counters='http' OK: Requests http hits: 0 | 'http_hits'=0;;;0;
|
||||
... 3 --warning-live-users=0 --critical-live-users=0 CRITICAL: Requests live users: 38 | 'live_users'=38;0:0;0:0;0; 'http_hits'=0;;;0; 'ftp_hits'=0;;;0; 'pop3_hits'=0;;;0; 'imap_hits'=0;;;0; 'smtp_hits'=0;;;0;
|
||||
... 4 --warning-http-hits=0 --critical-http-hits=10 OK: Requests live users: 38, http hits: 0, ftp hits: 0, pop3 hits: 0, imap hits: 0, smtp hits: 0 | 'live_users'=38;;;0; 'http_hits'=0;0:0;0:10;0; 'ftp_hits'=0;;;0; 'pop3_hits'=0;;;0; 'imap_hits'=0;;;0; 'smtp_hits'=0;;;0;
|
||||
... 5 --warning-ftp-hits=5 --critical-ftp-hits=10 OK: Requests live users: 38, http hits: 0, ftp hits: 0, pop3 hits: 0, imap hits: 0, smtp hits: 0 | 'live_users'=38;;;0; 'http_hits'=0;;;0; 'ftp_hits'=0;0:5;0:10;0; 'pop3_hits'=0;;;0; 'imap_hits'=0;;;0; 'smtp_hits'=0;;;0;
|
||||
... 6 --warning-smtp-hits=20 --critical-smtp-hits=10 OK: Requests live users: 38, http hits: 0, ftp hits: 0, pop3 hits: 0, imap hits: 0, smtp hits: 0 | 'live_users'=38;;;0; 'http_hits'=0;;;0; 'ftp_hits'=0;;;0; 'pop3_hits'=0;;;0; 'imap_hits'=0;;;0; 'smtp_hits'=0;0:20;0:10;0;
|
||||
... 7 --warning-pop3-hits=80 --critical-pop3-hits=100 OK: Requests live users: 38, http hits: 0, ftp hits: 0, pop3 hits: 0, imap hits: 0, smtp hits: 0 | 'live_users'=38;;;0; 'http_hits'=0;;;0; 'ftp_hits'=0;;;0; 'pop3_hits'=0;0:80;0:100;0; 'imap_hits'=0;;;0; 'smtp_hits'=0;;;0;
|
||||
... 8 --warning-imap-hits=50 --critical-imap-hits=50 OK: Requests live users: 38, http hits: 0, ftp hits: 0, pop3 hits: 0, imap hits: 0, smtp hits: 0 | 'live_users'=38;;;0; 'http_hits'=0;;;0; 'ftp_hits'=0;;;0; 'pop3_hits'=0;;;0; 'imap_hits'=0;0:50;0:50;0; 'smtp_hits'=0;;;0;
|
32
tests/network/cyberoam/snmp/services.robot
Normal file
32
tests/network/cyberoam/snmp/services.robot
Normal file
@ -0,0 +1,32 @@
|
||||
*** Settings ***
|
||||
Documentation Check services.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
services ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=services
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --component='service' OK: All 21 components are ok [21/21 services]. | 'hardware.service.count'=21;;;;
|
||||
... 2 --filter='toto' OK: All 21 components are ok [21/21 services]. | 'hardware.service.count'=21;;;;
|
||||
... 3 --no-component='UNKNOWN' OK: All 21 components are ok [21/21 services]. | 'hardware.service.count'=21;;;;
|
||||
... 4 --threshold-overload='service,toto,OK,running' OK: All 21 components are ok [21/21 services]. | 'hardware.service.count'=21;;;;
|
1231
tests/network/cyberoam/snmp/slim_sophos.snmpwalk
Normal file
1231
tests/network/cyberoam/snmp/slim_sophos.snmpwalk
Normal file
File diff suppressed because it is too large
Load Diff
1231
tests/network/cyberoam/snmp/slim_sophos_no_ha.snmpwalk
Normal file
1231
tests/network/cyberoam/snmp/slim_sophos_no_ha.snmpwalk
Normal file
File diff suppressed because it is too large
Load Diff
30
tests/network/cyberoam/snmp/storage.robot
Normal file
30
tests/network/cyberoam/snmp/storage.robot
Normal file
@ -0,0 +1,30 @@
|
||||
*** Settings ***
|
||||
Documentation Check storage usage.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
storage ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=storage
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --warning-usage=0 WARNING: Storage Usage Total: 86.97 GB Used: 20.87 GB (24.00%) Free: 66.10 GB (76.00%) | 'used'=22411676221.44B;0:0;;0;93381984256
|
||||
... 2 --critical-usage=0 CRITICAL: Storage Usage Total: 86.97 GB Used: 20.87 GB (24.00%) Free: 66.10 GB (76.00%) | 'used'=22411676221.44B;;0:0;0;93381984256
|
40
tests/network/cyberoam/snmp/vpn-status.robot
Normal file
40
tests/network/cyberoam/snmp/vpn-status.robot
Normal file
@ -0,0 +1,40 @@
|
||||
*** Settings ***
|
||||
Documentation Check VPN status. VPN-Connection-Status: inactive, active,partiallyActive.
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
Test Setup Ctn Generic Suite Setup
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cyberoam::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
vpn-status ${tc}
|
||||
[Tags] network cyberoam
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=vpn-status
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cyberoam/snmp/slim_sophos
|
||||
... --snmp-timeout=1
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --filter-counters='^total$|^total-normal$' OK: VPN total: 4 - All VPNs are ok | 'total'=4;;;0;
|
||||
... 2 --filter-name='Anonymized 029' CRITICAL: VPN 'Anonymized 029' (Anonymized 157) status: inactive | 'total'=1;;;0; 'total_inactive'=1;;;0; 'total_active'=0;;;0; 'total_partially_active'=0;;;0;
|
||||
... 3 --filter-name='Anonymized 132' OK: VPN total: 1, inactive: 0, active: 1, partially active: 0 - VPN 'Anonymized 132' status: active | 'total'=1;;;0; 'total_inactive'=0;;;0; 'total_active'=1;;;0; 'total_partially_active'=0;;;0;
|
||||
... 4 --filter-vpn-activated='^inactive$' OK: VPN total : skipped (no value(s)), inactive: 0, active: 0, partially active: 0 | 'total_inactive'=0;;;0; 'total_active'=0;;;0; 'total_partially_active'=0;;;0;
|
||||
... 5 --filter-vpn-activated='^active$' CRITICAL: VPN 'Anonymized 029' (Anonymized 157) status: inactive | 'total'=4;;;0; 'total_inactive'=1;;;0; 'total_active'=3;;;0; 'total_partially_active'=0;;;0;
|
||||
... 6 --filter-connection-type='host-to-host' OK: VPN total : skipped (no value(s)), inactive: 0, active: 0, partially active: 0 | 'total_inactive'=0;;;0; 'total_active'=0;;;0; 'total_partially_active'=0;;;0;
|
||||
... 7 --filter-connection-type='site-to-site' CRITICAL: VPN 'Anonymized 029' (Anonymized 157) status: inactive | 'total'=4;;;0; 'total_inactive'=1;;;0; 'total_active'=3;;;0; 'total_partially_active'=0;;;0;
|
||||
... 8 --filter-connection-type='tunnel-interface' OK: VPN total : skipped (no value(s)), inactive: 0, active: 0, partially active: 0 | 'total_inactive'=0;;;0; 'total_active'=0;;;0; 'total_partially_active'=0;;;0;
|
||||
... 9 --critical-status='' --warning-status='\\\%{connection_status} ne "active"' WARNING: VPN 'Anonymized 029' (Anonymized 157) status: inactive | 'total'=4;;;0; 'total_inactive'=1;;;0; 'total_active'=3;;;0; 'total_partially_active'=0;;;0;
|
||||
... 10 --critical-status='' --warning-total=0 --critical-total=20 WARNING: VPN total: 4 | 'total'=4;0:0;0:20;0; 'total_inactive'=1;;;0; 'total_active'=3;;;0; 'total_partially_active'=0;;;0;
|
||||
... 11 --critical-status='' --warning-total-inactive=10 --critical-total-inactive=0 CRITICAL: VPN inactive: 1 | 'total'=4;;;0; 'total_inactive'=1;0:10;0:0;0; 'total_active'=3;;;0; 'total_partially_active'=0;;;0;
|
||||
... 12 --critical-status='' --warning-total-active=0 --critical-total-active=0 CRITICAL: VPN active: 3 | 'total'=4;;;0; 'total_inactive'=1;;;0; 'total_active'=3;0:0;0:0;0; 'total_partially_active'=0;;;0;
|
@ -51,6 +51,7 @@ cpu-utilization-1m
|
||||
cpu-utilization-5m
|
||||
cpu-utilization-5s
|
||||
CX
|
||||
Cyberoam
|
||||
Datacore
|
||||
datasource
|
||||
DC4
|
||||
@ -61,12 +62,10 @@ dev
|
||||
df
|
||||
--dfsr
|
||||
dfsrevent
|
||||
--diskpath
|
||||
--display-transform-dst
|
||||
--display-transform-src
|
||||
dns-resolve-time
|
||||
--dyn-mode
|
||||
Ekara
|
||||
-EncodedCommand
|
||||
env
|
||||
ESX
|
||||
@ -99,7 +98,6 @@ ifName
|
||||
--ignore-orgs-api-disabled
|
||||
IMEI
|
||||
in-bcast
|
||||
includeAllDisks
|
||||
in-crc
|
||||
in-fcserror
|
||||
in-mcast
|
||||
@ -172,6 +170,7 @@ NLCapacity
|
||||
--noidle
|
||||
-NoLogo
|
||||
--nomachineaccount
|
||||
notapplicable
|
||||
--ntlmv2
|
||||
NTLMv2
|
||||
NTP
|
||||
@ -190,6 +189,7 @@ out-fc-wait
|
||||
out-mcast
|
||||
out-ucast
|
||||
overprovisioning
|
||||
partiallyActive
|
||||
--patch-redhat
|
||||
perfdata
|
||||
physicaldrive
|
||||
@ -214,7 +214,7 @@ Sansymphony
|
||||
SAS
|
||||
scenarii
|
||||
--scope-datacenter
|
||||
SFDC
|
||||
SFOS
|
||||
sfp.temperature
|
||||
--skip-ssl-check
|
||||
SkyHigh
|
||||
@ -226,6 +226,7 @@ space-usage-prct
|
||||
--sql-errors-exit
|
||||
SSDCapacity
|
||||
SSH
|
||||
standAlone
|
||||
statefile
|
||||
--statefile-concat-cwd
|
||||
SureBackup
|
||||
|
Loading…
x
Reference in New Issue
Block a user