Release 20240808 (#5135)

This commit is contained in:
pkippes 2024-08-08 14:37:18 +02:00 committed by GitHub
commit 6a985099d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
85 changed files with 5389 additions and 2041 deletions

View File

@ -134,8 +134,8 @@ runs:
path: ./*.${{ inputs.package_extension }}
key: ${{ inputs.cache_key }}
# Update if condition to true to get packages as artifacts
- if: ${{ false }}
# Add to your PR the label upload-artifacts to get packages as artifacts
- if: ${{ contains(github.event.pull_request.labels.*.name, 'upload-artifacts') }}
name: Upload package artifacts
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:

32
.github/patch/fpm-deb.rb.diff vendored Normal file
View File

@ -0,0 +1,32 @@
--- deb-save.rb 2024-07-12 16:04:30.785256976 +0000
+++ deb.rb 2024-07-12 16:21:22.035244607 +0000
@@ -709,10 +709,19 @@
end.flatten
if origin == FPM::Package::CPAN
+
+ # By default, we'd prefer to name Debian-targeted Perl packages using the
+ # same naming scheme that Debian itself uses, which is usually something
+ # like "lib<module-name-hyphenated>-perl", such as libregexp-common-perl
+ #
+ logger.info("Changing package name to match Debian's typical libmodule-name-perl style")
+ self.name = "lib#{self.name.sub(/^perl-/, "")}-perl"
+
# The fpm cpan code presents dependencies and provides fields as perl(ModuleName)
# so we'll need to convert them to something debian supports.
- # Replace perl(ModuleName) > 1.0 with Debian-style perl-ModuleName (> 1.0)
+ # Replace perl(Module::Name) > 1.0 with Debian-style libmodule-name-perl (> 1.0)
+ # per: https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html
perldepfix = lambda do |dep|
m = dep.match(/perl\((?<name>[A-Za-z0-9_:]+)\)\s*(?<op>.*$)/)
if m.nil?
@@ -723,7 +732,7 @@
modulename = m["name"].gsub("::", "-")
# Fix any upper-casing or other naming concerns Debian has about packages
- name = "#{attributes[:cpan_package_name_prefix]}-#{modulename}"
+ name = "lib#{modulename}-perl"
if m["op"].empty?
name

View File

@ -327,9 +327,12 @@ jobs:
image: [packaging-plugins-bullseye, packaging-plugins-bookworm, packaging-plugins-jammy, packaging-plugins-bullseye-arm64]
name:
[
"ARGV::Struct",
"Authen::SCRAM::Client",
"Config::AWS",
"Convert::EBCDIC",
"Crypt::Blowfish_PP",
"DataStruct::Flat",
"DateTime::Format::Duration::ISO8601",
"Device::Modbus",
"Digest::SHA1",
@ -371,6 +374,10 @@ jobs:
image: packaging-plugins-bullseye-arm64
arch: arm64
runner_name: ["self-hosted", "collect-arm64"]
- name: "Paws"
use_dh_make_perl: "false"
deb_dependencies: "libmoose-perl libmoosex-classattribute-perl libjson-maybexs-perl liburl-encode-perl libargv-struct-perl libmoo-perl libtype-tiny-perl libdatastruct-flat-perl libmodule-find-perl libthrowable-perl liburi-template-perl libnet-amazon-signature-v4-perl"
no-auto-depends: true
- name: "Statistics::Regression"
build_distribs: "bullseye"
version: "0.53"
@ -416,8 +423,6 @@ jobs:
run: |
apt-get install -y ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev
PACKAGE_NAME=`echo ${{ matrix.name }} | sed -e 's/::/-/g' | tr '[A-Z]' '[a-z]' | sed -e 's/^/lib/g' | sed -e 's/$/-perl/g' | sed -e 's/liblib/lib/g'`
if [ -z "${{ matrix.deb_dependencies }}" ]; then
PACKAGE_DEPENDENCIES=""
else
@ -426,11 +431,17 @@ jobs:
done
fi
if [ ! -z "${{ matrix.no-auto-depends }}" ]; then
PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --no-auto-depends"
fi
cpanm Module::Build::Tiny
cpanm Module::Install
gem install fpm
fpm -a native -s cpan -t ${{ matrix.package_extension }} --deb-dist ${{ matrix.distrib }} --iteration ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test -n $PACKAGE_NAME$PACKAGE_DEPENDENCIES -v ${{ steps.package-version.outputs.package_version }} ${{ matrix.name }}
# Patch to apply fpm fix for debian package generation while waiting for the official fix to be released.
patch -i .github/patch/fpm-deb.rb.diff $(find / -type f -name "deb.rb")
fpm -a native -s cpan -t ${{ matrix.package_extension }} --deb-dist ${{ matrix.distrib }} --iteration ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES -v ${{ steps.package-version.outputs.package_version }} ${{ matrix.name }}
shell: bash
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }}

View File

@ -248,8 +248,9 @@ jobs:
strategy:
fail-fast: false
matrix:
distrib: [el8, el9, jammy, bullseye, bookworm]
image: [testing-plugins-alma8, testing-plugins-alma9, testing-plugins-jammy, testing-plugins-bullseye, testing-plugins-bookworm]
include:
- runner_name: ubuntu-22.04
- package_extension: rpm
image: testing-plugins-alma8
distrib: el8
@ -265,8 +266,13 @@ jobs:
- package_extension: deb
image: testing-plugins-jammy
distrib: jammy
- package_extension: deb
image: testing-plugins-bullseye-arm64
distrib: bullseye
arch: arm64
runner_name: ["self-hosted", "collect-arm64"]
runs-on: ubuntu-22.04
runs-on: ${{ matrix.runner_name }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
credentials:

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
log.html
output.xml
report.html

View File

@ -0,0 +1,4 @@
{
"dependencies": [
]
}

View File

@ -0,0 +1,9 @@
{
"pkg_name": "centreon-plugin-Hardware-Storage-Hpe-Primera-Restapi",
"pkg_summary": "Centreon Plugin",
"plugin_name": "centreon_hpe_primera_restapi.pl",
"files": [
"centreon/plugins/script_custom.pm",
"storage/hp/primera/restapi/"
]
}

View File

@ -0,0 +1,4 @@
{
"dependencies": [
]
}

View File

@ -6,6 +6,7 @@
"centreon/plugins/script_snmp.pm",
"centreon/plugins/snmp.pm",
"snmp_standard/mode/cpu.pm",
"snmp_standard/mode/swap.pm",
"snmp_standard/mode/listinterfaces.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/interfaces.pm",

View File

@ -39,7 +39,7 @@ sub new {
'schedules' => 'apps::automation::ansible::tower::mode::schedules'
};
$self->{custom_modes}->{api} = 'apps::automation::ansible::tower::custom::api';
$self->{custom_modes}->{api} = 'apps::automation::ansible::tower::custom::api';
$self->{custom_modes}->{towercli} = 'apps::automation::ansible::tower::custom::towercli';
return $self;

View File

@ -42,12 +42,13 @@ sub new {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'hostname:s' => { name => 'hostname' },
'port:s' => { name => 'port'},
'proto:s' => { name => 'proto' },
'3cx-version:s' => { name => 'version_3cx' },
'api-username:s' => { name => 'api_username' },
'api-password:s' => { name => 'api_password' },
'timeout:s' => { name => 'timeout', default => 30 },
@ -56,7 +57,7 @@ sub new {
'critical-http-status:s' => { name => 'critical_http_status' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
$self->{output} = $options{output};
@ -77,16 +78,17 @@ sub set_defaults {}
sub check_options {
my ($self, %options) = @_;
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : '';
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
$self->{ssl_opt} = (defined($self->{option_results}->{ssl_opt})) ? $self->{option_results}->{ssl_opt} : undef;
$self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : '';
$self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : '';
$self->{unknown_http_status} = (defined($self->{option_results}->{unknown_http_status})) ? $self->{option_results}->{unknown_http_status} : '%{http_code} < 200 or %{http_code} >= 300' ;
$self->{warning_http_status} = (defined($self->{option_results}->{warning_http_status})) ? $self->{option_results}->{warning_http_status} : '';
$self->{critical_http_status} = (defined($self->{option_results}->{critical_http_status})) ? $self->{option_results}->{critical_http_status} : '';
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : '';
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
$self->{version_3cx} = (defined($self->{option_results}->{version_3cx})) ? $self->{option_results}->{version_3cx} : '';
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
$self->{ssl_opt} = (defined($self->{option_results}->{ssl_opt})) ? $self->{option_results}->{ssl_opt} : undef;
$self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : '';
$self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : '';
$self->{unknown_http_status} = (defined($self->{option_results}->{unknown_http_status})) ? $self->{option_results}->{unknown_http_status} : '%{http_code} < 200 or %{http_code} >= 300' ;
$self->{warning_http_status} = (defined($self->{option_results}->{warning_http_status})) ? $self->{option_results}->{warning_http_status} : '';
$self->{critical_http_status} = (defined($self->{option_results}->{critical_http_status})) ? $self->{option_results}->{critical_http_status} : '';
if ($self->{hostname} eq '') {
$self->{output}->add_option_msg(short_msg => 'Need to specify --hostname option.');
@ -100,7 +102,7 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => 'Need to specify --api-password option.');
$self->{output}->option_exit();
}
$self->{option_results}->{api_version} = $self->get_api_version(version_3cx => $self->{option_results}->{version_3cx});
$self->{cache}->check_options(option_results => $self->{option_results});
return 0;
@ -123,8 +125,12 @@ sub settings {
$self->{http}->add_header(key => 'Content-Type', value => 'application/json;charset=UTF-8');
if (defined($self->{cookie})) {
$self->{http}->add_header(key => 'Cookie', value => $self->{cookie});
if (defined($self->{xsrf})) {
$self->{http}->add_header(key => 'X-XSRF-TOKEN', value => $self->{xsrf});
if (defined($self->{auth_header})) {
my $auth_header_key = ( $self->{option_results}->{api_version} == 1 )
? 'X-XSRF-TOKEN'
: 'Authorization';
$self->{http}->add_header(key => $auth_header_key, value => $self->{auth_header});
}
}
$self->{http}->set_options(%{$self->{option_results}});
@ -135,10 +141,10 @@ sub authenticate {
my $has_cache_file = $options{statefile}->read(statefile => '3cx_api_' . md5_hex($self->{option_results}->{hostname}) . '_' . md5_hex($self->{option_results}->{api_username}));
my $cookie = $options{statefile}->get(name => 'cookie');
my $xsrf = $options{statefile}->get(name => 'xsrf');
my $auth_header = $options{statefile}->get(name => 'auth_header');
my $expires_on = $options{statefile}->get(name => 'expires_on');
if ($has_cache_file == 0 || !defined($cookie) || !defined($xsrf) || (($expires_on - time()) < 10)) {
if ($has_cache_file == 0 || !defined($cookie) || !defined($auth_header) || (($expires_on - time()) < 10)) {
my $post_data = '{"Username":"' . $self->{api_username} . '",' .
'"Password":"' . $self->{api_password} . '"}';
@ -161,17 +167,49 @@ sub authenticate {
$self->{output}->add_option_msg(short_msg => "Error retrieving cookie");
$self->{output}->option_exit();
}
# 3CX 16.0.5.611 does not use XSRF-TOKEN anymore
if (defined ($header) && $header =~ /(?:^| )XSRF-TOKEN=([^;]+);.*/) {
$xsrf = $1;
my $data;
if ($self->{option_results}->{api_version} == 1)
{
# for 3CX versions prior to 18.0.5
# 3CX 16.0.5.611 does not use XSRF-TOKEN anymore
if (defined ($header) && $header =~ /(?:^| )XSRF-TOKEN=([^;]+);.*/) {
$auth_header = $1;
}
$data = { last_timestamp => time(), cookie => $cookie, xsrf => $auth_header, expires_on => time() + (3600 * 24) };
} else {
# for 3CX versions higher or equal to 18.0.5
$self->{http}->add_header(key => 'Cookie', value => $cookie);
$content = $self->{http}->request(
method => 'GET',
url_path => '/api/Token',
unknown_status => $self->{unknown_http_status},
warning_status => $self->{warning_http_status},
critical_status => $self->{critical_http_status}
);
my $decoded;
eval {
$decoded = JSON::XS->new->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
$self->{output}->option_exit();
}
if (!defined($decoded)) {
$self->{output}->add_option_msg(short_msg => "Error while retrieving data (add --debug option for detailed message)");
$self->{output}->option_exit();
}
$auth_header = $decoded->{token_type} . " " . $decoded->{access_token};
$expires_on = time() + ($decoded->{expires_in} * 60);
$data = { last_timestamp => time(), cookie => $cookie, bearer => $auth_header, expires_on => $expires_on };
}
my $datas = { last_timestamp => time(), cookie => $cookie, xsrf => $xsrf, expires_on => time() + (3600 * 24) };
$options{statefile}->write(data => $datas);
$options{statefile}->write(data => $data);
}
$self->{cookie} = $cookie;
$self->{xsrf} = $xsrf;
$self->{auth_header} = $auth_header;
}
sub request_api {
@ -271,7 +309,7 @@ sub api_system_status {
return $status;
}
sub internal_update_checker {
sub internal_update_checker_v1 {
my ($self, %options) = @_;
my $status = $self->request_api(method => 'GET', url_path =>'/api/UpdateChecker/GetFromParams', eval_content => 1);
@ -285,11 +323,65 @@ sub internal_update_checker {
return $status;
}
sub internal_update_checker_v2 {
my ($self, %options) = @_;
my $status = $self->request_api(method => 'GET', url_path =>'/xapi/v1/GetUpdatesStats()');
if (ref($status) eq 'HASH') {
$status = $status->{TcxUpdate};
if (ref($status) ne 'ARRAY') {
# See above note about strange content
$status = JSON::XS->new->decode($status);
}
}
return $status;
}
sub api_update_checker {
my ($self, %options) = @_;
my $status = $self->internal_update_checker();
return $status;
if ($self->{option_results}->{api_version} == 1){
return $self->internal_update_checker_v1();
}
return $self->internal_update_checker_v2();
}
sub get_api_version {
my ($self, %options) = @_;
# Given the provided (or not) 3cx version, determine once and for all the API version
# This API version is an internal reference in centreon-plugins
# Version 1 corresponds to versions prior to v18 update 5 (<= 18.0.4.x)
# Version 2 corresponds to versions greater or equal to v18 update 5 (> 18.0.5.0)
# assuming the lastest API version if not provided
return 2 if ( !defined($options{version_3cx}) );
my @version_decomposition = $options{version_3cx} =~ /^([0-9]+)\.?([0-9]*)\.?([0-9]*)\.?([0-9]*)$/;
if (scalar(@version_decomposition) == 0){
$self->{output}->add_option_msg(
debug => 1,
long_msg => "Version '" . $options{version_3cx} . "' not formatted properly. Switching to latest supported version.");
return 2;
}
if ($version_decomposition[0] < 18
or $version_decomposition[0] == 18
and defined($version_decomposition[1]) and $version_decomposition[1] == 0
and defined($version_decomposition[2]) and $version_decomposition[2] < 5) {
$self->{output}->add_option_msg(
debug => 1,
long_msg => "Version '" . $options{version_3cx} . "' identified as prior to 18 update 5. Using old API.");
return 1;
} else {
$self->{output}->add_option_msg(
debug => 1,
long_msg => "Version '" . $options{version_3cx} . "' identified as higher or equal to 18 update 5. Using new API.");
return 2;
}
}
1;
@ -298,7 +390,7 @@ __END__
=head1 NAME
3CX Rest API
3CX Rest API module
=head1 REST API OPTIONS
@ -306,37 +398,48 @@ __END__
=item B<--hostname>
Set hostname or IP of 3CX server.
Define the name or the address of the 3CX server.
=item B<--port>
Set 3CX Port (default: '443').
Define the port to connect to (default: '443').
=item B<--proto>
Specify http if needed (default: 'https').
Define the protocol to reach the API (default: 'https').
=item B<--3cx-version>
Define the version of 3CX to monitor for the plugin to adapt to the API version. If this option is omitted, the plugin will assume the API is in the latest supported version.
Example: 18.0.9.20 for version 18 update 9.
=item B<--api-username>
Set 3CX Username.
Define the username for authentication.
=item B<--api-password>
Set 3CX Password.
Define the password associated with the username.
=item B<--timeout>
Threshold for HTTP timeout (default: '30').
Define the timeout in seconds (default: 30).
=item B<--unknown-http-status>
Threshold unknown for http response code.
(default: '%{http_code} < 200 or %{http_code} >= 300')
Define the conditions to match on the HTTP Status for the returned status to be UNKNOWN.
Default: '%{http_code} < 200 or %{http_code} >= 300'
=item B<--warning-http-status>
Warning threshold for http response code.
Define the conditions to match on the HTTP Status for the returned status to be WARNING.
Example: '%{http_code} == 500'
=item B<--critical-http-status>
Critical threshold for http response code.
Define the conditions to match on the HTTP Status for the returned status to be CRITICAL.
Example: '%{http_code} == 500'
=back

View File

@ -46,7 +46,7 @@ __END__
=head1 PLUGIN DESCRIPTION
Check 3CX ressources through its HTTPS remote API.
Monitor 3CX resources through its HTTPS API.
Requirements: at least 3CX 15.5.

View File

@ -26,11 +26,11 @@ use DBI;
use Digest::MD5 qw(md5_hex);
use POSIX qw(:signal_h);
my %handlers = ( ALRM => {} );
my %handlers = (ALRM => {});
sub new {
my ($class, %options) = @_;
my $self = {};
my $self = {};
bless $self, $class;
# $options{options} = options object
# $options{output} = output object
@ -60,16 +60,16 @@ sub new {
}
$options{options}->add_help(package => __PACKAGE__, sections => 'DBI OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{sqlmode_name} = $options{sqlmode_name};
$self->{instance} = undef;
$self->{output} = $options{output};
$self->{sqlmode_name} = $options{sqlmode_name};
$self->{instance} = undef;
$self->{statement_handle} = undef;
$self->{version} = undef;
$self->{version} = undef;
$self->{data_source} = undef;
$self->{username} = undef;
$self->{password} = undef;
$self->{connect_options} = undef;
$self->{data_source} = undef;
$self->{username} = undef;
$self->{password} = undef;
$self->{connect_options} = undef;
$self->{connect_options_hash} = {};
# Sometimes, we need to set ENV
@ -87,7 +87,7 @@ sub prepare_destroy {
sub set_signal_handlers {
my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM;
$SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
}
@ -103,7 +103,7 @@ sub handle_ALRM {
$self->prepare_destroy();
$self->disconnect();
$self->{output}->output_add(
severity => $self->{sql_errors_exit},
severity => $self->{sql_errors_exit},
short_msg => 'Timeout'
);
$self->{output}->display();
@ -136,7 +136,7 @@ sub check_options {
my ($self, %options) = @_;
$self->{data_source} = (defined($self->{option_results}->{data_source})) ? shift(@{$self->{option_results}->{data_source}}) : undef;
$self->{username} = undef;
$self->{username} = undef;
if (defined($self->{option_results}->{username})) {
$self->{username} = ref($self->{option_results}->{username}) eq 'ARRAY' ? shift(@{$self->{option_results}->{username}}) : $self->{option_results}->{username};
}
@ -144,10 +144,10 @@ sub check_options {
if (defined($self->{option_results}->{password})) {
$self->{password} = ref($self->{option_results}->{password}) eq 'ARRAY' ? shift(@{$self->{option_results}->{password}}) : $self->{option_results}->{password};
}
$self->{connect_options} = (defined($self->{option_results}->{connect_options})) ? shift(@{$self->{option_results}->{connect_options}}) : undef;
$self->{connect_query} = (defined($self->{option_results}->{connect_query})) ? shift(@{$self->{option_results}->{connect_query}}) : undef;
$self->{env} = (defined($self->{option_results}->{env})) ? shift(@{$self->{option_results}->{env}}) : undef;
$self->{connect_query} = (defined($self->{option_results}->{connect_query})) ? shift(@{$self->{option_results}->{connect_query}}) : undef;
$self->{env} = (defined($self->{option_results}->{env})) ? shift(@{$self->{option_results}->{env}}) : undef;
$self->{sql_errors_exit} = $self->{option_results}->{sql_errors_exit};
$self->{timeout} = 10;
@ -192,10 +192,10 @@ sub quote {
sub is_version_minimum {
my ($self, %options) = @_;
# $options{version} = string version to check
my @version_src = split /\./, $self->{version};
my @versions = split /\./, $options{version};
for (my $i = 0; $i < scalar(@versions); $i++) {
my @versions = split /\./, $options{version};
for (my $i = 0; $i < scalar(@versions); $i++) {
return 1 if ($versions[$i] eq 'x');
return 1 if (!defined($version_src[$i]));
$version_src[$i] =~ /^([0-9]*)/;
@ -222,10 +222,10 @@ sub disconnect {
$self->{instance} = undef;
}
}
sub connect {
my ($self, %options) = @_;
my $dontquit = (defined($options{dontquit}) && $options{dontquit} == 1) ? 1 : 0;
my $dontquit = (defined($options{dontquit}) && $options{dontquit} == 1) ? 1 : 0;
return if (defined($self->{instance}));
@ -241,7 +241,7 @@ sub connect {
eval {
alarm($self->{timeout}) if (defined($self->{timeout}));
$self->{instance} = DBI->connect(
"DBI:". $self->{data_source},
"DBI:" . $self->{data_source},
$self->{username},
$self->{password},
{ RaiseError => 0, PrintError => 0, AutoCommit => 1, %{$self->{connect_options_hash}} }
@ -257,8 +257,8 @@ sub connect {
if (!defined($self->{instance})) {
my $err_msg = sprintf(
'Cannot connect: %s',
defined($DBI::errstr) ? $DBI::errstr :
(defined($connect_error) ? $connect_error : '(no error string)')
defined($DBI::errstr) ? $DBI::errstr :
(defined($connect_error) ? $connect_error : '(no error string)')
);
if ($dontquit == 0) {
$self->{output}->add_option_msg(short_msg => $err_msg);
@ -306,7 +306,7 @@ sub fetchrow_hashref {
sub query {
my ($self, %options) = @_;
my $continue_error = defined($options{continue_error}) && $options{continue_error} == 1 ? 1 : 0;
my $continue_error = defined($options{continue_error}) && $options{continue_error} == 1 ? 1 : 0;
$self->{statement_handle} = $self->{instance}->prepare($options{query});
if (!defined($self->{statement_handle})) {
@ -318,7 +318,7 @@ sub query {
my $rv;
if (defined($self->{exec_timeout})) {
my $mask = POSIX::SigSet->new(SIGALRM);
my $mask = POSIX::SigSet->new(SIGALRM);
my $action = POSIX::SigAction->new(
sub { $self->handle_ALRM() },
$mask,
@ -335,7 +335,7 @@ sub query {
sigaction(SIGALRM, $oldaction);
} else {
$rv = $self->{statement_handle}->execute();
}
}
if (!$rv) {
return 1 if ($continue_error == 1);
@ -343,7 +343,7 @@ sub query {
$self->disconnect();
$self->{output}->option_exit(exit_litteral => $self->{sql_errors_exit});
}
return 0;
}
@ -357,7 +357,7 @@ DBI global
=head1 SYNOPSIS
dbi class
DBI class
=head1 DBI OPTIONS
@ -402,6 +402,6 @@ Timeout in seconds for query execution
=head1 DESCRIPTION
B<snmp>.
B<DBI>.
=cut

View File

@ -43,14 +43,15 @@ sub new {
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'hostname:s' => { name => 'hostname' },
'port:s' => { name => 'port' },
'proto:s' => { name => 'proto' },
'token:s' => { name => 'token' },
'timeout:s' => { name => 'timeout' },
'limit:s' => { name => 'limit' },
'config-file:s' => { name => 'config_file' },
'namespace:s' => { name => 'namespace' }
'hostname:s' => { name => 'hostname' },
'port:s' => { name => 'port' },
'proto:s' => { name => 'proto' },
'token:s' => { name => 'token' },
'timeout:s' => { name => 'timeout' },
'limit:s' => { name => 'limit' },
'config-file:s' => { name => 'config_file' },
'namespace:s' => { name => 'namespace' },
'legacy-api-beta:s' => { name => 'legacy_api_beta' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
@ -190,9 +191,14 @@ sub request_api_paginate {
sub kubernetes_list_cronjobs {
my ($self, %options) = @_;
my $url_path=$self->{namespace} ne '' ? '/apis/batch/v1/namespaces/' . $self->{namespace} . '/cronjobs' : '/apis/batch/v1/cronjobs';
if (defined($self->{legacy_api_beta})){
$url_path=$self->{namespace} ne '' ? '/apis/batch/v1beta1/namespaces/' . $self->{namespace} . '/cronjobs' : '/apis/batch/v1beta1/cronjobs';
};
my $response = $self->request_api_paginate(
method => 'GET',
url_path => $self->{namespace} ne '' ? '/apis/batch/v1beta1/namespaces/' . $self->{namespace} . '/cronjobs' : '/apis/batch/v1beta1/cronjobs'
url_path => $url_path
);
return $response;
@ -234,9 +240,14 @@ sub kubernetes_list_events {
sub kubernetes_list_ingresses {
my ($self, %options) = @_;
my $url_path=$self->{namespace} ne '' ? '/apis/networking.k8s.io/v1/namespaces/' . $self->{namespace} . '/ingresses' : '/apis/networking.k8s.io/v1/ingresses';
if (defined($self->{legacy_api_beta})){
$url_path=$self->{namespace} ne '' ? '/apis/extensions/v1beta1/namespaces/' . $self->{namespace} . '/ingresses' : '/apis/extensions/v1beta1/ingresses';
};
my $response = $self->request_api_paginate(
method => 'GET',
url_path => $self->{namespace} ne '' ? '/apis/extensions/v1beta1/namespaces/' . $self->{namespace} . '/ingresses' : '/apis/extensions/v1beta1/ingresses'
url_path => $url_path
);
return $response;
@ -369,7 +380,13 @@ See https://kubernetes.io/docs/reference/kubernetes-api/common-parameters/common
=item B<--namespace>
Set namespace to get informations.
Set namespace to get information.
=item B<--legacy-api-beta>
If this option is set the legacy API path are set for this API calls:
kubernetes_list_cronjobs will use this path: /apis/batch/v1beta1/namespaces/
kubernetes_list_ingresses will use this path: /apis/extensions/v1beta1/namespaces/
=back

View File

@ -283,7 +283,8 @@ sub get_entreprise_id {
my $response = $self->request_api(
method => 'POST',
endpoint => '/enterprise/getEnterprise'
endpoint => '/enterprise/getEnterprise',
query_form_post => {}
);
$self->{entreprise_id} = $response->{id};

View File

@ -210,7 +210,7 @@ Filter disks by name (can be a regexp).
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}, %{name}
=item B<--warning--status>
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (default: '%{status} =~ /reparing|formatting/i').
You can use the following variables: %{status}, %{name}

View File

@ -20,7 +20,7 @@
package network::sonus::sbc::snmp::mode::cpu;
use base qw(snmp_standard::mode::cpudetailed);
use base qw(snmp_standard::mode::cpu);
use strict;
use warnings;
@ -39,7 +39,7 @@ __END__
=head1 MODE
Check system CPUs.
Check system CPU.
(The average, over the last minute, of the percentage
of time that this processor was not idle)
@ -47,7 +47,7 @@ of time that this processor was not idle)
=item B<--use-ucd>
Use UCD mib for CPU average.
Use UCD MIB for CPU average.
=item B<--warning-average>

View File

@ -1,346 +1,367 @@
#
# 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::teldat::snmp::mode::cellsradio;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_signal_perfdata {
my ($self) = @_;
my $instances = [];
foreach (@{$self->{instance_mode}->{custom_perfdata_instances}}) {
push @$instances, $self->{result_values}->{$_};
}
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
instances => $instances,
value => $self->{result_values}->{ $self->{key_values}->[0]->{name} },
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_status_output {
my ($self, %options) = @_;
return sprintf(
'sim status: %s [imsi: %s] [interface state: %s]',
$self->{result_values}->{simStatus},
$self->{result_values}->{imsi},
$self->{result_values}->{interfaceState}
);
}
sub cell_long_output {
my ($self, %options) = @_;
return sprintf(
"checking cellular radio module '%s' [sim icc: %s, operator: %s]",
$options{instance_value}->{cellId},
$options{instance_value}->{simIcc},
$options{instance_value}->{operator}
);
}
sub prefix_cell_output {
my ($self, %options) = @_;
return sprintf(
"cellular radio module '%s' [sim icc: %s, operator: %s] ",
$options{instance_value}->{cellId},
$options{instance_value}->{simIcc},
$options{instance_value}->{operator}
);
}
sub prefix_global_output {
my ($self, %options) = @_;
return 'Number of cellular radio modules ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
{ name => 'cells', type => 3, cb_prefix_output => 'prefix_cell_output', cb_long_output => 'cell_long_output',
indent_long_output => ' ', message_multiple => 'All cellular radio modules are ok',
group => [
{ name => 'status', type => 0, skipped_code => { -10 => 1 } },
{ name => 'signal', type => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{global} = [
{ label => 'modules-cellradio-detected', display_ok => 0, nlabel => 'modules.cellradio.detected.count', set => {
key_values => [ { name => 'detected' } ],
output_template => 'detected: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'name'}
]
}
}
];
$self->{maps_counters}->{status} = [
{
label => 'status',
type => 2,
warning_default => '%{interfaceState} =~ /disconnect/',
critical_default => '%{simStatus} =~ /LOCKED/ || %{simStatus} =~ /DETECTING/',
set => {
key_values => [
{ name => 'cellId' }, { name => 'operator' }, { name => 'imsi' }, { name => 'simIcc' },
{ name => 'simStatus' }, { name => 'interfaceState' }
],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
];
$self->{maps_counters}->{signal} = [
{ label => 'module-cellradio-rsrp', nlabel => 'module.cellradio.rsrp.dbm', set => {
key_values => [ { name => 'rsrp' }, { name => 'cellId' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'rsrp: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-rsrq', nlabel => 'module.cellradio.rsrq.dbm', set => {
key_values => [ { name => 'rsrq' }, { name => 'cellId' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'rsrq: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-snr', nlabel => 'module.cellradio.snr.db', set => {
key_values => [ { name => 'snr' }, { name => 'cellId' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'snr: %s dB',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-rscp', nlabel => 'module.cellradio.rscp.dbm', set => {
key_values => [ { name => 'rscp' }, { name => 'cellId' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'rscp: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-csq', nlabel => 'module.cellradio.csq.dbm', set => {
key_values => [ { name => 'csq' }, { name => 'cellId' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'csq: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
}
];
}
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-cell-id:s' => { name => 'filter_cell_id' },
'custom-perfdata-instances:s' => { name => 'custom_perfdata_instances' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
if (!defined($self->{option_results}->{custom_perfdata_instances}) || $self->{option_results}->{custom_perfdata_instances} eq '') {
$self->{option_results}->{custom_perfdata_instances} = '%(cellId) %(operator)';
}
$self->{custom_perfdata_instances} = $self->custom_perfdata_instances(
option_name => '--custom-perfdata-instances',
instances => $self->{option_results}->{custom_perfdata_instances},
labels => { cellId => 1, operator => 1, simIcc => 1}
);
}
my $mapping_info_interface = {
imei => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.5' }, # teldatCellularInfoInterfaceModuleIMEI : Cellular module IMEI.
imsi => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.6' }, # teldatCellularInfoInterfaceModuleIMSI : Cellular module IMSI.
simIcc => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.8' }, # teldatCellularInfoInterfaceSIMIcc : Cellular active SIM ICC.
};
my $mapping_state_interface = {
interfaceState => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.1.1.2' } # teldatCellularStateInterfaceState : Call state.
};
my $mapping_state_mobile = {
techno => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.6' }, # teldatCellularStateMobileRadioTechnology : Cellular mobile current radio access tecnology used (!GETRAT).
rscp => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.8' }, # teldatCellularStateMobileRxSignalCodePwr : Cellular mobile received signal code power (RSCP).
csq => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.10' }, # teldatCellularStateMobileSignalQuality : Cellular mobile reception signal quality (+CSQ).
rsrp => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.22' }, # teldatCellularStateMobileRxRSRP : Cellular mobile reference symbol received power (RSRP).
rsrq => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.23' }, # teldatCellularStateMobileRxRSRQ : Cellular mobile reference signal received quality (RSRQ).
snr => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.24' }, # teldatCellularStateMobileRxSINR : Cellular mobile signal versus noise ratio (SINR).
simStatus => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.26' } # teldatCellularStateMobileSIMStatus : Cellular mobile SIM status.
};
my $mapping_prof_dial = {
operator => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.4.1.2' } # teldatCellularProfDialName1 : Dial Profile Name(1) associated to cellular interface.
};
my $oid_teldatCellularInfoInterfaceEntry = '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1'; # teldatInfoInterfaceTable
my $oid_teldatCellularStateMobileEntry = '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1'; # teldatStateMobileTable
sub manage_selection {
my ($self, %options) = @_;
$self->{global} = { detected => 0 };
$self->{cells} = {};
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $mapping_state_interface->{interfaceState}->{oid} },
{ oid => $mapping_prof_dial->{operator}->{oid} },
{ oid => $oid_teldatCellularInfoInterfaceEntry, start => $mapping_info_interface->{imei}->{oid}, end => $mapping_info_interface->{simIcc}->{oid} },
{ oid => $oid_teldatCellularStateMobileEntry, start => $mapping_state_mobile->{techno}->{oid}, end => $mapping_state_mobile->{simStatus}->{oid} }
],
nothing_quit => 1
);
foreach my $oid (keys %{$snmp_result->{$oid_teldatCellularInfoInterfaceEntry}}) {
next if ($oid !~ /^$mapping_info_interface->{imei}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping_info_interface, results => $snmp_result->{$oid_teldatCellularInfoInterfaceEntry}, instance => $instance);
my $result2 = $options{snmp}->map_instance(mapping => $mapping_state_interface, results => $snmp_result->{$mapping_state_interface->{interfaceState}->{oid}}, instance => $instance);
my $result3 = $options{snmp}->map_instance(mapping => $mapping_prof_dial, results => $snmp_result->{$mapping_prof_dial->{operator}->{oid}}, instance => $instance);
my $cell_id = $result->{imei};
next if ($cell_id !~ /^(?:[0-9]+)$/);
next if (defined($self->{option_results}->{filter_cell_id}) && $self->{option_results}->{filter_cell_id} ne '' &&
$cell_id !~ /$self->{option_results}->{filter_cell_id}/ && $result->{simIcc} !~ /$self->{option_results}->{filter_cell_id}/);
my $operator = $result3->{operator};
if($result3->{operator} =~ /^-+$/){
$operator = "N/A";
}
$self->{cells}->{$instance} = {
cellId => $cell_id,
simIcc => $result->{simIcc},
operator => $operator,
status => {
cellId => $cell_id,
simIcc => $result->{simIcc},
operator => $operator,
imsi => $result->{imsi},
interfaceState => $result2->{interfaceState}
},
signal => {
cellId => $cell_id,
simIcc => $result->{simIcc},
operator => $operator
}
};
}
if (scalar(keys %{$self->{cells}}) <= 0 && defined($self->{option_results}->{filter_cell_id}) && $self->{option_results}->{filter_cell_id} ne '') {
$self->{output}->add_option_msg(short_msg => "No Cell ID found matching with filter : ".$self->{option_results}->{filter_cell_id});
$self->{output}->option_exit();
}
# Return : OK: | 'modules.cellradio.detected.count'=0;;;0;
# return if (scalar(keys %{$self->{cells}}) <= 0);
foreach my $instance (keys %{$self->{cells}}) {
my $result4 = $options{snmp}->map_instance(mapping => $mapping_state_mobile, results => $snmp_result->{$oid_teldatCellularStateMobileEntry}, instance => $instance);
$self->{cells}->{$instance}->{status}->{simStatus} = $result4->{simStatus};
if ($self->{cells}->{$instance}->{status}->{simIcc} ne '') {
if($result4->{rsrp} ne '' && $result4->{rsrp} ne 0){
$self->{cells}->{$instance}->{signal}->{rsrp} = $result4->{rsrp};
}
if($result4->{rsrq} ne '' && $result4->{rsrq} ne 0) {
$self->{cells}->{$instance}->{signal}->{rsrq} = $result4->{rsrq};
}
if($result4->{snr} ne '' && $result4->{snr} ne 0) {
$self->{cells}->{$instance}->{signal}->{snr} = $result4->{snr};
}
if($result4->{rscp} ne '' && $result4->{rscp} ne 0) {
$self->{cells}->{$instance}->{signal}->{rscp} = $result4->{rscp};
}
if($result4->{csq} ne '' && $result4->{csq} ne 0) {
$self->{cells}->{$instance}->{signal}->{csq} = $result4->{csq};
}
}
$self->{global}->{detected}++;
}
}
1;
__END__
=head1 MODE
Check cellular radio modules.
=over 8
=item B<--filter-cell-id>
Filter cell modules by IMEI ID.
=item B<--custom-perfdata-instances>
Define perfdatas instance (default: '%(cellId) %(operator)').
You can use the following variables: %{cellId}, %{simIcc}, %{operator}
=item B<--unknown-status>
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{simStatus}, %{interfaceState}, %{cellId}, %{simIcc}, %{operator}, %{imsi}
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (default: '%{interfaceState} =~ /disconnect/').
You can use the following variables: %{simStatus}, %{interfaceState}, %{cellId}, %{simIcc}, %{operator}, %{imsi}
=item B<--critical-status>
Define the conditions to match for the status to be CRITICAL (default: '%{simStatus} =~ /LOCKED/ || %{simStatus} =~ /DETECTING/').
You can use the following variables: %{simStatus}, %{interfaceState}, %{cellId}, %{simIcc}, %{operator}, %{imsi}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'modules-cellradio-detected', 'module-cellradio-rsrp', ''module-cellradio-rsrq', 'module-cellradio-rscp', 'module-cellradio-csq'
'module-cellradio-snr'.
=back
=cut
#
# 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::teldat::snmp::mode::cellsradio;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_signal_perfdata {
my ($self) = @_;
my $instances = [];
foreach (@{$self->{instance_mode}->{custom_perfdata_instances}}) {
push @$instances, $self->{result_values}->{$_};
}
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
instances => $instances,
value => $self->{result_values}->{ $self->{key_values}->[0]->{name} },
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_status_output {
my ($self, %options) = @_;
return sprintf(
'sim status: %s [operator: %s] [imsi: %s] [interface state: %s] [simIcc: %s]',
$self->{result_values}->{simStatus},
$self->{result_values}->{operator},
$self->{result_values}->{imsi},
$self->{result_values}->{interfaceState},
$self->{result_values}->{simIcc}
);
}
sub cell_long_output {
my ($self, %options) = @_;
return sprintf(
"checking cellular radio module '%s' interface '%s' [imei: %s] ",
$options{instance_value}->{module_num},
$options{instance_value}->{interfaceType},
$options{instance_value}->{imei}
);
}
sub prefix_cell_output {
my ($self, %options) = @_;
return sprintf(
"cellular radio module '%s' interface '%s' [imei: %s] ",
$options{instance_value}->{module_num},
$options{instance_value}->{interfaceType},
$options{instance_value}->{imei}
);
}
sub prefix_global_output {
my ($self, %options) = @_;
return 'Number of cellular radio interfaces';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
{ name => 'cells', type => 3, cb_prefix_output => 'prefix_cell_output', cb_long_output => 'cell_long_output',
indent_long_output => ' ', message_multiple => 'All cellular radio interfaces are ok',
group => [
{ name => 'status', type => 0, skipped_code => { -10 => 1 } },
{ name => 'signal', type => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{global} = [
{ label => 'modules-cellradio-detected', display_ok => 0, nlabel => 'modules.cellradio.detected.count', set => {
key_values => [ { name => 'detected' } ],
output_template => 'detected: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
}
];
$self->{maps_counters}->{status} = [
{
label => 'status',
type => 2,
warning_default => '%{interfaceState} =~ /disconnect/ && %{interfaceType} =~ /data primary/',
set => {
key_values => [
{ name => 'module' }, { name => 'interfaceType' }, { name => 'imei' }, { name => 'simIcc' },
{ name => 'operator' }, { name => 'imsi' },
{ name => 'simStatus' }, { name => 'interfaceState' }
],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
];
$self->{maps_counters}->{signal} = [
{ label => 'module-cellradio-rsrp', nlabel => 'module.cellradio.rsrp.dbm', set => {
key_values => [ { name => 'rsrp' }, { name => 'module' }, { name => 'interfaceType' }, { name => 'imei' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'rsrp: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-rsrq', nlabel => 'module.cellradio.rsrq.dbm', set => {
key_values => [ { name => 'rsrq' }, { name => 'module' }, { name => 'interfaceType' }, { name => 'imei' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'rsrq: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-snr', nlabel => 'module.cellradio.snr.db', set => {
key_values => [ { name => 'snr' }, { name => 'module' }, { name => 'interfaceType' }, { name => 'imei' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'snr: %s dB',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-rscp', nlabel => 'module.cellradio.rscp.dbm', set => {
key_values => [ { name => 'rscp' }, { name => 'module' }, { name => 'interfaceType' }, { name => 'imei' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'rscp: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
},
{ label => 'module-cellradio-csq', nlabel => 'module.cellradio.csq.dbm', set => {
key_values => [ { name => 'csq' }, { name => 'module' }, { name => 'interfaceType' }, { name => 'imei' }, { name => 'simIcc' }, { name => 'operator' } ],
output_template => 'csq: %s dBm',
closure_custom_perfdata => $self->can('custom_signal_perfdata')
}
}
];
}
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-module:s' => { name => 'filter_module' },
'filter-imei:s' => { name => 'filter_imei' },
'filter-interface-type:s' => { name => 'filter_interface_type' },
'custom-perfdata-instances:s' => { name => 'custom_perfdata_instances' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
if (!defined($self->{option_results}->{custom_perfdata_instances}) || $self->{option_results}->{custom_perfdata_instances} eq '') {
$self->{option_results}->{custom_perfdata_instances} = '%(module) %(interfaceType) %(imei)';
}
$self->{custom_perfdata_instances} = $self->custom_perfdata_instances(
option_name => '--custom-perfdata-instances',
instances => $self->{option_results}->{custom_perfdata_instances},
labels => { module => 1, interfaceType => 1, imei => 1, imsi => 1, operator => 1, simIcc => 1}
);
}
my $mapping_info_interface = {
imei => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.5' }, # teldatCellularInfoInterfaceModuleIMEI : Cellular module IMEI.
imsi => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.6' }, # teldatCellularInfoInterfaceModuleIMSI : Cellular module IMSI.
simIcc => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.8' } # teldatCellularInfoInterfaceSIMIcc : Cellular active SIM ICC.
};
my $mapping_data_interface = {
interfaceState => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.1.1.2' }, # teldatCellularStateInterfaceState : Call state.
techno => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.6' }, # teldatCellularStateMobileRadioTechnology : Cellular mobile current radio access tecnology used (!GETRAT).
rscp => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.8' }, # teldatCellularStateMobileRxSignalCodePwr : Cellular mobile received signal code power (RSCP).
csq => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.10' }, # teldatCellularStateMobileSignalQuality : Cellular mobile reception signal quality (+CSQ).
rsrp => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.22' }, # teldatCellularStateMobileRxRSRP : Cellular mobile reference symbol received power (RSRP).
rsrq => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.23' }, # teldatCellularStateMobileRxRSRQ : Cellular mobile reference signal received quality (RSRQ).
snr => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.24' }, # teldatCellularStateMobileRxSINR : Cellular mobile signal versus noise ratio (SINR).
simStatus => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.2.1.26' }, # teldatCellularStateMobileSIMStatus : Cellular mobile SIM status.
operator => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.3.4.1.2' }
};
my $oid_teldatCellularInfoInterfaceEntry = '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1'; # teldatInfoInterfaceTable
my $interface_types = {
1 => 'control vocal',
2 => 'data primary',
3 => 'data auxiliary'
};
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_table(
oid => $oid_teldatCellularInfoInterfaceEntry,
start => $mapping_info_interface->{imei}->{oid},
end => $mapping_info_interface->{simIcc}->{oid},
nothing_quit => 1
);
$self->{global} = { detected => 0 };
$self->{cells} = {};
my $modules = {};
my $module_num = 0;
my $interface_type = 0;
foreach my $oid ($options{snmp}->oid_lex_sort(keys %$snmp_result)) {
next if ($oid !~ /^$mapping_info_interface->{imei}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping_info_interface, results => $snmp_result, instance => $instance);
next if ($result->{imei} !~ /^[0-9]+$/);
if (!defined($modules->{$module_num}) || $result->{imei} ne $modules->{$module_num}) {
$module_num++;
$interface_type = 0;
$modules->{$module_num} = $result->{imei};
}
if (defined($modules->{$module_num})) {
$interface_type++;
}
my $module = 'module' . $module_num;
next if (defined($self->{option_results}->{filter_module}) && $self->{option_results}->{filter_module} ne '' &&
$module !~ /$self->{option_results}->{filter_module}/);
next if (defined($self->{option_results}->{filter_imei}) && $self->{option_results}->{filter_imei} ne '' &&
$result->{imei} !~ /$self->{option_results}->{filter_imei}/);
next if (defined($self->{option_results}->{filter_interface_type}) && $self->{option_results}->{filter_interface_type} ne '' &&
$interface_types->{$interface_type} !~ /$self->{option_results}->{filter_interface_type}/);
$self->{cells}->{$instance} = {
module => $module,
module_num => $module_num,
interfaceType => $interface_types->{$interface_type},
imei => $result->{imei},
status => {
module => $module,
interfaceType => $interface_types->{$interface_type},
imei => $result->{imei},
imsi => $result->{imsi},
simIcc => $result->{simIcc}
},
signal => {
module => $module,
interfaceType => $interface_types->{$interface_type},
imei => $result->{imei},
imsi => $result->{imsi},
simIcc => $result->{simIcc}
}
};
$self->{global}->{detected}++;
}
if (scalar(keys %{$self->{cells}}) <= 0 &&
(defined($self->{option_results}->{filter_module}) && $self->{option_results}->{filter_module} ne '') ||
(defined($self->{option_results}->{filter_imei}) && $self->{option_results}->{filter_imei} ne '')) {
$self->{output}->add_option_msg(short_msg => 'No interfaces found matching with filter');
$self->{output}->option_exit();
}
$options{snmp}->load(
oids => [ map($_->{oid}, values(%$mapping_data_interface)) ],
instances => [ map($_, keys(%{$self->{cells}})) ],
instance_regexp => '^(.*)$'
);
$snmp_result = $options{snmp}->get_leef();
foreach (keys %{$self->{cells}}) {
my $result = $options{snmp}->map_instance(mapping => $mapping_data_interface, results => $snmp_result, instance => $_);
$self->{cells}->{$_}->{status}->{simStatus} = $result->{simStatus};
$self->{cells}->{$_}->{status}->{interfaceState} = $result->{interfaceState};
$self->{cells}->{$_}->{status}->{operator} = $result->{operator};
$self->{cells}->{$_}->{signal}->{operator} = $result->{operator};
next if ($self->{cells}->{$_}->{status}->{simIcc} eq '');
$self->{cells}->{$_}->{signal}->{rsrp} = $result->{rsrp} if ($result->{rsrp} ne '' && $result->{rsrp} != 0);
$self->{cells}->{$_}->{signal}->{rsrq} = $result->{rsrq} if ($result->{rsrq} ne '' && $result->{rsrq} != 0);
$self->{cells}->{$_}->{signal}->{snr} = $result->{snr} if ($result->{snr} ne '' && $result->{snr} != 0);
$self->{cells}->{$_}->{signal}->{rscp} = $result->{rscp} if ($result->{rscp} ne '' && $result->{rscp} != 0);
$self->{cells}->{$_}->{signal}->{csq} = $result->{csq} if ($result->{csq} ne '' && $result->{csq} != 0);
}
}
1;
__END__
=head1 MODE
Check cellular radio interfaces.
=over 8
=item B<--filter-module>
Filter cellular radio interfaces by module.
=item B<--filter-imei>
Filter cellular radio interfaces by IMEI.
=item B<--filter-interface-type>
Filter cellular radio interfaces by type.
=item B<--custom-perfdata-instances>
Customize the name composition rule for the instances the metrics will be attached to (default: '%(module) %(interfaceType) %(imei)').
You can use the following variables: %(module), %(interfaceType), %(imei), %(operator), %(simIcc)
=item B<--unknown-status>
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{module}, %{interfaceType}, %{imei}, %{operator}, %{imsi}, %{simIcc}, %{simStatus}, %{interfaceState}
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (default: '%{interfaceState} =~ /disconnect/ && %{interfaceType} =~ /data primary/').
You can use the following variables: %{module}, %{interfaceType}, %{imei}, %{operator}, %{imsi}, %{simIcc}, %{simStatus}, %{interfaceState}
=item B<--critical-status>
Define the conditions to match for the status to be CRITICAL.
You can use the following variables: %{module}, %{interfaceType}, %{imei}, %{operator}, %{imsi}, %{simIcc}, %{simStatus}, %{interfaceState}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'modules-cellradio-detected', 'module-cellradio-rsrp', ''module-cellradio-rsrq', 'module-cellradio-rscp', 'module-cellradio-csq'
'module-cellradio-snr'.
=back
=cut

View File

@ -1,116 +1,116 @@
#
# 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::teldat::snmp::mode::cpu;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_cpu_output {
my ($self, %options) = @_;
return 'cpu average usage: ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'cpu-utilization-5s', nlabel => 'cpu.utilization.5s.percentage', set => {
key_values => [ { name => 'cpu_load5s' } ],
output_template => '%.2f %% (5s)',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'cpu-utilization-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
key_values => [ { name => 'cpu_load1m' } ],
output_template => '%.2f %% (1m)',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'cpu-utilization-5m', nlabel => 'cpu.utilization.15m.percentage', set => {
key_values => [ { name => 'cpu_load5m' } ],
output_template => '%.2f %% (5m)',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_cpu5s = '.1.3.6.1.4.1.2007.4.1.2.1.2.1.1.1.0'; # teldatCPUBusy5sec
my $oid_cpu1m = '.1.3.6.1.4.1.2007.4.1.2.1.2.1.1.2.0'; # teldatCPUBusy1min
my $oid_cpu5m = '.1.3.6.1.4.1.2007.4.1.2.1.2.1.1.3.0'; # teldatCPUBusy5min
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_cpu5s, $oid_cpu1m, $oid_cpu5m],
nothing_quit => 1
);
$self->{global} = {
cpu_load5s => $snmp_result->{$oid_cpu5s},
cpu_load1m => $snmp_result->{$oid_cpu1m},
cpu_load5m => $snmp_result->{$oid_cpu5m}
};
}
1;
__END__
=head1 MODE
Check CPU usage.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'cpu-utilization-5s', 'cpu-utilization-1m', 'cpu-utilization-5m'.
=back
=cut
#
# 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::teldat::snmp::mode::cpu;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_cpu_output {
my ($self, %options) = @_;
return 'cpu average usage: ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'cpu-utilization-5s', nlabel => 'cpu.utilization.5s.percentage', set => {
key_values => [ { name => 'cpu_load5s' } ],
output_template => '%.2f %% (5s)',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'cpu-utilization-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
key_values => [ { name => 'cpu_load1m' } ],
output_template => '%.2f %% (1m)',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'cpu-utilization-5m', nlabel => 'cpu.utilization.15m.percentage', set => {
key_values => [ { name => 'cpu_load5m' } ],
output_template => '%.2f %% (5m)',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_cpu5s = '.1.3.6.1.4.1.2007.4.1.2.1.2.1.1.1.0'; # teldatCPUBusy5sec
my $oid_cpu1m = '.1.3.6.1.4.1.2007.4.1.2.1.2.1.1.2.0'; # teldatCPUBusy1min
my $oid_cpu5m = '.1.3.6.1.4.1.2007.4.1.2.1.2.1.1.3.0'; # teldatCPUBusy5min
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_cpu5s, $oid_cpu1m, $oid_cpu5m],
nothing_quit => 1
);
$self->{global} = {
cpu_load5s => $snmp_result->{$oid_cpu5s},
cpu_load1m => $snmp_result->{$oid_cpu1m},
cpu_load5m => $snmp_result->{$oid_cpu5m}
};
}
1;
__END__
=head1 MODE
Check CPU usage.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'cpu-utilization-5s', 'cpu-utilization-1m', 'cpu-utilization-5m'.
=back
=cut

View File

@ -1,182 +1,180 @@
#
# 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::teldat::snmp::mode::interfaces;
use base qw(snmp_standard::mode::interfaces);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
1;
__END__
=head1 MODE
Check interfaces.
=over 8
=item B<--add-global>
Check global port statistics (By default if no --add-* option is set).
=item B<--add-status>
Check interface status.
=item B<--add-duplex-status>
Check duplex status (with --warning-status and --critical-status).
=item B<--add-traffic>
Check interface traffic.
=item B<--add-errors>
Check interface errors.
=item B<--add-cast>
Check interface cast.
=item B<--add-speed>
Check interface speed.
=item B<--add-volume>
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
=item B<--check-metrics>
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
=item B<--warning-status>
Set warning threshold for status.
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--critical-status>
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
'speed' (b/s).
=item B<--units-traffic>
Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta', 'bps', 'counter').
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>
Display traffic perfdata to be compatible with nagvis widget.
=item B<--interface>
Set the interface (number expected) ex: 1,2,... (empty means 'check all interface').
=item B<--name>
Allows to use interface name with option --interface instead of interface oid index (Can be a regexp)
=item B<--speed>
Set interface speed for incoming/outgoing traffic (in Mb).
=item B<--speed-in>
Set interface speed for incoming traffic (in Mb).
=item B<--speed-out>
Set interface speed for outgoing traffic (in Mb).
=item B<--map-speed-dsl>
Get interface speed configuration for interface type 'adsl' and 'vdsl2'.
Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
=item B<--force-counters64>
Force to use 64 bits counters only. Can be used to improve performance.
=item B<--force-counters32>
Force to use 32 bits counters (even in snmp v2c and v3). Should be used when 64 bits counters are buggy.
=item B<--reload-cache-time>
Time in minutes before reloading cache file (default: 180).
=item B<--oid-filter>
Choose OID used to filter interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-display>
Choose OID used to display interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-extra-display>
Add an OID to display.
=item B<--display-transform-src>
Regexp src to transform display value.
=item B<--display-transform-dst>
Regexp dst to transform display value.
=item B<--show-cache>
Display cache interface data.
=back
=cut
#
# 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::teldat::snmp::mode::interfaces;
use base qw(snmp_standard::mode::interfaces);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
1;
__END__
=head1 MODE
Check interfaces.
=over 8
=item B<--add-global>
Check global port statistics (By default if no --add-* option is set).
=item B<--add-status>
Check interface status.
=item B<--add-duplex-status>
Check duplex status (with --warning-status and --critical-status).
=item B<--add-traffic>
Check interface traffic.
=item B<--add-errors>
Check interface errors.
=item B<--add-cast>
Check interface cast.
=item B<--add-speed>
Check interface speed.
=item B<--add-volume>
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
=item B<--check-metrics>
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
=item B<--warning-status>
Set warning threshold for status.
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--critical-status>
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
'speed' (b/s).
=item B<--units-traffic>
Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta', 'bps', 'counter').
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter').
=item B<--nagvis-perfdata>
Display traffic perfdata to be compatible with NagVis widget.
=item B<--interface>
Set the interface (number expected) ex: 1,2,... (empty means 'check all interface').
=item B<--name>
Allows to use interface name with option --interface instead of interface OID index (Can be a regexp)
=item B<--speed>
Set interface speed for incoming/outgoing traffic (in Mb).
=item B<--speed-in>
Set interface speed for incoming traffic (in Mb).
=item B<--speed-out>
Set interface speed for outgoing traffic (in Mb).
=item B<--map-speed-dsl>
Get interface speed configuration for interface type 'ADSL' and 'VDSL2'.
Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
=item B<--force-counters64>
Force to use 64 bits counters only. Can be used to improve performance.
=item B<--force-counters32>
Force to use 32 bits counters (even in SNMP version 2c and version 3). Should be used when 64 bits counters are buggy.
=item B<--reload-cache-time>
Time in minutes before reloading cache file (default: 180).
=item B<--oid-filter>
Choose OID used to filter interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-display>
Choose OID used to display interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-extra-display>
Add an OID to display.
=item B<--display-transform-src> B<--display-transform-dst>
Modify the interface name displayed by using a regular expression.
Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>
Display cache interface data.
=back
=cut

View File

@ -0,0 +1,151 @@
#
# 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::teldat::snmp::mode::listcellsradio;
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 => {
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
my $mapping = {
imei => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.5' }, # teldatCellularInfoInterfaceModuleIMEI : Cellular module IMEI.
imsi => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.6' }, # teldatCellularInfoInterfaceModuleIMSI : Cellular module IMSI.
simIcc => { oid => '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1.8' } # teldatCellularInfoInterfaceSIMIcc : Cellular active SIM ICC.
};
my $oid_teldatCellularInfoInterfaceEntry = '.1.3.6.1.4.1.2007.4.1.2.2.2.18.1.1'; # teldatInfoInterfaceTable
my $interface_types = {
1 => 'control vocal',
2 => 'data primary',
3 => 'data auxiliary'
};
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_table(
oid => $oid_teldatCellularInfoInterfaceEntry,
start => $mapping->{imei}->{oid},
end => $mapping->{simIcc}->{oid},
nothing_quit => 1
);
my $results = {};
my $modules = {};
my $module_num = 0;
my $interface_type = 0;
foreach my $oid ($options{snmp}->oid_lex_sort(keys %$snmp_result)) {
next if ($oid !~ /^$mapping->{imei}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
next if ($result->{imei} !~ /^[0-9]+$/);
if (!defined($modules->{$module_num}) || $result->{imei} ne $modules->{$module_num}) {
$module_num++;
$interface_type = 0;
$modules->{$module_num} = $result->{imei};
}
if (defined($modules->{$module_num})) {
$interface_type++;
}
my $module = 'module' . $module_num;
$results->{$instance} = {
module => $module,
moduleNum => $module_num,
interfaceType => $interface_types->{$interface_type},
imei => $result->{imei},
imsi => $result->{imsi},
simIcc => $result->{simIcc}
};
}
return $results;
}
sub run {
my ($self, %options) = @_;
my $results = $self->manage_selection(snmp => $options{snmp});
foreach my $name (sort keys %$results) {
$self->{output}->output_add(long_msg =>
'[module = ' . $results->{$name}->{module} . ']' .
'[moduleNum = ' . $results->{$name}->{moduleNum} . ']' .
'[interfaceType = ' . $results->{$name}->{interfaceType} . ']' .
join('', map("[$_ = " . $results->{$name}->{$_} . ']', keys(%$mapping)))
);
}
$self->{output}->output_add(
severity => 'OK',
short_msg => 'List cellular radio interfaces:'
);
$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 => ['module', 'moduleNum', 'interfaceType', keys %$mapping]);
}
sub disco_show {
my ($self, %options) = @_;
my $results = $self->manage_selection(snmp => $options{snmp});
foreach (sort keys %$results) {
$self->{output}->add_disco_entry(
%{$results->{$_}}
);
}
}
1;
__END__
=head1 MODE
List cellular radio interfaces.
=over 8
=back
=cut

View File

@ -1,128 +1,128 @@
#
# 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::teldat::snmp::mode::memory;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_usage_output {
my ($self, %options) = @_;
return sprintf(
'total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)',
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total}),
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used}),
$self->{result_values}->{prct_used},
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free}),
$self->{result_values}->{prct_free}
);
}
sub prefix_memory_output {
my ($self, %options) = @_;
return "Memory '" . $options{instance} . "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'memory', type => 1, cb_prefix_output => 'prefix_memory_output', message_multiple => 'All memory usages are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{memory} = [
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', display_ok => 0, set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'usage-prct', nlabel => 'memory.usage.percentage', display_ok => 0, set => {
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_total = '.1.3.6.1.4.1.2007.4.1.2.1.1.26.0'; # telProdNpMonSistemMemTotal
my $oid_free = '.1.3.6.1.4.1.2007.4.1.2.1.1.30.0'; # telProdNpMonSistemMemFreenoncache
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_total, $oid_free],
nothing_quit => 1
);
$self->{memory}->{system} = {
used => $snmp_result->{$oid_total} - $snmp_result->{$oid_free},
free => $snmp_result->{$oid_free},
prct_used => ($snmp_result->{$oid_total} - $snmp_result->{$oid_free}) * 100 / $snmp_result->{$oid_total},
prct_free => $snmp_result->{$oid_free} * 100 / $snmp_result->{$oid_total},
total => $snmp_result->{$oid_total}
};
}
1;
__END__
=head1 MODE
Check memory.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
=back
=cut
#
# 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::teldat::snmp::mode::memory;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_usage_output {
my ($self, %options) = @_;
return sprintf(
'total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)',
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total}),
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used}),
$self->{result_values}->{prct_used},
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free}),
$self->{result_values}->{prct_free}
);
}
sub prefix_memory_output {
my ($self, %options) = @_;
return "Memory '" . $options{instance} . "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'memory', type => 1, cb_prefix_output => 'prefix_memory_output', message_multiple => 'All memory usages are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{memory} = [
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', display_ok => 0, set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'usage-prct', nlabel => 'memory.usage.percentage', display_ok => 0, set => {
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_total = '.1.3.6.1.4.1.2007.4.1.2.1.1.26.0'; # telProdNpMonSistemMemTotal
my $oid_free = '.1.3.6.1.4.1.2007.4.1.2.1.1.30.0'; # telProdNpMonSistemMemFreenoncache
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_total, $oid_free],
nothing_quit => 1
);
$self->{memory}->{system} = {
used => $snmp_result->{$oid_total} - $snmp_result->{$oid_free},
free => $snmp_result->{$oid_free},
prct_used => ($snmp_result->{$oid_total} - $snmp_result->{$oid_free}) * 100 / $snmp_result->{$oid_total},
prct_free => $snmp_result->{$oid_free} * 100 / $snmp_result->{$oid_total},
total => $snmp_result->{$oid_total}
};
}
1;
__END__
=head1 MODE
Check memory.
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
=back
=cut

View File

@ -1,77 +1,77 @@
#
# 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::teldat::snmp::mode::uptime;
use base qw(snmp_standard::mode::uptime);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
1;
__END__
=head1 MODE
Check system uptime.
=over 8
=item B<--warning-uptime>
Threshold warning.
=item B<--critical-uptime>
Threshold critical.
=item B<--add-sysdesc>
Display system description.
=item B<--force-oid>
Can choose your oid (numeric format only).
=item B<--check-overload>
Uptime counter limit is 4294967296 and overflow.
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
=item B<--reboot-window>
To be used with check-overload option. Time in milliseconds (Default: 5000)
You increase the chance of not missing a reboot if you decrease that value.
=item B<--unit>
Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes,
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds
=back
#
# 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::teldat::snmp::mode::uptime;
use base qw(snmp_standard::mode::uptime);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
1;
__END__
=head1 MODE
Check system uptime.
=over 8
=item B<--warning-uptime>
Threshold warning.
=item B<--critical-uptime>
Threshold critical.
=item B<--add-sysdesc>
Display system description.
=item B<--force-oid>
Can choose your OID (numeric format only).
=item B<--check-overload>
Uptime counter limit is 4294967296 and overflow.
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
=item B<--reboot-window>
To be used with check-overload option. Time in milliseconds (Default: 5000)
You increase the chance of not missing a reboot if you decrease that value.
=item B<--unit>
Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes,
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds
=back

View File

@ -1,52 +1,53 @@
#
# 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::teldat::snmp::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{modes} = {
'cells-radio' => 'network::teldat::snmp::mode::cellsradio',
'cpu' => 'network::teldat::snmp::mode::cpu',
'interfaces' => 'network::teldat::snmp::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::teldat::snmp::mode::memory',
'uptime' => 'network::teldat::snmp::mode::uptime'
};
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Teldat equipments in SNMP.
=cut
#
# 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::teldat::snmp::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{modes} = {
'cells-radio' => 'network::teldat::snmp::mode::cellsradio',
'cpu' => 'network::teldat::snmp::mode::cpu',
'interfaces' => 'network::teldat::snmp::mode::interfaces',
'list-cells-radio' => 'network::teldat::snmp::mode::listcellsradio',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::teldat::snmp::mode::memory',
'uptime' => 'network::teldat::snmp::mode::uptime'
};
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Teldat equipments in SNMP.
=cut

View File

@ -0,0 +1,155 @@
#
# 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 notification::microsoft::office365::teams::custom::workflowapi;
use strict;
use warnings;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON::XS;
sub new {
my ($class, %options) = @_;
my $self = {};
bless $self, $class;
if (!defined($options{output})) {
print "Class Custom: Need to specify 'output' argument.\n";
exit 3;
}
if (!defined($options{options})) {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'teams-workflow:s' => { name => 'teams_workflow' },
'port:s' => { name => 'port' },
'proto:s' => { name => 'proto' },
'timeout:s' => { name => 'timeout' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{http} = centreon::plugins::http->new(%options);
return $self;
}
sub set_defaults {}
sub set_options {
my ($self, %options) = @_;
$self->{option_results} = $options{option_results};
$self->{http}->add_header(key => 'Accept', value => 'application/json');
$self->{http}->add_header(key => 'Content-Type', value => 'application/json');
}
sub check_options {
my ($self, %options) = @_;
$self->{teams_workflow} = (defined($self->{option_results}->{teams_workflow})) ? $self->{option_results}->{teams_workflow} : '';
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
if ($self->{teams_workflow} eq '') {
$self->{output}->add_option_msg(short_msg => 'Need to specify the --teams-workflow option.');
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}}, hostname => 'dummy');
return 0;
}
sub json_decode {
my ($self, %options) = @_;
$options{content} =~ s/\r//mg;
my $decoded;
eval {
$decoded = JSON::XS->new->allow_nonref(1)->utf8->decode($options{content});
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
$self->{output}->option_exit();
}
return $decoded;
}
sub teams_post_notification {
my ($self, %options) = @_;
my $encoded_data = JSON::XS->new->utf8->encode($options{json_request});
my $content = $self->{http}->request(
method => 'POST',
full_url => $self->{teams_workflow},
query_form_post => $encoded_data
);
return $content;
}
1;
__END__
=head1 NAME
O365 Teams Workflows API
=head1 SYNOPSIS
O365 Teams Workflows API
=head1 REST API OPTIONS
=over 8
=item B<--teams-workflow>
Define the Workflow full URI (required).
=item B<--port>
Define the API port (default: 443).
=item B<--proto>
Define the protocol if needed (default: 'https').
=item B<--timeout>
Define the HTTP timeout.
=back
=head1 DESCRIPTION
B<custom>.
=cut

View File

@ -28,7 +28,7 @@ use JSON::XS;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
@ -38,13 +38,13 @@ sub new {
'centreon-url:s' => { name => 'centreon_url' },
'channel-id:s' => { name => 'channel_id' },
'date:s' => { name => 'date' },
'extra-info-format:s' => { name => 'extra_info_format', default => 'Author: %s, Comment: %s'},
'extra-info:s' => { name => 'extra_info'},
'extra-info-format:s' => { name => 'extra_info_format', default => 'Author: %s, Comment: %s' },
'extra-info:s' => { name => 'extra_info' },
'host-name:s' => { name => 'host_name' },
'host-output:s' => { name => 'host_output', default => '' },
'host-state:s' => { name => 'host_state' },
'legacy:s' => { name => 'legacy' },
'notification-type:s' => { name => 'notif_type'},
'notification-type:s' => { name => 'notif_type' },
'service-description:s' => { name => 'service_name' },
'service-output:s' => { name => 'service_output', default => '' },
'service-state:s' => { name => 'service_state' },
@ -59,9 +59,9 @@ sub check_options {
$self->SUPER::init(%options);
$self->{teams}->{channel_id} = defined($self->{option_results}->{channel_id}) && $self->{option_results}->{channel_id} ne '' ?
$self->{option_results}->{channel_id} : undef;
$self->{option_results}->{channel_id} : undef;
$self->{teams}->{team_id} = defined($self->{option_results}->{team_id}) && $self->{option_results}->{channel_id} ne ''
? $self->{option_results}->{team_id} : undef;
? $self->{option_results}->{team_id} : undef;
if (!defined($self->{option_results}->{notif_type}) || $self->{option_results}->{notif_type} eq '') {
$self->{output}->add_option_msg(short_msg => "You need to specify the --notification-type option.");
@ -72,85 +72,85 @@ sub check_options {
sub build_resource_status_filters {
my ($self, %options) = @_;
my $data_format = URI::Encode->new({encode_reserved => 1});
my $data_format = URI::Encode->new({ encode_reserved => 1 });
my $raw_resource_status_filters = {
"id" => "",
"name" => "New+filter",
"id" => "",
"name" => "New+filter",
"criterias" => [
{
"name" => "resource_types",
"name" => "resource_types",
"object_type" => undef,
"type" => "multi_select",
"value" => [
"type" => "multi_select",
"value" => [
{
"id" => "service",
"id" => "service",
"name" => "Service"
}
]
},
{
"name" => "states",
"object_type" => undef,
"type" => "multi_select",
"value" => [
]
},
{
"name" => "statuses",
"name" => "states",
"object_type" => undef,
"type" => "multi_select",
"value" => [
"type" => "multi_select",
"value" => [
]
},
{
"name" => "status_types",
"name" => "statuses",
"object_type" => undef,
"type" => "multi_select",
"value" => [
"type" => "multi_select",
"value" => [
]
},
{
"name" => "host_groups",
"name" => "status_types",
"object_type" => undef,
"type" => "multi_select",
"value" => [
]
},
{
"name" => "host_groups",
"object_type" => "host_groups",
"type" => "multi_select",
"value" => [
"type" => "multi_select",
"value" => [
]
},
{
"name" => "service_groups",
"name" => "service_groups",
"object_type" => "service_groups",
"type" => "multi_select",
"value" => [
"type" => "multi_select",
"value" => [
]
},
{
"name" => "monitoring_servers",
"name" => "monitoring_servers",
"object_type" => "monitoring_servers",
"type" => "multi_select",
"value" => [
"type" => "multi_select",
"value" => [
]
},
{
"name" => "search",
"name" => "search",
"object_type" => undef,
"type" => "text",
"value" => sprintf(
"type" => "text",
"value" => sprintf(
's.description:%s h.name:%s',
defined($self->{option_results}->{service_name}) ? $self->{option_results}->{service_name} : '',
defined($self->{option_results}->{host_name}) ? $self->{option_results}->{host_name} : ''
defined($self->{option_results}->{service_name}) ? $self->{option_results}->{service_name} : '',
defined($self->{option_results}->{host_name}) ? $self->{option_results}->{host_name} : ''
)
},
{
"name" => "sort",
"name" => "sort",
"object_type" => undef,
"type" => "array",
"value" => [
"type" => "array",
"value" => [
"status_severity_code",
"asc"
]
@ -158,25 +158,25 @@ sub build_resource_status_filters {
]
};
my $link_url_path = '/monitoring/resources?filter=';
my $link_url_path = '/monitoring/resources?filter=';
my $encoded_resource_status_filters = JSON::XS->new->utf8->encode($raw_resource_status_filters);
my $encoded_data_for_uri = $data_format->encode($encoded_resource_status_filters);
$link_url_path .= $encoded_data_for_uri;
my $encoded_data_for_uri = $data_format->encode($encoded_resource_status_filters);
$link_url_path .= $encoded_data_for_uri;
return $link_url_path;
}
sub build_payload {
sub build_webhook_payload {
my ($self, %options) = @_;
my $message = $self->build_message();
my $message = $self->build_webhook_message();
$self->{json_payload} = {
'@type' => 'MessageCard',
'@context' => 'https://schema.org/extensions',
potentialAction => $message->{potentialAction},
sections => $message->{sections},
summary => 'Centreon ' . $message->{notif_type},
themecolor => $message->{themecolor}
themeColor => $message->{themecolor}
};
if ($@) {
@ -187,41 +187,43 @@ sub build_payload {
return $self;
}
sub build_message {
sub build_webhook_message {
my ($self, %options) = @_;
my $teams_colors = {
ACKNOWLEDGEMENT => 'fefc8e',
DOWNTIMEEND => 'f1dfff',
DOWNTIMESTART => 'f1dfff',
RECOVERY => '42f56f',
PROBLEM => {
host => {
DOWNTIMEEND => 'f1dfff',
DOWNTIMESTART => 'f1dfff',
RECOVERY => '42f56f',
PROBLEM => {
host => {
up => '42f56f',
down => 'f21616',
unreachable => 'f21616'
},
service => {
ok => '42f56f',
warning => 'f59042',
ok => '42f56f',
warning => 'f59042',
critical => 'f21616',
unknown => '757575'
unknown => '757575'
}
}
};
$self->{sections} = [];
$self->{notif_type} = $self->{option_results}->{notif_type};
my $resource_type = defined($self->{option_results}->{host_state}) ? 'host' : 'service';
$self->{sections} = [];
$self->{notif_type} = $self->{option_results}->{notif_type};
my $resource_type = defined($self->{option_results}->{host_state}) ? 'host' : 'service';
my $formatted_resource = ucfirst($resource_type);
$formatted_resource = 'BAM' if defined($self->{option_results}->{bam});
$formatted_resource = 'BAM' if defined($self->{option_results}->{bam});
push @{$self->{sections}}, {
activityTitle => $self->{notif_type} . ': ' . $formatted_resource . ' "' . $self->{option_results}->{$resource_type . '_name'} . '" is ' . $self->{option_results}->{$resource_type . '_state'},
activitySubtitle => $resource_type eq 'service' ? 'Host ' . $self->{option_results}->{host_name} : ''
activityTitle =>
$self->{notif_type} . ': ' . $formatted_resource . ' "' . $self->{option_results}->{$resource_type . '_name'} . '" is ' . $self->{option_results}->{$resource_type . '_state'},
activitySubtitle =>
$resource_type eq 'service' ? 'Host ' . $self->{option_results}->{host_name} : ''
};
$self->{themecolor} = $teams_colors->{$self->{notif_type}};
if ($self->{option_results}->{notif_type} eq 'PROBLEM') {
if ($self->{notif_type} eq 'PROBLEM') {
$self->{themecolor} = $teams_colors->{PROBLEM}->{$resource_type}->{lc($self->{option_results}->{$resource_type . '_state'})};
}
@ -243,23 +245,23 @@ sub build_message {
}
if (defined($self->{option_results}->{action_links})) {
if (!defined($self->{option_results}->{centreon_url}) || $self->{option_results}->{centreon_url} eq ''){
if (!defined($self->{option_results}->{centreon_url}) || $self->{option_results}->{centreon_url} eq '') {
$self->{output}->add_option_msg(short_msg => 'Please set --centreon-url option');
$self->{output}->option_exit();
}
my $uri = URI::Encode->new({encode_reserved => 0});
my $uri = URI::Encode->new({ encode_reserved => 0 });
my $link_url_path;
if (defined($self->{option_results}->{legacy})){
if (defined($self->{option_results}->{legacy})) {
$link_url_path = '/main.php?p=2020'; # deprecated pages
$link_url_path .= ($resource_type eq 'service') ?
'1&o=svc&host_search=' . $self->{option_results}->{host_name} . '&search=' . $self->{option_results}->{service_name} :
'2&o=svc&host_search=' . $self->{option_results}->{host_name};
'1&o=svc&host_search=' . $self->{option_results}->{host_name} . '&search=' . $self->{option_results}->{service_name} :
'2&o=svc&host_search=' . $self->{option_results}->{host_name};
my $link_uri_encoded = $uri->encode($self->{option_results}->{centreon_url} . $link_url_path);
} else {
$link_url_path = $self->build_resource_status_filters();
}
}
my $link_uri_encoded = $uri->encode($self->{option_results}->{centreon_url}) . $link_url_path;
@ -275,7 +277,7 @@ sub build_message {
if ($resource_type eq 'service') {
my $graph_url_path = '/main.php?p=204&mode=0&svc_id=';
$graph_url_path .= $self->{option_results}->{host_name} . ';' . $self->{option_results}->{service_name};
$graph_url_path .= $self->{option_results}->{host_name} . ';' . $self->{option_results}->{service_name};
my $graph_uri_encoded = $uri->encode($self->{option_results}->{centreon_url} . $graph_url_path);
push @{$self->{potentialAction}}, {
'@type' => 'OpenUri',
@ -286,7 +288,157 @@ sub build_message {
}]
};
}
}
return $self;
}
sub build_workflow_payload {
my ($self, %options) = @_;
my $message = $self->build_workflow_message();
$self->{json_payload} = {
type => "message",
attachments => [
{
contentType => "application/vnd.microsoft.card.adaptive",
content => {
'$schema' => "http://adaptivecards.io/schemas/adaptive-card.json",
type => "AdaptiveCard",
version => "1.0",
body => $message->{body},
actions => $message->{actions}
}
}
]
};
if ($@) {
$self->{output}->add_option_msg(short_msg => 'Cannot decode json response');
$self->{output}->option_exit();
}
return $self;
}
sub build_workflow_message {
my ($self, %options) = @_;
my $teams_colors = {
ACKNOWLEDGEMENT => 'accent',
DOWNTIMEEND => 'accent',
DOWNTIMESTART => 'accent',
RECOVERY => 'good',
PROBLEM => {
host => {
up => 'good',
down => 'attention',
unreachable => 'attention'
},
service => {
ok => 'good',
warning => 'warning',
critical => 'attention',
unknown => 'light'
}
}
};
$self->{body} = [];
$self->{notif_type} = $self->{option_results}->{notif_type};
my $resource_type = defined($self->{option_results}->{host_state}) ? 'host' : 'service';
my $formatted_resource = ucfirst($resource_type);
$formatted_resource = 'BAM' if defined($self->{option_results}->{bam});
my $themecolor = $teams_colors->{$self->{notif_type}};
if ($self->{notif_type} eq 'PROBLEM') {
$themecolor = $teams_colors->{PROBLEM}->{$resource_type}->{lc($self->{option_results}->{$resource_type . '_state'})};
}
if (!defined($themecolor)) {
$themecolor = 'default';
}
push @{$self->{body}}, {
type => "TextBlock",
text => $self->{notif_type} . ': ' . $formatted_resource . ' "' . $self->{option_results}->{$resource_type . '_name'} . '" is ' . $self->{option_results}->{$resource_type . '_state'},
"size" => "Large",
"weight" => "Bolder",
"style" => "heading",
"color" => $themecolor
};
push @{$self->{body}}, {
type => "TextBlock",
text => $resource_type eq 'service' ? 'Host ' . $self->{option_results}->{host_name} : '',
"size" => "Medium",
"weight" => "Bolder",
"style" => "heading",
"color" => $themecolor
};
if (defined($self->{option_results}->{$resource_type . '_output'}) && $self->{option_results}->{$resource_type . '_output'} ne '') {
push @{$self->{body}}, {
type => "TextBlock",
text => "Status: " . $self->{option_results}->{$resource_type . '_output'}
};
}
if (defined($self->{option_results}->{date}) && $self->{option_results}->{date} ne '') {
push @{$self->{body}}, {
type => "TextBlock",
text => "Event date: " . $self->{option_results}->{date}
};
}
if (defined($self->{option_results}->{extra_info}) && $self->{option_results}->{extra_info} !~ m/^\/\/$/) {
if ($self->{option_results}->{extra_info} =~ m/^(.*)\/\/(.*)$/) {
push @{$self->{body}}, {
type => "TextBlock",
text => "Additional Information: \n" . sprintf($self->{option_results}->{extra_info_format}, $1, $2),
"wrap" => "true"
};
}
}
if (defined($self->{option_results}->{action_links})) {
if (!defined($self->{option_results}->{centreon_url}) || $self->{option_results}->{centreon_url} eq '') {
$self->{output}->add_option_msg(short_msg => 'Please set --centreon-url option');
$self->{output}->option_exit();
}
my $uri = URI::Encode->new({ encode_reserved => 0 });
my $link_url_path;
if (defined($self->{option_results}->{legacy})) {
$link_url_path = '/main.php?p=2020'; # deprecated pages
$link_url_path .= ($resource_type eq 'service') ?
'1&o=svc&host_search=' . $self->{option_results}->{host_name} . '&search=' . $self->{option_results}->{service_name} :
'2&o=svc&host_search=' . $self->{option_results}->{host_name};
my $link_uri_encoded = $uri->encode($self->{option_results}->{centreon_url} . $link_url_path);
} else {
$link_url_path = $self->build_resource_status_filters();
}
my $link_uri_encoded = $uri->encode($self->{option_results}->{centreon_url}) . $link_url_path;
push @{$self->{actions}}, {
"type" => "Action.OpenUrl",
"title" => "Details",
"url" => "$link_uri_encoded",
"role" => "button"
};
if ($resource_type eq 'service') {
my $graph_url_path = '/main.php?p=204&mode=0&svc_id=';
$graph_url_path .= $self->{option_results}->{host_name} . ';' . $self->{option_results}->{service_name};
my $graph_uri_encoded = $uri->encode($self->{option_results}->{centreon_url} . $graph_url_path);
push @{$self->{actions}}, {
"type" => "Action.OpenUrl",
"title" => "Graph",
"url" => $graph_uri_encoded,
"role" => "button"
};
}
}
return $self;
}
@ -294,8 +446,13 @@ sub build_message {
sub run {
my ($self, %options) = @_;
my $json_request = $self->build_payload();
my $response = $options{custom}->teams_post_notification(
my $json_request;
if (!centreon::plugins::misc::is_empty($options{custom}->{teams_webhook})) {
$json_request = $self->build_webhook_payload();
} else {
$json_request = $self->build_workflow_payload();
}
$options{custom}->teams_post_notification(
channel_id => $self->{teams}->{channel_id},
json_request => $self->{json_payload},
team_id => $self->{teams}->{team_id}

View File

@ -36,6 +36,7 @@ sub new {
$self->{custom_modes}->{graphapi} = 'cloud::microsoft::office365::custom::graphapi';
$self->{custom_modes}->{webhookapi} = 'notification::microsoft::office365::teams::custom::webhookapi';
$self->{custom_modes}->{workflowapi} = 'notification::microsoft::office365::teams::custom::workflowapi';
return $self;
}

View File

@ -118,7 +118,7 @@ Specify the command to execute (required).
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}, %{name}
=item B<--warning--status>
=item B<--warning-status>
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{status}, %{name}

View File

@ -243,7 +243,7 @@ Filter disks by name (can be a regexp).
Define the conditions to match for the status to be UNKNOWN (default: '%{status} =~ /unknown/i').
You can use the following variables: %{status}, %{name}
=item B<--warning--status>
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (default: '%{status} =~ /noReady|busy|hwFailureOk|hwFailurePerf|Protected|rebuilding/i').
You can use the following variables: %{status}, %{name}

View File

@ -208,7 +208,7 @@ JOBQ selection. Example: --jobq="QGPL:QBASE" --jobq="QGPL:QPGMR"
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}, %{name}, %{library}
=item B<--warning--status>
=item B<--warning-status>
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{status}, %{name}, %{library}

View File

@ -190,7 +190,7 @@ Filter subsystems by library (can be a regexp).
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}, %{name}, %{library}
=item B<--warning--status>
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (default: '%{status} =~ /ending|restricted|starting/i').
You can use the following variables: %{status}, %{name}, %{library}

View File

@ -0,0 +1,239 @@
#
# 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 storage::hp::primera::restapi::custom::api;
use strict;
use warnings;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON::XS;
use Digest::MD5 qw(md5_hex);
sub new {
my ($class, %options) = @_;
my $self = {};
bless $self, $class;
if (!defined($options{output})) {
print "Class Custom: Need to specify 'output' argument.\n";
exit 3;
}
if (!defined($options{options})) {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'api-username:s' => { name => 'api_username' },
'api-password:s' => { name => 'api_password' },
'hostname:s' => { name => 'hostname' },
'port:s' => { name => 'port', default => 443 },
'proto:s' => { name => 'proto', default => 'https' },
'timeout:s' => { name => 'timeout', default => 30 },
'unknown-http-status:s' => { name => 'unknown_http_status', default => '%{http_code} < 200 or %{http_code} >= 300' },
'warning-http-status:s' => { name => 'warning_http_status' },
'critical-http-status:s' => { name => 'critical_http_status' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'HPE PRIMERA API OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl');
$self->{cache} = centreon::plugins::statefile->new(%options);
return $self;
}
sub set_options {
my ($self, %options) = @_;
$self->{option_results} = $options{option_results};
}
sub set_defaults {}
sub check_options {
my ($self, %options) = @_;
if (centreon::plugins::misc::is_empty($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => 'Need to specify --hostname option.');
$self->{output}->option_exit();
}
if (centreon::plugins::misc::is_empty($self->{option_results}->{api_username})) {
$self->{output}->add_option_msg(short_msg => 'Need to specify --api-username option.');
$self->{output}->option_exit();
}
if (centreon::plugins::misc::is_empty($self->{option_results}->{api_password})) {
$self->{output}->add_option_msg(short_msg => 'Need to specify --api-password option.');
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
$self->{http}->add_header(key => 'Accept', value => 'application/json');
$self->{cache}->check_options(option_results => $self->{option_results});
return 0;
}
sub get_connection_info {
my ($self, %options) = @_;
return $self->{option_results}->{hostname} . ':' . $self->{option_results}->{port};
}
sub get_token {
my ($self, %options) = @_;
my $has_cache_file = $self->{cache}->read(statefile => 'hpe_primera_' . md5_hex($self->get_connection_info() . '_' . $self->{option_results}->{api_username}));
my $auth_key = $self->{cache}->get(name => 'auth_key');
if ($has_cache_file == 0 || !defined($auth_key) || $auth_key eq '' ) {
my $json_request = {
user => $self->{option_results}->{api_username},
password => $self->{option_results}->{api_password}
};
my $encoded;
eval {
$encoded = encode_json($json_request);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => 'An error occurred while encoding the credentials to a JSON string.');
$self->{output}->option_exit();
}
my $content = $self->{http}->request(
method => 'POST',
url_path => '/api/v1/credentials',
query_form_post => $encoded,
unknown_status => $self->{option_results}->{unknown_http_status},
warning_status => $self->{option_results}->{warning_http_status},
critical_status => $self->{option_results}->{critical_http_status},
header => ['Content-Type: application/json']
);
my $decoded;
eval {
$decoded = JSON::XS->new->utf8->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "An error occurred while decoding the response ('$content').");
$self->{output}->option_exit();
}
$auth_key = $decoded->{key};
my $data = {
updated => time(),
auth_key => $auth_key
};
$self->{cache}->write(data => $data);
}
return $auth_key;
}
sub clean_token {
my ($self, %options) = @_;
my $data = { updated => time() };
$self->{cache}->write(data => $data);
}
sub request_api {
my ($self, %options) = @_;
my $get_param = [];
if (defined($options{get_param})) {
$get_param = $options{get_param};
}
my $token = $self->get_token();
my ($content) = $self->{http}->request(
url_path => $options{endpoint},
get_param => $get_param,
header => [ 'Authorization: Bearer ' . $token ],
unknown_status => '',
warning_status => '',
critical_status => ''
);
if (!defined($content) || $content eq '') {
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
$self->{output}->option_exit();
}
my $decoded;
eval {
$decoded = JSON::XS->new->allow_nonref(1)->utf8->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode response (add --debug option to display returned content)");
$self->{output}->option_exit();
}
return $decoded;
}
1;
__END__
=head1 NAME
HPE Primera REST API
=head1 HPE Primera API OPTIONS
HPE Primera REST API
=over 8
=item B<--hostname>
Address of the server that hosts the API.
=item B<--port>
Define the TCP port to use to reach the API (default: 443).
=item B<--proto>
Define the protocol to reach the API (default: 'https').
=item B<--api-username>
Define the username for authentication.
=item B<--api-password>
Define the password associated with the username.
=item B<--timeout>
Define the timeout in seconds for HTTP requests (default: 30).
=back
=head1 DESCRIPTION
B<custom>.
=cut

View File

@ -0,0 +1,241 @@
#
# 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 storage::hp::primera::restapi::mode::capacity;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_space_usage_output {
my ($self, %options) = @_;
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
return sprintf(
'space usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)',
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
);
}
sub storage_long_output {
my ($self, %options) = @_;
return sprintf(
"checking storage '%s'",
$options{instance_value}->{type}
);
}
sub prefix_storage_output {
my ($self, %options) = @_;
return sprintf(
"storage '%s' ",
$options{instance_value}->{type}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{
name => 'storages', type => 3, cb_prefix_output => 'prefix_storage_output', cb_long_output => 'storage_long_output', indent_long_output => ' ', message_multiple => 'All storage capacities are ok',
group => [
{ name => 'space', type => 0 },
{ name => 'efficiency', type => 0, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{space} = [
{ label => 'space-usage', nlabel => 'storage.space.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_space_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'space-usage-free', nlabel => 'storage.space.free.bytes', display_ok => 0, set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_space_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'space-usage-prct', nlabel => 'storage.space.usage.percentage', display_ok => 0, set => {
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_space_usage_output'),
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
},
{ label => 'space-unavailable', nlabel => 'storage.space.unavailable.bytes', set => {
key_values => [ { name => 'unavailable' } ],
output_template => 'unavailable: %s %s',
output_change_bytes => 1,
perfdatas => [
{ template => '%s', unit => 'B', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'space-failed', nlabel => 'storage.space.failed.bytes', set => {
key_values => [ { name => 'failed' } ],
output_template => 'failed: %s %s',
output_change_bytes => 1,
perfdatas => [
{ template => '%s', unit => 'B', min => 0, label_extra_instance => 1 }
]
}
}
];
$self->{maps_counters}->{efficiency} = [
{ label => 'compaction', nlabel => 'storage.space.compaction.ratio.count', set => {
key_values => [ { name => 'compaction' } ],
output_template => 'compaction: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'deduplication', nlabel => 'storage.space.deduplication.ratio.count', set => {
key_values => [ { name => 'deduplication' } ],
output_template => 'deduplication: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'compression', nlabel => 'storage.space.compression.ratio.count', set => {
key_values => [ { name => 'compression' } ],
output_template => 'compression: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'data-reduction', nlabel => 'storage.space.data_reduction.ratio.count', set => {
key_values => [ { name => 'data_reduction' } ],
output_template => 'data reduction: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'overprovisioning', nlabel => 'storage.space.overprovisioning.ratio.count', set => {
key_values => [ { name => 'overprovisioning' } ],
output_template => 'overprovisioning: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
}
];
}
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-type:s' => { name => 'filter_type' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $response = $options{custom}->request_api(
endpoint => '/api/v1/capacity'
);
for my $type (keys %{$response}) {
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne ''
&& $type !~ /$self->{option_results}->{filter_type}/);
my $total = $response->{$type}->{totalMiB} * 1024 * 1024;
my $free = $response->{$type}->{freeMiB} * 1024 * 1024;
my $unavailable = $response->{$type}->{unavailableCapacityMiB} * 1024 * 1024;
my $failed = $response->{$type}->{failedCapacityMiB} * 1024 * 1024;
$self->{storages}->{$type} = {
type => $type,
space => {
total => $total,
free => $free,
used => $total - $free,
unavailable => $unavailable,
prct_used => ($total - $free) * 100 / $total,
prct_free => $free * 100 / $total,
failed => $failed
}
};
my $shortcut = $response->{$type}->{allocated}->{volumes}->{capacityEfficiency};
$self->{storages}->{$type}->{efficiency}->{compaction} = $shortcut->{compaction} if defined($shortcut->{compaction});
$self->{storages}->{$type}->{efficiency}->{deduplication} = $shortcut->{deduplication} if defined($shortcut->{deduplication});
$self->{storages}->{$type}->{efficiency}->{compression} = $shortcut->{compression} if defined($shortcut->{compression});
$self->{storages}->{$type}->{efficiency}->{data_reduction} = $shortcut->{dataReduction} if defined($shortcut->{dataReduction});
$self->{storages}->{$type}->{efficiency}->{overprovisioning} = $shortcut->{overProvisioning} if defined($shortcut->{overProvisioning});
}
if (scalar(keys %{$self->{storages}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "Couldn't get capacity information");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check storage capacity per storage type.
=over 8
=item B<--filter-type>
Filter storage by type (regular expression).
The known types are: allCapacity, FCCapacity, SSDCapacity and NLCapacity.
=item B<--warning-*> B<--critical-*>
Thresholds that can apply to:
- Space oriented metrics: 'space-usage', 'space-usage-free', 'space-usage-prct', 'space-unavailable', 'space-failed',
- Storage optimization metrics: 'compaction', 'deduplication', 'compression', 'data-reduction', 'overprovisioning'.
=back
=cut

View File

@ -0,0 +1,288 @@
#
# 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 storage::hp::primera::restapi::mode::diskstatus;
use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
use strict;
use warnings;
my %map_state = (
1 => 'normal',
2 => 'degraded',
3 => 'new',
4 => 'failed',
99 => 'unknown'
);
sub custom_status_output {
my ($self, %options) = @_;
return sprintf(
"Disk #%s (%s/%s, serial: %s) located %s is %s",
$self->{result_values}->{id},
$self->{result_values}->{manufacturer},
$self->{result_values}->{model},
$self->{result_values}->{serial},
$self->{result_values}->{position},
$self->{result_values}->{status}
);
}
sub prefix_global_output {
my ($self, %options) = @_;
return 'Disks ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', cb_prefix_output => 'prefix_global_output', type => 0 },
{ name => 'disks', type => 1, message_multiple => 'All disks are ok' }
];
$self->{maps_counters}->{global} = [
{ label => 'disks-total', nlabel => 'disks.total.count', set => {
key_values => [ { name => 'total' } ],
output_template => 'total: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'disks-normal', nlabel => 'disks.normal.count', set => {
key_values => [ { name => 'normal' }, { name => 'total' } ],
output_template => 'normal: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
},
{ label => 'disks-degraded', nlabel => 'disks.degraded.count', set => {
key_values => [ { name => 'degraded' }, { name => 'total' } ],
output_template => 'degraded: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
},
{ label => 'disks-new', nlabel => 'disks.new.count', set => {
key_values => [ { name => 'new' }, { name => 'total' } ],
output_template => 'new: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
},
{ label => 'disks-failed', nlabel => 'disks.failed.count', set => {
key_values => [ { name => 'failed' }, { name => 'total' } ],
output_template => 'failed: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
},
{ label => 'disks-unknown', nlabel => 'disks.unknown.count', set => {
key_values => [ { name => 'unknown' }, { name => 'total' } ],
output_template => 'unknown: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
}
];
$self->{maps_counters}->{disks} = [
{
label => 'status',
type => 2,
warning_default => '%{status} =~ /^(new|degraded|unknown)$/',
critical_default => '%{status} =~ /failed/',
unknown_default => '%{status} =~ /NOT_DOCUMENTED$/',
set => {
key_values => [ { name => 'status' }, { name => 'id' }, { name => 'manufacturer' }, { name => 'model' }, { name => 'serial' }, { name => 'position' } ],
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, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-id:s' => { name => 'filter_id' },
'filter-manufacturer:s' => { name => 'filter_manufacturer' },
'filter-model:s' => { name => 'filter_model' },
'filter-position:s' => { name => 'filter_position' },
'filter-serial:s' => { name => 'filter_serial' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $api_response = $options{custom}->request_api(
endpoint => '/api/v1/disks'
);
my $disks = $api_response->{members};
$self->{global} = {
total => 0,
normal => 0,
degraded => 0,
new => 0,
failed => 0,
unknown => 0
};
for my $disk (@{$disks}) {
my $disk_intro = "disk #" . $disk->{id} . " (" . $disk->{manufacturer} . "/" . $disk->{model}
. ", serial: " . $disk->{serialNumber} . ") located '" . $disk->{position};
# skip if filtered by id
if (defined($self->{option_results}->{filter_id})
and $self->{option_results}->{filter_id} ne ''
and $disk->{id} !~ /$self->{option_results}->{filter_id}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the id does not match the filter.", debug => 1);
next;
}
# skip if filtered by manufacturer
if (defined($self->{option_results}->{filter_manufacturer})
and $self->{option_results}->{filter_manufacturer} ne ''
and $disk->{manufacturer} !~ /$self->{option_results}->{filter_manufacturer}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the manufacturer does not match the filter.", debug => 1);
next;
}
# skip if filtered by model
if (defined($self->{option_results}->{filter_model})
and $self->{option_results}->{filter_model} ne ''
and $disk->{model} !~ /$self->{option_results}->{filter_model}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the model does not match the filter.", debug => 1);
next;
}
# skip if filtered by position
if (defined($self->{option_results}->{filter_position})
and $self->{option_results}->{filter_position} ne ''
and $disk->{position} !~ /$self->{option_results}->{filter_position}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the position does not match the filter.", debug => 1);
next;
}
# skip if filtered by serial
if (defined($self->{option_results}->{filter_serial})
and $self->{option_results}->{filter_serial} ne ''
and $disk->{serial} !~ /$self->{option_results}->{filter_serial}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the serial does not match the filter.", debug => 1);
next;
}
my $state = defined($map_state{$disk->{state}}) ? $map_state{$disk->{state}} : 'NOT_DOCUMENTED';
# increment adequate global counters
$self->{global}->{total} = $self->{global}->{total} + 1;
$self->{global}->{$state} = $self->{global}->{$state} + 1;
# add the instance
$self->{disks}->{ $disk->{id} } = {
status => $state,
position => $disk->{position},
id => $disk->{id},
manufacturer => $disk->{manufacturer},
model => $disk->{model},
serial => $disk->{serialNumber}
};
}
}
1;
__END__
=head1 MODE
Monitor the states of the physical disks.
=over 8
=item B<--filter-id>
Define which disks should be monitored based on their IDs.
This option will be treated as a regular expression.
=item B<--filter-manufacturer>
Define which volumes should be monitored based on the disk manufacturer.
This option will be treated as a regular expression.
=item B<--filter-model>
Define which volumes should be monitored based on the disk model.
This option will be treated as a regular expression.
=item B<--filter-serial>
Define which volumes should be monitored based on the disk serial number.
This option will be treated as a regular expression.
=item B<--filter-position>
Define which volumes should be monitored based on the disk position.
The position is composed of 3 integers, separated by colons:
- Cage number where the physical disk is in.
- Magazine number where the physical disk is in.
- For DC4 cages, disk position within the magazine. For non-DC4 cages, 0.
Example: 7:5:0
This option will be treated as a regular expression.
=item B<--warning-status>
Define the condition to match for the returned status to be WARNING.
Default: '%{status} =~ /^(new|degraded|unknown)$/'
=item B<--critical-status>
Define the condition to match for the returned status to be CRITICAL.
Default: '%{status} =~ /failed/'
=item B<--unknown-status>
Define the condition to match for the returned status to be UNKNOWN.
Default: '%{status} =~ /NOT_DOCUMENTED$/'
=item B<--warning-*> B<--critical-*>
Thresholds. '*' may stand for 'disks-total', 'disks-normal', 'disks-degraded', 'disks-new',
'disks-failed', 'disks-unknown'.
=back
=cut

View File

@ -0,0 +1,304 @@
#
# 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 storage::hp::primera::restapi::mode::diskusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_usage_output {
my ($self, %options) = @_;
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
return sprintf(
"Used: %s of %s (%.2f%%) Free: %s (%.2f%%)",
$total_used_value . " " . $total_used_unit,
$total_size_value . " " . $total_size_unit,
$self->{result_values}->{prct_used},
$total_free_value . " " . $total_free_unit,
$self->{result_values}->{prct_free}
);
}
sub custom_global_total_usage_output {
my ($self, %options) = @_;
my ($used_human, $used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
my ($total_human, $total_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
my $msg = "Total Used: $used_human $used_unit / $total_human $total_unit" ;
return $msg;
}
sub custom_global_total_free_output {
my ($self, %options) = @_;
my ($free_human, $free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
my $msg = "Total Free: $free_human $free_unit" ;
return $msg;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'disk', type => 1, cb_prefix_output => 'prefix_disk_output', message_multiple => 'All disks are ok' },
];
$self->{maps_counters}->{global} = [
{
label => 'total-usage',
nlabel => 'disks.total.space.usage.bytes',
set => {
key_values => [ { name => 'used' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_global_total_usage_output'),
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
},
{
label => 'total-usage-prct',
nlabel => 'disks.total.space.usage.percent',
set => {
key_values => [ { name => 'used_prct' }],
output_template => 'Total percentage used: %.2f %%',
perfdatas => [
{ template => '%s', uom => '%', min => 0, max => 100 }
]
}
},
{
label => 'total-free',
nlabel => 'disks.total.space.free.bytes',
set => {
key_values => [ { name => 'free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_global_total_free_output'),
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
}
];
$self->{maps_counters}->{disk} = [
{ label => 'usage', nlabel => 'disk.space.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'id' }, { name => 'position' }, { name => 'manufacturer' }, { name => 'model' }, { name => 'serial' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'id' }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'disk.space.free.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'id' }, { name => 'position' }, { name => 'manufacturer' }, { name => 'model' }, { name => 'serial' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'id' }
]
}
},
{ label => 'usage-prct', display_ok => 0, nlabel => 'disk.space.usage.percentage', set => {
key_values => [ { name => 'prct_used' }, { name => 'id' }, { name => 'position' }, { name => 'manufacturer' }, { name => 'model' }, { name => 'serial' } ],
output_template => 'Used : %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'id' }
]
}
}
];
}
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-id:s' => { name => 'filter_id' },
'filter-manufacturer:s' => { name => 'filter_manufacturer' },
'filter-model:s' => { name => 'filter_model' },
'filter-serial:s' => { name => 'filter_serial' },
'filter-position:s' => { name => 'filter_position' },
});
return $self;
}
sub prefix_disk_output {
my ($self, %options) = @_;
#return "Disk '" . $options{instance_value}->{display} . "' ";
return sprintf(
"Disk #%s (%s/%s, serial: %s) located %s has ",
$options{instance_value}->{id},
$options{instance_value}->{manufacturer},
$options{instance_value}->{model},
$options{instance_value}->{serial},
$options{instance_value}->{position}
);
}
sub manage_selection {
my ($self, %options) = @_;
my $response = $options{custom}->request_api(
endpoint => '/api/v1/disks'
);
my $disks = $response->{members};
$self->{global} = {
total => 0,
free => 0,
used => 0,
used_prct => 0
};
$self->{disk} = {};
for my $disk (@{$disks}) {
my $disk_intro = "disk #" . $disk->{id} . " (" . $disk->{manufacturer} . "/" . $disk->{model}
. ", serial: " . $disk->{serialNumber} . ") located '" . $disk->{position};
# skip if filtered by id
if (defined($self->{option_results}->{filter_id})
and $self->{option_results}->{filter_id} ne ''
and $disk->{id} !~ /$self->{option_results}->{filter_id}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the id does not match the filter.", debug => 1);
next;
}
# skip if filtered by manufacturer
if (defined($self->{option_results}->{filter_manufacturer})
and $self->{option_results}->{filter_manufacturer} ne ''
and $disk->{manufacturer} !~ /$self->{option_results}->{filter_manufacturer}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the manufacturer does not match the filter.", debug => 1);
next;
}
# skip if filtered by model
if (defined($self->{option_results}->{filter_model})
and $self->{option_results}->{filter_model} ne ''
and $disk->{model} !~ /$self->{option_results}->{filter_model}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the model does not match the filter.", debug => 1);
next;
}
# skip if filtered by position
if (defined($self->{option_results}->{filter_position})
and $self->{option_results}->{filter_position} ne ''
and $disk->{position} !~ /$self->{option_results}->{filter_position}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the position does not match the filter.", debug => 1);
next;
}
# skip if filtered by serial
if (defined($self->{option_results}->{filter_serial})
and $self->{option_results}->{filter_serial} ne ''
and $disk->{serial} !~ /$self->{option_results}->{filter_serial}/) {
$self->{output}->output_add(long_msg => "Skipping $disk_intro because the serial does not match the filter.", debug => 1);
next;
}
my $total = $disk->{totalSizeMiB} * 1024 * 1024;
my $free = $disk->{freeSizeMiB} * 1024 * 1024;
my $used = $total - $free;
$self->{global}->{total} = $self->{global}->{total} + $total;
$self->{global}->{free} = $self->{global}->{free} + $free;
$self->{global}->{used} = $self->{global}->{used} + $used;
$self->{disk}->{$disk->{id}} = {
id => $disk->{id},
total => $total,
used => $used,
free => $free,
prct_used => $used * 100 / $total,
prct_free => $free * 100 / $total,
manufacturer => $disk->{manufacturer},
model => $disk->{model},
serial => $disk->{serialNumber},
position => $disk->{position}
};
}
$self->{global}->{used_prct} = $self->{global}->{used} * 100 / $self->{global}->{total} if ($self->{global}->{total} > 0);
if (scalar(keys %{$self->{disk}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No disk found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check disk usage.
=over 8
=item B<--filter-counters>
Define which counters (filtered by regular expression) should be monitored.
Example: --filter-counters='^usage$'
=item B<--filter-id>
Define which disks should be monitored based on their IDs.
This option will be treated as a regular expression.
=item B<--filter-manufacturer>
Define which volumes should be monitored based on the disk manufacturer.
This option will be treated as a regular expression.
=item B<--filter-model>
Define which volumes should be monitored based on the disk model.
This option will be treated as a regular expression.
=item B<--filter-serial>
Define which volumes should be monitored based on the disk serial number.
This option will be treated as a regular expression.
=item B<--filter-position>
Define which volumes should be monitored based on the disk position.
The position is composed of 3 integers, separated by colons:
- Cage number where the physical disk is in.
- Magazine number where the physical disk is in.
- For DC4 cages, disk position within the magazine. For non-DC4 cages, 0.
Example: 7:5:0
This option will be treated as a regular expression.
=item B<--warning-*> B<--critical-*>
Thresholds for disk usage metrics. * may be replaced with:
- For individual disks: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
- For global statistics: 'total-usage' (B), 'total-free' (B), 'total-usage-prct' (%).
=back
=cut

View File

@ -0,0 +1,208 @@
#
# 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 storage::hp::primera::restapi::mode::licenses;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_license_output {
my ($self, %options) = @_;
my $message;
if (!defined($self->{result_values}->{expires_seconds})) {
$message = $self->{result_values}->{name} . ' has permanent license';
} elsif ($self->{result_values}->{expires_seconds} == 0) {
$message = sprintf(
"%s license has expired.",
$self->{result_values}->{name}
);
} else {
$message = sprintf(
"%s license expires in %s.",
$self->{result_values}->{name},
centreon::plugins::misc::change_seconds(value => $self->{result_values}->{expires_seconds})
);
}
return $message;
}
sub custom_license_perfdata {
my ($self, %options) = @_;
return if ($self->{result_values}->{expires_seconds} eq 'permanent');
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
unit => 's',
instances => $self->{result_values}->{name},
value => $self->{result_values}->{expires_seconds},
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_license_threshold {
my ($self, %options) = @_;
return 'ok' if (!defined($self->{result_values}->{expires_seconds}));
return $self->{perfdata}->threshold_check(
value => $self->{result_values}->{expires_seconds},
threshold => [
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' }
]
);
}
sub prefix_license_output {
my ($self, %options) = @_;
return "License '" . $options{instance_value}->{name} . "' expires: " . $options{instance_value}->{expiration_human} . ". ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'license_expiration', type => 1, cb_prefix_output => 'prefix_license_output', message_multiple => 'All licenses are ok'} #, cb_prefix_output => 'prefix_license_output'
];
$self->{maps_counters}->{global} = [
{
label => 'total',
nlabel => 'licenses.total.count',
set => {
key_values => [ { name => 'total' } ],
output_template => 'Number of licenses: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{
label => 'expired',
nlabel => 'licenses.expired.count',
set => {
key_values => [ { name => 'expired' }, { name => 'total' } ],
output_template => 'Number of expired licenses: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
}
];
$self->{maps_counters}->{license_expiration} = [
{ label => 'license-expiration', nlabel => 'license.expiration.seconds', set => {
key_values => [ { name => 'name' }, { name => 'expires_seconds' }, { name => 'expiration_status' }, { name => 'expiration_human' }],
closure_custom_output => $self->can('custom_license_output'),
closure_custom_perfdata => $self->can('custom_license_perfdata'),
closure_custom_threshold_check => $self->can('custom_license_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' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $response = $options{custom}->request_api(
endpoint => '/api/v1/system'
);
my $licenses = $response->{licenseInfo}->{licenses};
my ($total_licenses, $expired_licenses) = (0, 0);
for my $license_item (@{$licenses}) {
# skip if filter does not match
next if (defined($self->{option_results}->{filter_name})
and $self->{option_results}->{filter_name} ne ''
and $license_item->{name} !~ /$self->{option_results}->{filter_name}/);
$total_licenses = $total_licenses + 1;
$self->{license_expiration}->{$license_item->{name}} = {
name => $license_item->{name},
expiration_human => defined($license_item->{expiryTime8601}) ? $license_item->{expiryTime8601} : 'never'
};
my $license_status = 'valid';
if (defined($license_item->{expiryTimeSec})) {
if ($license_item->{expiryTimeSec} > time()) {
$self->{license_expiration}->{$license_item->{name}}->{expires_seconds} = $license_item->{expiryTimeSec} - time();
} else {
$self->{license_expiration}->{$license_item->{name}}->{expires_seconds} = 0;
$license_status = 'expired';
$expired_licenses = $expired_licenses + 1;
}
}
$self->{license_expiration}->{$license_item->{name}}->{expiration_status} = $license_status;
}
$self->{global} = {
total => $total_licenses,
expired => $expired_licenses
};
if (scalar(keys %{$self->{license_expiration}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "Couldn't get information about licenses");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check storage capacities.
=over 8
=item B<--filter-name>
Filter licenses by name (regular expression).
=item B<--warning-*> B<--critical-*>
Thresholds for counters and license validity remaining time in seconds.
* may be replaced with:
'total': applies to the total number of licenses.
'expired': applies to the number of expired licenses.
'license-expiration': applies to the remaining time in seconds until the licenses will expire.
=back
=cut

View File

@ -0,0 +1,111 @@
#
# Copyright 2024 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::hp::primera::restapi::mode::listdisks;
use strict;
use warnings;
use base qw(centreon::plugins::mode);
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 run {
my ($self, %options) = @_;
my $response = $options{custom}->request_api( endpoint => '/api/v1/disks' );
my $disks = $response->{members};
$self->{disks} = [];
for my $disk (@{$disks}) {
push @{$self->{disks}}, {
id => $disk->{id},
position => $disk->{position},
size => $disk->{totalSizeMiB},
manufacturer => $disk->{manufacturer},
model => $disk->{model},
serial => $disk->{serialNumber}
};
$self->{output}->output_add(
long_msg => sprintf(
"[id: %s][position: %s][size: %s][manufacturer: %s][model: %s][serial: %s]",
$disk->{id},
$disk->{position},
$disk->{totalSizeMiB},
$disk->{manufacturer},
$disk->{model},
$disk->{serialNumber}
)
);
}
if (!defined($options{disco_show})) {
$self->{output}->output_add(severity => 'OK', short_msg => 'Disks:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
}
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => [ 'id', 'position','size', 'manufacturer', 'model', 'serial' ]);
}
sub disco_show {
my ($self, %options) = @_;
$options{disco_show} = 1;
$self->run(%options);
for my $disk (@{$self->{disks}}) {
$self->{output}->add_disco_entry(
id => $disk->{id},
position => $disk->{position},
size => $disk->{size},
manufacturer => $disk->{manufacturer},
model => $disk->{model},
serial => $disk->{serial}
);
}
}
1;
__END__
=head1 MODE
List physical disks using the HPE Primera REST API.
=back
=cut

View File

@ -0,0 +1,105 @@
#
# 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 storage::hp::primera::restapi::mode::listvolumes;
use strict;
use warnings;
use base qw(centreon::plugins::mode);
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 run {
my ($self, %options) = @_;
my $response = $options{custom}->request_api( endpoint => '/api/v1/volumes' );
my $volumes = $response->{members};
$self->{volumes} = [];
for my $disk (@{$volumes}) {
push @{$self->{volumes}}, {
id => $disk->{id},
name => $disk->{name},
size => $disk->{sizeMiB},
state => $disk->{state}
};
$self->{output}->output_add(
long_msg => sprintf(
"[id: %s][name: %s][size: %s][state: %s]",
$disk->{id},
$disk->{name},
$disk->{sizeMiB},
$disk->{state}
)
);
}
if (!defined($options{disco_show})) {
$self->{output}->output_add(severity => 'OK', short_msg => 'Volumes:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
}
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => [ 'id', 'name','size', 'state' ]);
}
sub disco_show {
my ($self, %options) = @_;
$options{disco_show} = 1;
$self->run(%options);
for my $disk (@{$self->{volumes}}) {
$self->{output}->add_disco_entry(
id => $disk->{id},
name => $disk->{name},
size => $disk->{size},
state => $disk->{state}
);
}
}
1;
__END__
=head1 MODE
List physical volumes using the HPE Primera REST API.
=back
=cut

View File

@ -0,0 +1,215 @@
#
# 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 storage::hp::primera::restapi::mode::nodes;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc catalog_status_threshold_ng);
sub custom_node_output {
my ($self, %options) = @_;
return sprintf(
"node %s is %s",
$self->{result_values}->{id},
$self->{result_values}->{status}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'nodes', type => 1, message_multiple => 'All nodes are online.' },
];
$self->{maps_counters}->{global} = [
{
label => 'total',
nlabel => 'nodes.total.count',
set => {
key_values => [ { name => 'total' } ],
output_template => 'Total number of nodes: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{
label => 'online',
nlabel => 'nodes.online.count',
set => {
key_values => [ { name => 'online' }, { name => 'total' } ],
output_template => 'Number of online nodes: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
},
{
label => 'offline',
nlabel => 'nodes.offline.count',
set => {
key_values => [ { name => 'offline' }, { name => 'total' } ],
output_template => 'Number of offline nodes: %s',
perfdatas => [
{ template => '%s', min => 0, max => 'total' }
]
}
}
];
$self->{maps_counters}->{nodes} = [
{
label => 'node-status',
type => 2,
warning_default => '%{status} !~ /^online$/',
set => {
key_values => [ { name => 'status' }, { name => 'id' } ],
closure_custom_output => $self->can('custom_node_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, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-node:s' => { name => 'filter_node' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
}
sub manage_selection {
my ($self, %options) = @_;
my $response = $options{custom}->request_api(
endpoint => '/api/v1/system'
);
my $total_nodes = 0;
my $online_nodes = 0;
my $offline_nodes = 0;
# Typical content of onlineNodes is [0, 1]
# This is the list of the nodes that are currently connected
# Each number is the ID of a node
# %online_nodes_statuses associates 'online' to every online node with the node ID as key.
# Example {'0' => 'online', '1' => 'online'} if both nodes are online (corresponding to input [0, 1])
# Example {'0' => 'online'} if only the node of ID 0 is online (corresponding to input [0])
my %online_nodes_statuses = map { $_ => 'online' } @{ $response->{onlineNodes} };
# Typical content of clusterNodes is [0, 1]
# %all_nodes_statuses uses this data and the data from %online_nodes_statuses to give the status of all nodes
# Example: {[0] => 'online', [1] => 'offline'}
my %all_nodes_statuses = map {$_ => defined($online_nodes_statuses{$_}) ? $online_nodes_statuses{$_} : 'offline'} @{ $response->{clusterNodes} };
for my $node (keys(%all_nodes_statuses)) {
next if (defined($self->{option_results}->{filter_node})
and $self->{option_results}->{filter_node} ne ''
and $node !~ /$self->{option_results}->{filter_node}/);
$total_nodes = $total_nodes + 1;
if ($all_nodes_statuses{$node} eq 'online') {
$online_nodes = $online_nodes + 1;
} else {
$offline_nodes = $offline_nodes + 1;
}
$self->{nodes}->{$node} = {
id => $node,
status => $all_nodes_statuses{$node}
}
}
$self->{global} = {
total => $total_nodes,
online => $online_nodes,
offline => $offline_nodes
}
}
1;
__END__
=head1 MODE
Check if the configured nodes of the HPE Primera cluster are all online.
=over 8
=item B<--filter-node>
Define which nodes (filtered by regular expression) should be monitored.
Example: --filter-node='^(0|1)$'
=item B<--warning-node-status>
Define the conditions to match for the status to be WARNING. (default: '%{status} ne "online"').
You can use the %{status} variables.
=item B<--critical-node-status>
Define the conditions to match for the status to be CRITICAL
You can use the %{status} variables.
=item B<--warning-total>
Thresholds for the total number of nodes.
=item B<--critical-total>
Thresholds for the total number of nodes.
=item B<--warning-online>
Thresholds for the number of online nodes.
=item B<--critical-online>
Thresholds for the number of online nodes.
=item B<--warning-offline>
Thresholds for the number of offline nodes.
=item B<--critical-offline>
Thresholds for the number of offline nodes.
=back
=cut

View File

@ -0,0 +1,174 @@
#
# 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 storage::hp::primera::restapi::mode::volumeusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_usage_output {
my ($self, %options) = @_;
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
return sprintf(
"Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'volume', type => 1, cb_prefix_output => 'prefix_volume_output', message_multiple => 'All volumes are ok' },
];
$self->{maps_counters}->{volume} = [
{ label => 'usage', nlabel => 'volume.space.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'name' }, { name => 'id' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'name' }
]
}
},
{ label => 'usage-free', display_ok => 0, nlabel => 'volume.space.free.bytes', set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, , { name => 'name' }, { name => 'id' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'name' }
]
}
},
{ label => 'usage-prct', display_ok => 0, nlabel => 'volume.space.usage.percentage', set => {
key_values => [ { name => 'prct_used' }, { name => 'name' }, { name => 'id' } ],
output_template => 'Used : %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'name' }
]
}
}
];
}
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-id:s' => { name => 'filter_id' },
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub prefix_volume_output {
my ($self, %options) = @_;
return "Volume '" . $options{instance_value}->{name} . "' (#" . $options{instance_value}->{id} . ") ";
}
sub manage_selection {
my ($self, %options) = @_;
my $response = $options{custom}->request_api(endpoint => '/api/v1/volumes');
my $volumes = $response->{members};
$self->{volume} = {};
for my $volume (@{$volumes}) {
my $name = $volume->{name};
my $id = $volume->{id};
if (defined($self->{option_results}->{filter_name}) and $self->{option_results}->{filter_name} ne '' and
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping volume named '" . $name . "': not matching filter /" . $self->{option_results}->{filter_name} . "/.", debug => 1);
next;
}
if (defined($self->{option_results}->{filter_id}) and $self->{option_results}->{filter_id} ne '' and
$id !~ /$self->{option_results}->{filter_id}/) {
$self->{output}->output_add(long_msg => "Skipping volume #" . $id . ": not matching filter /" . $self->{option_results}->{filter_id} . "/.", debug => 1);
next;
}
my $total = $volume->{sizeMiB} * 1024 * 1024;
my $snap_used = $volume->{snapshotSpace}->{usedMiB};
my $adm_used = $volume->{adminSpace}->{usedMiB};
my $usr_used = $volume->{userSpace}->{usedMiB};
my $used = ($snap_used + $adm_used + $usr_used) * 1024 * 1024;
$self->{volume}->{$name} = {
id => $id,
name => $name,
total => $total,
used => $used,
free => ($total - $used) >= 0 ? ($total - $used) : 0,
prct_used => $used * 100 / $total,
prct_free => (100 - ($used * 100 / $total) >= 0) ? (100 - ($used * 100 / $total)) : 0
};
}
if (scalar(keys %{$self->{volume}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No volume found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check volume usage.
=over 8
=item B<--filter-counters>
Define which counters (filtered by regular expression) should be monitored.
Example: --filter-counters='^usage$'
=item B<--filter-id>
Define which volumes should be monitored based on their IDs.
This option will be treated as a regular expression.
=item B<--filter-name>
Define which volumes should be monitored based on the volume names.
This option will be treated as a regular expression.
=item B<--warning-*> B<--critical-*>
Thresholds for volume usage metrics.
* may be replaced with:
'usage' (B), 'usage-free' (B), 'usage-prct' (%).
=back
=cut

View File

@ -0,0 +1,55 @@
#
# 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 storage::hp::primera::restapi::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_custom);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{modes} = {
'capacity' => 'storage::hp::primera::restapi::mode::capacity',
'disk-status' => 'storage::hp::primera::restapi::mode::diskstatus',
'disk-usage' => 'storage::hp::primera::restapi::mode::diskusage',
'licenses' => 'storage::hp::primera::restapi::mode::licenses',
'list-disks' => 'storage::hp::primera::restapi::mode::listdisks',
'list-volumes' => 'storage::hp::primera::restapi::mode::listvolumes',
'nodes' => 'storage::hp::primera::restapi::mode::nodes',
'volume-usage' => 'storage::hp::primera::restapi::mode::volumeusage',
};
$self->{custom_modes}->{api} = 'storage::hp::primera::restapi::custom::api';
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Monitor HPE Primera storage controller.
=cut

View File

@ -1,5 +1,6 @@
*** Settings ***
Documentation This is the documentation for the import resource file.
Documentation This is the documentation for the import resource file.
Library Examples
Library OperatingSystem
Library String

View File

@ -1,12 +1,19 @@
*** Settings ***
Documentation Centreon Plugins for Robot Framework
Library Process
*** Variables ***
${CENTREON_PLUGINS} perl ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl
${CENTREON_PLUGINS} perl ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl
# one we use package, we need to remove the "perl" part to be sure the plugin is executable and is correctly formated
# with a shebang at the top.
${PERCENT} %
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${SNMPPORT} 2024
${SNMPVERSION} 2c
${PERCENT} %
*** Keywords ***
Start Mockoon
@ -19,5 +26,17 @@ Start Mockoon
... --port
... 3000
Sleep 10s
Stop Mockoon
Terminate All Processes
Terminate All Processes
Ctn Run Command And Check Result As Strings
[Arguments] ${command} ${expected_result}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${expected_result}
... ${output}
... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True

View File

@ -1,7 +1,11 @@
--3cx-version
--add-sysdesc
--api-filter-orgs
--api-password
--api-password
--api-path
--api-token
--api-username
--api-version
--cacert-file
--cert-pkcs12
@ -12,6 +16,7 @@
--dyn-mode
--exclude-fs
--filter-fs
--filter-imei
--filter-vdom
--filter-vm
--force-counters32
@ -19,6 +24,8 @@
--force-oid
--get-param
--ignore-orgs-api-disabled
--jobq
--legacy-api-beta
--lookup-perfdatas-nagios
--map-speed-dsl
--mqtt
@ -36,53 +43,81 @@
--oid-display
--oid-extra-display
--oid-filter
--sql-errors-exit
--urlpath
--use-ucd
--warning-bytesallocatedpercentage
-EncodedCommand
-InputFormat
-NoLogo
2c
3CX
ADSL
ASAM
Alcatel
Ansible
Avigilon
Centreon
cpu-utilization-1m
cpu-utilization-5m
cpu-utilization-5s
DC4
Datacore
FCCapacity
Fortigate
Fortinet
HPE
HashiCorp
ISAM
IMEI
IpAddr
ISAM
Iwsva
JOBQ
Loggly
MBean
MIB
MQTT
Meraki
module-cellradio-rscp
module-cellradio-csq
module-cellradio-rsrp
module-cellradio-rsrq
module-cellradio-snr
modules-cellradio-detected
Mosquitto
NLCapacity
NTLMv2
NagVis
Nagios
Netscaler
OID
PKCS1
Primera
QoS
RestAPI
RRDCached
SNMP
SSDCapacity
SSH
Sansymphony
SureBackup
TCP
TrendMicro
UCD
VDSL2
VM
Veeam
VPN
Veeam
WSMAN
XPath
allCapacity
api.meraki.com
cardtemperature
connections-dhcp
connections-dns
deduplication
datasource
deltaps
df
eth
@ -95,6 +130,8 @@ in-bcast
in-mcast
in-ucast
interface-dsl-name
jobqueue
jobqueues
keepass
ldap
license-instances-usage-prct
@ -103,22 +140,33 @@ oneaccess-sys-mib
out-bcast
out-mcast
out-ucast
overprovisioning
perfdata
powershell
powershell.exe
prct
proto
psu
queue-messages-inflighted
sfp.temperature
space-usage-prct
teampass
Teldat
timeframe
topic-messages-inflighted
total-offline-prct
total-online-prct
total-oper-down
total-oper-up
tower-cli
uptime
usage-prct
userpass
v1
v2
VDSL2
Veeam
VeloCloud
VMware
WSMAN
Kubernetes

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,33 @@
*** Settings ***
Documentation Check the hosts mode with api custom mode
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}ansible_tower.json
${CMD} ${CENTREON_PLUGINS}
... --plugin=apps::automation::ansible::tower::plugin
... --custommode=api
... --hostname=${HOSTNAME}
... --username=username
... --password=password
... --port=${APIPORT}
*** Test Cases ***
Hosts ${tc}
[Documentation] Check the number of returned hosts
[Tags] apps automation ansible service-disco
${command} Catenate
... ${CMD}
... --mode=hosts
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc snmpcommunity expected_result --
... 1 os/linux/snmp/list-diskio OK: Hosts total: 10, failed: 0 - All hosts are ok | 'hosts.total.count'=10;;;0; 'hosts.failed.count'=0;;;0;10

View File

@ -0,0 +1,47 @@
*** Settings ***
Documentation Check the jobs mode with api custom mode
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}ansible_tower.json
${cmd} ${CENTREON_PLUGINS}
... --plugin=apps::automation::ansible::tower::plugin
... --custommode=api
... --hostname=${HOSTNAME}
... --username=username
... --password=password
... --port=${APIPORT}
*** Test Cases ***
jobs ${tc}
[Documentation] Check the number of returned jobs
[Tags] apps automation ansible jobs
${command} Catenate
... ${cmd}
... --mode=jobs
... ${extraoptions}
Log ${cmd}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc extraoptions expected_result --
... 1 --filter-name='' OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 2 --filter-name=toto OK: Jobs total: 0, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=0;;;0; 'jobs.successful.count'=0;;;0;0 'jobs.failed.count'=0;;;0;0 'jobs.running.count'=0;;;0;0 'jobs.canceled.count'=0;;;0;0 'jobs.pending.count'=0;;;0;0 'jobs.default.count'=0;;;0;0
... 3 --filter-name=toto --critical-total=1:1 CRITICAL: Jobs total: 0 | 'jobs.total.count'=0;;1:1;0; 'jobs.successful.count'=0;;;0;0 'jobs.failed.count'=0;;;0;0 'jobs.running.count'=0;;;0;0 'jobs.canceled.count'=0;;;0;0 'jobs.pending.count'=0;;;0;0 'jobs.default.count'=0;;;0;0
... 4 --filter-name='' --critical-total=1:1 CRITICAL: Jobs total: 2 | 'jobs.total.count'=2;;1:1;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 5 --filter-name='' --critical-total=2:2 OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;;2:2;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 6 --critical-total=2:1 CRITICAL: Jobs total: 2 | 'jobs.total.count'=2;;2:1;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 7 --filter-name='' --display-failed-jobs OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 8 --filter-name='' --warning-total=1:1 WARNING: Jobs total: 2 | 'jobs.total.count'=2;1:1;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 9 --filter-name='' --warning-total=2:2 OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;2:2;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 10 --filter-name=toto --warning-total=1:1 WARNING: Jobs total: 0 | 'jobs.total.count'=0;1:1;;0; 'jobs.successful.count'=0;;;0;0 'jobs.failed.count'=0;;;0;0 'jobs.running.count'=0;;;0;0 'jobs.canceled.count'=0;;;0;0 'jobs.pending.count'=0;;;0;0 'jobs.default.count'=0;;;0;0
... 11 --warning-total=1:2 OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;1:2;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 12 --warning-total=2:1 WARNING: Jobs total: 2 | 'jobs.total.count'=2;2:1;;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2
... 13 --critical-total=1:2 OK: Jobs total: 2, successful: 0, failed: 0, running: 0 | 'jobs.total.count'=2;;1:2;0; 'jobs.successful.count'=0;;;0;2 'jobs.failed.count'=0;;;0;2 'jobs.running.count'=0;;;0;2 'jobs.canceled.count'=0;;;0;2 'jobs.pending.count'=0;;;0;2 'jobs.default.count'=0;;;0;2

View File

@ -13,7 +13,8 @@ ${CMD} ${CENTREON_PLUGINS}
... --command=cat
... --command-path=/usr/bin
... --no-ps
... --command-options=nodeintegrationservice-2022.json
... --command-options=${CURDIR}/nodeintegrationservice-2022.json
*** Test Cases ***
HyperV 2022 ${tc}/3
@ -22,16 +23,9 @@ HyperV 2022 ${tc}/3
${command} Catenate
... ${CMD}
... --filter-vm='${filter_vm}'
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc filter_vm expected_result --
... 1 ${EMPTY} CRITICAL: 1 problem(s) detected
... 2 VSERVER05 OK: VM 'VSERVER05' 0 problem(s) detected - VM 'VSERVER05' 0 problem(s) detected
... 3 VSERVER07 CRITICAL: VM 'VSERVER07' 1 problem(s) detected

View File

@ -11,23 +11,23 @@ Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}collection-centreon-web.mockoon.json
${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::http::plugin --mode collection
... --constant='hostname=127.0.0.1' --constant='protocol=http' --constant='port=3000'
... --constant='username=admin' --constant='password=myPassword'
${CMD} ${CENTREON_PLUGINS} --plugin=apps::protocols::http::plugin
... --mode collection
... --constant='hostname=${HOSTNAME}'
... --constant='protocol=http'
... --constant='port=${APIPORT}'
... --constant='username=admin'
... --constant='password=myPassword'
*** Test Cases ***
Check if ${test_desc} on Centreon
[Tags] centreon collections http
${output} Run
... ${CMD} --config=${CURDIR}/${collection}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected}
... Wrong output result:\n\n ${output}\nInstead of:\n ${expected}\n\n
${command} Catenate
... ${CMD} --config=${CURDIR}/${collection}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: test_desc collection expected --
Examples: test_desc collection expected_result --
... authentication succeeds collection-centreon-web-check-auth.collection.json OK: Authentication resulted in 200 HTTP code
... hosts are down collection-centreon-web-check-down-hosts.collection.json OK: All hosts are UP | 'hostsRequest.down.count'=0;0;;0;1
... commands are broken collection-centreon-web-check-broken-commands.collection.json WARNING:${SPACE} - Service FakeHostThatIsDown/Svc-BadCommand output is '(Execute command failed)' | 'commands.broken.count'=1;0;;0;

View File

@ -16,18 +16,13 @@ SNMP Collection - Sputnik Environment ${tc}/3
${command} Catenate
... ${CMD}
... --mode=collection
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=apps/protocols/snmp/collection-sputnik
... --config=${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}src/contrib/collection/snmp/sputnik-environment.json
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... ${command}\nWrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc expected_result --
... 1 OK: Sensor '1' temperature is '20.06'°C and humidity is '33'% | '1#environment.temperature.celsius'=20.06C;;;; '1#environment.humidity.percent'=33%;;;0;100

View File

@ -9,40 +9,35 @@ Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}vault-authentication-hashicorp.json
${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::snmp::plugin --hostname=127.0.0.1
${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::snmp::plugin --hostname=${HOSTNAME}
*** Test Cases ***
check hashicorp vault manager${Name}
[Documentation] Check hashicorp vaultmanager
[Tags] snmp vault
${cmd_hashicorp} Catenate
${command} Catenate
... ${CMD}
... --pass-manager=hashicorpvault
... --vault-address=127.0.0.1
... --vault-port=3000
... --vault-address=${HOSTNAME}
... --vault-port=${APIPORT}
... --vault-protocol=http
... --auth-method=userpass
... --auth-settings="username=hcvaultuser"
... --secret-path="path/of/the/secret"
... --snmp-port=2024
... --snmp-port=${SNMPPORT}
... --map-option="snmp_community=\\%{value_path/of/the/secret}"
... --mode=string-value
... --snmp-version=2c
... --snmp-version=${SNMPVERSION}
... --snmp-community=apps/protocols/snmp/snmp-single-oid
... --oid='.1.3.6.1.2.1.1.1.0' ${path-param}
... --format-ok='current value is: \\%{details_ok}'
... --format-details-warning='current value is: \\%{details_warning}'
... --format-details-critical='current value is: \\%{details_critical}'
${output} Run
... ${cmd_hashicorp}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${result}
... ${cmd_hashicorp}\n\n Wrong output result for hashicorp auth manager on snmp generic plugin, output got :\n${output} \nExpected : \n ${result}\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: Name path-param result --
Examples: Name path-param expected_result --
... default path --auth-path='' --auth-settings="password=secrethashicorpPassword" OK: current value is: Linux centreon-devbox 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64
... wrong path --auth-path='specific-url' --auth-settings="password=secrethashicorpPassword" OK: current value is: Linux centreon-devbox 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64
... wrong password --auth-path='' --auth-settings="password=WrongPassword" UNKNOWN: 401 Unauthorized

View File

@ -11,29 +11,30 @@ Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}cloud-azure-policyinsights-policystates.json
${LOGIN_ENDPOINT} http://localhost:3000/login
${BASE_URL} http://${HOSTNAME}:${APIPORT}
${LOGIN_ENDPOINT} ${BASE_URL}/login
${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::policyinsights::policystates::plugin --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --statefile-dir=/tmp/cache/ --login-endpoint=${LOGIN_ENDPOINT}
&{compliance_value1}
... endpoint=http://localhost:3000/ok
... endpoint=${BASE_URL}/ok
... policyname=
... resourcelocation=
... resourcetype=
... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0;
&{compliance_value2}
... endpoint=http://localhost:3000/oknextlink
... endpoint=${BASE_URL}/oknextlink
... policyname=9daedab3-fb2d-461e-b861-71790eead4f6
... resourcelocation=
... resourcetype=
... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0;
&{compliance_value3}
... endpoint=http://localhost:3000/nok1
... endpoint=${BASE_URL}/nok1
... policyname=9daedab3-fb2d-461e-b861-71790eead4f6
... resourcelocation=fr
... resourcetype=
... result=CRITICAL: Compliance state for policy '9daedab3-fb2d-461e-b861-71790eead4f6' on resource 'mypubip1' is 'NonCompliant' | 'policies.non_compliant.count'=1;;;0;
&{compliance_value4}
... endpoint=http://localhost:3000/nok2
... endpoint=${BASE_URL}/nok2
... policyname=9daedab3-fb2d-461e-b861-71790eead4f6
... resourcelocation=fr
... resourcetype=ip
@ -62,10 +63,6 @@ Azure PolicyInsights PolicyStates compliance
IF ${length} > 0
${command} Catenate ${command} --resource-type=${compliance_value.resourcetype}
END
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${compliance_value.result}
... Wrong output result for compliance of ${compliance_value}.{\n}Command output:{\n}${output}
Ctn Run Command And Check Result As Strings ${command} ${compliance_value.result}
END

View File

@ -0,0 +1,43 @@
*** Settings ***
Documentation VeloCloud REST API Edge Status
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}velocloud.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=cloud::vmware::velocloud::restapi::plugin
... --mode edge-status
... --hostname=${HOSTNAME}
... --username=XloginX
... --password=XpasswordX
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Edge Status ${tc}
[Tags] cloud api vmware
${command} Catenate ${CMD} ${extraoptions}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${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 extraoptions expected_result --
... 1 ${EMPTY} CRITICAL: Edge 'MYEDGE#02' State is 'OFFLINE', Service State is 'IN_SERVICE', HA State is 'READY', Activation State is 'ACTIVATED'
... 2 --critical-status='' OK: All edges status are ok

View File

@ -0,0 +1,42 @@
*** Settings ***
Documentation VeloCloud REST API Edge Status
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}velocloud.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=cloud::vmware::velocloud::restapi::plugin
... --mode list-edges
... --hostname=${HOSTNAME}
... --username=XloginX
... --password=XpasswordX
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
List Edges ${tc}
[Tags] cloud api vmware discovery
${command} Catenate ${CMD} ${extraoptions} | wc -l
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${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 extraoptions expected_result --
... 1 ${EMPTY} 9

File diff suppressed because one or more lines are too long

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::devices::camera::avigilon::snmp::plugin
... --mode=memory
... --hostname=127.0.0.1
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}
*** Test Cases ***
@ -24,12 +24,7 @@ Avigilon camera Memory ${tc}/3
... --warning-available='${warning_available}'
... --critical-available='${critical_available}'
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc warning_available critical_available expected_result --
... 1 ${EMPTY} ${EMPTY} OK: total system memory available: 464.85 KB | 'memory.available'=476004B;;;0;

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::devices::camera::avigilon::snmp::plugin
... --mode=storage
... --hostname=127.0.0.1
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}
*** Test Cases ***
@ -25,12 +25,7 @@ Avigilon camera Storage ${tc}/3
... --critical-status='${critical_status}'
... --unknown-status='${unknown_status}'
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc warning_status critical_status unknown_status expected_result --
... 1 ${EMPTY} ${EMPTY} ${EMPTY} OK: state of the SD card: mediaNotPresent

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::devices::camera::avigilon::snmp::plugin
... --mode=temperature
... --hostname=127.0.0.1
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}
*** Test Cases ***
@ -26,12 +26,7 @@ Avigilon camera Temperature ${tc}/5
... --warning-status='${warning_status}'
... --critical-status='${critical_status}'
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc warning_temperature critical_temperature warning_status critical_status expected_result --
... 1 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: temperature: 23.00 C, sensor 1 [type:mainSensor] status: ok | 'sensor.temperature.celsius'=23C;;;0;

View File

@ -7,9 +7,6 @@ Test Timeout 120s
*** Variables ***
${HOSTADDRESS} 127.0.0.1
${SNMPPORT} 2024
${SNMPVERSION} 2c
${SNMPCOMMUNITY} hardware/kvm/avocent/acs/8000/avocent8000
@ -93,7 +90,7 @@ Run Avocent 8000 Plugin
... ${CENTREON_PLUGINS}
... --plugin=hardware::kvm::avocent::acs::8000::snmp::plugin
... --mode=${mode}
... --hostname=${HOSTADDRESS}
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=${SNMPCOMMUNITY}

View File

@ -7,7 +7,7 @@ Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=127.0.0.1 --snmp-version=2c --snmp-port=2024
${CMD} ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=${HOSTNAME} --snmp-version=${SNMPVERSION} --snmp-port=${SNMPPORT}
*** Test Cases ***
@ -22,12 +22,7 @@ APC Sensors ${tc}/9
${command} Append Option To Command ${command} --critical ${critical}
${command} Append Option To Command ${command} --component ${component}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
# --component 'temperature' --warning='humidity,.,45:65' --critical='humidity,.,35:70'
Examples: tc component warning critical expected_result --
... 1 _empty_ _empty_ _empty_ OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;;

View File

@ -16,9 +16,9 @@ Sputnik UPS - Environment ${tc}/9
${command} Catenate
... ${CMD}
... --mode=environment
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik
# Append options to command
@ -33,12 +33,7 @@ Sputnik UPS - Environment ${tc}/9
${opt} Append Option --filter-id ${filter_id}
${command} Catenate ${command} ${opt}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc filter_id w_temperature c_temperature w_humidity c_humidity expected_result --
... 1 1 30 50 50 70 OK: 'Sensor 1': temperature 20.06 C, humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:30;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:50;0:70;0;100

View File

@ -16,9 +16,9 @@ Battery ${tc}/4
${command} Catenate
... ${CMD}
... --mode=battery
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=hardware/ups/socomec/netvision/snmp/battery
# Append options to command
@ -27,12 +27,7 @@ Battery ${tc}/4
${opt} Append Option --critical-temperature ${c_temperature}
${command} Catenate ${command} ${opt}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... ${command} \nWrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc w_temperature c_temperature expected_result --
... 1 30 50 OK: battery status is normal - charge remaining: 100% (0 minutes remaining) | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:30;0:50;;

View File

@ -65,9 +65,9 @@ Hardware UPS Standard SNMP input lines
${command} Catenate
... ${CMD}
... --mode=input-lines
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=${ups_standard_test.snmpcommunity}
${length} Get Length ${ups_standard_test.warningpower}
IF ${length} > 0

View File

@ -7,7 +7,7 @@ Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::instant::snmp::plugin --mode=ap-usage --hostname=127.0.0.1 --snmp-version=2c --snmp-port=2024
${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::instant::snmp::plugin --mode=ap-usage --hostname=${HOSTNAME} --snmp-version=${SNMPVERSION} --snmp-port=${SNMPPORT}
&{ap_usage_test_1}
... documentation=Test AP usage without filters
@ -66,10 +66,5 @@ Network Aruba Instant SNMP plugin
... --snmp-community=${ap_usage_tc.snmpcommunity}
Log To Console ${command}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${ap_usage_tc.result}
... Wrong output result for compliance of ${ap_usage_tc.result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
Ctn Run Command And Check Result As Strings ${command} ${ap_usage_tc.result}
END

View File

@ -10,15 +10,16 @@ Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}meraki.mockoon.json
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::meraki::cloudcontroller::restapi::plugin
... --api-token=EEECGFCGFCGF
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::meraki::cloudcontroller::restapi::plugin
... --api-token=EEECGFCGFCGF
... --statefile-dir=/dev/shm/
*** Test Cases ***
Create cache from API
[Tags] meraki api vpn network cache
${output} Run
... ${CMD} --mode=cache --proto http --port 3000 --hostname=127.0.0.1
... ${CMD} --mode=cache --proto=http --port=${APIPORT} --hostname=${HOSTNAME}
${output} Strip String ${output}
Should Be Equal As Strings
@ -30,17 +31,13 @@ Create cache from API
Check if ${test_desc} works
[Tags] meraki api vpn network
${output} Run
... ${CMD} --mode=vpn-tunnels --filter-network-name=${filter_network_name} --cache-use --critical-total-dormant=1:
${command} Catenate
... ${CMD}
... --mode=vpn-tunnels --filter-network-name=${filter_network_name} --cache-use --critical-total-dormant=1:
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected}
... Wrong output result:\n\n ${output}\nInstead of:\n ${expected}\n\n
Examples: test_desc filter_network_name expected --
Examples: test_desc filter_network_name expected_result --
... all links .* OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1
... empty filter ${EMPTY} OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1
... absurd filter toto CRITICAL: Vpn tunnels dormant: 0 | 'vpn.tunnels.online.count'=0;;;0;0 'vpn.tunnels.offline.count'=0;;;0;0 'vpn.tunnels.dormant.count'=0;;1:;0;0

View File

@ -17,18 +17,13 @@ check psu components ${tc}/2
${command} Catenate
... ${CMD}
... --mode=health
... --hostname='127.0.0.1'
... --snmp-port='2024'
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}
... --snmp-community='network/citrix/netscaler/snmp/mode/components/${community}'
... --component=psu
... --alternative-status-mapping='${alternative_status_mapping}'
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc alternative_status_mapping community expected_result --
... 1 true psu-citrix-v13 OK: All 4 components are ok [4/4 psus]. | 'count_psu'=4;;;;

View File

@ -306,9 +306,9 @@ Network Fortinet Fortigate SNMP link monitor
${command} Catenate
... ${CMD}
... --mode=link-monitor
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor
${length} Get Length ${fortinet_fortigate_linkmonitor_test.filterid}
IF ${length} > 0
@ -382,14 +382,9 @@ Network Fortinet Fortigate SNMP link monitor
... ${command}
... --critical-packet-loss=${fortinet_fortigate_linkmonitor_test.criticalpacketloss}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${fortinet_fortigate_linkmonitor_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${fortinet_fortigate_linkmonitor_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
Ctn Run Command And Check Result As Strings ${command} ${fortinet_fortigate_linkmonitor_test.result}
END
Network Fortinet Fortigate SNMP list link monitor
@ -399,9 +394,9 @@ Network Fortinet Fortigate SNMP list link monitor
${command} Catenate
... ${CMD}
... --mode=list-link-monitors
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor
${length} Get Length ${fortinet_fortigate_listlinkmonitors_test.filterstate}
IF ${length} > 0
@ -421,12 +416,5 @@ Network Fortinet Fortigate SNMP list link monitor
... ${command}
... --filter-vdom=${fortinet_fortigate_listlinkmonitors_test.filtervdom}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${fortinet_fortigate_listlinkmonitors_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${fortinet_fortigate_listlinkmonitors_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
Ctn Run Command And Check Result As Strings ${command} ${fortinet_fortigate_listlinkmonitors_test.result}
END

View File

@ -0,0 +1,52 @@
*** Settings ***
Documentation Network Teldat SNMP plugin
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::teldat::snmp::plugin
*** Test Cases ***
Cells radio ${tc}
[Tags] network teldat snmp
${command} Catenate
... ${CMD}
... --mode=cells-radio
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
... --custom-perfdata-instances=${customperfdatainstances}
... --critical-status=${criticalstatus}
... --warning-modules-cellradio-detected=${warningmodulescellradiodetected}
... --critical-modules-cellradio-detected=${criticalmodulescellradiodetected}
... --warning-module-cellradio-rsrp=${warningmodulecellradiorsrp}
... --critical-module-cellradio-rsrp=${criticalmodulecellradiorsrp}
... --warning-module-cellradio-rsrq=${warningmodulecellradiorsrq}
... --critical-module-cellradio-rsrq=${criticalmodulecellradiorsrq}
... --warning-module-cellradio-csq=${warningmodulecellradiocsq}
... --critical-module-cellradio-csq=${criticalmodulecellradiocsq}
... --warning-module-cellradio-snr=${warningmodulecellradiosnr}
... --critical-module-cellradio-snr=${criticalmodulecellradiosnr}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc customperfdatainstances criticalstatus warningmodulescellradiodetected criticalmodulescellradiodetected warningmodulecellradiorsrp criticalmodulecellradiorsrp warningmodulecellradiorsrq criticalmodulecellradiorsrq warningmodulecellradiocsq criticalmodulecellradiocsq warningmodulecellradiosnr criticalmodulecellradiosnr expected_result --
... 1 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: All cellular radio interfaces are ok | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 4 '%(operator) %(simIcc)' ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: All cellular radio interfaces are ok | 'modules.cellradio.detected.count'=3;;;0; '---~89330122115801091660#module.cellradio.rsrp.dbm'=-114;;;0; '---~89330122115801091660#module.cellradio.rsrq.dbm'=-18;;;0; '---~89330122115801091660#module.cellradio.snr.db'=-1;;;0; '---~89330122115801091660#module.cellradio.csq.dbm'=-73;;;0; 'PHENIX~89330122115801091660#module.cellradio.rsrp.dbm'=-114;;;0; 'PHENIX~89330122115801091660#module.cellradio.rsrq.dbm'=-18;;;0; 'PHENIX~89330122115801091660#module.cellradio.snr.db'=-1;;;0; 'PHENIX~89330122115801091660#module.cellradio.csq.dbm'=-73;;;0;
... 5 ${EMPTY} ${EMPTY} 2 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} WARNING: Number of cellular radio interfacesdetected: 3 | 'modules.cellradio.detected.count'=3;0:2;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 6 ${EMPTY} ${EMPTY} ${EMPTY} 2 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} CRITICAL: Number of cellular radio interfacesdetected: 3 | 'modules.cellradio.detected.count'=3;;0:2;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 7 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} -100 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} WARNING: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] rsrp: -114 dBm - cellular radio module '1' interface 'data primary' [imei: 359072066403821] rsrp: -114 dBm | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;0:-100;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;0:-100;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 8 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} -100 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} CRITICAL: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] rsrp: -114 dBm - cellular radio module '1' interface 'data primary' [imei: 359072066403821] rsrp: -114 dBm | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;0:-100;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;0:-100;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 9 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 10 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} WARNING: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] rsrq: -18 dBm - cellular radio module '1' interface 'data primary' [imei: 359072066403821] rsrq: -18 dBm | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;0:10;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;0:10;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 10 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 10 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} CRITICAL: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] rsrq: -18 dBm - cellular radio module '1' interface 'data primary' [imei: 359072066403821] rsrq: -18 dBm | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;0:10;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;0:10;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 11 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 10 ${EMPTY} ${EMPTY} ${EMPTY} WARNING: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] csq: -73 dBm - cellular radio module '1' interface 'data primary' [imei: 359072066403821] csq: -73 dBm | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;0:10;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;0:10;;0;
... 12 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 10 ${EMPTY} ${EMPTY} CRITICAL: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] csq: -73 dBm - cellular radio module '1' interface 'data primary' [imei: 359072066403821] csq: -73 dBm | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;0:10;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;0:10;0;
... 13 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 0 ${EMPTY} WARNING: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] snr: -1 dB - cellular radio module '1' interface 'data primary' [imei: 359072066403821] snr: -1 dB | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;0:0;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;0:0;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 14 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 0 CRITICAL: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] snr: -1 dB - cellular radio module '1' interface 'data primary' [imei: 359072066403821] snr: -1 dB | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;0:0;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;0:0;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;
... 15 ${EMPTY} '\\\%{interfaceState} =~ /disconnect/' ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} CRITICAL: cellular radio module '1' interface 'control vocal' [imei: 359072066403821] sim status: OK [operator: ---] [imsi: 208015606540916] [interface state: disconnect(1)] [simIcc: 89330122115801091660] - cellular radio module '1' interface 'data auxiliary' [imei: 359072066403821] sim status: DETECTING [operator: ---] [imsi: 208015606540916] [interface state: disconnect(1)] [simIcc: 89330122115801091660] | 'modules.cellradio.detected.count'=3;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~control vocal~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~control vocal~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~control vocal~359072066403821#module.cellradio.csq.dbm'=-73;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrp.dbm'=-114;;;0; 'module1~data primary~359072066403821#module.cellradio.rsrq.dbm'=-18;;;0; 'module1~data primary~359072066403821#module.cellradio.snr.db'=-1;;;0; 'module1~data primary~359072066403821#module.cellradio.csq.dbm'=-73;;;0;

View File

@ -0,0 +1,40 @@
*** Settings ***
Documentation Network Teldat SNMP plugin
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::teldat::snmp::plugin
*** Test Cases ***
CPU ${tc}
[Tags] network teldat snmp
${command} Catenate
... ${CMD}
... --mode=cpu
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
... --warning-cpu-utilization-5s=${warningcpuutilization5s}
... --critical-cpu-utilization-5s=${criticalcpuutilization5s}
... --warning-cpu-utilization-1m=${warningcpuutilization1m}
... --critical-cpu-utilization-1m=${criticalcpuutilization1m}
... --warning-cpu-utilization-5m=${warningcpuutilization5m}
... --critical-cpu-utilization-5m=${criticalcpuutilization5m}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc warningcpuutilization5s criticalcpuutilization5s warningcpuutilization1m criticalcpuutilization1m warningcpuutilization5m criticalcpuutilization5m expected_result --
... 1 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: cpu average usage: 1.00 % (5s), 1.00 % (1m), 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
... 2 0.5 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} WARNING: cpu average usage: 1.00 % (5s) | 'cpu.utilization.5s.percentage'=1.00%;0:0.5;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
... 3 ${EMPTY} 0.5 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} CRITICAL: cpu average usage: 1.00 % (5s) | 'cpu.utilization.5s.percentage'=1.00%;;0:0.5;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
... 4 ${EMPTY} ${EMPTY} 0.5 ${EMPTY} ${EMPTY} ${EMPTY} WARNING: cpu average usage: 1.00 % (1m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;0:0.5;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
... 5 ${EMPTY} ${EMPTY} ${EMPTY} 0.5 ${EMPTY} ${EMPTY} CRITICAL: cpu average usage: 1.00 % (1m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;0:0.5;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
... 6 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 0.5 ${EMPTY} WARNING: cpu average usage: 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;0:0.5;;0;100
... 7 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 0.5 CRITICAL: cpu average usage: 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;0:0.5;0;100

View File

@ -0,0 +1,40 @@
*** Settings ***
Documentation Network Teldat SNMP plugin
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::teldat::snmp::plugin
*** Test Cases ***
Memory ${tc}
[Tags] network teldat snmp
${command} Catenate
... ${CMD}
... --mode=memory
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
... --warning-usage=${warningusage}
... --critical-usage=${criticalusage}
... --warning-usage-free=${warningusagefree}
... --critical-usage-free=${criticalusagefree}
... --warning-usage-prct=${warningusageprct}
... --critical-usage-prct=${criticalusageprct}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc warningusage criticalusage warningusagefree criticalusagefree warningusageprct criticalusageprct expected_result --
... 1 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
... 2 100 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;0:100;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
... 3 ${EMPTY} 100 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;0:100;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
... 4 ${EMPTY} ${EMPTY} 100 ${EMPTY} ${EMPTY} ${EMPTY} WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;0:100;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
... 5 ${EMPTY} ${EMPTY} ${EMPTY} 100 ${EMPTY} ${EMPTY} CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;0:100;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
... 6 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 30 ${EMPTY} WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;0:30;;0;100
... 7 ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} 30 CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;0:30;0;100

View File

@ -1,719 +0,0 @@
*** Settings ***
Documentation Network Teldat SNMP plugin
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::teldat::snmp::plugin
# Test simple usage of the cellsradio mode
&{teldat_cellsradio_test1}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with filter-cell-id option set to a fake value
&{teldat_cellsradio_test2}
... filtercellid=toto
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=UNKNOWN: No Cell ID found matching with filter : toto
# Test cellsradio mode with filter-cell-id option set to a imei value
&{teldat_cellsradio_test3}
... filtercellid='359072066403821'
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with custom-perfdata-instances option set to '%(cellId) %(simIcc)'
&{teldat_cellsradio_test4}
... filtercellid=
... customperfdatainstances='%(cellId) %(simIcc)'
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~89330122115801091660#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~89330122115801091660#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~89330122115801091660#module.cellradio.snr.db'=-1;;;0; '359072066403821~89330122115801091660#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~89330122115801091660#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~89330122115801091660#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~89330122115801091660#module.cellradio.snr.db'=-1;;;0; '359072066403821~89330122115801091660#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with warning-modules-cellradio-detected option set to a 2
&{teldat_cellsradio_test5}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=2
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: Number of cellular radio modules detected: 3 - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;0:2;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with critical-modules-cellradio-detected option set to a 2
&{teldat_cellsradio_test6}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=2
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: Number of cellular radio modules detected: 3 - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;0:2;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with warning-module-cellradio-rsrp option set to a -100
&{teldat_cellsradio_test7}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=-100
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] - rsrp: -114 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] rsrp: -114 dBm | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;0:-100;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;0:-100;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with critical-module-cellradio-rsrp option set to a -100
&{teldat_cellsradio_test8}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=-100
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] rsrp: -114 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - rsrp: -114 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;0:-100;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;0:-100;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with warning-module-cellradio-rsrq option set to a -10
&{teldat_cellsradio_test9}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=-10
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] - rsrq: -18 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] rsrq: -18 dBm | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;0:-10;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;0:-10;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with critical-module-cellradio-rsrq option set to a -10
&{teldat_cellsradio_test10}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=-10
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] rsrq: -18 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - rsrq: -18 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;0:-10;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;0:-10;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with warning-module-cellradio-csq option set to a -10
&{teldat_cellsradio_test11}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=-10
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] - csq: -73 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] csq: -73 dBm | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;0:-10;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;0:-10;;0;
# Test cellsradio mode with critical-module-cellradio-csq option set to a -10
&{teldat_cellsradio_test12}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=-10
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] csq: -73 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - csq: -73 dBm - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;0:-10;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;0:-10;0;
# Test cellsradio mode with warning-module-cellradio-snr option set to a 0
&{teldat_cellsradio_test13}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=0
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] - snr: -1 dB - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] snr: -1 dB | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;0:0;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;0:0;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with critical-module-cellradio-snr option set to a 0
&{teldat_cellsradio_test14}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus=
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=0
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] snr: -1 dB - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: PHENIX] sim status: LOCKED [imsi: 208015606540916] [interface state: connect(9)] - snr: -1 dB - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] WARNING: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;0:0;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;0:0;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
# Test cellsradio mode with critical-status option set to '%{interfaceState} =~ /disconnect/'
&{teldat_cellsradio_test15}
... filtercellid=
... customperfdatainstances=
... unknownstatus=
... warningstatus=
... criticalstatus='\%{interfaceState} =~ /disconnect/'
... warningmodulescellradiodetected=
... criticalmodulescellradiodetected=
... warningmodulecellradiorsrp=
... criticalmodulecellradiorsrp=
... warningmodulecellradiorsrq=
... criticalmodulecellradiorsrq=
... warningmodulecellradiorscp=
... criticalmodulecellradiorscp=
... warningmodulecellradiocsq=
... criticalmodulecellradiocsq=
... warningmodulecellradiosnr=
... criticalmodulecellradiosnr=
... result=CRITICAL: cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: OK [imsi: 208015606540916] [interface state: disconnect(1)] - cellular radio module '359072066403821' [sim icc: 89330122115801091660, operator: N/A] sim status: DETECTING [imsi: 208015606540916] [interface state: disconnect(1)] | 'modules.cellradio.detected.count'=3;;;0; '359072066403821~N/A#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~N/A#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~N/A#module.cellradio.snr.db'=-1;;;0; '359072066403821~N/A#module.cellradio.csq.dbm'=-73;;;0; '359072066403821~PHENIX#module.cellradio.rsrp.dbm'=-114;;;0; '359072066403821~PHENIX#module.cellradio.rsrq.dbm'=-18;;;0; '359072066403821~PHENIX#module.cellradio.snr.db'=-1;;;0; '359072066403821~PHENIX#module.cellradio.csq.dbm'=-73;;;0;
@{teldat_cellsradio_tests}
... &{teldat_cellsradio_test1}
... &{teldat_cellsradio_test2}
... &{teldat_cellsradio_test3}
... &{teldat_cellsradio_test4}
... &{teldat_cellsradio_test5}
... &{teldat_cellsradio_test6}
... &{teldat_cellsradio_test7}
... &{teldat_cellsradio_test8}
... &{teldat_cellsradio_test9}
... &{teldat_cellsradio_test10}
... &{teldat_cellsradio_test11}
... &{teldat_cellsradio_test12}
... &{teldat_cellsradio_test13}
... &{teldat_cellsradio_test14}
... &{teldat_cellsradio_test15}
# Test simple usage of the CPU mode
&{teldat_cpu_test1}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=OK: cpu average usage: 1.00 % (5s), 1.00 % (1m), 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with warning-cpu-utilization-5s option set to a 0.5
&{teldat_cpu_test2}
... warningcpuutilization5s=0.5
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=WARNING: cpu average usage: 1.00 % (5s) | 'cpu.utilization.5s.percentage'=1.00%;0:0.5;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with critical-cpu-utilization-5s option set to a 0.5
&{teldat_cpu_test3}
... warningcpuutilization5s=
... criticalcpuutilization5s=0.5
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=CRITICAL: cpu average usage: 1.00 % (5s) | 'cpu.utilization.5s.percentage'=1.00%;;0:0.5;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with warning-cpu-utilization-1m option set to a 0.5
&{teldat_cpu_test4}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=0.5
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=WARNING: cpu average usage: 1.00 % (1m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;0:0.5;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with critical-cpu-utilization-1m option set to a 0.5
&{teldat_cpu_test5}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=0.5
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=CRITICAL: cpu average usage: 1.00 % (1m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;0:0.5;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with warning-cpu-utilization-5m option set to a 0.5
&{teldat_cpu_test6}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=0.5
... criticalcpuutilization5m=
... result=WARNING: cpu average usage: 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;0:0.5;;0;100
# Test CPU mode with critical-cpu-utilization-5m option set to a 0.5
&{teldat_cpu_test7}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=0.5
... result=CRITICAL: cpu average usage: 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;0:0.5;0;100
@{teldat_cpu_tests}
... &{teldat_cpu_test1}
... &{teldat_cpu_test2}
... &{teldat_cpu_test3}
... &{teldat_cpu_test4}
... &{teldat_cpu_test5}
... &{teldat_cpu_test6}
... &{teldat_cpu_test7}
# Test simple usage of the memory mode
&{teldat_memory_test1}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=OK: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with warning-usage option set to a 100
&{teldat_memory_test2}
... warningusage=100
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;0:100;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with critical-usage option set to a 100
&{teldat_memory_test3}
... warningusage=
... criticalusage=100
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;0:100;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with warning-usage-free option set to a 100
&{teldat_memory_test4}
... warningusage=
... criticalusage=
... warningusagefree=100
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;0:100;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with critical-usage-free option set to a 100
&{teldat_memory_test5}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=100
... warningusageprct=
... criticalusageprct=
... result=CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;0:100;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with warning-usage-prct option set to a 30
&{teldat_memory_test6}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=30
... criticalusageprct=
... result=WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;0:30;;0;100
# Test memory mode with critical-usage-prct option set to a 30
&{teldat_memory_test7}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=30
... result=CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;0:30;0;100
@{teldat_memory_tests}
... &{teldat_memory_test1}
... &{teldat_memory_test2}
... &{teldat_memory_test3}
... &{teldat_memory_test4}
... &{teldat_memory_test5}
... &{teldat_memory_test6}
... &{teldat_memory_test7}
*** Test Cases ***
Network Teldat SNMP cells radio
[Documentation] Network Teldat SNMP cells radio
[Tags] network teldat snmp
FOR ${teldat_cellsradio_test} IN @{teldat_cellsradio_tests}
${command} Catenate
... ${CMD}
... --mode=cells-radio
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
${length} Get Length ${teldat_cellsradio_test.filtercellid}
IF ${length} > 0
${command} Catenate ${command} --filter-cell-id=${teldat_cellsradio_test.filtercellid}
END
${length} Get Length ${teldat_cellsradio_test.customperfdatainstances}
IF ${length} > 0
${command} Catenate
... ${command}
... --custom-perfdata-instances=${teldat_cellsradio_test.customperfdatainstances}
END
${length} Get Length ${teldat_cellsradio_test.unknownstatus}
IF ${length} > 0
${command} Catenate ${command} --unknown-status=${teldat_cellsradio_test.unknownstatus}
END
${length} Get Length ${teldat_cellsradio_test.warningstatus}
IF ${length} > 0
${command} Catenate ${command} --warning-status=${teldat_cellsradio_test.warningstatus}
END
${length} Get Length ${teldat_cellsradio_test.criticalstatus}
IF ${length} > 0
${command} Catenate ${command} --critical-status=${teldat_cellsradio_test.criticalstatus}
END
${length} Get Length ${teldat_cellsradio_test.warningmodulescellradiodetected}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-modules-cellradio-detected=${teldat_cellsradio_test.warningmodulescellradiodetected}
END
${length} Get Length ${teldat_cellsradio_test.criticalmodulescellradiodetected}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-modules-cellradio-detected=${teldat_cellsradio_test.criticalmodulescellradiodetected}
END
${length} Get Length ${teldat_cellsradio_test.warningmodulecellradiorsrp}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-module-cellradio-rsrp=${teldat_cellsradio_test.warningmodulecellradiorsrp}
END
${length} Get Length ${teldat_cellsradio_test.criticalmodulecellradiorsrp}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-module-cellradio-rsrp=${teldat_cellsradio_test.criticalmodulecellradiorsrp}
END
${length} Get Length ${teldat_cellsradio_test.warningmodulecellradiorsrq}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-module-cellradio-rsrq=${teldat_cellsradio_test.warningmodulecellradiorsrq}
END
${length} Get Length ${teldat_cellsradio_test.criticalmodulecellradiorsrq}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-module-cellradio-rsrq=${teldat_cellsradio_test.criticalmodulecellradiorsrq}
END
${length} Get Length ${teldat_cellsradio_test.warningmodulecellradiorscp}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-module-cellradio-rscp=${teldat_cellsradio_test.warningmodulecellradiorscp}
END
${length} Get Length ${teldat_cellsradio_test.criticalmodulecellradiorscp}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-module-cellradio-rscp=${teldat_cellsradio_test.criticalmodulecellradiorscp}
END
${length} Get Length ${teldat_cellsradio_test.warningmodulecellradiocsq}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-module-cellradio-csq=${teldat_cellsradio_test.warningmodulecellradiocsq}
END
${length} Get Length ${teldat_cellsradio_test.criticalmodulecellradiocsq}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-module-cellradio-csq=${teldat_cellsradio_test.criticalmodulecellradiocsq}
END
${length} Get Length ${teldat_cellsradio_test.warningmodulecellradiosnr}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-module-cellradio-snr=${teldat_cellsradio_test.warningmodulecellradiosnr}
END
${length} Get Length ${teldat_cellsradio_test.criticalmodulecellradiosnr}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-module-cellradio-snr=${teldat_cellsradio_test.criticalmodulecellradiosnr}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${teldat_cellsradio_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${teldat_cellsradio_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
END
Network Teldat SNMP CPU
[Documentation] Network Teldat SNMP CPU
[Tags] network teldat snmp
FOR ${teldat_cpu_test} IN @{teldat_cpu_tests}
${command} Catenate
... ${CMD}
... --mode=cpu
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
${length} Get Length ${teldat_cpu_test.warningcpuutilization5s}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-cpu-utilization-5s=${teldat_cpu_test.warningcpuutilization5s}
END
${length} Get Length ${teldat_cpu_test.criticalcpuutilization5s}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-cpu-utilization-5s=${teldat_cpu_test.criticalcpuutilization5s}
END
${length} Get Length ${teldat_cpu_test.warningcpuutilization1m}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-cpu-utilization-1m=${teldat_cpu_test.warningcpuutilization1m}
END
${length} Get Length ${teldat_cpu_test.criticalcpuutilization1m}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-cpu-utilization-1m=${teldat_cpu_test.criticalcpuutilization1m}
END
${length} Get Length ${teldat_cpu_test.warningcpuutilization5m}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-cpu-utilization-5m=${teldat_cpu_test.warningcpuutilization5m}
END
${length} Get Length ${teldat_cpu_test.criticalcpuutilization5m}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-cpu-utilization-5m=${teldat_cpu_test.criticalcpuutilization5m}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${teldat_cpu_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${teldat_cpu_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
END
Network Teldat SNMP Memory
[Documentation] Network Teldat SNMP memory
[Tags] network teldat snmp
FOR ${teldat_memory_test} IN @{teldat_memory_tests}
${command} Catenate
... ${CMD}
... --mode=memory
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
${length} Get Length ${teldat_memory_test.warningusage}
IF ${length} > 0
${command} Catenate ${command} --warning-usage=${teldat_memory_test.warningusage}
END
${length} Get Length ${teldat_memory_test.criticalusage}
IF ${length} > 0
${command} Catenate ${command} --critical-usage=${teldat_memory_test.criticalusage}
END
${length} Get Length ${teldat_memory_test.warningusagefree}
IF ${length} > 0
${command} Catenate ${command} --warning-usage-free=${teldat_memory_test.warningusagefree}
END
${length} Get Length ${teldat_memory_test.criticalusagefree}
IF ${length} > 0
${command} Catenate ${command} --critical-usage-free=${teldat_memory_test.criticalusagefree}
END
${length} Get Length ${teldat_memory_test.warningusageprct}
IF ${length} > 0
${command} Catenate ${command} --warning-usage-prct=${teldat_memory_test.warningusageprct}
END
${length} Get Length ${teldat_memory_test.criticalusageprct}
IF ${length} > 0
${command} Catenate ${command} --critical-usage-prct=${teldat_memory_test.criticalusageprct}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${teldat_memory_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${teldat_memory_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
END

View File

@ -7,7 +7,7 @@ Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=os::linux::snmp::plugin
${CMD} ${CENTREON_PLUGINS} --plugin=os::linux::snmp::plugin
*** Test Cases ***
@ -17,9 +17,9 @@ List diskio ${tc}
${command} Catenate
... ${CMD}
... --mode=list-diskio
... --hostname=127.0.0.1
... --snmp-version=2
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --disco-show
... --snmp-community=${snmpcommunity}
${output} Run ${command}
@ -32,5 +32,5 @@ List diskio ${tc}
... Wrong output result for command:{\n}{\n}${command}{\n}{\n}Command output:{\n}{\n}${output}
Examples: tc snmpcommunity expected_result --
... 1 os/linux/snmp/list-diskio 10
... 2 os/linux/snmp/list-diskio-2 4
... 1 os/linux/snmp/list-diskio 10
... 2 os/linux/snmp/list-diskio-2 4

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS}
... --plugin=os::linux::snmp::plugin
... --mode=interfaces
... --hostname=127.0.0.1
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/linux/snmp/network-interfaces
... --statefile-dir=/tmp/cache/
@ -26,15 +26,10 @@ Interfaces by id ${tc}/5
... --interface='${filter}'
... ${extra_options}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc filter extra_options expected_result --
... 1 1 ${EMPTY} OK: Interface 'lo' Status : up (admin: up)
Examples: tc filter extra_options expected_result --
... 1 1 ${EMPTY} OK: Interface 'lo' Status : up (admin: up)
... 2 1,3 --add-traffic OK: All interfaces are ok
... 3 1,3 --add-traffic OK: All interfaces are ok | 'traffic_in_lo'=0.00b/s;;;0;10000000 'traffic_out_lo'=0.00b/s;;;0;10000000 'traffic_in_eth1'=0.00b/s;;;0;1000000000 'traffic_out_eth1'=0.00b/s;;;0;1000000000
... 4 2,3,4 --add-traffic OK: All interfaces are ok
@ -50,12 +45,7 @@ Interfaces by id regexp ${tc}/6
... --regex-id
... ${extra_options}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc filter extra_options expected_result --
... 1 ^1$ ${EMPTY} OK: Interface 'lo' Status : up (admin: up)

View File

@ -10,12 +10,12 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS}
... --plugin=os::windows::snmp::plugin
... --mode=service
... --hostname=127.0.0.1
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-port=${SNMPPORT}
*** Test Cases ***
Windows Services EN ${tc}/x
Windows Services EN ${tc}
[Documentation] Full ASCII
[Tags] os linux local
${command} Catenate
@ -24,12 +24,7 @@ Windows Services EN ${tc}/x
... --filter-name='${filter}'
... ${extra_option}
${output} Run ${command}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... \nWrong output result for command:\n${command}\n\nExpected:\n${expected_result}\nCommand output:\n${output}\n\n
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc filter extra_option expected_result --
... 1 ${EMPTY} ${EMPTY} OK: All services are ok | 'services.total.count'=168;;;0; 'services.active.count'=168;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;

View File

@ -11,50 +11,53 @@ Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}storage-datacore-api.json
${CMD} ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=3000 --hostname=127.0.0.1 --proto=http
${CMD} ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=${APIPORT} --hostname=${HOSTNAME} --proto=http
*** Test Cases ***
Datacore check pool usage
[Documentation] Check Datacore pool usage
[Tags] storage api
${output} Run
... ${CMD} --mode=pool-usage --critical-oversubscribed=${critical-oversubscribed} --warning-oversubscribed=${warning-oversubscribed} --warning-bytesallocatedpercentage=${warning-bytesallocatedpercentage} --critical-bytesallocatedpercentage=${critical-bytesallocatedpercentage} --pool-id=B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:{4dec1b5a-2577-11e5-80c3-00155d651622}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${result}
... Wrong output result for pool usage :\n\n ${output} \n\n ${result}\n\n
${command} Catenate
... ${CMD}
... --mode=pool-usage
... --critical-oversubscribed=${critical-oversubscribed}
... --warning-oversubscribed=${warning-oversubscribed}
... --warning-bytesallocatedpercentage=${warning-bytesallocatedpercentage}
... --critical-bytesallocatedpercentage=${critical-bytesallocatedpercentage}
... --pool-id=B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:{4dec1b5a-2577-11e5-80c3-00155d651622}
Examples: warning-bytesallocatedpercentage critical-bytesallocatedpercentage warning-oversubscribed critical-oversubscribed result --
... 2 5 -1 3 CRITICAL: Bytes Allocated : 12 % WARNING: Over subscribed bytes : 0 | 'datacore.pool.bytesallocated.percentage'=12%;0:2;0:5;0;100 'datacore.pool.oversubscribed.bytes'=0bytes;0:-1;0:3;0;
... 70 80 10 20 OK: Bytes Allocated : 12 % - Over subscribed bytes : 0 | 'datacore.pool.bytesallocated.percentage'=12%;0:70;0:80;0;100 'datacore.pool.oversubscribed.bytes'=0bytes;0:10;0:20;0;
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: warning-bytesallocatedpercentage critical-bytesallocatedpercentage warning-oversubscribed critical-oversubscribed expected_result --
... 2 5 -1 3 CRITICAL: Bytes Allocated : 12 % WARNING: Over subscribed bytes : 0 | 'datacore.pool.bytesallocated.percentage'=12%;0:2;0:5;0;100 'datacore.pool.oversubscribed.bytes'=0bytes;0:-1;0:3;0;
... 70 80 10 20 OK: Bytes Allocated : 12 % - Over subscribed bytes : 0 | 'datacore.pool.bytesallocated.percentage'=12%;0:70;0:80;0;100 'datacore.pool.oversubscribed.bytes'=0bytes;0:10;0:20;0;
Datacore check alert count
[Documentation] Check Datacore pool usage
[Tags] storage api
${output} Run
... ${CMD} --mode=alerts --warning-error=${warning-error} --critical-error=${critical-error} --warning-warning=${warning-warning} --critical-warning=${critical-warning}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${result}
... Wrong output result for alert count :\n\n ${output} \n\n ${result}\n\n
${command} Catenate
... ${CMD}
... --mode=alerts
... --warning-error=${warning-error}
... --critical-error=${critical-error}
... --warning-warning=${warning-warning}
... --critical-warning=${critical-warning}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: warning-error critical-error warning-warning critical-warning result --
... 0 1 5 5 WARNING: number of error alerts : 1 | 'datacore.event.error.count'=1;0:0;0:1;0; 'datacore.alerts.warning.count'=1;0:5;0:5;0; 'datacore.alerts.info.count'=0;;;0; 'datacore.alerts.trace.count'=0;;;0;
... 5 5 5 5 OK: number of error alerts : 1, number of warning alerts : 1, number of info alerts : 0, number of trace alerts : 0 | 'datacore.event.error.count'=1;0:5;0:5;0; 'datacore.alerts.warning.count'=1;0:5;0:5;0; 'datacore.alerts.info.count'=0;;;0; 'datacore.alerts.trace.count'=0;;;0;
Examples: warning-error critical-error warning-warning critical-warning expected_result --
... 0 1 5 5 WARNING: number of error alerts : 1 | 'datacore.event.error.count'=1;0:0;0:1;0; 'datacore.alerts.warning.count'=1;0:5;0:5;0; 'datacore.alerts.info.count'=0;;;0; 'datacore.alerts.trace.count'=0;;;0;
... 5 5 5 5 OK: number of error alerts : 1, number of warning alerts : 1, number of info alerts : 0, number of trace alerts : 0 | 'datacore.event.error.count'=1;0:5;0:5;0; 'datacore.alerts.warning.count'=1;0:5;0:5;0; 'datacore.alerts.info.count'=0;;;0; 'datacore.alerts.trace.count'=0;;;0;
Datacore check status monitor
[Documentation] Check Datacore pool usage
[Tags] storage api
${output} Run
... ${CMD} --mode=status-monitor
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${result}
... Wrong output result for status monitor :\n${output} \nresult:\n${result}\n\n
${command} Catenate
... ${CMD}
... --mode=status-monitor
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: result --
... CRITICAL: 'State of HostVM2' status : 'Critical', message is 'Connected'
Examples: expected_result --
... CRITICAL: 'State of HostVM2' status : 'Critical', message is 'Connected'

View File

@ -0,0 +1,54 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=capacity
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Capacity ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 --filter-type=allCapacity OK: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%), unavailable: 0.00 B, failed: 0.00 B - compaction: 1.66, deduplication: 1.02, compression: 1.37, data reduction: 1.37, overprovisioning: 0.45 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 2 --filter-type=FCCapacity OK: storage 'FCCapacity' space usage total: 104.72 TB used: 25.69 TB (24.53%) free: 79.03 TB (75.47%), unavailable: 0.00 B, failed: 0.00 B - compaction: 1.98, deduplication: 0, data reduction: 0, overprovisioning: 0.39 | 'FCCapacity#storage.space.usage.bytes'=28242631196672B;;;0;115139483271168 'FCCapacity#storage.space.free.bytes'=86896852074496B;;;0;115139483271168 'FCCapacity#storage.space.usage.percentage'=24.53%;;;0;100 'FCCapacity#storage.space.unavailable.bytes'=0B;;;0; 'FCCapacity#storage.space.failed.bytes'=0B;;;0; 'FCCapacity#storage.space.compaction.ratio.count'=1.98;;;0; 'FCCapacity#storage.space.deduplication.ratio.count'=0;;;0; 'FCCapacity#storage.space.data_reduction.ratio.count'=0;;;0; 'FCCapacity#storage.space.overprovisioning.ratio.count'=0.39;;;0;
... 3 --filter-type=SSDCapacity OK: storage 'SSDCapacity' space usage total: 24.43 TB used: 10.23 TB (41.88%) free: 14.20 TB (58.12%), unavailable: 0.00 B, failed: 0.00 B - compaction: 2.12, deduplication: 1.02, compression: 1.37, data reduction: 1.37, overprovisioning: 0.54 | 'SSDCapacity#storage.space.usage.bytes'=11250666831872B;;;0;26862872952832 'SSDCapacity#storage.space.free.bytes'=15612206120960B;;;0;26862872952832 'SSDCapacity#storage.space.usage.percentage'=41.88%;;;0;100 'SSDCapacity#storage.space.unavailable.bytes'=0B;;;0; 'SSDCapacity#storage.space.failed.bytes'=0B;;;0; 'SSDCapacity#storage.space.compaction.ratio.count'=2.12;;;0; 'SSDCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'SSDCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'SSDCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'SSDCapacity#storage.space.overprovisioning.ratio.count'=0.54;;;0;
... 4 --filter-type=NLCapacity OK: storage 'NLCapacity' space usage total: 249.45 TB used: 91.19 TB (36.55%) free: 158.27 TB (63.45%), unavailable: 0.00 B, failed: 0.00 B - compaction: 1.51, deduplication: 0, data reduction: 0, overprovisioning: 0.47 | 'NLCapacity#storage.space.usage.bytes'=100261716557824B;;;0;274276611522560 'NLCapacity#storage.space.free.bytes'=174014894964736B;;;0;274276611522560 'NLCapacity#storage.space.usage.percentage'=36.55%;;;0;100 'NLCapacity#storage.space.unavailable.bytes'=0B;;;0; 'NLCapacity#storage.space.failed.bytes'=0B;;;0; 'NLCapacity#storage.space.compaction.ratio.count'=1.51;;;0; 'NLCapacity#storage.space.deduplication.ratio.count'=0;;;0; 'NLCapacity#storage.space.data_reduction.ratio.count'=0;;;0; 'NLCapacity#storage.space.overprovisioning.ratio.count'=0.47;;;0;
... 5 --filter-type=allCapacity --warning-compaction=2: WARNING: storage 'allCapacity' compaction: 1.66 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;2:;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 6 --filter-type=allCapacity --critical-deduplication=2: CRITICAL: storage 'allCapacity' deduplication: 1.02 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;2:;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 7 --filter-type=allCapacity --warning-data-reduction=2: WARNING: storage 'allCapacity' data reduction: 1.37 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;2:;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 8 --filter-type=allCapacity --critical-overprovisioning=20 OK: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%), unavailable: 0.00 B, failed: 0.00 B - compaction: 1.66, deduplication: 1.02, compression: 1.37, data reduction: 1.37, overprovisioning: 0.45 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;0:20;0;
... 9 --critical-deduplication=2: CRITICAL: storage 'FCCapacity' deduplication: 0 - storage 'NLCapacity' deduplication: 0 - storage 'SSDCapacity' deduplication: 1.02 - storage 'allCapacity' deduplication: 1.02 | 'FCCapacity#storage.space.usage.bytes'=28242631196672B;;;0;115139483271168 'FCCapacity#storage.space.free.bytes'=86896852074496B;;;0;115139483271168 'FCCapacity#storage.space.usage.percentage'=24.53%;;;0;100 'FCCapacity#storage.space.unavailable.bytes'=0B;;;0; 'FCCapacity#storage.space.failed.bytes'=0B;;;0; 'FCCapacity#storage.space.compaction.ratio.count'=1.98;;;0; 'FCCapacity#storage.space.deduplication.ratio.count'=0;;2:;0; 'FCCapacity#storage.space.data_reduction.ratio.count'=0;;;0; 'FCCapacity#storage.space.overprovisioning.ratio.count'=0.39;;;0; 'NLCapacity#storage.space.usage.bytes'=100261716557824B;;;0;274276611522560 'NLCapacity#storage.space.free.bytes'=174014894964736B;;;0;274276611522560 'NLCapacity#storage.space.usage.percentage'=36.55%;;;0;100 'NLCapacity#storage.space.unavailable.bytes'=0B;;;0; 'NLCapacity#storage.space.failed.bytes'=0B;;;0; 'NLCapacity#storage.space.compaction.ratio.count'=1.51;;;0; 'NLCapacity#storage.space.deduplication.ratio.count'=0;;2:;0; 'NLCapacity#storage.space.data_reduction.ratio.count'=0;;;0; 'NLCapacity#storage.space.overprovisioning.ratio.count'=0.47;;;0; 'SSDCapacity#storage.space.usage.bytes'=11250666831872B;;;0;26862872952832 'SSDCapacity#storage.space.free.bytes'=15612206120960B;;;0;26862872952832 'SSDCapacity#storage.space.usage.percentage'=41.88%;;;0;100 'SSDCapacity#storage.space.unavailable.bytes'=0B;;;0; 'SSDCapacity#storage.space.failed.bytes'=0B;;;0; 'SSDCapacity#storage.space.compaction.ratio.count'=2.12;;;0; 'SSDCapacity#storage.space.deduplication.ratio.count'=1.02;;2:;0; 'SSDCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'SSDCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'SSDCapacity#storage.space.overprovisioning.ratio.count'=0.54;;;0; 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;2:;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 10 --filter-type=allCapacity --warning-space-usage=180 WARNING: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%) | 'allCapacity#storage.space.usage.bytes'=139755014586368B;0:180;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 11 --filter-type=allCapacity --critical-space-usage-free=180 CRITICAL: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%) | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;0:180;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 12 --filter-type=allCapacity --warning-space-usage-prct=20 WARNING: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%) | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;0:20;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 13 --filter-type=allCapacity --critical-space-unavailable=20 OK: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%), unavailable: 0.00 B, failed: 0.00 B - compaction: 1.66, deduplication: 1.02, compression: 1.37, data reduction: 1.37, overprovisioning: 0.45 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;0:20;0; 'allCapacity#storage.space.failed.bytes'=0B;;;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;
... 14 --filter-type=allCapacity --critical-space-failed=20 OK: storage 'allCapacity' space usage total: 378.60 TB used: 127.11 TB (33.57%) free: 251.50 TB (66.43%), unavailable: 0.00 B, failed: 0.00 B - compaction: 1.66, deduplication: 1.02, compression: 1.37, data reduction: 1.37, overprovisioning: 0.45 | 'allCapacity#storage.space.usage.bytes'=139755014586368B;;;0;416278967746560 'allCapacity#storage.space.free.bytes'=276523953160192B;;;0;416278967746560 'allCapacity#storage.space.usage.percentage'=33.57%;;;0;100 'allCapacity#storage.space.unavailable.bytes'=0B;;;0; 'allCapacity#storage.space.failed.bytes'=0B;;0:20;0; 'allCapacity#storage.space.compaction.ratio.count'=1.66;;;0; 'allCapacity#storage.space.deduplication.ratio.count'=1.02;;;0; 'allCapacity#storage.space.compression.ratio.count'=1.37;;;0; 'allCapacity#storage.space.data_reduction.ratio.count'=1.37;;;0; 'allCapacity#storage.space.overprovisioning.ratio.count'=0.45;;;0;

View File

@ -0,0 +1,49 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode disk-status
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Diskstatus ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 ${EMPTY} CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82
... 2 --critical-status='' WARNING: Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82
... 3 --warning-status='' CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82
... 4 --warning-disks-new=0 CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disks new: 2 - Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;0:0;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82
... 5 --warning-disks-total=83:83 CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disks total: 82 - Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;83:83;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82
... 6 --critical-disks-failed=0 CRITICAL: Disks failed: 1 - Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;0:0;0;82 'disks.unknown.count'=1;;;0;82
... 7 --warning-disks-degraded=0 CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disks degraded: 1 - Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;0:0;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82
... 8 --warning-disks-unknown=0 CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disks unknown: 1 - Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;0:0;;0;82
... 9 --warning-disks-normal=82:82 CRITICAL: Disk #73 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SWLT) located 7:5:0 is failed WARNING: Disks normal: 77 - Disk #75 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4SSKT) located 8:1:0 is unknown - Disk #78 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4TLLT) located 8:4:0 is new - Disk #79 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N1TT) located 8:5:0 is new - Disk #81 (WDC/WLEB14T0S5xeF7.2, serial: 9MJ4N8UT) located 8:7:0 is degraded | 'disks.total.count'=82;;;0; 'disks.normal.count'=77;82:82;;0;82 'disks.degraded.count'=1;;;0;82 'disks.new.count'=2;;;0;82 'disks.failed.count'=1;;;0;82 'disks.unknown.count'=1;;;0;82

View File

@ -0,0 +1,53 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=disk-usage
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Disk Usage ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 --filter-manufacturer=SAMSUNG --filter-counters='^usage$' OK: All disks are ok | '0#disk.space.usage.bytes'=652835028992B;;;0;1918776639488 '1#disk.space.usage.bytes'=651761287168B;;;0;1918776639488 '14#disk.space.usage.bytes'=1006096089088B;;;0;1918776639488 '15#disk.space.usage.bytes'=1006096089088B;;;0;1918776639488 '2#disk.space.usage.bytes'=652835028992B;;;0;1918776639488 '26#disk.space.usage.bytes'=1006096089088B;;;0;1918776639488 '27#disk.space.usage.bytes'=1006096089088B;;;0;1918776639488 '3#disk.space.usage.bytes'=651761287168B;;;0;1918776639488 '38#disk.space.usage.bytes'=651761287168B;;;0;1918776639488 '39#disk.space.usage.bytes'=650687545344B;;;0;1918776639488 '40#disk.space.usage.bytes'=651761287168B;;;0;1918776639488 '41#disk.space.usage.bytes'=650687545344B;;;0;1918776639488 '50#disk.space.usage.bytes'=1006096089088B;;;0;1918776639488 '51#disk.space.usage.bytes'=1006096089088B;;;0;1918776639488
... 2 --filter-manufacturer=SAMSUNG --filter-counters='^usage-free$' OK: All disks are ok | '0#disk.space.free.bytes'=652835028992B;;;0;1918776639488 '1#disk.space.free.bytes'=651761287168B;;;0;1918776639488 '14#disk.space.free.bytes'=1006096089088B;;;0;1918776639488 '15#disk.space.free.bytes'=1006096089088B;;;0;1918776639488 '2#disk.space.free.bytes'=652835028992B;;;0;1918776639488 '26#disk.space.free.bytes'=1006096089088B;;;0;1918776639488 '27#disk.space.free.bytes'=1006096089088B;;;0;1918776639488 '3#disk.space.free.bytes'=651761287168B;;;0;1918776639488 '38#disk.space.free.bytes'=651761287168B;;;0;1918776639488 '39#disk.space.free.bytes'=650687545344B;;;0;1918776639488 '40#disk.space.free.bytes'=651761287168B;;;0;1918776639488 '41#disk.space.free.bytes'=650687545344B;;;0;1918776639488 '50#disk.space.free.bytes'=1006096089088B;;;0;1918776639488 '51#disk.space.free.bytes'=1006096089088B;;;0;1918776639488
... 3 --filter-manufacturer=SAMSUNG --filter-counters='^usage-prct$' OK: All disks are ok | '0#disk.space.usage.percentage'=34.02%;;;0;100 '1#disk.space.usage.percentage'=33.97%;;;0;100 '14#disk.space.usage.percentage'=52.43%;;;0;100 '15#disk.space.usage.percentage'=52.43%;;;0;100 '2#disk.space.usage.percentage'=34.02%;;;0;100 '26#disk.space.usage.percentage'=52.43%;;;0;100 '27#disk.space.usage.percentage'=52.43%;;;0;100 '3#disk.space.usage.percentage'=33.97%;;;0;100 '38#disk.space.usage.percentage'=33.97%;;;0;100 '39#disk.space.usage.percentage'=33.91%;;;0;100 '40#disk.space.usage.percentage'=33.97%;;;0;100 '41#disk.space.usage.percentage'=33.91%;;;0;100 '50#disk.space.usage.percentage'=52.43%;;;0;100 '51#disk.space.usage.percentage'=52.43%;;;0;100
... 4 --filter-manufacturer=SAMSUNG --filter-counters='total' OK: Total Used: 10.23 TB / 24.43 TB, Total percentage used: 41.88 %, Total Free: 14.20 TB | 'disks.total.space.usage.bytes'=11250666831872;;;0;26862872952832 'disks.total.space.usage.percent'=41.8818450715485;;;0;100 'disks.total.space.free.bytes'=15612206120960;;;0;26862872952832
... 5 --filter-manufacturer=SAMSUNG --filter-counters='total' --warning-total-usage=5 WARNING: Total Used: 10.23 TB / 24.43 TB | 'disks.total.space.usage.bytes'=11250666831872;0:5;;0;26862872952832 'disks.total.space.usage.percent'=41.8818450715485;;;0;100 'disks.total.space.free.bytes'=15612206120960;;;0;26862872952832
... 6 --filter-manufacturer=SAMSUNG --filter-counters='total' --critical-total-usage=5 CRITICAL: Total Used: 10.23 TB / 24.43 TB | 'disks.total.space.usage.bytes'=11250666831872;;0:5;0;26862872952832 'disks.total.space.usage.percent'=41.8818450715485;;;0;100 'disks.total.space.free.bytes'=15612206120960;;;0;26862872952832
... 7 --filter-manufacturer=SAMSUNG --filter-counters='total' --warning-total-usage-prct=35 WARNING: Total percentage used: 41.88 % | 'disks.total.space.usage.bytes'=11250666831872;;;0;26862872952832 'disks.total.space.usage.percent'=41.8818450715485;0:35;;0;100 'disks.total.space.free.bytes'=15612206120960;;;0;26862872952832
... 8 --filter-manufacturer=SAMSUNG --filter-counters='total' --critical-total-usage-prct=35 CRITICAL: Total percentage used: 41.88 % | 'disks.total.space.usage.bytes'=11250666831872;;;0;26862872952832 'disks.total.space.usage.percent'=41.8818450715485;;0:35;0;100 'disks.total.space.free.bytes'=15612206120960;;;0;26862872952832
... 9 --filter-manufacturer=SAMSUNG --filter-counters='^usage$' --warning-usage=1000000000000 WARNING: Disk #14 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600288) located 2:0:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #15 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600290) located 2:1:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #26 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600289) located 3:0:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #27 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600293) located 3:1:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #50 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600297) located 5:0:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #51 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600287) located 5:1:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) | '0#disk.space.usage.bytes'=652835028992B;0:1000000000000;;0;1918776639488 '1#disk.space.usage.bytes'=651761287168B;0:1000000000000;;0;1918776639488 '14#disk.space.usage.bytes'=1006096089088B;0:1000000000000;;0;1918776639488 '15#disk.space.usage.bytes'=1006096089088B;0:1000000000000;;0;1918776639488 '2#disk.space.usage.bytes'=652835028992B;0:1000000000000;;0;1918776639488 '26#disk.space.usage.bytes'=1006096089088B;0:1000000000000;;0;1918776639488 '27#disk.space.usage.bytes'=1006096089088B;0:1000000000000;;0;1918776639488 '3#disk.space.usage.bytes'=651761287168B;0:1000000000000;;0;1918776639488 '38#disk.space.usage.bytes'=651761287168B;0:1000000000000;;0;1918776639488 '39#disk.space.usage.bytes'=650687545344B;0:1000000000000;;0;1918776639488 '40#disk.space.usage.bytes'=651761287168B;0:1000000000000;;0;1918776639488 '41#disk.space.usage.bytes'=650687545344B;0:1000000000000;;0;1918776639488 '50#disk.space.usage.bytes'=1006096089088B;0:1000000000000;;0;1918776639488 '51#disk.space.usage.bytes'=1006096089088B;0:1000000000000;;0;1918776639488
... 10 --filter-manufacturer=SAMSUNG --filter-counters='^usage$' --critical-usage=1000000000000 CRITICAL: Disk #14 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600288) located 2:0:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #15 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600290) located 2:1:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #26 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600289) located 3:0:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #27 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600293) located 3:1:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #50 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600297) located 5:0:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) - Disk #51 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600287) located 5:1:0 has Used: 937.00 GB of 1.75 TB (52.43%) Free: 850.00 GB (47.57%) | '0#disk.space.usage.bytes'=652835028992B;;0:1000000000000;0;1918776639488 '1#disk.space.usage.bytes'=651761287168B;;0:1000000000000;0;1918776639488 '14#disk.space.usage.bytes'=1006096089088B;;0:1000000000000;0;1918776639488 '15#disk.space.usage.bytes'=1006096089088B;;0:1000000000000;0;1918776639488 '2#disk.space.usage.bytes'=652835028992B;;0:1000000000000;0;1918776639488 '26#disk.space.usage.bytes'=1006096089088B;;0:1000000000000;0;1918776639488 '27#disk.space.usage.bytes'=1006096089088B;;0:1000000000000;0;1918776639488 '3#disk.space.usage.bytes'=651761287168B;;0:1000000000000;0;1918776639488 '38#disk.space.usage.bytes'=651761287168B;;0:1000000000000;0;1918776639488 '39#disk.space.usage.bytes'=650687545344B;;0:1000000000000;0;1918776639488 '40#disk.space.usage.bytes'=651761287168B;;0:1000000000000;0;1918776639488 '41#disk.space.usage.bytes'=650687545344B;;0:1000000000000;0;1918776639488 '50#disk.space.usage.bytes'=1006096089088B;;0:1000000000000;0;1918776639488 '51#disk.space.usage.bytes'=1006096089088B;;0:1000000000000;0;1918776639488
... 11 --filter-manufacturer=SAMSUNG --filter-counters='^usage-prct$' --warning-usage-prct=35 WARNING: Disk #14 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600288) located 2:0:0 has Used : 52.43 % - Disk #15 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600290) located 2:1:0 has Used : 52.43 % - Disk #26 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600289) located 3:0:0 has Used : 52.43 % - Disk #27 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600293) located 3:1:0 has Used : 52.43 % - Disk #50 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600297) located 5:0:0 has Used : 52.43 % - Disk #51 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600287) located 5:1:0 has Used : 52.43 % | '0#disk.space.usage.percentage'=34.02%;0:35;;0;100 '1#disk.space.usage.percentage'=33.97%;0:35;;0;100 '14#disk.space.usage.percentage'=52.43%;0:35;;0;100 '15#disk.space.usage.percentage'=52.43%;0:35;;0;100 '2#disk.space.usage.percentage'=34.02%;0:35;;0;100 '26#disk.space.usage.percentage'=52.43%;0:35;;0;100 '27#disk.space.usage.percentage'=52.43%;0:35;;0;100 '3#disk.space.usage.percentage'=33.97%;0:35;;0;100 '38#disk.space.usage.percentage'=33.97%;0:35;;0;100 '39#disk.space.usage.percentage'=33.91%;0:35;;0;100 '40#disk.space.usage.percentage'=33.97%;0:35;;0;100 '41#disk.space.usage.percentage'=33.91%;0:35;;0;100 '50#disk.space.usage.percentage'=52.43%;0:35;;0;100 '51#disk.space.usage.percentage'=52.43%;0:35;;0;100
... 12 --filter-manufacturer=SAMSUNG --filter-counters='^usage-prct$' --critical-usage-prct=35 CRITICAL: Disk #14 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600288) located 2:0:0 has Used : 52.43 % - Disk #15 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600290) located 2:1:0 has Used : 52.43 % - Disk #26 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600289) located 3:0:0 has Used : 52.43 % - Disk #27 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600293) located 3:1:0 has Used : 52.43 % - Disk #50 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600297) located 5:0:0 has Used : 52.43 % - Disk #51 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600287) located 5:1:0 has Used : 52.43 % | '0#disk.space.usage.percentage'=34.02%;;0:35;0;100 '1#disk.space.usage.percentage'=33.97%;;0:35;0;100 '14#disk.space.usage.percentage'=52.43%;;0:35;0;100 '15#disk.space.usage.percentage'=52.43%;;0:35;0;100 '2#disk.space.usage.percentage'=34.02%;;0:35;0;100 '26#disk.space.usage.percentage'=52.43%;;0:35;0;100 '27#disk.space.usage.percentage'=52.43%;;0:35;0;100 '3#disk.space.usage.percentage'=33.97%;;0:35;0;100 '38#disk.space.usage.percentage'=33.97%;;0:35;0;100 '39#disk.space.usage.percentage'=33.91%;;0:35;0;100 '40#disk.space.usage.percentage'=33.97%;;0:35;0;100 '41#disk.space.usage.percentage'=33.91%;;0:35;0;100 '50#disk.space.usage.percentage'=52.43%;;0:35;0;100 '51#disk.space.usage.percentage'=52.43%;;0:35;0;100
... 13 --filter-manufacturer=SAMSUNG --filter-counters='^usage-free$' --warning-usage-free=1000000000000: WARNING: Disk #0 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600283) located 0:0:0 has Used: 608.00 GB of 1.75 TB (34.02%) Free: 1.15 TB (65.98%) - Disk #1 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600286) located 0:1:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #2 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600197) located 0:2:0 has Used: 608.00 GB of 1.75 TB (34.02%) Free: 1.15 TB (65.98%) - Disk #3 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600285) located 0:3:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #38 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600303) located 4:0:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #39 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600302) located 4:1:0 has Used: 606.00 GB of 1.75 TB (33.91%) Free: 1.15 TB (66.09%) - Disk #40 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600296) located 4:2:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #41 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600291) located 4:3:0 has Used: 606.00 GB of 1.75 TB (33.91%) Free: 1.15 TB (66.09%) | '0#disk.space.free.bytes'=652835028992B;1000000000000:;;0;1918776639488 '1#disk.space.free.bytes'=651761287168B;1000000000000:;;0;1918776639488 '14#disk.space.free.bytes'=1006096089088B;1000000000000:;;0;1918776639488 '15#disk.space.free.bytes'=1006096089088B;1000000000000:;;0;1918776639488 '2#disk.space.free.bytes'=652835028992B;1000000000000:;;0;1918776639488 '26#disk.space.free.bytes'=1006096089088B;1000000000000:;;0;1918776639488 '27#disk.space.free.bytes'=1006096089088B;1000000000000:;;0;1918776639488 '3#disk.space.free.bytes'=651761287168B;1000000000000:;;0;1918776639488 '38#disk.space.free.bytes'=651761287168B;1000000000000:;;0;1918776639488 '39#disk.space.free.bytes'=650687545344B;1000000000000:;;0;1918776639488 '40#disk.space.free.bytes'=651761287168B;1000000000000:;;0;1918776639488 '41#disk.space.free.bytes'=650687545344B;1000000000000:;;0;1918776639488 '50#disk.space.free.bytes'=1006096089088B;1000000000000:;;0;1918776639488 '51#disk.space.free.bytes'=1006096089088B;1000000000000:;;0;1918776639488
... 14 --filter-manufacturer=SAMSUNG --filter-counters='^usage-free$' --critical-usage-free=1000000000000: CRITICAL: Disk #0 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600283) located 0:0:0 has Used: 608.00 GB of 1.75 TB (34.02%) Free: 1.15 TB (65.98%) - Disk #1 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600286) located 0:1:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #2 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600197) located 0:2:0 has Used: 608.00 GB of 1.75 TB (34.02%) Free: 1.15 TB (65.98%) - Disk #3 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600285) located 0:3:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #38 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600303) located 4:0:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #39 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600302) located 4:1:0 has Used: 606.00 GB of 1.75 TB (33.91%) Free: 1.15 TB (66.09%) - Disk #40 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600296) located 4:2:0 has Used: 607.00 GB of 1.75 TB (33.97%) Free: 1.15 TB (66.03%) - Disk #41 (SAMSUNG/ARFA1920S5xnFTRI, serial: 0T600291) located 4:3:0 has Used: 606.00 GB of 1.75 TB (33.91%) Free: 1.15 TB (66.09%) | '0#disk.space.free.bytes'=652835028992B;;1000000000000:;0;1918776639488 '1#disk.space.free.bytes'=651761287168B;;1000000000000:;0;1918776639488 '14#disk.space.free.bytes'=1006096089088B;;1000000000000:;0;1918776639488 '15#disk.space.free.bytes'=1006096089088B;;1000000000000:;0;1918776639488 '2#disk.space.free.bytes'=652835028992B;;1000000000000:;0;1918776639488 '26#disk.space.free.bytes'=1006096089088B;;1000000000000:;0;1918776639488 '27#disk.space.free.bytes'=1006096089088B;;1000000000000:;0;1918776639488 '3#disk.space.free.bytes'=651761287168B;;1000000000000:;0;1918776639488 '38#disk.space.free.bytes'=651761287168B;;1000000000000:;0;1918776639488 '39#disk.space.free.bytes'=650687545344B;;1000000000000:;0;1918776639488 '40#disk.space.free.bytes'=651761287168B;;1000000000000:;0;1918776639488 '41#disk.space.free.bytes'=650687545344B;;1000000000000:;0;1918776639488 '50#disk.space.free.bytes'=1006096089088B;;1000000000000:;0;1918776639488 '51#disk.space.free.bytes'=1006096089088B;;1000000000000:;0;1918776639488

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=licenses
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Licenses ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions}
${output} Strip String ${output}
Should Match Regexp
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
Examples: tc extraoptions expected_result --
... 1 ${EMPTY} OK: Number of licenses: 25, Number of expired licenses: 1 - All licenses are ok \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;;;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;;;0;
... 2 --critical-license-expiration=86400: CRITICAL: License 'Adaptive Flash Cache' expires: 2024-07-14. Adaptive Flash Cache license has expired. \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;;86400:;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;;86400:;0;
... 3 --warning-license-expiration=86400: WARNING: License 'Adaptive Flash Cache' expires: 2024-07-14. Adaptive Flash Cache license has expired. \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;86400:;;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;86400:;;0;
... 4 --warning-expired=0:0 WARNING: Number of expired licenses: 1 \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;0:0;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;;;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;;;0;
... 5 --critical-license-expiration=86400: --warning-license-expiration=1296000: CRITICAL: License 'Adaptive Flash Cache' expires: 2024-07-14. Adaptive Flash Cache license has expired. \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;1296000:;86400:;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;1296000:;86400:;0;
... 6 --critical-license-expiration=86400: --warning-license-expiration=86400: CRITICAL: License 'Adaptive Flash Cache' expires: 2024-07-14. Adaptive Flash Cache license has expired. \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;86400:;86400:;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;86400:;86400:;0;
... 7 --critical-license-expiration=86400: --warning-license-expiration=1296000: --warning-expired=0:0 CRITICAL: License 'Adaptive Flash Cache' expires: 2024-07-14. Adaptive Flash Cache license has expired. WARNING: Number of expired licenses: 1 \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;0:0;;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;1296000:;86400:;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;1296000:;86400:;0;
... 8 --critical-expired=0:0 CRITICAL: Number of expired licenses: 1 \| 'licenses.total.count'=25;;;0; 'licenses.expired.count'=1;;0:0;0;25 'Adaptive Flash Cache#Adaptive Flash Cache#license.expiration.seconds'=0s;;;0; 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;;;0;
... 9 --filter-name='Autonomic Rebalance' OK: Number of licenses: 1, Number of expired licenses: 0 - License 'Autonomic Rebalance' expires: 2284-05-21. Autonomic Rebalance license expires in .*. \| 'licenses.total.count'=1;;;0; 'licenses.expired.count'=0;;;0;1 'Autonomic Rebalance#Autonomic Rebalance#license.expiration.seconds'=[0-9]+s;;;0;

View File

@ -0,0 +1,44 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=list-disks
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
...
*** Test Cases ***
List-Disks ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions} | wc -l
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 ${EMPTY} 83
... 2 --disco-show 85
... 3 --disco-format 9

View File

@ -0,0 +1,44 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=list-volumes
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
...
*** Test Cases ***
List-Volumes ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions} | wc -l
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 ${EMPTY} 18
... 2 --disco-show 20
... 3 --disco-format 7

View File

@ -0,0 +1,44 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=nodes
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Nodes ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 ${EMPTY} WARNING: node 0 is offline | 'nodes.total.count'=2;;;0; 'nodes.online.count'=1;;;0;2 'nodes.offline.count'=1;;;0;2
... 2 --warning-node-status='${PERCENT}\\{status\\} ne "offline"' WARNING: node 1 is online | 'nodes.total.count'=2;;;0; 'nodes.online.count'=1;;;0;2 'nodes.offline.count'=1;;;0;2
... 3 --warning-online=2:2 WARNING: Number of online nodes: 1 - node 0 is offline | 'nodes.total.count'=2;;;0; 'nodes.online.count'=1;2:2;;0;2 'nodes.offline.count'=1;;;0;2
... 4 --critical-online=2:2 CRITICAL: Number of online nodes: 1 WARNING: node 0 is offline | 'nodes.total.count'=2;;;0; 'nodes.online.count'=1;;2:2;0;2 'nodes.offline.count'=1;;;0;2
... 5 --critical-offline=0:0 CRITICAL: Number of offline nodes: 1 WARNING: node 0 is offline | 'nodes.total.count'=2;;;0; 'nodes.online.count'=1;;;0;2 'nodes.offline.count'=1;;0:0;0;2

View File

@ -0,0 +1,52 @@
*** Settings ***
Documentation HPE Primera Storage REST API
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s
*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}hpe-primera.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=storage::hp::primera::restapi::plugin
... --mode=volume-usage
... --hostname=${HOSTNAME}
... --api-username=toto
... --api-password=toto
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/
*** Test Cases ***
Volumeusage ${tc}
[Tags] storage api hpe hp
${output} Run ${CMD} ${extraoptions}
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${expected_result}
... Wrong output result for command:\n${CMD} ${extraoptions}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
... values=False
... collapse_spaces=True
Examples: tc extraoptions expected_result --
... 1 ${EMPTY} OK: All volumes are ok | '.mgmtdata#volume.space.usage.bytes'=549755813888B;;;0;549755813888 '.mgmtdata#volume.space.free.bytes'=0B;;;0;549755813888 '.mgmtdata#volume.space.usage.percentage'=100.00%;;;0;100 '.shared.SSD_r6_0#volume.space.usage.bytes'=166599852032B;;;0;70368744177664 '.shared.SSD_r6_0#volume.space.free.bytes'=70202144325632B;;;0;70368744177664 '.shared.SSD_r6_0#volume.space.usage.percentage'=0.24%;;;0;100 '.srdata#volume.space.usage.bytes'=225485783040B;;;0;225485783040 '.srdata#volume.space.free.bytes'=0B;;;0;225485783040 '.srdata#volume.space.usage.percentage'=100.00%;;;0;100 'DR-WOO-SSD01#volume.space.usage.bytes'=4327029604352B;;;0;6047313952768 'DR-WOO-SSD01#volume.space.free.bytes'=1720284348416B;;;0;6047313952768 'DR-WOO-SSD01#volume.space.usage.percentage'=71.55%;;;0;100 'DR-WOO-SSD02#volume.space.usage.bytes'=1137753194496B;;;0;5497558138880 'DR-WOO-SSD02#volume.space.free.bytes'=4359804944384B;;;0;5497558138880 'DR-WOO-SSD02#volume.space.usage.percentage'=20.70%;;;0;100 'JHDFB_NL01#volume.space.usage.bytes'=537547243520B;;;0;5497558138880 'JHDFB_NL01#volume.space.free.bytes'=4960010895360B;;;0;5497558138880 'JHDFB_NL01#volume.space.usage.percentage'=9.78%;;;0;100 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;;;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;;;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;;;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;;;0;100 'QUPODHDG01#volume.space.usage.bytes'=74894540800B;;;0;343597383680 'QUPODHDG01#volume.space.free.bytes'=268702842880B;;;0;343597383680 'QUPODHDG01#volume.space.usage.percentage'=21.80%;;;0;100 'Quorum-.0#volume.space.usage.bytes'=424673280B;;;0;107374182400 'Quorum-.0#volume.space.free.bytes'=106949509120B;;;0;107374182400 'Quorum-.0#volume.space.usage.percentage'=0.40%;;;0;100 'Quorum-.1#volume.space.usage.bytes'=3145728B;;;0;107374182400 'Quorum-.1#volume.space.free.bytes'=107371036672B;;;0;107374182400 'Quorum-.1#volume.space.usage.percentage'=0.00%;;;0;100 'YLBQFC#volume.space.usage.bytes'=2059163140096B;;;0;4398046511104 'YLBQFC#volume.space.free.bytes'=2338883371008B;;;0;4398046511104 'YLBQFC#volume.space.usage.percentage'=46.82%;;;0;100 'YLBQG01#volume.space.usage.bytes'=357328486400B;;;0;1099511627776 'YLBQG01#volume.space.free.bytes'=742183141376B;;;0;1099511627776 'YLBQG01#volume.space.usage.percentage'=32.50%;;;0;100 'YLBQYLBQ01#volume.space.usage.bytes'=13838988607488B;;;0;21990232555520 'YLBQYLBQ01#volume.space.free.bytes'=8151243948032B;;;0;21990232555520 'YLBQYLBQ01#volume.space.usage.percentage'=62.93%;;;0;100 'admin#volume.space.usage.bytes'=10737418240B;;;0;10737418240 'admin#volume.space.free.bytes'=0B;;;0;10737418240 'admin#volume.space.usage.percentage'=100.00%;;;0;100
... 2 --filter-name=LZRFEE_NL03 OK: Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) | 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100
... 3 --filter-counters='^usage$' OK: All volumes are ok | '.mgmtdata#volume.space.usage.bytes'=549755813888B;;;0;549755813888 '.shared.SSD_r6_0#volume.space.usage.bytes'=166599852032B;;;0;70368744177664 '.srdata#volume.space.usage.bytes'=225485783040B;;;0;225485783040 'DR-WOO-SSD01#volume.space.usage.bytes'=4327029604352B;;;0;6047313952768 'DR-WOO-SSD02#volume.space.usage.bytes'=1137753194496B;;;0;5497558138880 'JHDFB_NL01#volume.space.usage.bytes'=537547243520B;;;0;5497558138880 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;;0;32985348833280 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;;0;6034429050880 'QUPODHDG01#volume.space.usage.bytes'=74894540800B;;;0;343597383680 'Quorum-.0#volume.space.usage.bytes'=424673280B;;;0;107374182400 'Quorum-.1#volume.space.usage.bytes'=3145728B;;;0;107374182400 'YLBQFC#volume.space.usage.bytes'=2059163140096B;;;0;4398046511104 'YLBQG01#volume.space.usage.bytes'=357328486400B;;;0;1099511627776 'YLBQYLBQ01#volume.space.usage.bytes'=13838988607488B;;;0;21990232555520 'admin#volume.space.usage.bytes'=10737418240B;;;0;10737418240
... 4 --warning-usage-prct='70' --filter-name=LZRFEE WARNING: Volume 'LZRFEE_NL01' (#12) Used : 73.01 % - Volume 'LZRFEE_NL02' (#13) Used : 77.07 % | 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;;;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;0:70;;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;0:70;;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;0:70;;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;0:70;;0;100
... 5 --critical-usage-prct='70' --filter-name=LZRFEE CRITICAL: Volume 'LZRFEE_NL01' (#12) Used : 73.01 % - Volume 'LZRFEE_NL02' (#13) Used : 77.07 % | 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;;;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;;0:70;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;;0:70;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;0:70;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;;0:70;0;100
... 6 --warning-usage='70' --filter-name=LZRFEE WARNING: Volume 'LZRFEE_NL01' (#12) Usage Total: 30.00 TB Used: 21.90 TB (73.01%) Free: 8.10 TB (26.99%) - Volume 'LZRFEE_NL02' (#13) Usage Total: 30.00 TB Used: 23.12 TB (77.07%) Free: 6.88 TB (22.93%) - Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) - Volume 'LZRFEE_NL2024' (#15) Usage Total: 5.49 TB Used: 430.56 GB (7.66%) Free: 5.07 TB (92.34%) | 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;0:70;;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;;;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;;;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;0:70;;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;;;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;0:70;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;0:70;;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;;;0;100
... 7 --critical-usage='70' --filter-name=LZRFEE CRITICAL: Volume 'LZRFEE_NL01' (#12) Usage Total: 30.00 TB Used: 21.90 TB (73.01%) Free: 8.10 TB (26.99%) - Volume 'LZRFEE_NL02' (#13) Usage Total: 30.00 TB Used: 23.12 TB (77.07%) Free: 6.88 TB (22.93%) - Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) - Volume 'LZRFEE_NL2024' (#15) Usage Total: 5.49 TB Used: 430.56 GB (7.66%) Free: 5.07 TB (92.34%) | 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;0:70;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;;;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;;;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;0:70;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;;;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;0:70;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;0:70;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;;;0;100
... 8 --warning-usage-free='10:' --filter-name=LZRFEE OK: All volumes are ok | 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;10:;;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;;;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;10:;;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;;;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;10:;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;10:;;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;;;0;100
... 9 --critical-usage-free='10:' --filter-name=LZRFEE OK: All volumes are ok | 'LZRFEE_NL01#volume.space.usage.bytes'=24082603048960B;;;0;32985348833280 'LZRFEE_NL01#volume.space.free.bytes'=8902745784320B;;10:;0;32985348833280 'LZRFEE_NL01#volume.space.usage.percentage'=73.01%;;;0;100 'LZRFEE_NL02#volume.space.usage.bytes'=25421404962816B;;;0;32985348833280 'LZRFEE_NL02#volume.space.free.bytes'=7563943870464B;;10:;0;32985348833280 'LZRFEE_NL02#volume.space.usage.percentage'=77.07%;;;0;100 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;10:;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100 'LZRFEE_NL2024#volume.space.usage.bytes'=462308769792B;;;0;6034429050880 'LZRFEE_NL2024#volume.space.free.bytes'=5572120281088B;;10:;0;6034429050880 'LZRFEE_NL2024#volume.space.usage.percentage'=7.66%;;;0;100
... 10 --warning-usage='70' --filter-id='^14$' WARNING: Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) | 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;0:70;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100
... 11 --critical-usage='70' --filter-id='^14$' CRITICAL: Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) | 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;0:70;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100
... 12 --warning-usage-free='10:' --filter-id='^14$' OK: Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) | 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;10:;;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100
... 13 --critical-usage-free='10:' --filter-id='^14$' OK: Volume 'LZRFEE_NL03' (#14) Usage Total: 5.50 TB Used: 1.60 TB (29.05%) Free: 3.90 TB (70.95%) | 'LZRFEE_NL03#volume.space.usage.bytes'=1756681469952B;;;0;6047313952768 'LZRFEE_NL03#volume.space.free.bytes'=4290632482816B;;10:;0;6047313952768 'LZRFEE_NL03#volume.space.usage.percentage'=29.05%;;;0;100

View File

@ -63,16 +63,12 @@ Components
${command} Catenate
... ${CMD}
... --mode=components
... --hostname=127.0.0.1
... --snmp-version=2
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=${check_components_test.snmpcommunity}
${output} Run ${command}
Should Be Equal As Strings
... ${check_components_test.expected_output}
... ${output}
... ${check_components_test.description} failed. Wrong output for components mode: ${check_components_test}.{\n}Command output:{\n}${output}
Ctn Run Command And Check Result As Strings ${command} ${check_components_test.expected_output}
END
Uptime
@ -81,16 +77,12 @@ Uptime
${command} Catenate
... ${CMD}
... --mode=uptime
... --hostname=127.0.0.1
... --snmp-version=2
... --snmp-port=2024
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=${test_item.snmpcommunity}
... --warning-uptime=${test_item.warning}
... --critical-uptime=${test_item.critical}
${output} Run ${command}
Should Be Equal As Strings
... ${test_item.expected_output}
... ${output}
... ${test_item.description} failed. Wrong output for components mode: ${test_item}.{\n}Command output:{\n}${output}
Ctn Run Command And Check Result As Strings ${command} ${test_item.expected_output}
END