mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
Ctor 716 plugin network cisco standar (#5455)
Co-authored-by: garnier-quentin <garnier.quentin@gmail.com> Co-authored-by: omercier <32134301+omercier@users.noreply.github.com>
This commit is contained in:
parent
f2142d2485
commit
5d10adc39b
@ -24,98 +24,111 @@ use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub custom_status_perfdata {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(label => 'running_last_changed', unit => 's',
|
||||
value => sprintf("%d", $self->{result_values}->{running_last_changed}),
|
||||
min => 0);
|
||||
$self->{output}->perfdata_add(label => 'running_last_saved', unit => 's',
|
||||
value => sprintf("%d", $self->{result_values}->{running_last_saved}),
|
||||
min => 0);
|
||||
$self->{output}->perfdata_add(label => 'startup_last_changed', unit => 's',
|
||||
value => sprintf("%d", $self->{result_values}->{startup_last_changed}),
|
||||
min => 0);
|
||||
}
|
||||
use centreon::plugins::misc;
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("Configuration Running Last Changed: %s, Running Last Saved: %s, Startup Last Changed: %s",
|
||||
($self->{result_values}->{running_last_changed} > 0) ? centreon::plugins::misc::change_seconds(value => $self->{result_values}->{running_last_changed}) : "-",
|
||||
($self->{result_values}->{running_last_saved} > 0) ? centreon::plugins::misc::change_seconds(value => $self->{result_values}->{running_last_saved}) : "-",
|
||||
($self->{result_values}->{startup_last_changed} > 0) ? centreon::plugins::misc::change_seconds(value => $self->{result_values}->{startup_last_changed}) : "-");
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_status_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{running_last_changed} = $options{new_datas}->{$self->{instance} . '_running_last_changed'};
|
||||
$self->{result_values}->{running_last_saved} = $options{new_datas}->{$self->{instance} . '_running_last_saved'};
|
||||
$self->{result_values}->{startup_last_changed} = $options{new_datas}->{$self->{instance} . '_startup_last_changed'};
|
||||
return 0;
|
||||
return $self->{result_values}->{output_message};
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'global', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
key_values => [ { name => 'running_last_changed' }, { name => 'running_last_saved' }, { name => 'startup_last_changed' } ],
|
||||
closure_custom_calc => $self->can('custom_status_calc'),
|
||||
{
|
||||
label => 'config-running-ahead', nlabel => 'configuration.running.ahead.since.seconds',
|
||||
set => {
|
||||
key_values => [ { name => 'running_ahead' }, { name => 'output_message' } ],
|
||||
closure_custom_output => $self->can('custom_status_output'),
|
||||
closure_custom_perfdata => $self->can('custom_status_perfdata'),
|
||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 's' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{running_last_changed} > %{running_last_saved}' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
||||
}
|
||||
|
||||
my $oid_ccmHistoryRunningLastChanged = '.1.3.6.1.4.1.9.9.43.1.1.1.0';
|
||||
my $oid_ccmHistoryRunningLastSaved = '.1.3.6.1.4.1.9.9.43.1.1.2.0';
|
||||
my $oid_ccmHistoryStartupLastChanged = '.1.3.6.1.4.1.9.9.43.1.1.3.0';
|
||||
my $oid_sysUpTime = '.1.3.6.1.2.1.1.3.0';
|
||||
my $oid_snmpEngineTime = '.1.3.6.1.6.3.10.2.1.3.0';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
$self->{snmp} = $options{snmp};
|
||||
my $ctime = time();
|
||||
my $runningChangedMarginAfterReload = 300;
|
||||
|
||||
$self->{global} = {};
|
||||
my $results = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_ccmHistoryRunningLastChanged,
|
||||
$oid_ccmHistoryRunningLastSaved,
|
||||
$oid_ccmHistoryStartupLastChanged,
|
||||
$oid_sysUpTime,
|
||||
$oid_snmpEngineTime
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{results} = $self->{snmp}->get_leef(oids => [ $oid_ccmHistoryRunningLastChanged, $oid_ccmHistoryRunningLastSaved,
|
||||
$oid_ccmHistoryStartupLastChanged ], nothing_quit => 1);
|
||||
my $uptime = defined($results->{$oid_snmpEngineTime}) ? $results->{$oid_snmpEngineTime} : ($results->{$oid_sysUpTime} / 100);
|
||||
|
||||
my $start_time = $ctime - $uptime;
|
||||
my $ccmHistoryRunningLastChanged = $start_time + ($results->{$oid_ccmHistoryRunningLastChanged} / 100);
|
||||
my $ccmHistoryRunningLastSaved = $start_time + ($results->{$oid_ccmHistoryRunningLastSaved} / 100);
|
||||
my $ccmHistoryStartupLastChanged = $start_time + ($results->{$oid_ccmHistoryStartupLastChanged} / 100);
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf(
|
||||
"ccmHistoryRunningLastChanged: %s (%s)",
|
||||
$ccmHistoryRunningLastChanged,
|
||||
scalar(localtime($ccmHistoryRunningLastChanged)))
|
||||
);
|
||||
$self->{output}->output_add(long_msg => sprintf(
|
||||
"ccmHistoryRunningLastSaved: %s (%s)",
|
||||
$ccmHistoryRunningLastSaved,
|
||||
scalar(localtime($ccmHistoryRunningLastSaved)))
|
||||
);
|
||||
$self->{output}->output_add(long_msg => sprintf(
|
||||
"ccmHistoryStartupLastChanged: %s (%s)",
|
||||
$ccmHistoryStartupLastChanged,
|
||||
scalar(localtime($ccmHistoryStartupLastChanged)))
|
||||
);
|
||||
|
||||
my $runningUnchangedDuration = $ctime - $ccmHistoryRunningLastChanged;
|
||||
my $startupUnchangedDuration = $ctime - $ccmHistoryStartupLastChanged;
|
||||
|
||||
my $runningAhead = 0;
|
||||
my $output = 'saved config is up to date';
|
||||
if ($runningUnchangedDuration < $startupUnchangedDuration) {
|
||||
if (($runningUnchangedDuration + $runningChangedMarginAfterReload) > $uptime) {
|
||||
$output = sprintf("running config has not changed since reload (using a %d second margin)", $runningChangedMarginAfterReload);
|
||||
} else {
|
||||
$output = sprintf(
|
||||
"running config is ahead of startup config since %s. changes will be lost in case of a reboot",
|
||||
centreon::plugins::misc::change_seconds(value => $runningUnchangedDuration)
|
||||
);
|
||||
$runningAhead = $runningUnchangedDuration;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{global} = {
|
||||
running_last_changed => $self->{results}->{$oid_ccmHistoryRunningLastChanged} / 100,
|
||||
running_last_saved => $self->{results}->{$oid_ccmHistoryRunningLastSaved} / 100,
|
||||
startup_last_changed => $self->{results}->{$oid_ccmHistoryStartupLastChanged} / 100,
|
||||
output_message => $output,
|
||||
running_ahead => $runningAhead
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,15 +142,13 @@ Check Cisco changed and saved configurations (CISCO-CONFIG-MAN-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-status>
|
||||
=item B<--warning-config-running-ahead>
|
||||
|
||||
Define the conditions to match for the status to be WARNING (default: '').
|
||||
You can use the following variables: %{running_last_changed}, %{running_last_saved}, %{startup_last_changed}
|
||||
Thresholds.
|
||||
|
||||
=item B<--critical-status>
|
||||
=item B<--critical-config-running-ahead>
|
||||
|
||||
Define the conditions to match for the status to be CRITICAL (default: '%{running_last_changed} > %{running_last_saved}').
|
||||
You can use the following variables: %{running_last_changed}, %{running_last_saved}, %{startup_last_changed}
|
||||
Thresholds.
|
||||
|
||||
=back
|
||||
|
||||
|
31
tests/network/cisco/standard/snmp/arp.robot
Normal file
31
tests/network/cisco/standard/snmp/arp.robot
Normal file
@ -0,0 +1,31 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
arp ${tc}
|
||||
[Tags] network arp snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=arp
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-version=${SNMPVERSION}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --warning-total-entries=2 --critical-total-entries=0 CRITICAL: total entries 3 | 'arp.total.entries.count'=3;0:2;0:0;0; 'arp.duplicate.macaddr.count'=0;;;0; 'arp.duplicate.ipaddr.count'=0;;;0;
|
||||
... 2 --filter-macaddr=1 OK: total entries 3 - duplicate mac address 0 - duplicate ip address 0 | 'arp.total.entries.count'=3;;;0; 'arp.duplicate.macaddr.count'=0;;;0; 'arp.duplicate.ipaddr.count'=0;;;0;
|
||||
... 3 --filter-ipaddr=5 OK: total entries 0 - duplicate mac address 0 - duplicate ip address 0 | 'arp.total.entries.count'=0;;;0; 'arp.duplicate.macaddr.count'=0;;;0; 'arp.duplicate.ipaddr.count'=0;;;0;
|
||||
... 4 --warning-duplicate-macaddr=3:3 --critical-duplicate-macaddr=0:0 WARNING: duplicate mac address 0 | 'arp.total.entries.count'=3;;;0; 'arp.duplicate.macaddr.count'=0;3:3;0:0;0; 'arp.duplicate.ipaddr.count'=0;;;0;
|
||||
... 5 --warning-duplicate-ipaddr=3:0 --critical-duplicate-ipaddr=1:0 CRITICAL: duplicate ip address 0 | 'arp.total.entries.count'=3;;;0; 'arp.duplicate.macaddr.count'=0;;;0; 'arp.duplicate.ipaddr.count'=0;3:0;1:0;0;
|
4006
tests/network/cisco/standard/snmp/cisco.snmpwalk
Normal file
4006
tests/network/cisco/standard/snmp/cisco.snmpwalk
Normal file
File diff suppressed because it is too large
Load Diff
28
tests/network/cisco/standard/snmp/configuration.robot
Normal file
28
tests/network/cisco/standard/snmp/configuration.robot
Normal file
@ -0,0 +1,28 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
configuration ${tc}
|
||||
[Tags] network configuration snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=configuration
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} OK: running config is ahead of startup config since -1y 3M 1w 4d 18h 40m 35s. changes will be lost in case of a reboot | 'configuration.running.ahead.since.seconds'=-40463790.78s;;;0;
|
||||
... 2 --warning-config-running-ahead=0 WARNING: running config is ahead of startup config since -1y 3M 1w 4d 18h 40m 35s. changes will be lost in case of a reboot | 'configuration.running.ahead.since.seconds'=-40463790.78s;0:0;;0;
|
||||
... 3 --critical-config-running-ahead=10 CRITICAL: running config is ahead of startup config since -1y 3M 1w 4d 18h 40m 35s. changes will be lost in case of a reboot | 'configuration.running.ahead.since.seconds'=-40463790.78s;;0:10;0;
|
32
tests/network/cisco/standard/snmp/cpu.robot
Normal file
32
tests/network/cisco/standard/snmp/cpu.robot
Normal file
@ -0,0 +1,32 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
cpu ${tc}
|
||||
[Tags] network cpu snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=cpu
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --verbose OK: 1 CPU(s) average usage is 60.00 % (5s) 57.00 % (1m) 48.00 % (5m) - CPU '1' usage 60.00 % (5s) 57.00 % (1m) 48.00 % (5m) | 'total_cpu_5s_avg'=60.00%;;;0;100 'total_cpu_1m_avg'=57.00%;;;0;100 'total_cpu_5m_avg'=48.00%;;;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;;;0;100 'cpu_5m'=48.00%;;;0;100 CPU '1' usage 60.00 % (5s) 57.00 % (1m) 48.00 % (5m)
|
||||
... 2 --check-order='process,old_sys,system_ext' OK: 1 CPU(s) average usage is 60.00 % (5s) 57.00 % (1m) 48.00 % (5m) - CPU '1' usage 60.00 % (5s) 57.00 % (1m) 48.00 % (5m) | 'total_cpu_5s_avg'=60.00%;;;0;100 'total_cpu_1m_avg'=57.00%;;;0;100 'total_cpu_5m_avg'=48.00%;;;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;;;0;100 'cpu_5m'=48.00%;;;0;100
|
||||
... 3 --warning-average-5s=0:2 --critical-average-5s=0:2 CRITICAL: 1 CPU(s) average usage is 60.00 % (5s) | 'total_cpu_5s_avg'=60.00%;0:2;0:2;0;100 'total_cpu_1m_avg'=57.00%;;;0;100 'total_cpu_5m_avg'=48.00%;;;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;;;0;100 'cpu_5m'=48.00%;;;0;100
|
||||
... 4 --warning-core-1m=0:1 --critical-core-1m=0:1 CRITICAL: CPU '1' usage 57.00 % (1m) | 'total_cpu_5s_avg'=60.00%;;;0;100 'total_cpu_1m_avg'=57.00%;;;0;100 'total_cpu_5m_avg'=48.00%;;;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;0:1;0:1;0;100 'cpu_5m'=48.00%;;;0;100
|
||||
... 5 --warning-average-5s=0:5 --critical-average-5s=0:5 CRITICAL: 1 CPU(s) average usage is 60.00 % (5s) | 'total_cpu_5s_avg'=60.00%;0:5;0:5;0;100 'total_cpu_1m_avg'=57.00%;;;0;100 'total_cpu_5m_avg'=48.00%;;;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;;;0;100 'cpu_5m'=48.00%;;;0;100
|
||||
... 6 --warning-average-1m=0:2 --critical-average-1m=0:2 CRITICAL: 1 CPU(s) average usage is 57.00 % (1m) | 'total_cpu_5s_avg'=60.00%;;;0;100 'total_cpu_1m_avg'=57.00%;0:2;0:2;0;100 'total_cpu_5m_avg'=48.00%;;;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;;;0;100 'cpu_5m'=48.00%;;;0;100
|
||||
... 7 --warning-average-5m=0:2 --critical-average-5m=0:0 CRITICAL: 1 CPU(s) average usage is 48.00 % (5m) | 'total_cpu_5s_avg'=60.00%;;;0;100 'total_cpu_1m_avg'=57.00%;;;0;100 'total_cpu_5m_avg'=48.00%;0:2;0:0;0;100 'cpu_5s'=60.00%;;;0;100 'cpu_1m'=57.00%;;;0;100 'cpu_5m'=48.00%;;;0;100
|
35
tests/network/cisco/standard/snmp/interfaces.robot
Normal file
35
tests/network/cisco/standard/snmp/interfaces.robot
Normal file
@ -0,0 +1,35 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
interfaces ${tc}
|
||||
[Tags] network interfaces snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=interfaces
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
${output} Run ${command}
|
||||
${output} Strip String ${output}
|
||||
Should Contain
|
||||
... ${output}
|
||||
... ${expected_result}
|
||||
... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
|
||||
... values=False
|
||||
... collapse_spaces=True
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --oid-display='ifName' CRITICAL: Interface 'Anonymized 250' Status : down (admin: up) - Interface 'Anonymized 235' Status : down (admin: up) - Interface 'Anonymized 155' Status : down (admin: up) - Interface 'Anonymized 080' Status : down (admin: up) - Interface 'Anonymized 103' Status : down (admin: up)
|
||||
... 2 --oid-extra-display='ifdesc' CRITICAL: Interface 'Anonymized 250' [ Anonymized 147 ] Status : down (admin: up) - Interface 'Anonymized 235' [ Anonymized 094 ] Status : down (admin: up) - Interface 'Anonymized 155' [ Anonymized 130 ] Status : down (admin: up) - Interface 'Anonymized 080' [ Anonymized 221 ] Status : down (admin: up) - Interface 'Anonymized 103' [ Anonymized 017 ] Status : down (admin: up)
|
||||
... 3 --display-transform-dst='toto' --display-transform-src='Anonymized 250' CRITICAL: Interface 'toto' Status : down (admin: up) - Interface 'Anonymized 235' Status : down (admin: up) - Interface 'Anonymized 155' Status : down (admin: up) - Interface 'Anonymized 080' Status : down (admin: up) - Interface 'Anonymized 103' Status : down (admin: up)
|
36
tests/network/cisco/standard/snmp/list-interfaces.robot
Normal file
36
tests/network/cisco/standard/snmp/list-interfaces.robot
Normal file
@ -0,0 +1,36 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
list-interfaces ${tc}
|
||||
[Tags] network list-interfaces snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=list-interfaces
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
${output} Run ${command}
|
||||
${output} Strip String ${output}
|
||||
Should Contain
|
||||
... ${output}
|
||||
... ${expected_result}
|
||||
... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
|
||||
... values=False
|
||||
... collapse_spaces=True
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} List interfaces: 'Anonymized 250' [speed = 1000][status = down][id = 1][type = propVirtual] 'Anonymized 072' [speed = 1000][status = up][id = 10101][type = ethernetCsmacd] 'Anonymized 064' [speed = 1000][status = up][id = 10102][type = ethernetCsmacd] 'Anonymized 254' [speed = 1000][status = up][id = 10103][type = ethernetCsmacd] 'Anonymized 243' [speed = 1000][status = up][id = 10104][type = ethernetCsmacd] 'Anonymized 071' [speed = 10][status = down][id = 10105][type = ethernetCsmacd] 'Anonymized 023' [speed = 10][status = down][id = 10106][type = ethernetCsmacd]
|
||||
... 2 --add-extra-oid='alias,.1.3.6.1.2.1.31.1.1.1.18' 'Anonymized 250' [speed = 1000][status = down][id = 1][alias = ][type = propVirtual]
|
||||
... 3 --display-transform-src='eth' --display-transform-dst='ens' 'Anonymized 250' [speed = 1000][status = down][id = 1][type = propVirtual]
|
||||
... 4 --add-mac-address 'Anonymized 250' [speed = 1000][status = down][id = 1][macaddress = 41:6e:6f:6e:79:6d:69:7a:65:64:20:32:34:38][type = propVirtual]
|
32
tests/network/cisco/standard/snmp/memory-flash.robot
Normal file
32
tests/network/cisco/standard/snmp/memory-flash.robot
Normal file
@ -0,0 +1,32 @@
|
||||
*** Settings ***
|
||||
Documentation Network citrix netscaler health
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
memory-flash ${tc}
|
||||
[Tags] network memory-flash snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=memory-flash
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} OK: All memory flash partitions are ok | 'Anonymized 175#memory.flash.usage.bytes'=68809216B;;;0;122185728 'Anonymized 175#memory.flash.free.bytes'=53376512B;;;0;122185728 'Anonymized 175#memory.flash.usage.percentage'=56.32%;;;0;100 'Anonymized 163#memory.flash.usage.bytes'=68844544B;;;0;122185728 'Anonymized 163#memory.flash.free.bytes'=53341184B;;;0;122185728 'Anonymized 163#memory.flash.usage.percentage'=56.34%;;;0;100 'Anonymized 131#memory.flash.usage.bytes'=65309184B;;;0;122185728 'Anonymized 131#memory.flash.free.bytes'=56876544B;;;0;122185728 'Anonymized 131#memory.flash.usage.percentage'=53.45%;;;0;100
|
||||
... 2 --warning-status='\\\%{status} eq "readWrite"' --filter-name='Anonymized 175' WARNING: Partition 'Anonymized 175' status : readWrite | 'Anonymized 175#memory.flash.usage.bytes'=68809216B;;;0;122185728 'Anonymized 175#memory.flash.free.bytes'=53376512B;;;0;122185728 'Anonymized 175#memory.flash.usage.percentage'=56.32%;;;0;100
|
||||
... 3 --critical-status='\\\%{status} eq "readWrite"' --filter-name='Anonymized 175' CRITICAL: Partition 'Anonymized 175' status : readWrite | 'Anonymized 175#memory.flash.usage.bytes'=68809216B;;;0;122185728 'Anonymized 175#memory.flash.free.bytes'=53376512B;;;0;122185728 'Anonymized 175#memory.flash.usage.percentage'=56.32%;;;0;100
|
||||
... 4 --warning-usage='' --critical-usage='' --filter-name='Anonymized 175' OK: Partition 'Anonymized 175' status : readWrite, Total: 116.53 MB Used: 65.62 MB (56.32%) Free: 50.90 MB (43.68%) | 'Anonymized 175#memory.flash.usage.bytes'=68809216B;;;0;122185728 'Anonymized 175#memory.flash.free.bytes'=53376512B;;;0;122185728 'Anonymized 175#memory.flash.usage.percentage'=56.32%;;;0;100
|
||||
... 5 --warning-usage-free=50 --critical-usage-free='' --filter-name='Anonymized 175' WARNING: Partition 'Anonymized 175' Total: 116.53 MB Used: 65.62 MB (56.32%) Free: 50.90 MB (43.68%) | 'Anonymized 175#memory.flash.usage.bytes'=68809216B;;;0;122185728 'Anonymized 175#memory.flash.free.bytes'=53376512B;0:50;;0;122185728 'Anonymized 175#memory.flash.usage.percentage'=56.32%;;;0;100
|
||||
... 6 --warning-usage-prct=0 --critical-usage-prct=1 --filter-name='Anonymized 175' CRITICAL: Partition 'Anonymized 175' Used : 56.32 % | 'Anonymized 175#memory.flash.usage.bytes'=68809216B;;;0;122185728 'Anonymized 175#memory.flash.free.bytes'=53376512B;;;0;122185728 'Anonymized 175#memory.flash.usage.percentage'=56.32%;0:0;0:1;0;100
|
29
tests/network/cisco/standard/snmp/memory.robot
Normal file
29
tests/network/cisco/standard/snmp/memory.robot
Normal file
@ -0,0 +1,29 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
memory ${tc}
|
||||
[Tags] network memory snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=memory
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 --warning-usage=0 WARNING: Memory 'Anonymized 021' Usage Total: 349.21 MB Used: 77.82 MB (22.29%) Free: 271.39 MB (77.71%) - Memory 'Anonymized 062' Usage Total: 916.05 KB Used: 40.00 B (0.00%) Free: 916.02 KB (100.00%) - Memory 'Anonymized 021' Usage Total: 83.95 KB Used: 40.00 B (0.05%) Free: 83.91 KB (99.95%) - Memory 'Anonymized 246' Usage Total: 32.00 MB Used: 12.10 MB (37.82%) Free: 19.90 MB (62.18%) - Memory 'Anonymized 135' Usage Total: 1.00 MB Used: 40.00 B (0.00%) Free: 1023.96 KB (100.00%) | 'used_Anonymized 021'=81605080B;0:0;;0;366174644 'used_Anonymized 062'=40B;0:0;;0;938040 'used_Anonymized 021'=40B;0:0;;0;85960 'used_Anonymized 246'=12689640B;0:0;;0;33554432 'used_Anonymized 135'=40B;0:0;;0;1048576
|
||||
... 2 --critical-usage=0 CRITICAL: Memory 'Anonymized 021' Usage Total: 349.21 MB Used: 77.82 MB (22.29%) Free: 271.39 MB (77.71%) - Memory 'Anonymized 062' Usage Total: 916.05 KB Used: 40.00 B (0.00%) Free: 916.02 KB (100.00%) - Memory 'Anonymized 021' Usage Total: 83.95 KB Used: 40.00 B (0.05%) Free: 83.91 KB (99.95%) - Memory 'Anonymized 246' Usage Total: 32.00 MB Used: 12.10 MB (37.82%) Free: 19.90 MB (62.18%) - Memory 'Anonymized 135' Usage Total: 1.00 MB Used: 40.00 B (0.00%) Free: 1023.96 KB (100.00%) | 'used_Anonymized 021'=81605080B;;0:0;0;366174644 'used_Anonymized 062'=40B;;0:0;0;938040 'used_Anonymized 021'=40B;;0:0;0;85960 'used_Anonymized 246'=12689640B;;0:0;0;33554432 'used_Anonymized 135'=40B;;0:0;0;1048576
|
||||
... 3 --filter-pool='.*' OK: All memories are ok | 'used_Anonymized 021'=81605080B;;;0;366174644 'used_Anonymized 062'=40B;;;0;938040 'used_Anonymized 021'=40B;;;0;85960 'used_Anonymized 246'=12689640B;;;0;33554432 'used_Anonymized 135'=40B;;;0;1048576
|
||||
... 4 --check-order='enhanced_pool,pool,process,system_ext' OK: All memories are ok | 'used_Anonymized 021'=81605080B;;;0;366174644 'used_Anonymized 062'=40B;;;0;938040 'used_Anonymized 021'=40B;;;0;85960 'used_Anonymized 246'=12689640B;;;0;33554432 'used_Anonymized 135'=40B;;;0;1048576
|
31
tests/network/cisco/standard/snmp/stack.robot
Normal file
31
tests/network/cisco/standard/snmp/stack.robot
Normal file
@ -0,0 +1,31 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
stack ${tc}
|
||||
[Tags] network stack snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=stack
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} OK: Stack status is 'redundant' - Number of members waiting: 0, progressing: 0, added: 0, ready: 3, SDM mismatch: 0, version mismatch: 0, feature mismatch: 0, new master init: 0, provisioned: 0, invalid: 0, removed: 0 - All stack members status are ok | 'waiting'=0;;;0; 'progressing'=0;;;0; 'added'=0;;;0; 'ready'=3;;;0; 'sdm_mismatch'=0;;;0; 'version_mismatch'=0;;;0; 'feature_mismatch'=0;;;0; 'new_master_init'=0;;;0; 'provisioned'=0;;;0; 'invalid'=0;;;0; 'removed'=0;;;0;
|
||||
... 2 --critical-status='\\\%{role} =~ /master/' CRITICAL: Member 'Anonymized 250' state is 'ready', role is 'master' | 'waiting'=0;;;0; 'progressing'=0;;;0; 'added'=0;;;0; 'ready'=3;;;0; 'sdm_mismatch'=0;;;0; 'version_mismatch'=0;;;0; 'feature_mismatch'=0;;;0; 'new_master_init'=0;;;0; 'provisioned'=0;;;0; 'invalid'=0;;;0; 'removed'=0;;;0;
|
||||
... 3 --warning-stack-status='\\\%{stack_status} =~ /redundant/' WARNING: Stack status is 'redundant' | 'waiting'=0;;;0; 'progressing'=0;;;0; 'added'=0;;;0; 'ready'=3;;;0; 'sdm_mismatch'=0;;;0; 'version_mismatch'=0;;;0; 'feature_mismatch'=0;;;0; 'new_master_init'=0;;;0; 'provisioned'=0;;;0; 'invalid'=0;;;0; 'removed'=0;;;0;
|
||||
... 4 --critical-stack-status='\\\%{stack_status} =~ /redundant/' CRITICAL: Stack status is 'redundant' | 'waiting'=0;;;0; 'progressing'=0;;;0; 'added'=0;;;0; 'ready'=3;;;0; 'sdm_mismatch'=0;;;0; 'version_mismatch'=0;;;0; 'feature_mismatch'=0;;;0; 'new_master_init'=0;;;0; 'provisioned'=0;;;0; 'invalid'=0;;;0; 'removed'=0;;;0;
|
||||
... 5 --warning-status='\\\%{state} =~ /ready/' WARNING: Member 'Anonymized 250' state is 'ready', role is 'master' - Member 'Anonymized 127' state is 'ready', role is 'member' - Member 'Anonymized 094' state is 'ready', role is 'member' | 'waiting'=0;;;0; 'progressing'=0;;;0; 'added'=0;;;0; 'ready'=3;;;0; 'sdm_mismatch'=0;;;0; 'version_mismatch'=0;;;0; 'feature_mismatch'=0;;;0; 'new_master_init'=0;;;0; 'provisioned'=0;;;0; 'invalid'=0;;;0; 'removed'=0;;;0;
|
||||
... 6 --warning-waiting=@0:10 --critical-waiting=@2:2 WARNING: Number of members waiting: 0 | 'waiting'=0;@0:10;@2:2;0; 'progressing'=0;;;0; 'added'=0;;;0; 'ready'=3;;;0; 'sdm_mismatch'=0;;;0; 'version_mismatch'=0;;;0; 'feature_mismatch'=0;;;0; 'new_master_init'=0;;;0; 'provisioned'=0;;;0; 'invalid'=0;;;0; 'removed'=0;;;0;
|
32
tests/network/cisco/standard/snmp/uptime.robot
Normal file
32
tests/network/cisco/standard/snmp/uptime.robot
Normal file
@ -0,0 +1,32 @@
|
||||
*** Settings ***
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::standard::snmp::plugin
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
uptime ${tc}
|
||||
[Tags] network uptime snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=uptime
|
||||
... --hostname=${HOSTNAME}
|
||||
... --snmp-port=${SNMPPORT}
|
||||
... --snmp-community=network/cisco/standard/snmp/cisco
|
||||
... ${extra_options}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extra_options expected_result --
|
||||
... 1 ${EMPTY} OK: System uptime is: 19d 16h 25m 40s | 'uptime'=1700740.00s;;;0;
|
||||
... 2 --warning-uptime=2000 WARNING: System uptime is: 19d 16h 25m 40s | 'uptime'=1700740.00s;0:2000;;0;
|
||||
... 3 --critical-uptime=5000 CRITICAL: System uptime is: 19d 16h 25m 40s | 'uptime'=1700740.00s;;0:5000;0;
|
||||
... 4 --add-sysdesc OK: System uptime is: 19d 16h 25m 40s, Anonymized 023Technical Support: http://www.cisco.com/techsupport | 'uptime'=1700740.00s;;;0;
|
||||
... 5 --force-oid='.1.3.6.1.2.1.2.2.1.3.181' OK: System uptime is: 0d | 'uptime'=0.00s;;;0;
|
||||
... 6 --check-overload --reboot-window=1000 OK: System uptime is: 19d 16h 25m 40s | 'uptime'=1700740.00s;;;0;
|
||||
... 7 --unit='w' OK: System uptime is: 19d 16h 25m 40s | 'uptime'=2.81w;;;0;
|
Loading…
x
Reference in New Issue
Block a user