(plugin) os::linux::snmp - add service discovery listdiskio (#4615)
This commit is contained in:
parent
7402f466cd
commit
cf2fa4366b
|
@ -12,6 +12,7 @@ on:
|
|||
- 'src/**'
|
||||
- 'tests/functional/**'
|
||||
- 'tests/resources/mockoon/**'
|
||||
- 'tests/resources/snmp/**'
|
||||
|
||||
jobs:
|
||||
functional-tests-with-robot:
|
||||
|
@ -19,51 +20,54 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install libs
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt-get install -y libcurl4-openssl-dev
|
||||
sudo apt-get install -qqy snmpsim
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "16.x"
|
||||
node-version: 16
|
||||
|
||||
- name: Install Mockoon CLI
|
||||
run: npm install -g -D @mockoon/cli@3.1.0
|
||||
|
||||
- name: Install libs
|
||||
run: sudo apt-get install libcurl4-openssl-dev
|
||||
|
||||
- name: Install perl dependencies
|
||||
uses: shogo82148/actions-setup-perl@v1
|
||||
with:
|
||||
perl-version: '5.34'
|
||||
install-modules-with: cpm
|
||||
install-modules: |
|
||||
Alien::SNMP
|
||||
DateTime
|
||||
Digest::MD5
|
||||
Encode
|
||||
ExtUtils::PkgConfig
|
||||
HTTP::ProxyPAC
|
||||
IO::Socket::SSL
|
||||
JSON::XS
|
||||
LWP::Protocol::https
|
||||
LWP::UserAgent
|
||||
MIME::Base64
|
||||
Net::Curl::Easy
|
||||
Paws
|
||||
POSIX
|
||||
Storable
|
||||
URI
|
||||
Net::SNMP
|
||||
URI::Encode
|
||||
XML::LibXML
|
||||
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Robot Framework
|
||||
run: pip3 install robotframework
|
||||
run: pip3.11 install robotframework
|
||||
shell: bash
|
||||
|
||||
- name: Run Robot Framework tests
|
||||
- name: Run Robot Framework API tests
|
||||
run: |
|
||||
sudo mkdir -p /var/lib/centreon/centplugins/
|
||||
sudo chmod 777 /var/lib/centreon/centplugins/
|
||||
robot tests/functional/
|
||||
robot tests/functional/api
|
||||
|
||||
- name: Run Robot Framework SNMP tests
|
||||
run: |
|
||||
sudo useradd snmp
|
||||
sudo mkdir -p /usr/snmpsim/data
|
||||
sudo cp tests/resources/snmp/* /usr/snmpsim/data/
|
||||
snmpsimd --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp &
|
||||
robot tests/functional/snmp
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
"snmp_standard/mode/inodes.pm",
|
||||
"snmp_standard/mode/interfaces.pm",
|
||||
"snmp_standard/mode/loadaverage.pm",
|
||||
"snmp_standard/mode/listdiskio.pm",
|
||||
"snmp_standard/mode/listdiskspath.pm",
|
||||
"snmp_standard/mode/listinterfaces.pm",
|
||||
"snmp_standard/mode/resources/",
|
||||
|
|
|
@ -39,6 +39,7 @@ sub new {
|
|||
'inodes' => 'snmp_standard::mode::inodes',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'load' => 'snmp_standard::mode::loadaverage',
|
||||
'list-diskio' => 'snmp_standard::mode::listdiskio',
|
||||
'list-diskspath' => 'snmp_standard::mode::listdiskspath',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'list-processes' => 'snmp_standard::mode::listprocesses',
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
#
|
||||
# Copyright 2023 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 snmp_standard::mode::listdiskio;
|
||||
|
||||
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;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $mapping = {
|
||||
index => { oid => '.1.3.6.1.4.1.2021.13.15.1.1.1' }, # diskioindex
|
||||
name => { oid => '.1.3.6.1.4.1.2021.13.15.1.1.2' } # diskiodevice
|
||||
};
|
||||
# parent oid for all the mapping usage
|
||||
my $oid_diskioEntry = '.1.3.6.1.4.1.2021.13.15.1.1';
|
||||
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_diskioEntry,
|
||||
start => $mapping->{index}->{oid}, # First oid of the mapping
|
||||
end => $mapping->{name}->{oid} # Last oid of the mapping
|
||||
);
|
||||
|
||||
my $results = {};
|
||||
# Iterate for all oids catch in snmp result above
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$mapping->{index}->{oid}\.(.*)$/);
|
||||
my $oid_path = $1;
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $oid_path);
|
||||
$results->{$oid_path} = {
|
||||
index => $result->{index},
|
||||
name => $result->{name}
|
||||
};
|
||||
}
|
||||
|
||||
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] [index: %s] [name: %s]',
|
||||
$oid_path,
|
||||
$results->{$oid_path}->{index},
|
||||
$results->{$oid_path}->{name}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List disk IO device'
|
||||
);
|
||||
$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 => ['index','name']);
|
||||
}
|
||||
|
||||
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(
|
||||
index => $results->{$oid_path}->{index},
|
||||
name => $results->{$oid_path}->{name}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List disk IO device (UCD-DISKIO-MIB).
|
||||
Need to enable "includeAllDisks 10%" on snmpd.conf.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -7,11 +7,12 @@ Library String
|
|||
|
||||
Suite Setup Start Mockoon
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||
${MOCKOON_JSON} ${CURDIR}${/}..${/}resources${/}mockoon${/}cloud-aws-cloudtrail.json
|
||||
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||
${MOCKOON_JSON} ${CURDIR}${/}..${/}..${/}resources${/}mockoon${/}cloud-aws-cloudtrail.json
|
||||
|
||||
${CMD} perl ${CENTREON_PLUGINS} --plugin=cloud::aws::cloudtrail::plugin --custommode=paws --region=eu-west --aws-secret-key=secret --aws-access-key=key
|
||||
|
||||
|
@ -150,53 +151,53 @@ AWS CloudTrail check trail status
|
|||
[Documentation] Check AWS CloudTrail trail status
|
||||
[Tags] cloud aws cloudtrail
|
||||
FOR ${checktrailstatus_value} IN @{checktrailstatus_values}
|
||||
${output} = Run
|
||||
${output} Run
|
||||
... ${CMD} --mode=checktrailstatus --endpoint=http://localhost:3000/cloudtrail/gettrailstatus/${checktrailstatus_value.trailstatus} --trail-name=${checktrailstatus_value.trailname}
|
||||
Should Be Equal As Strings
|
||||
... ${output}
|
||||
... ${checktrailstatus_value.result}
|
||||
... msg=Wrong output result for check trail status of ${checktrailstatus_value}
|
||||
... Wrong output result for check trail status of ${checktrailstatus_value}.{\n}Command output:{\n}${output}
|
||||
END
|
||||
|
||||
AWS CloudTrail count events
|
||||
[Documentation] Check AWS CloudTrail count events
|
||||
[Tags] cloud aws cloudtrail
|
||||
FOR ${countevents_value} IN @{countevents_values}
|
||||
${command} = Catenate
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=countevents
|
||||
... --endpoint=http://localhost:3000/cloudtrail/events/AwsApiCall/${countevents_value.AwsApiCall}/AwsServiceEvent/${countevents_value.AwsServiceEvent}/AwsConsoleAction/${countevents_value.AwsConsoleAction}/AwsConsoleSignIn/${countevents_value.AwsConsoleSignIn}/NextToken/${countevents_value.NextToken}
|
||||
${length} = Get Length ${countevents_value.eventtype}
|
||||
${length} Get Length ${countevents_value.eventtype}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --event-type=${countevents_value.eventtype}
|
||||
${command} Catenate ${command} --event-type=${countevents_value.eventtype}
|
||||
END
|
||||
${length} = Get Length ${countevents_value.delta}
|
||||
${length} Get Length ${countevents_value.delta}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --delta=${countevents_value.delta}
|
||||
${command} Catenate ${command} --delta=${countevents_value.delta}
|
||||
END
|
||||
${length} = Get Length ${countevents_value.errormessage}
|
||||
${length} Get Length ${countevents_value.errormessage}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --error-message=${countevents_value.errormessage}
|
||||
${command} Catenate ${command} --error-message=${countevents_value.errormessage}
|
||||
END
|
||||
${length} = Get Length ${countevents_value.warningcount}
|
||||
${length} Get Length ${countevents_value.warningcount}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --warning-count=${countevents_value.warningcount}
|
||||
${command} Catenate ${command} --warning-count=${countevents_value.warningcount}
|
||||
END
|
||||
${length} = Get Length ${countevents_value.criticalcount}
|
||||
${length} Get Length ${countevents_value.criticalcount}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --critical-count=${countevents_value.criticalcount}
|
||||
${command} Catenate ${command} --critical-count=${countevents_value.criticalcount}
|
||||
END
|
||||
${output} = Run ${command}
|
||||
${output} Run ${command}
|
||||
Should Be Equal As Strings
|
||||
... ${output}
|
||||
... ${countevents_value.result}
|
||||
... msg=Wrong output result for count events of ${countevents_value}
|
||||
... Wrong output result for count events of ${countevents_value}.{\n}Command output:{\n}${output}
|
||||
END
|
||||
|
||||
|
||||
*** Keywords ***
|
||||
Start Mockoon
|
||||
${executionresult} = Run Process
|
||||
${process} Start Process
|
||||
... mockoon-cli
|
||||
... start
|
||||
... --data
|
||||
|
@ -204,12 +205,12 @@ Start Mockoon
|
|||
... --port
|
||||
... 3000
|
||||
... --pname
|
||||
... azure-policyinsights
|
||||
Should Be Empty ${executionresult.stderr}
|
||||
... aws-cloudtrail
|
||||
Wait For Process ${process}
|
||||
|
||||
Stop Mockoon
|
||||
${executionresult} = Run Process
|
||||
${process} Start Process
|
||||
... mockoon-cli
|
||||
... stop
|
||||
... mockoon-azure-policyinsights
|
||||
Should Be Empty ${executionresult.stderr}
|
||||
... mockoon-aws-cloudtrail
|
||||
Wait For Process ${process}
|
|
@ -7,11 +7,12 @@ Library String
|
|||
|
||||
Suite Setup Start Mockoon
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||
${MOCKOON_JSON} ${CURDIR}${/}..${/}resources${/}mockoon${/}cloud-azure-policyinsights-policystates.json
|
||||
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||
${MOCKOON_JSON} ${CURDIR}${/}..${/}..${/}resources${/}mockoon${/}cloud-azure-policyinsights-policystates.json
|
||||
|
||||
${LOGIN_ENDPOINT} http://localhost:3000/login
|
||||
${CMD} perl ${CENTREON_PLUGINS} --plugin=cloud::azure::policyinsights::policystates::plugin --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --login-endpoint=${LOGIN_ENDPOINT}
|
||||
|
@ -48,33 +49,33 @@ Azure PolicyInsights PolicyStates compliance
|
|||
[Documentation] Check Azure PolicyInsights PolicyStates compliance
|
||||
[Tags] cloud azure policyinsights policystates
|
||||
FOR ${compliance_value} IN @{compliance_values}
|
||||
${command} = Catenate
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=compliance
|
||||
... --management-endpoint=${compliance_value.endpoint}
|
||||
${length} = Get Length ${compliance_value.policyname}
|
||||
${length} Get Length ${compliance_value.policyname}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --policy-name=${compliance_value.policyname}
|
||||
${command} Catenate ${command} --policy-name=${compliance_value.policyname}
|
||||
END
|
||||
${length} = Get Length ${compliance_value.resourcelocation}
|
||||
${length} Get Length ${compliance_value.resourcelocation}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --resource-location=${compliance_value.resourcelocation}
|
||||
${command} Catenate ${command} --resource-location=${compliance_value.resourcelocation}
|
||||
END
|
||||
${length} = Get Length ${compliance_value.resourcetype}
|
||||
${length} Get Length ${compliance_value.resourcetype}
|
||||
IF ${length} > 0
|
||||
${command} = Catenate ${command} --resource-type=${compliance_value.resourcetype}
|
||||
${command} Catenate ${command} --resource-type=${compliance_value.resourcetype}
|
||||
END
|
||||
${output} = Run ${command}
|
||||
${output} Run ${command}
|
||||
Should Be Equal As Strings
|
||||
... ${output}
|
||||
... ${compliance_value.result}
|
||||
... msg=Wrong output result for compliance of ${compliance_value}
|
||||
... Wrong output result for compliance of ${compliance_value}.{\n}Command output:{\n}${output}
|
||||
END
|
||||
|
||||
|
||||
*** Keywords ***
|
||||
Start Mockoon
|
||||
${executionresult} = Run Process
|
||||
${process} Start Process
|
||||
... mockoon-cli
|
||||
... start
|
||||
... --data
|
||||
|
@ -83,11 +84,11 @@ Start Mockoon
|
|||
... 3000
|
||||
... --pname
|
||||
... azure-policyinsights
|
||||
Should Be Empty ${executionresult.stderr}
|
||||
Wait For Process ${process}
|
||||
|
||||
Stop Mockoon
|
||||
${executionresult} = Run Process
|
||||
${process} Start Process
|
||||
... mockoon-cli
|
||||
... stop
|
||||
... mockoon-azure-policyinsights
|
||||
Should Be Empty ${executionresult.stderr}
|
||||
Wait For Process ${process}
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
current_dir="$( cd "$(dirname "$0")/../../../../.." >/dev/null 2>&1 || exit ; pwd -P )"
|
||||
cmd="perl $current_dir/src/centreon_plugins.pl --plugin=cloud::aws::cloudtrail::plugin --custommode=paws --region=eu-west --aws-secret-key=secret --aws-access-key=key"
|
||||
|
||||
nb_tests=0
|
||||
nb_tests_ok=0
|
||||
|
||||
test_status_ok=$($cmd --mode=checktrailstatus --endpoint=http://localhost:3000/cloudtrail/gettrailstatus/true --trail-name=TrailName)
|
||||
((nb_tests++))
|
||||
if [[ $test_status_ok = "OK: Trail is logging: 1 | 'trail_is_logging'=1;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_status_ok ko"
|
||||
echo $test_status_ok
|
||||
fi
|
||||
|
||||
test_status_critical=$($cmd --mode=checktrailstatus --endpoint=http://localhost:3000/cloudtrail/gettrailstatus/false --trail-name=TrailName)
|
||||
((nb_tests++))
|
||||
if [[ $test_status_critical = "CRITICAL: Trail is logging: 0 | 'trail_is_logging'=0;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_status_critical ko"
|
||||
echo $test_status_critical
|
||||
fi
|
||||
|
||||
if [[ $nb_tests_ok = $nb_tests ]]
|
||||
then
|
||||
echo "OK: "$nb_tests_ok"/"$nb_tests" tests OK"
|
||||
else
|
||||
echo "NOK: "$nb_tests_ok"/"$nb_tests" tests OK"
|
||||
fi
|
|
@ -1,106 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
current_dir="$( cd "$(dirname "$0")/../../../../.." >/dev/null 2>&1 || exit ; pwd -P )"
|
||||
cmd="perl $current_dir/src/centreon_plugins.pl --plugin=cloud::aws::cloudtrail::plugin --custommode=paws --region=eu-west --aws-secret-key=secret --aws-access-key=key"
|
||||
|
||||
nb_tests=0
|
||||
nb_tests_ok=0
|
||||
|
||||
endpoint_url="http://localhost:3000/cloudtrail/events/AwsApiCall/4/AwsServiceEvent/2/AwsConsoleAction/1/AwsConsoleSignIn/3/NextToken/t"
|
||||
|
||||
test_ok=$($cmd --mode=countevents --endpoint=$endpoint_url)
|
||||
((nb_tests++))
|
||||
if [[ $test_ok = "OK: Number of events: 10.00 | 'events_count'=10.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_ok ko"
|
||||
echo $test_ok
|
||||
fi
|
||||
|
||||
test_oknexttoken=$($cmd --mode=countevents --endpoint=$endpoint_url"rue")
|
||||
((nb_tests++))
|
||||
if [[ $test_oknexttoken = "OK: Number of events: 20.00 | 'events_count'=20.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_oknexttoken ko"
|
||||
echo $test_oknexttoken
|
||||
fi
|
||||
|
||||
test_okeventtype=$($cmd --mode=countevents --endpoint=$endpoint_url --event-type=AwsApiCall)
|
||||
((nb_tests++))
|
||||
if [[ $test_okeventtype = "OK: Number of events: 4.00 | 'events_count'=4.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_okeventtype ko"
|
||||
echo $test_okeventtype
|
||||
fi
|
||||
|
||||
test_okeventtypenexttoken=$($cmd --mode=countevents --endpoint=$endpoint_url"rue" --event-type=AwsServiceEvent)
|
||||
((nb_tests++))
|
||||
if [[ $test_okeventtypenexttoken = "OK: Number of events: 4.00 | 'events_count'=4.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_okeventtypenexttoken ko"
|
||||
echo $test_okeventtypenexttoken
|
||||
fi
|
||||
|
||||
test_okdelta=$($cmd --mode=countevents --endpoint=$endpoint_url --event-type=AwsApiCall --delta=10)
|
||||
((nb_tests++))
|
||||
if [[ $test_okdelta = "OK: Number of events: 4.00 | 'events_count'=4.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_okdelta ko"
|
||||
echo $test_okdelta
|
||||
fi
|
||||
|
||||
test_okerrormessage=$($cmd --mode=countevents --endpoint=$endpoint_url --error-message='Login error')
|
||||
((nb_tests++))
|
||||
if [[ $test_okerrormessage = "OK: Number of events: 3.00 | 'events_count'=3.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_okerrormessage ko"
|
||||
echo $test_okerrormessage
|
||||
fi
|
||||
|
||||
test_okerrormessagepartial=$($cmd --mode=countevents --endpoint=$endpoint_url --error-message='.*error')
|
||||
((nb_tests++))
|
||||
if [[ $test_okerrormessagepartial = "OK: Number of events: 4.00 | 'events_count'=4.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_okerrormessagepartial ko"
|
||||
echo $test_okerrormessagepartial
|
||||
fi
|
||||
|
||||
test_warning=$($cmd --mode=countevents --endpoint=$endpoint_url --warning-count=3)
|
||||
((nb_tests++))
|
||||
if [[ $test_warning = "WARNING: Number of events: 10.00 | 'events_count'=10.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_warning ko"
|
||||
echo $test_warning
|
||||
fi
|
||||
|
||||
test_critical=$($cmd --mode=countevents --endpoint=$endpoint_url --critical-count=5)
|
||||
((nb_tests++))
|
||||
if [[ $test_critical = "CRITICAL: Number of events: 10.00 | 'events_count'=10.00;;;0;" ]]
|
||||
then
|
||||
((nb_tests_ok++))
|
||||
else
|
||||
echo "test_critical ko"
|
||||
echo $test_critical
|
||||
fi
|
||||
|
||||
if [[ $nb_tests_ok = $nb_tests ]]
|
||||
then
|
||||
echo "OK: "$nb_tests_ok"/"$nb_tests" tests OK"
|
||||
else
|
||||
echo "NOK: "$nb_tests_ok"/"$nb_tests" tests OK"
|
||||
fi
|
|
@ -0,0 +1,48 @@
|
|||
*** Settings ***
|
||||
Documentation OS Linux SNMP plugin
|
||||
|
||||
Library OperatingSystem
|
||||
Library XML
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||
|
||||
${CMD} perl ${CENTREON_PLUGINS} --plugin=os::linux::snmp::plugin
|
||||
|
||||
&{list_diskio_test1}
|
||||
... snmpcommunity=os_linux_snmp_plugin
|
||||
... nbresults=10
|
||||
&{list_diskio_test2}
|
||||
... snmpcommunity=os_linux_snmp_plugin_2
|
||||
... nbresults=4
|
||||
@{list_diskio_tests}
|
||||
... &{list_diskio_test1}
|
||||
... &{list_diskio_test2}
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
Linux SNMP list diskio devices
|
||||
[Documentation] List Linux diskio devices
|
||||
[Tags] os linux snmp
|
||||
FOR ${list_diskio_test} IN @{list_diskio_tests}
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=list-diskio
|
||||
... --hostname=127.0.0.1
|
||||
... --snmp-version=2
|
||||
... --snmp-port=2024
|
||||
... --disco-show
|
||||
${command} Catenate ${command} --snmp-community=${list_diskio_test.snmpcommunity}
|
||||
${output} Run ${command}
|
||||
Log To Console ${command}
|
||||
${nb_results} Get Element Count
|
||||
... ${output}
|
||||
... label
|
||||
Should Be Equal As Integers
|
||||
... ${list_diskio_test.nbresults}
|
||||
... ${nb_results}
|
||||
... Wrong output result for list diskio devices: ${list_diskio_test}.{\n}Command output:{\n}${output}
|
||||
END
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue