Release 20230810 (#4595)

This commit is contained in:
omercier 2023-08-10 12:01:16 +02:00 committed by GitHub
commit 71f662103e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
132 changed files with 3734 additions and 1358 deletions

View File

@ -10,7 +10,7 @@ baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo
dnf -y install git gettext rpm-build dos2unix python3 epel-release nfpm jq zstd
dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm openssl-devel jq zstd
dnf -y install perl-App-cpanminus perl-JSON
cpanm App::FatPacker
cpanm File::Copy::Recursive

View File

@ -10,7 +10,7 @@ baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo
dnf -y install git gettext rpm-build dos2unix python3 epel-release nfpm jq zstd
dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm openssl-devel jq zstd
dnf -y install perl-App-cpanminus perl-JSON
cpanm App::FatPacker
cpanm File::Copy::Recursive

View File

@ -25,6 +25,7 @@ apt-get install -y \
dh-make \
aptitude \
ca-certificates \
libssh-dev \
lintian \
pbuilder \
quilt \
@ -33,6 +34,7 @@ apt-get install -y \
devscripts \
fakeroot \
curl \
gcc \
git \
python3 \
libjson-perl \

View File

@ -54,6 +54,8 @@ jobs:
if [[ "${{ inputs.version_file }}" == "" ]]; then
VERSION=$(date '+%Y%m%d')
elif [[ "${{ inputs.version_file }}" == */*.yaml ]]; then
VERSION=$(grep 'version: ' ${{ inputs.version_file }} | cut -d' ' -f2 | tr -d '"')
else
VERSION=$(grep VERSION ${{ inputs.version_file }} | cut -d "'" -f 2)
fi

153
.github/workflows/nrpe.yml vendored Normal file
View File

@ -0,0 +1,153 @@
name: nrpe
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- 'nrpe/packaging/**'
push:
branches:
- develop
- master
paths:
- 'nrpe/packaging/**'
tags:
- centreon-nrpe-*
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
with:
version_file: nrpe/packaging/centreon-nrpe3-daemon.yaml
package:
needs: [get-environment]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- package_extension: rpm
image: packaging-plugins-alma8
distrib: el8
- package_extension: rpm
image: packaging-plugins-alma9
distrib: el9
- package_extension: deb
image: packaging-plugins-bullseye
distrib: bullseye
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
credentials:
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
name: package ${{ matrix.distrib }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Download nrpe sources
run: |
curl -Lo - "https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-${{ needs.get-environment.outputs.version }}/nrpe-${{ needs.get-environment.outputs.version }}.tar.gz" | tar zxpf -
mv nrpe-${{ needs.get-environment.outputs.version }} nrpe-src
shell: bash
- name: Compile sources
run: |
cd nrpe-src
patch -p1 < ../nrpe/packaging/files/nrpe3_add_centreon_cmd.patch
if [ "${{ matrix.package_extension }}" = "deb" ]; then
NAGIOS_PLUGINS_PATH="/usr/lib/nagios/plugins"
else
NAGIOS_PLUGINS_PATH="/usr/lib64/nagios/plugins"
fi
CXXFLAGS="-Wall -Wextra" ./configure \
--libexecdir="$NAGIOS_PLUGINS_PATH" \
--localstatedir="/var/log/nrpe" \
--sysconfdir="/etc/nrpe" \
--enable-command-args \
--with-nrpe-user="centreon-engine" \
--with-nrpe-group="centreon-engine" \
--with-nrpe-port="5666" \
--with-nagios-user="centreon-engine" \
--with-nagios-group="centreon-engine"
make all
shell: bash
- name: Generate debug files
run: |
cd nrpe-src/src
for file in "nrpe" "check_nrpe"; do
objcopy --only-keep-debug $file $file.debug
objcopy --strip-debug $file
objcopy --add-gnu-debuglink $file.debug $file
done
shell: bash
- name: Package
uses: ./.github/actions/package
with:
nfpm_file_pattern: "nrpe/packaging/*.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
version: ${{ needs.get-environment.outputs.version }}
release: ${{ needs.get-environment.outputs.release }}
commit_hash: ${{ github.sha }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
deliver-rpm:
needs: [get-environment, package]
if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [el8, el9]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Delivery
uses: ./.github/actions/rpm-delivery
with:
module_name: nrpe
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
deliver-deb:
needs: [get-environment ,package]
if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [bullseye]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Delivery
uses: ./.github/actions/deb-delivery
with:
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}

View File

@ -67,7 +67,7 @@ jobs:
strategy:
fail-fast: false
matrix:
distrib: [el7]
distrib: [el7, el8, el9]
steps:
- name: Checkout sources
@ -88,7 +88,7 @@ jobs:
strategy:
fail-fast: false
matrix:
distrib: [el7]
distrib: [el7, el8]
major_version: ["21.10", "22.04", "22.10"]
steps:
@ -109,7 +109,6 @@ jobs:
stability: ${{ inputs.stability }}
deliver-deb:
if: ${{ inputs.stability == 'REMOVE-LINE' }}
runs-on: [self-hosted, common]
strategy:
fail-fast: false
@ -129,7 +128,7 @@ jobs:
artifactory_token: ${{ secrets.artifactory_token }}
deliver-deb-legacy:
if: ${{ inputs.stability == 'RESET-TO-STABLE' }}
if: ${{ inputs.stability == 'stable' }}
runs-on: [self-hosted, common]
strategy:
fail-fast: false

View File

@ -1,4 +1,4 @@
name: Functional tests
name: functional-tests
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -8,23 +8,27 @@ on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/tests-functional.yml'
- 'src/**'
- 'tests/functional/**'
- 'tests/resources/mockoon/**'
jobs:
AWS_tests:
functional-tests-with-robot:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Use Node.js
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
- name: Install Mockoon CLI
run: npm install -D @mockoon/cli
run: npm install -g -D @mockoon/cli@3.1.0
- name: Install libs
run: sudo apt-get install libcurl4-openssl-dev
- name: Install perl dependencies
uses: shogo82148/actions-setup-perl@v1
@ -35,40 +39,31 @@ jobs:
DateTime
Digest::MD5
Encode
ExtUtils::PkgConfig
HTTP::ProxyPAC
IO::Socket::SSL
JSON::XS
LWP::Protocol::https
LWP::UserAgent
MIME::Base64
Net::Curl::Easy
Paws
POSIX
Storable
URI
URI::Encode
- name: Run Mockoon CLI
run: npx mockoon-cli start --data tests/resources/mockoon/cloud-aws-cloudtrail.json --port 3000
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run plugin
- name: Install Robot Framework
run: pip3 install robotframework
shell: bash
- name: Run Robot Framework tests
run: |
sudo chmod -R +x tests/functional/
sudo mkdir -p /var/lib/centreon/centplugins/
sudo chmod 777 /var/lib/centreon/centplugins/
TESTS="$(tests/functional/cloud/aws/cloudtrail/checktrailstatus.sh)"
echo "tests=$(echo $TESTS)" >> $GITHUB_OUTPUT
if [[ $TESTS = "OK:"* ]]; then
echo "OK"
else
echo $TESTS
exit 1
fi
TESTS="$(tests/functional/cloud/aws/cloudtrail/countevents.sh)"
echo "tests=$(echo $TESTS)" >> $GITHUB_OUTPUT
if [[ $TESTS = "OK:"* ]]; then
echo "OK"
else
echo $TESTS
exit 1
fi
shell: bash
robot tests/functional/

View File

@ -0,0 +1,92 @@
name: "centreon-nrpe3-daemon"
arch: "amd64"
platform: "linux"
version_schema: "none"
version: "4.1.0"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
The centreon-nrpe packages contains the Nagios Remote Plug-ins Executor.
Daemon which can execute predefined commands on the remote host.
Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://centreon.com"
license: "GPLv2+"
contents:
- src: "../../nrpe-src/src/nrpe"
dst: "/usr/sbin/centreon-nrpe3"
- src: "../../nrpe-src/sample-config/nrpe.cfg"
dst: "/etc/nrpe/centreon-nrpe3.cfg"
type: config|noreplace
file_info:
mode: 0644
- src: "files/nrpe3.sysconfig"
dst: "/etc/sysconfig/centreon-nrpe3"
packager: rpm
file_info:
mode: 0644
- src: "files/nrpe3.sysconfig"
dst: "/etc/default/centreon-nrpe3"
packager: deb
file_info:
mode: 0644
- src: "files/nrpe3.service.rpm"
dst: "/lib/systemd/system/centreon-nrpe3.service"
packager: rpm
file_info:
mode: 0644
- src: "files/nrpe3.service.deb"
dst: "/lib/systemd/system/centreon-nrpe3.service"
packager: deb
file_info:
mode: 0644
- dst: "/var/log/nrpe"
type: dir
file_info:
mode: 0755
owner: centreon-engine
group: centreon-engine
- dst: "/var/log/nrpe/centplugins"
type: dir
file_info:
mode: 0755
owner: centreon-engine
group: centreon-engine
scripts:
preinstall: ./scripts/centreon-nrpe3-daemon-preinstall.sh
postinstall: ./scripts/centreon-nrpe3-daemon-postinstall.sh
preremove: ./scripts/centreon-nrpe3-daemon-preremove.sh
overrides:
rpm:
replaces:
- centreon-nrpe3-daemon-debuginfo
- centreon-nrpe3-daemon-debugsource
conflicts:
- centreon-nrpe3-daemon-debuginfo
- centreon-nrpe3-daemon-debugsource
provides:
- centreon-nrpe3-daemon-debuginfo
- centreon-nrpe3-daemon-debugsource
deb:
replaces:
- centreon-nrpe3-daemon-dbgsym
conflicts:
- centreon-nrpe3-daemon-dbgsym
provides:
- centreon-nrpe3-daemon-dbgsym
rpm:
summary: Nagios Remote Plugins Execution daemon
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}

View File

@ -0,0 +1,53 @@
name: "centreon-nrpe3-plugin"
arch: "amd64"
platform: "linux"
version_schema: "none"
version: "4.1.0"
release: "${RELEASE}${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
Plug-in for Centreon monitoring system.
The centreon-nrpe packages contains the Nagios Remote Plug-ins Executor
Commit: @COMMIT_HASH@
vendor: "Centreon"
homepage: "https://centreon.com"
license: "GPLv2+"
contents:
- src: "../../nrpe-src/src/check_nrpe"
dst: "/usr/lib64/nagios/plugins/check_centreon_nrpe3"
packager: rpm
file_info:
mode: 0755
- src: "../../nrpe-src/src/check_nrpe"
dst: "/usr/lib/nagios/plugins/check_centreon_nrpe3"
packager: deb
file_info:
mode: 0755
overrides:
rpm:
replaces:
- centreon-nrpe3-plugin-debuginfo
- centreon-nrpe3-plugin-debugsource
conflicts:
- centreon-nrpe3-plugin-debuginfo
- centreon-nrpe3-plugin-debugsource
provides:
- centreon-nrpe3-plugin-debuginfo
- centreon-nrpe3-plugin-debugsource
deb:
replaces:
- centreon-nrpe3-plugin-dbgsym
conflicts:
- centreon-nrpe3-plugin-dbgsym
provides:
- centreon-nrpe3-plugin-dbgsym
rpm:
summary: Nagios plugin for NRPE
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}

View File

@ -0,0 +1,23 @@
[Unit]
Description=Nagios Remote Program Executor
Documentation=http://www.nagios.org/documentation
After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target
Before=getty@tty1.service plymouth-quit.service xdm.service
Conflicts=nrpe.socket
Requires=network.target
[Service]
Type=forking
User=centreon-engine
Group=centreon-engine
EnvironmentFile=/etc/default/centreon-nrpe3
ExecStart=/usr/sbin/centreon-nrpe3 -c /etc/nrpe/centreon-nrpe3.cfg -d $NRPE_OPT
Restart=on-abort
PIDFile=/var/log/nrpe/nrpe3.pid
ExecStopPost=/bin/rm -f /var/log/nrpe/nrpe3.pid
TimeoutStopSec=60
PrivateTmp=false
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,23 @@
[Unit]
Description=Nagios Remote Program Executor
Documentation=http://www.nagios.org/documentation
After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target
Before=getty@tty1.service plymouth-quit.service xdm.service
Conflicts=nrpe.socket
Requires=network.target
[Service]
Type=forking
User=centreon-engine
Group=centreon-engine
EnvironmentFile=/etc/sysconfig/centreon-nrpe3
ExecStart=/usr/sbin/centreon-nrpe3 -c /etc/nrpe/centreon-nrpe3.cfg -d $NRPE_OPT
Restart=on-abort
PIDFile=/var/log/nrpe/nrpe3.pid
ExecStopPost=/bin/rm -f /var/log/nrpe/nrpe3.pid
TimeoutStopSec=60
PrivateTmp=false
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,2 @@
# specify additional command line arguments for nrpe
NRPE_OPT=""

View File

@ -0,0 +1,29 @@
--- a/sample-config/nrpe.cfg.in 2018-09-14 13:40:08.496324915 +0200
+++ b/sample-config/nrpe.cfg.in 2018-09-14 13:47:57.624296953 +0200
@@ -40,7 +40,7 @@
# number. The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
-pid_file=@piddir@/nrpe.pid
+pid_file=@piddir@/nrpe3.pid
@@ -119,7 +119,7 @@
#
# Values: 0=do not allow arguments, 1=allow command arguments
-dont_blame_nrpe=0
+dont_blame_nrpe=1
@@ -300,7 +300,7 @@
command[check_hda1]=@pluginsdir@/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=@pluginsdir@/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=@pluginsdir@/check_procs -w 150 -c 200
-
+command[check_centreon_plugins]=/usr/lib/centreon/plugins/centreon_linux_local.pl --plugin=$ARG1$ --mode=$ARG2$ $ARG3$
# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for

View File

@ -0,0 +1,31 @@
#!/bin/sh
startNrpeDaemon() {
systemctl daemon-reload ||:
systemctl unmask centreon-nrpe3.service ||:
systemctl preset centreon-nrpe3.service ||:
systemctl enable centreon-nrpe3.service ||:
systemctl restart centreon-nrpe3.service ||:
}
action="$1"
if [ "$1" = "configure" ] && [ -z "$2" ]; then
# Alpine linux does not pass args, and deb passes $1=configure
action="install"
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
# deb passes $1=configure $2=<current version>
action="upgrade"
fi
case "$action" in
"1" | "install")
startNrpeDaemon
;;
"2" | "upgrade")
startNrpeDaemon
;;
*)
# $1 == version being installed
startNrpeDaemon
;;
esac

View File

@ -0,0 +1,4 @@
#!/bin/sh
getent group centreon-engine > /dev/null 2>&1 || groupadd -r centreon-engine
getent passwd centreon-engine > /dev/null 2>&1 || useradd -g centreon-engine -m -d /var/lib/centreon-engine -r centreon-engine > /dev/null 2>&1 ||:

View File

@ -0,0 +1,3 @@
#!/bin/sh
systemctl stop centreon-nrpe3.service ||:

View File

@ -1,5 +1,6 @@
{
"dependencies": [
"libdbd-pg-perl",
"libdbi-perl"
]
}

View File

@ -1,5 +1,6 @@
{
"dependencies": [
"perl(DBD::Pg)",
"perl(DBI)",
"perl(Time::HiRes)",
"perl(POSIX)"

View File

@ -5,6 +5,7 @@
"files": [
"centreon/plugins/script_snmp.pm",
"centreon/plugins/snmp.pm",
"snmp_standard/mode/uptime.pm",
"hardware/sensors/rittal/cmc3/snmp/"
]
}

View File

@ -1,5 +1,6 @@
{
"dependencies": [
"libsnmp-perl"
"libsnmp-perl",
"libdatetime-format-strptime-perl"
]
}
}

View File

@ -5,6 +5,8 @@
"files": [
"centreon/plugins/script_snmp.pm",
"centreon/plugins/snmp.pm",
"hardware/ups/apc/snmp/"
"snmp_standard/mode/ntp.pm",
"snmp_standard/mode/uptime.pm",
"hardware/ups/apc/snmp/"
]
}
}

View File

@ -1,5 +1,6 @@
{
"dependencies": [
"perl(SNMP)"
"perl(SNMP)",
"perl(DateTime::Format::Strptime)"
]
}
}

View File

@ -55,13 +55,15 @@ sub new {
'unknown-http-status:s' => { name => 'unknown_http_status' },
'warning-http-status:s' => { name => 'warning_http_status' },
'critical-http-status:s' => { name => 'critical_http_status' },
'token:s' => { name => 'token' }
'token:s' => { name => 'token' },
'cache-use' => { name => 'cache_use' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{http} = centreon::plugins::http->new(%options);
$self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl');
$self->{cache_connect} = centreon::plugins::statefile->new(%options);
$self->{cache} = centreon::plugins::statefile->new(%options);
return $self;
@ -91,12 +93,14 @@ sub check_options {
$self->{critical_http_status} = (defined($self->{option_results}->{critical_http_status})) ? $self->{option_results}->{critical_http_status} : '';
$self->{token} = $self->{option_results}->{token};
$self->{cache}->check_options(option_results => $self->{option_results});
if (!defined($self->{option_results}->{hostname}) || $self->{option_results}->{hostname} eq '') {
$self->{output}->add_option_msg(short_msg => 'Need to specify --hostname option.');
$self->{output}->option_exit();
}
if (defined($self->{token})) {
$self->{cache}->check_options(option_results => $self->{option_results});
$self->{cache_connect}->check_options(option_results => $self->{option_results});
return 0 if ($self->{token} ne '');
}
@ -105,7 +109,7 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => 'Need to specify --secret option.');
$self->{output}->option_exit();
}
$self->{cache}->check_options(option_results => $self->{option_results});
$self->{cache_connect}->check_options(option_results => $self->{option_results});
return 0;
}
@ -140,9 +144,9 @@ sub get_connection_info {
sub get_token {
my ($self, %options) = @_;
my $has_cache_file = $self->{cache}->read(statefile => 'rubrik_api_' . md5_hex($self->{option_results}->{hostname} . '_' . $self->{api_username}));
my $token = $self->{cache}->get(name => 'token');
my $md5_secret_cache = $self->{cache}->get(name => 'md5_secret');
my $has_cache_file = $self->{cache_connect}->read(statefile => 'rubrik_api_' . md5_hex($self->{option_results}->{hostname} . '_' . $self->{api_username}));
my $token = $self->{cache_connect}->get(name => 'token');
my $md5_secret_cache = $self->{cache_connect}->get(name => 'md5_secret');
my $md5_secret = md5_hex($self->{api_username} . $self->{api_password});
if ($has_cache_file == 0 ||
@ -177,7 +181,7 @@ sub get_token {
token => $decoded->{token},
md5_secret => $md5_secret
};
$self->{cache}->write(data => $datas);
$self->{cache_connect}->write(data => $datas);
}
return $token;
@ -186,9 +190,9 @@ sub get_token {
sub get_service_account_token {
my ($self, %options) = @_;
my $has_cache_file = $self->{cache}->read(statefile => 'rubrik_api_' . md5_hex($self->{option_results}->{hostname} . '_' . $self->{service_account}));
my $token = $self->{cache}->get(name => 'token');
my $md5_secret_cache = $self->{cache}->get(name => 'md5_secret');
my $has_cache_file = $self->{cache_connect}->read(statefile => 'rubrik_api_' . md5_hex($self->{option_results}->{hostname} . '_' . $self->{service_account}));
my $token = $self->{cache_connect}->get(name => 'token');
my $md5_secret_cache = $self->{cache_connect}->get(name => 'md5_secret');
my $md5_secret = md5_hex($self->{service_account} . $self->{secret});
if ($has_cache_file == 0 ||
@ -235,7 +239,7 @@ sub get_service_account_token {
token => $decoded->{token},
md5_secret => $md5_secret
};
$self->{cache}->write(data => $datas);
$self->{cache_connect}->write(data => $datas);
}
return $token;
@ -245,7 +249,7 @@ sub clean_token {
my ($self, %options) = @_;
my $datas = { updated => time() };
$self->{cache}->write(data => $datas);
$self->{cache_connect}->write(data => $datas);
}
sub credentials {
@ -374,6 +378,54 @@ sub request_api {
return $result;
}
sub write_cache_file {
my ($self, %options) = @_;
$self->{cache}->read(statefile => 'cache_rubrik_' . $options{statefile} . '_' . md5_hex($self->get_connection_info()));
$self->{cache}->write(data => {
update_time => time(),
response => $options{response}
});
}
sub get_cache_file_response {
my ($self, %options) = @_;
$self->{cache}->read(statefile => 'cache_rubrik_' . $options{statefile} . '_' . md5_hex($self->get_connection_info()));
my $response = $self->{cache}->get(name => 'response');
if (!defined($response)) {
$self->{output}->add_option_msg(short_msg => 'Cache file missing');
$self->{output}->option_exit();
}
return $response;
}
sub cache_jobs_monitoring {
my ($self, %options) = @_;
my $datas = $self->get_jobs_monitoring(disable_cache => 1, limit => $options{limit});
$self->write_cache_file(
statefile => 'jobs_monitoring',
response => $datas
);
return $datas;
}
sub get_jobs_monitoring {
my ($self, %options) = @_;
return $self->get_cache_file_response(statefile => 'jobs_monitoring')
if (defined($self->{option_results}->{cache_use}) && !defined($options{disable_cache}));
return $self->request_api(
endpoint => '/api/v1/job_monitoring',
label => 'jobMonitoringInfoList',
get_param => ['limit=' . $options{limit}]
);
}
1;
__END__
@ -428,6 +480,10 @@ Use token authentication. If option is empty, token is created.
Set timeout in seconds (Default: 30).
=item B<--cache-use>
Use the cache file (created with cache mode).
=back
=head1 DESCRIPTION

View File

@ -0,0 +1,76 @@
#
# Copyright 2023 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::backup::rubrik::restapi::mode::cache;
use base qw(centreon::plugins::templates::counter);
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 => {
'limit:s' => { name => 'limit' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
if (!defined($self->{option_results}->{limit}) || $self->{option_results}->{limit} !~ /\d+/) {
$self->{option_results}->{limit} = 500;
}
}
sub manage_selection {
my ($self, %options) = @_;
$options{custom}->cache_jobs_monitoring(limit => $self->{option_results}->{limit});
$self->{output}->output_add(
severity => 'OK',
short_msg => 'Cache files created successfully'
);
}
1;
__END__
=head1 MODE
Create cache files (job mode could use it with --cache-use option).
=over 8
=item B<--limit>
Define the number of entries to retrieve for the pagination (default: 500).
=back
=cut

View File

@ -39,7 +39,7 @@ sub custom_last_exec_perfdata {
$self->{output}->perfdata_add(
nlabel => $self->{nlabel} . '.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
instances => $self->{result_values}->{name},
instances => [$self->{result_values}->{jobName}, $self->{result_values}->{jobType}],
unit => $self->{instance_mode}->{option_results}->{unit},
value => $self->{result_values}->{lastExecSeconds} >= 0 ? floor($self->{result_values}->{lastExecSeconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }) : $self->{result_values}->{lastExecSeconds},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
@ -66,7 +66,7 @@ sub custom_duration_perfdata {
$self->{output}->perfdata_add(
nlabel => $self->{nlabel} . '.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
instances => $self->{result_values}->{name},
instances => [$self->{result_values}->{jobName}, $self->{result_values}->{jobType}],
unit => $self->{instance_mode}->{option_results}->{unit},
value => floor($self->{result_values}->{durationSeconds} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
@ -151,18 +151,29 @@ sub set_counters {
$self->{maps_counters}->{failed} = [
{ label => 'job-executions-failed-prct', nlabel => 'job.executions.failed.percentage', set => {
key_values => [ { name => 'failedPrct' } ],
key_values => [ { name => 'failedPrct' }, { name => 'jobName' }, { name => 'jobType' } ],
output_template => 'number of failed executions: %.2f %%',
perfdatas => [
{ template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 }
]
closure_custom_perfdata => sub {
my ($self, %options) = @_;
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
unit => '%',
instances => [$self->{result_values}->{jobName}, $self->{result_values}->{jobType}],
value => sprintf('%.2f', $self->{result_values}->{failedPrct}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
min => 0,
max => 100
);
}
}
}
];
$self->{maps_counters}->{timers} = [
{ label => 'job-execution-last', nlabel => 'job.execution.last', set => {
key_values => [ { name => 'lastExecSeconds' }, { name => 'lastExecHuman' }, { name => 'name' } ],
key_values => [ { name => 'lastExecSeconds' }, { name => 'lastExecHuman' }, { name => 'jobName' }, { name => 'jobType' } ],
output_template => 'last execution %s',
output_use => 'lastExecHuman',
closure_custom_perfdata => $self->can('custom_last_exec_perfdata'),
@ -170,7 +181,7 @@ sub set_counters {
}
},
{ label => 'job-running-duration', nlabel => 'job.running.duration', set => {
key_values => [ { name => 'durationSeconds' }, { name => 'durationHuman' }, { name => 'name' } ],
key_values => [ { name => 'durationSeconds' }, { name => 'durationHuman' }, { name => 'jobName' }, { name => 'jobType' } ],
output_template => 'running duration %s',
output_use => 'durationHuman',
closure_custom_perfdata => $self->can('custom_duration_perfdata'),
@ -206,7 +217,8 @@ sub new {
'filter-job-name:s' => { name => 'filter_job_name' },
'filter-job-type:s' => { name => 'filter_job_type' },
'filter-location-name:s' => { name => 'filter_location_name' },
'unit:s' => { name => 'unit', default => 's' }
'unit:s' => { name => 'unit', default => 's' },
'limit:s' => { name => 'limit' }
});
$self->{cache_exec} = centreon::plugins::statefile->new(%options);
@ -222,19 +234,21 @@ sub check_options {
$self->{option_results}->{unit} = 's';
}
if (!defined($self->{option_results}->{limit}) || $self->{option_results}->{limit} !~ /\d+/) {
$self->{option_results}->{limit} = 500;
}
$self->{cache_exec}->check_options(option_results => $self->{option_results}, default_format => 'json');
}
sub manage_selection {
my ($self, %options) = @_;
my $jobs_exec = $options{custom}->request_api(
endpoint => '/api/v1/job_monitoring',
label => 'jobMonitoringInfoList'
);
my $jobs_exec = $options{custom}->get_jobs_monitoring(limit => $self->{option_results}->{limit});
$self->{cache_exec}->read(statefile => 'rubrik_' . $self->{mode} . '_' .
$self->{cache_exec}->read(statefile => 'rubrik_' . $self->{mode} . '_' .
Digest::MD5::md5_hex(
$options{custom}->get_connection_info() . '_' .
(defined($self->{option_results}->{filter_job_id}) ? $self->{option_results}->{filter_job_id} : '') . '_' .
(defined($self->{option_results}->{filter_job_name}) ? $self->{option_results}->{filter_job_name} : '') . '_' .
(defined($self->{option_results}->{filter_job_type}) ? $self->{option_results}->{filter_job_type} : '')
@ -256,10 +270,12 @@ sub manage_selection {
next if (defined($self->{option_results}->{filter_location_name}) && $self->{option_results}->{filter_location_name} ne '' &&
$job_exec->{locationName} !~ /$self->{option_results}->{filter_location_name}/);
$job_exec->{jobType} = lc($job_exec->{jobType});
if (!defined($self->{jobs}->{ $job_exec->{objectId} })) {
$self->{jobs}->{ $job_exec->{objectId} } = {
name => $job_exec->{objectName},
jobType => lc($job_exec->{jobType}),
jobType => $job_exec->{jobType},
timers => {},
executions => {}
};
@ -284,6 +300,8 @@ sub manage_selection {
}
$self->{jobs}->{ $job_exec->{objectId} }->{failed} = {
jobName => $job_exec->{objectName},
jobType => $job_exec->{jobType},
failedPrct => $total > 0 ? $failed * 100 / $total : 0
};
@ -296,16 +314,21 @@ sub manage_selection {
$last_exec->{startTime} =~ /^(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)/;
my $dt = DateTime->new(year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6);
$last_exec_times->{ $job_exec->{objectId} } = $dt->epoch();
$last_exec_times->{ $job_exec->{objectId} } = {
jobName => $job_exec->{objectName},
jobType => $job_exec->{jobType},
epoch => $dt->epoch()
};
}
$self->{jobs}->{ $job_exec->{objectId} }->{timers} = {
name => $job_exec->{objectName},
lastExecSeconds => defined($last_exec_times->{ $job_exec->{objectId} }) ? $ctime - $last_exec_times->{ $job_exec->{objectId} } : -1,
jobName => $job_exec->{objectName},
jobType => $job_exec->{jobType},
lastExecSeconds => defined($last_exec_times->{ $job_exec->{objectId} }) ? $ctime - $last_exec_times->{ $job_exec->{objectId} }->{epoch} : -1,
lastExecHuman => 'never'
};
if (defined($last_exec_times->{ $job_exec->{objectId} })) {
$self->{jobs}->{ $job_exec->{objectId} }->{timers}->{lastExecHuman} = centreon::plugins::misc::change_seconds(value => $ctime - $last_exec_times->{ $job_exec->{objectId} });
$self->{jobs}->{ $job_exec->{objectId} }->{timers}->{lastExecHuman} = centreon::plugins::misc::change_seconds(value => $ctime - $last_exec_times->{ $job_exec->{objectId} }->{epoch});
}
if (defined($older_running_exec)) {
@ -317,6 +340,21 @@ sub manage_selection {
}
}
foreach my $objectId (keys %$last_exec_times) {
next if (defined($self->{jobs}->{$objectId}));
$self->{jobs}->{$objectId} = {
name => $last_exec_times->{$objectId}->{jobName},
jobType => $last_exec_times->{$objectId}->{jobType},
timers => {
jobName => $last_exec_times->{$objectId}->{jobName},
jobType => $last_exec_times->{$objectId}->{jobType},
lastExecSeconds => $ctime - $last_exec_times->{$objectId}->{epoch},
lastExecHuman => centreon::plugins::misc::change_seconds(value => $ctime - $last_exec_times->{$objectId}->{epoch})
}
};
}
$self->{cache_exec}->write(data => {
jobs => $last_exec_times
});
@ -353,6 +391,10 @@ Filter jobs by location name.
Select the unit for last execution time threshold. May be 's' for seconds, 'm' for minutes,
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds.
=item B<--limit>
Define the number of entries to retrieve for the pagination (default: 500).
=item B<--unknown-execution-status>
Set unknown threshold for last job execution status.
@ -365,7 +407,7 @@ You can use the following variables: %{status}, %{jobName}
=item B<--critical-execution-status>
Set critical threshold for last job execution status (Default: %{status} =~ /Failure/i).
Set critical threshold for last job execution status (default: %{status} =~ /Failure/i).
You can use the following variables: %{status}, %{jobName}
=item B<--warning-*> B<--critical-*>

View File

@ -30,6 +30,7 @@ sub new {
bless $self, $class;
$self->{modes} = {
'cache' => 'apps::backup::rubrik::restapi::mode::cache',
'cluster' => 'apps::backup::rubrik::restapi::mode::cluster',
'compliance' => 'apps::backup::rubrik::restapi::mode::compliance',
'disks' => 'apps::backup::rubrik::restapi::mode::disks',

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use POSIX;
use DateTime;
sub robot_long_output {
@ -115,7 +114,8 @@ sub new {
$options{options}->add_options(arguments => {
'filter-robot-name:s' => { name => 'filter_robot_name' },
'filter-scenario-name:s' => { name => 'filter_scenario_name' }
'filter-scenario-name:s' => { name => 'filter_scenario_name' },
'timeframe:s' => { name => 'timeframe' }
});
return $self;
@ -129,11 +129,17 @@ sub manage_selection {
(defined($self->{option_results}->{filter_robot_name}) ? md5_hex($self->{option_results}->{filter_robot_name}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_scenario_name}) ? md5_hex($self->{option_results}->{filter_scenario_name}) : md5_hex('all'));
my $last_timestamp = $self->read_statefile_key(key => 'last_timestamp');
my $timespan = 5;
if (defined($last_timestamp)) {
$timespan = POSIX::ceil((time() - $last_timestamp) / 60);
my $timespan = 300;
if (defined($self->{option_results}->{timeframe}) && $self->{option_results}->{timeframe} =~ /^(\d+)$/) {
$timespan = $1;
$last_timestamp = time() - $timespan;
} else {
$last_timestamp = time() - (60 * 5);
if (defined($last_timestamp)) {
$timespan = time() - $last_timestamp;
} else {
$last_timestamp = time() - $timespan;
}
}
my $instances = $options{custom}->request_api(endpoint => '/api/instances');
@ -299,6 +305,11 @@ Filter robots (can be a regexp).
Filter scenarios (can be a regexp).
=item B<--timeframe>
Define timeframe (duration to go back in time) in seconds (default value: 300 ).
The first range is calculated with this value then it's calculated from the last execution (stored in the cache file).
=item B<--warning-*> B<--critical-*>
Thresholds.

View File

@ -26,28 +26,40 @@ use strict;
use warnings;
use JSON::XS;
sub prefix_global_output {
sub prefix_ping_output {
my ($self, %options) = @_;
return 'speedtest ';
return 'ping ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output', skipped_code => { -10 => 1 } }
{ name => 'ping', type => 0, cb_prefix_output => 'prefix_ping_output', skipped_code => { -10 => 1 } },
{ name => 'bandwidth', type => 0, skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'ping-time', nlabel => 'ping.time.milliseconds', set => {
key_values => [ { name => 'ping' } ],
output_template => 'ping time: %d ms',
$self->{maps_counters}->{ping} = [
{ label => 'ping-latency', nlabel => 'ping.latency.milliseconds', set => {
key_values => [ { name => 'latency' } ],
output_template => 'latency: %.3f ms',
perfdatas => [
{ template => '%.3f', unit => 'ms', min => 0 }
]
}
},
{ label => 'ping-jitter', nlabel => 'ping.jitter.milliseconds', set => {
key_values => [ { name => 'jitter' } ],
output_template => 'jitter: %.3f',
perfdatas => [
{ template => '%.3f', min => 0 }
]
}
}
];
$self->{maps_counters}->{bandwidth} = [
{ label => 'bandwidth-download', nlabel => 'internet.bandwidth.download.bitspersecond', set => {
key_values => [ { name => 'download' } ],
output_template => 'download: %s %s/s',
@ -83,8 +95,8 @@ sub manage_selection {
my ($self, %options) = @_;
my ($output) = $options{custom}->execute_command(
command => 'speedtest-cli',
command_options => '--json'
command => 'speedtest',
command_options => '--format=json'
);
my $decoded;
@ -95,10 +107,15 @@ sub manage_selection {
$self->{output}->add_option_msg(short_msg => 'Cannot decode response');
$self->{output}->option_exit();
}
$self->{global} = {
ping => $decoded->{ping},
download => $decoded->{download},
upload => $decoded->{upload}
$self->{ping} = {
latency => $decoded->{ping}->{latency},
jitter => $decoded->{ping}->{jitter}
};
$self->{bandwidth} = {
download => $decoded->{download}->{bytes},
upload => $decoded->{upload}->{bytes}
};
}
@ -110,14 +127,14 @@ __END__
Check internet bandwidth.
Command used: speedtest-cli --json
Command used: speedtest --format=json
=over 8
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'ping-time', 'bandwidth-download', 'bandwidth-upload'.
Can be: 'ping-jitter', 'ping-latency', 'bandwidth-download', 'bandwidth-upload'.
=back

View File

@ -64,7 +64,7 @@ sub custom_select_perfdata {
return if (!defined($self->{result_values}->{config}->{perfdatas}));
foreach (@{$self->{result_values}->{config}->{perfdatas}}) {
next if (!defined($_->{value}) || $_->{value} !~ /^\d+(?:\.\d+)?$/);
next if (!defined($_->{value}) || $_->{value} !~ /^[+-]?\d+(?:\.\d+)?$/);
$self->{output}->perfdata_add(%$_);
}
}

View File

@ -59,7 +59,7 @@ sub custom_select_perfdata {
return if (!defined($self->{result_values}->{config}->{perfdatas}));
foreach (@{$self->{result_values}->{config}->{perfdatas}}) {
next if (!defined($_->{value}) || $_->{value} !~ /^\d+(?:\.\d+)?$/);
next if (!defined($_->{value}) || $_->{value} !~ /^[+-]?\d+(?:\.\d+)?$/);
$self->{output}->perfdata_add(%$_);
}
}
@ -244,12 +244,28 @@ sub collect_snmp_tables {
foreach (keys %$snmp_result) {
/$used_instance/;
next if (defined($self->{snmp_collected}->{tables}->{ $table->{name} }->{$1}));
$self->{snmp_collected}->{tables}->{ $table->{name} }->{$1} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $1);
my $instance = $1;
$self->{snmp_collected}->{tables}->{ $table->{name} }->{$instance} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
foreach my $sample_name (keys %$sampling) {
$self->{snmp_collected_sampling}->{tables}->{ $table->{name} } = {}
if (!defined($self->{snmp_collected_sampling}->{tables}->{ $table->{name} }));
$self->{snmp_collected_sampling}->{tables}->{ $table->{name} }->{$1}->{$sample_name} =
$self->{snmp_collected}->{tables}->{ $table->{name} }->{$1}->{$sample_name};
$self->{snmp_collected_sampling}->{tables}->{ $table->{name} }->{$instance}->{$sample_name} =
$self->{snmp_collected}->{tables}->{ $table->{name} }->{$instance}->{$sample_name};
}
if (defined($table->{instance_entries})) {
my @matches = ($_ =~ /$table->{instance_entries}->{re}/);
foreach my $entry (@{$table->{instance_entries}->{entries}}) {
next if ($entry->{capture} !~ /^[0-9]+$/);
my $value = '';
if (defined($matches[ $entry->{capture} - 1])) {
$value = $matches[ $entry->{capture} - 1];
}
$self->{snmp_collected}->{tables}->{ $table->{name} }->{$instance}->{ $entry->{name} } = $value;
}
}
}
}
@ -387,6 +403,27 @@ sub collect_snmp_sampling {
$self->{snmp_cache}->write(data => { snmp_collected_sampling => $self->{snmp_collected_sampling} });
}
sub display_variables {
my ($self, %options) = @_;
$self->{output}->output_add(long_msg => '======> variables', debug => 1);
foreach my $tbl_name (keys %{$self->{snmp_collected}->{tables}}) {
my $expr = 'snmp.tables.' . $tbl_name;
foreach my $instance (keys %{$self->{snmp_collected}->{tables}->{$tbl_name}}) {
foreach my $attr (keys %{$self->{snmp_collected}->{tables}->{$tbl_name}->{$instance}}) {
$self->{output}->output_add(
long_msg => sprintf(
' %s = %s',
$expr . ".[$instance].$attr",
$self->{snmp_collected}->{tables}->{$tbl_name}->{$instance}->{$attr}
),
debug => 1
);
}
}
}
}
sub collect_snmp {
my ($self, %options) = @_;
@ -411,8 +448,14 @@ sub collect_snmp {
}
$self->collect_snmp_sampling(snmp => $options{snmp});
if ($self->{output}->is_debug()) {
$self->display_variables();
}
}
sub exist_table_name {
my ($self, %options) = @_;

View File

@ -90,7 +90,7 @@ sub set_counters {
key_values => [ { name => 'time_taken' } ],
output_template => 'execution time: %s ms',
perfdatas => [
{ label => 'total_time', template => '%s', min => 0, unit => 'ms' }
{ template => '%s', min => 0, unit => 'ms' }
]
}
},
@ -98,7 +98,7 @@ sub set_counters {
key_values => [ { name => 'total_steps' } ],
output_template => 'total steps: %s',
perfdatas => [
{ label => 'total_steps', template => '%s', min => 0 }
{ template => '%s', min => 0 }
]
}
},
@ -106,7 +106,7 @@ sub set_counters {
key_values => [ { name => 'failures' } ],
output_template => 'failures: %s',
perfdatas => [
{ label => 'failures', template => '%s', min => 0 }
{ template => '%s', min => 0 }
]
}
},
@ -114,10 +114,10 @@ sub set_counters {
key_values => [ { name => 'errors' } ],
output_template => 'errors: %s',
perfdatas => [
{ label => 'errors', template => '%s', min => 0 }
{ template => '%s', min => 0 }
]
}
},
}
];
$self->{maps_counters}->{steps} = [
@ -125,8 +125,7 @@ sub set_counters {
key_values => [ { name => 'time_taken' }, { name => 'step' } ],
output_template => 'execution time: %s ms',
perfdatas => [
{ label => 'step_time', template => '%s',
min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'step' }
{ template => '%s', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'step' }
]
}
}
@ -135,7 +134,7 @@ sub set_counters {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
@ -156,8 +155,8 @@ sub new {
'warning-run-status:s' => { name => 'warning_run_status' },
'critical-run-status:s' => { name => 'critical_run_status', default => '' }
});
$self->{http} = centreon::plugins::http->new(%options);
$self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl');
$self->set_signal_handlers();
return $self;
}
@ -203,12 +202,12 @@ sub check_options {
$self->{option_results}->{retries_scenario_status} < 0) {
$self->{option_results}->{retries_scenario_status} = 0;
}
if (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^\d+$/ &&
$self->{option_results}->{timeout} > 0) {
alarm($self->{option_results}->{timeout});
}
$self->{http}->set_options(port => $self->{option_results}->{sahi_port}, proto => $self->{option_results}->{sahi_proto});
}
@ -229,7 +228,7 @@ sub decode_xml_response {
sub generate_user_defined_id {
my ($self, %options) = @_;
my ($seconds, $microseconds) = Time::HiRes::gettimeofday();
my $user_defined_id = strftime('%d%B%Y__%H_%M_%S_', localtime($seconds));
$user_defined_id .= $microseconds;
@ -463,19 +462,19 @@ IP Addr/FQDN of the host
=item B<--sahi-port>
Port used (Default: 9999)
Port used (default: 9999)
=item B<--sahi-proto>
Specify https if needed (Default: 'http')
Define HTTPS if needed (default: 'http')
=item B<--sahi-endpoint>
Specify endpoint (Default: '/_s_/dyn/')
Define endpoint (default: '/_s_/dyn/')
=item B<--sahi-suite>
Full path to scenario and scenario name (Required)
Define path for scenario files (required. Example: 'sahitests/small.suite')
=item B<--sahi-http-timeout>
@ -483,35 +482,35 @@ Timeout for each HTTP requests (Default: 5)
=item B<--sahi-threads>
Number of simultaneous browser instances that can be executed (Default: 1)
Number of simultaneous browser instances that can be executed (default: 1)
=item B<--sahi-startwith>
Specify the start mode (Default: BROWSER)
Define the start mode (Default: BROWSER)
=item B<--sahi-browsertype>
Browser on which scripts will be executed (Default: chrome)
Browser used for script executions (Default: chrome)
=item B<--sahi-baseurl>
Url where the script should start
Define default Start URL for scripts
=item B<--timeout>
Specify the global script timeout. If timeout is reached, scenario is killed.
Define the global script timeout. If timeout is reached, scenario is killed.
=item B<--retries-scenario-status>
Specify the number of retries to get scenario status (if we fail to get the status).
Define the number of retries to get scenario status (if we fail to get the status).
=item B<--interval-scenario-status>
Specify time interval to get scenario status in seconds (Default: 10).
Define time interval to get scenario status in seconds (default: 10).
=item B<--unknown-run-status>
Threshold unknown for running scenario rest api response.
Unknown threshold for running scenario rest api response.
(Default: '%{http_code} < 200 or %{http_code} >= 300')
=item B<--warning-run-status>
@ -524,17 +523,17 @@ Critical threshold for running scenario rest api response.
=item B<--warning-status>
Set warning threshold for scenario status.
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{status}.
=item B<--critical-status>
Set critical threshold for scenario status (Default: '%{status} ne "SUCCESS"').
Define the conditions to match for the status to be CRITICAL (default: '%{status} ne "SUCCESS"').
You can use the following variables: %{status}.
=item B<--warning-*> B<--critical-*>
Set thresholds.
Thresholds.
Can be: 'total-time', 'total-steps', 'failures', 'errors', 'step-time'.
=back

View File

@ -29,7 +29,6 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
$self->{modes} = {
'scenario' => 'apps::sahipro::restapi::mode::scenario'
};

View File

@ -169,13 +169,11 @@ Define the OID that will be used to name the interfaces (default: ifDesc) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -85,13 +85,11 @@ Define the OID to be used to filter interfaces (default: ifDesc) (values: ifDesc
Define the OID that will be used to name the interfaces (default: ifDesc) (values: ifDesc, ifAlias, ifName).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--add-extra-oid>

View File

@ -102,13 +102,11 @@ Choose OID used to filter storage (default: hrStorageDescr) (values: hrStorageDe
Choose OID used to display storage (default: hrStorageDescr) (values: hrStorageDescr, hrFSMountPoint).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the storage name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='dev' --display-transform-dst='run' will replace all occurrences of 'dev' with 'run'
=item B<--show-cache>

View File

@ -177,13 +177,11 @@ Define the OID that will be used to name the interfaces (default: ifDesc) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -85,13 +85,11 @@ Define the OID to be used to filter interfaces (default: ifDesc) (values: ifDesc
Define the OID that will be used to name the interfaces (default: ifDesc) (values: ifDesc, ifAlias, ifName).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--add-extra-oid>

View File

@ -448,13 +448,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -176,13 +176,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -299,13 +299,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -60,7 +60,7 @@ sub custom_select_perfdata {
return if (!defined($self->{result_values}->{config}->{perfdatas}));
foreach (@{$self->{result_values}->{config}->{perfdatas}}) {
next if (!defined($_->{value}) || $_->{value} !~ /^\d+(?:\.\d+)?$/);
next if (!defined($_->{value}) || $_->{value} !~ /^[+-]?\d+(?:\.\d+)?$/);
$self->{output}->perfdata_add(%$_);
}
}

View File

@ -68,8 +68,8 @@ sub run {
if (length($self->{option_results}->{event_type}) || length($self->{option_results}->{error_message})) {
$count = 0;
foreach my $event (@{$self->{events}}) {
if ((defined($self->{option_results}->{event_type}) && length($self->{option_results}->{event_type}) && ($event->{eventType} eq $self->{option_results}->{event_type}))
|| (defined($self->{option_results}->{error_message}) && length($self->{option_results}->{error_message}) && ($event->{errorMessage} =~ $self->{option_results}->{error_message}))) {
if ((length($self->{option_results}->{event_type}) && ($event->{eventType} eq $self->{option_results}->{event_type}))
|| (length($self->{option_results}->{error_message}) && length($event->{errorMessage}) && $event->{errorMessage} =~ $self->{option_results}->{error_message})) {
$count++;
}
}

View File

@ -44,14 +44,6 @@ sub get_metrics_mapping {
'unit' => 'B',
'min' => '0',
'max' => '',
},
'privatebytes' => {
'output' => 'Private Bytes',
'label' => 'app-private-bytes',
'nlabel' => 'appservice.memory.privatebytes.usage.bytes',
'unit' => 'B',
'min' => '0',
'max' => '',
}
};
@ -146,12 +138,12 @@ Set resource group (Required if resource's name is used).
=item B<--warning-*>
Warning threshold where '*' can be:
'app-average-memory', 'app-memory', 'app-private-bytes'.
'app-average-memory', 'app-memory'.
=item B<--critical-*>
Critical threshold where '*' can be:.
'app-average-memory', 'app-memory', 'app-private-bytes'.
'app-average-memory', 'app-memory'.
=back

View File

@ -56,7 +56,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -73,11 +73,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;
@ -97,7 +96,7 @@ sub check_options {
}
my $resource_mapping = {
'servers' => [ 'active_connections', 'connections_failed' ],
'servers' => [ 'active_connections', 'connections_failed' ]
};
my $metrics_mapping_transformed;

View File

@ -50,7 +50,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -67,11 +67,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;

View File

@ -50,7 +50,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -67,11 +67,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;

View File

@ -50,7 +50,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -67,11 +67,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;

View File

@ -49,7 +49,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -66,11 +66,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;
@ -90,7 +89,7 @@ sub check_options {
}
my $resource_mapping = {
'servers' => [ 'seconds_behind_master' ],
'servers' => [ 'seconds_behind_master' ]
};
my $metrics_mapping_transformed;

View File

@ -91,7 +91,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -108,11 +108,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;
@ -132,9 +131,10 @@ sub check_options {
}
my $resource_mapping = {
'servers' => [ 'backup_storage_used', 'serverlog_storage_limit', 'serverlog_storage_percent',
'serverlog_storage_usage', 'storage_limit', 'storage_percent', 'storage_used'
],
'servers' => [
'backup_storage_used', 'serverlog_storage_limit', 'serverlog_storage_percent',
'serverlog_storage_usage', 'storage_limit', 'storage_percent', 'storage_used'
]
};
my $metrics_mapping_transformed;

View File

@ -34,14 +34,14 @@ sub get_metrics_mapping {
'label' => 'traffic-out',
'nlabel' => 'azmariadb.traffic.out.bytes',
'unit' => 'B',
'min' => '0',
'min' => '0'
},
'network_bytes_ingress' => {
'output' => 'Network In',
'label' => 'traffic-in',
'nlabel' => 'azmariadb.traffic.in.bytes',
'unit' => 'B',
'min' => '0',
'min' => '0'
}
};
@ -56,7 +56,7 @@ sub new {
$options{options}->add_options(arguments => {
'filter-metric:s' => { name => 'filter_metric' },
'resource:s' => { name => 'resource' },
'resource-group:s' => { name => 'resource_group' },
'resource-group:s' => { name => 'resource_group' }
});
return $self;
@ -73,11 +73,10 @@ sub check_options {
my $resource = $self->{option_results}->{resource};
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
my $resource_type = $self->{option_results}->{resource_type};
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/(.*)\/(.*)$/) {
my $resource_type = 'servers';
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforMariaDB\/servers\/(.*)$/) {
$resource_group = $1;
$resource_type = 'servers';
$resource = $3;
$resource = $2;
}
$self->{az_resource} = $resource;

View File

@ -0,0 +1,258 @@
{
"mapping": {
"eqptSlotPowerStatus": {
"1": "powerUp",
"2": "powerDown"
},
"eqptBoardAdminStatus": {
"1": "unlock",
"2": "lock"
},
"eqptBoardOperStatus": {
"1": "operUp",
"2": "operDown"
},
"eqptBoardOperError": {
"1": "no-error",
"2": "type-mismatch",
"3": "board-missing",
"4": "board-installation-missing",
"5": "no-planned-board",
"6": "waiting-for-sw",
"7": "init-boot-failed",
"8": "init-download-failed",
"9": "init-connection-failed",
"10": "init-configuration-failed",
"11": "board-reset-protection",
"12": "invalid-parameter",
"13": "temperature-alarm",
"14": "tempshutdown",
"15": "defense",
"16": "board-not-licensed",
"17": "sem-power-fail",
"18": "sem-ups-fail",
"19": "board-in-incompatible-slot",
"21": "download-ongoing",
"255": "unknown-error"
},
"eqptBoardAvailStatus": {
"1": "available",
"2": "inTest",
"3": "failed",
"4": "powerOff",
"5": "notInstalled",
"6": "offLine",
"7": "dependency"
},
"eqptBoardRestart": {
"1": "with-selftest",
"2": "without-selftest",
"5": "hot-restart",
"255": "initialValue"
},
"eqptBoardLastRestartCause": {
"1": "poweron",
"2": "unknown",
"3": "watchdog",
"4": "coldreset",
"5": "warmreset",
"6": "hotreset",
"7": "hotreload",
"8": "cleandata",
"9": "emergencybuild",
"10": "poweronreset",
"11": "commitfailure",
"12": "timezonemodified"
},
"eqptBoardContainerOffset": {
"0": "iont:1/1",
"1": "nt-a",
"2": "nt-b",
"3": "lt:1/1/1",
"4": "lt:1/1/2",
"5": "lt:1/1/3",
"6": "lt:1/1/4",
"7": "lt:1/1/5",
"8": "lt:1/1/6",
"9": "lt:1/1/7",
"10": "lt:1/1/8",
"11": "lt:1/1/12",
"12": "lt:1/1/13",
"13": "lt:1/1/14",
"14": "lt:1/1/15",
"15": "lt:1/1/16",
"16": "lt:1/1/17",
"17": "lt:1/1/18",
"18": "lt:1/1/19"
}
},
"constants": {
"warningStatus": "operDown",
"filtereqptSlotPlannedType": "NOT_PLANNED"
},
"snmp": {
"tables": [
{
"name": "eqptBoardEntry",
"oid": ".1.3.6.1.4.1.637.61.1.23.3.1",
"used_instance": "\\.(\\d+)$",
"entries" :[
{ "name": "eqptSlotPlannedType", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.2" },
{ "name": "eqptSlotActualType", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.3" },
{ "name": "eqptSlotPowerStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.4", "map": "eqptSlotPowerStatus" },
{ "name": "eqptBoardAdminStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.5", "map": "eqptBoardAdminStatus" },
{ "name": "eqptBoardOperStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.6", "map": "eqptBoardOperStatus" },
{ "name": "eqptBoardOperError", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.7", "map": "eqptBoardOperError" },
{ "name": "eqptBoardAvailStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.8", "map": "eqptBoardAvailStatus" },
{ "name": "eqptBoardRestart", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.9", "map": "eqptBoardRestart" },
{ "name": "eqptBoardContainerOffset", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.12", "map": "eqptBoardContainerOffset" },
{ "name": "eqptBoardInventoryTypeName", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.14" },
{ "name": "eqptBoardInventoryPBACode", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.15" },
{ "name": "eqptBoardInventorySerialNumber", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.19" },
{ "name": "eqptBoardLastRestartCause", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.24", "map": "eqptBoardLastRestartCause" },
{ "name": "eqptBoardLastRestartTime", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.25" }
]
},
{
"name": "eqptBoardThermalSensorEntry",
"oid": ".1.3.6.1.4.1.637.61.1.23.10.1",
"used_instance": "\\.(\\d+\\.\\d+)$",
"entries" :[
{ "name": "eqptBoardThermalSensorId", "oid": ".1.3.6.1.4.1.637.61.1.23.10.1.1" },
{ "name": "eqptBoardThermalSensorActualTemperature", "oid": ".1.3.6.1.4.1.637.61.1.23.10.1.2" },
{ "name": "eqptBoardThermalSensorTcaThresholdLow", "oid": ".1.3.6.1.4.1.637.61.1.23.10.1.3" },
{ "name": "eqptBoardThermalSensorTcaThresholdHigh", "oid": ".1.3.6.1.4.1.637.61.1.23.10.1.4" },
{ "name": "eqptBoardThermalSensorShutdownThresholdLow", "oid": ".1.3.6.1.4.1.637.61.1.23.10.1.5" },
{ "name": "eqptBoardThermalSensorShutdownThresholdHigh", "oid": ".1.3.6.1.4.1.637.61.1.23.10.1.6" }
],
"instance_entries": {
"re": "\\.(\\d+)\\.(\\d+)$",
"entries": [
{ "name": "slotId", "capture": "1" },
{ "name": "thermalSensorId", "capture": "2" }
]
}
}
]
},
"selection": [
{
"name": "operUp",
"functions": [
{
"type": "count",
"src": "%(snmp.tables.eqptBoardEntry)",
"filter": "%(src.eqptBoardOperStatus) eq %(name)",
"save": "%(numOperUp)"
}
],
"perfdatas": [
{
"nlabel": "isam.device.%(name).count",
"value": "%(numOperUp)",
"min": 0
}
],
"formatting": {
"printf_msg": "Number of %s cards: %d",
"printf_var": [
"%(name)",
"%(numOperUp)"
],
"display_ok": false
}
},
{
"name": "operDown",
"functions": [
{
"type": "count",
"src": "%(snmp.tables.eqptBoardEntry)",
"filter": "%(src.eqptSlotPlannedType) ne %(constants.filtereqptSlotPlannedType) and %(src.eqptBoardOperStatus) eq %(name)",
"save": "%(numOperDown)"
}
],
"perfdatas": [
{
"nlabel": "isam.device.%(name).count",
"value": "%(numOperDown)",
"min": 0
}
],
"formatting": {
"printf_msg": "Number of %s cards: %d",
"printf_var": [
"%(name)",
"%(numOperDown)"
],
"display_ok": false
}
}
],
"selection_loop": [
{
"name": "eqptBoardTable",
"source": "%(snmp.tables.eqptBoardEntry)",
"expand_table": {
"eqptBoardEntry": "%(snmp.tables.eqptBoardEntry.[%(eqptBoardEntry.instance)])"
},
"warning": "%(eqptBoardEntry.eqptSlotPlannedType) ne %(constants.filtereqptSlotPlannedType) and %(eqptBoardEntry.eqptBoardOperStatus) eq %(constants.warningStatus)",
"filter": "%(eqptBoardEntry.eqptSlotPlannedType) ne %(constants.filtereqptSlotPlannedType)",
"formatting": {
"printf_msg": "Card %s (%s): status is %s (%s), power status is %s, planned is %s",
"printf_var": [
"%(eqptBoardEntry.eqptSlotActualType)",
"%(eqptBoardEntry.eqptBoardContainerOffset)",
"%(eqptBoardEntry.eqptBoardOperStatus)",
"%(eqptBoardEntry.eqptBoardOperError)",
"%(eqptBoardEntry.eqptSlotPowerStatus)",
"%(eqptBoardEntry.eqptSlotPlannedType)"
],
"display_ok": true
}
},
{
"name": "eqptBoardThermalSensorTable",
"source": "%(snmp.tables.eqptBoardThermalSensorEntry)",
"expand_table": {
"eqptBoardThermalSensorEntry": "%(snmp.tables.eqptBoardThermalSensorEntry.[%(eqptBoardThermalSensorEntry.instance)])",
"eqptBoardEntry": "%(snmp.tables.eqptBoardEntry.[%(eqptBoardThermalSensorEntry.slotId)])"
},
"perfdatas": [
{
"nlabel": "%(eqptBoardEntry.eqptBoardContainerOffset).%(eqptBoardThermalSensorEntry.thermalSensorId).temp",
"instances":
[
"%(eqptBoardEntry.eqptBoardContainerOffset)",
"%(eqptBoardThermalSensorEntry.thermalSensorId)"
],
"value": "%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorActualTemperature)",
"warning": "%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorTcaThresholdLow)",
"critical": "%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorShutdownThresholdLow)",
"min": 0,
"unit": "°C"
}
],
"warning": "%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorActualTemperature) > (%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorShutdownThresholdLow) - %(eqptBoardThermalSensorEntry.eqptBoardThermalSensorShutdownThresholdLow) * 0.10)",
"critical": "%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorActualTemperature) > (%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorShutdownThresholdLow) - %(eqptBoardThermalSensorEntry.eqptBoardThermalSensorShutdownThresholdLow) * 0.05)",
"formatting": {
"printf_msg": "Card %s (%s): sensor #%s temperature is %s°C (shutdown at %s°C)\n",
"printf_var": [
"%(eqptBoardEntry.eqptSlotActualType)",
"%(eqptBoardEntry.eqptBoardContainerOffset)",
"%(eqptBoardThermalSensorEntry.thermalSensorId)",
"%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorActualTemperature)",
"%(eqptBoardThermalSensorEntry.eqptBoardThermalSensorShutdownThresholdLow)"
],
"display_ok": false
}
}
],
"formatting": {
"custom_message_global": "All ISAM Boards are OK",
"separator": "-"
}
}

View File

@ -1,178 +0,0 @@
{
"mapping": {
"eqptSlotPowerStatus": {
"1": "powerUp",
"2": "powerDown"
},
"eqptBoardAdminStatus": {
"1": "unlock",
"2": "lock"
},
"eqptBoardOperStatus": {
"1": "operUp",
"2": "operDown"
},
"eqptBoardOperError": {
"1": "no-error",
"2": "type-mismatch",
"3": "board-missing",
"4": "board-installation-missing",
"5": "no-planned-board",
"6": "waiting-for-sw",
"7": "init-boot-failed",
"8": "init-download-failed",
"9": "init-connection-failed",
"10": "init-configuration-failed",
"11": "board-reset-protection",
"12": "invalid-parameter",
"13": "temperature-alarm",
"14": "tempshutdown",
"15": "defense",
"16": "board-not-licensed",
"17": "sem-power-fail",
"18": "sem-ups-fail",
"19": "board-in-incompatible-slot",
"21": "download-ongoing",
"255": "unknown-error"
},
"eqptBoardAvailStatus": {
"1": "available",
"2": "inTest",
"3": "failed",
"4": "powerOff",
"5": "notInstalled",
"6": "offLine",
"7": "dependency"
},
"eqptBoardRestart": {
"1": "with-selftest",
"2": "without-selftest",
"5": "hot-restart",
"255": "initialValue"
},
"eqptBoardLastRestartCause": {
"1": "poweron",
"2": "unknown",
"3": "watchdog",
"4": "coldreset",
"5": "warmreset",
"6": "hotreset",
"7": "hotreload",
"8": "cleandata",
"9": "emergencybuild",
"10": "poweronreset",
"11": "commitfailure",
"12": "timezonemodified"
}
},
"constants": {
"criticalStatus": "operDown"
},
"snmp": {
"tables": [
{
"name": "eqptBoardEntry",
"oid": ".1.3.6.1.4.1.637.61.1.23.3.1",
"used_instance": "\\.(\\d+)$",
"entries" :[
{ "name": "eqptSlotPlannedType", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.2" },
{ "name": "eqptSlotActualType", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.3" },
{ "name": "eqptSlotPowerStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.4", "map": "eqptSlotPowerStatus" },
{ "name": "eqptBoardAdminStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.5", "map": "eqptBoardAdminStatus" },
{ "name": "eqptBoardOperStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.6", "map": "eqptBoardOperStatus" },
{ "name": "eqptBoardOperError", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.7", "map": "eqptBoardOperError" },
{ "name": "eqptBoardAvailStatus", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.8", "map": "eqptBoardAvailStatus" },
{ "name": "eqptBoardRestart", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.9", "map": "eqptBoardRestart" },
{ "name": "eqptBoardContainerOffset", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.12" },
{ "name": "eqptBoardInventoryTypeName", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.14" },
{ "name": "eqptBoardInventoryPBACode", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.15" },
{ "name": "eqptBoardInventorySerialNumber", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.19" },
{ "name": "eqptBoardLastRestartCause", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.24", "map": "eqptBoardLastRestartCause" },
{ "name": "eqptBoardLastRestartTime", "oid": ".1.3.6.1.4.1.637.61.1.23.3.1.25" }
]
}
]
},
"selection": [
{
"name": "operUp",
"functions": [
{
"type": "count",
"src": "%(snmp.tables.eqptBoardEntry)",
"filter": "%(src.eqptBoardOperStatus) eq %(name)",
"save": "%(numOperUp)"
}
],
"perfdatas": [
{
"nlabel": "isam.device.%(name).count",
"value": "%(numOperUp)",
"min": 0
}
],
"formatting": {
"printf_msg": "Number of %s device: %d",
"printf_var": [
"%(name)",
"%(numOperUp)"
],
"display_ok": false
}
},
{
"name": "operDown",
"functions": [
{
"type": "count",
"src": "%(snmp.tables.eqptBoardEntry)",
"filter": "%(src.eqptBoardOperStatus) eq %(name)",
"save": "%(numOperDown)"
}
],
"perfdatas": [
{
"nlabel": "isam.device.%(name).count",
"value": "%(numOperDown)",
"min": 0
}
],
"formatting": {
"printf_msg": "Number of %s device: %d",
"printf_var": [
"%(name)",
"%(numOperDown)"
],
"display_ok": false
}
}
],
"selection_loop": [
{
"name": "eqptSlot ISAM",
"source": "%(snmp.tables.eqptBoardEntry)",
"expand_table": {
"eqptBoardEntry": "%(snmp.tables.eqptBoardEntry.[%(eqptBoardEntry.instance)])"
},
"critical": "%(eqptBoardEntry.eqptBoardOperStatus) =~ /%(constants.criticalStatus)/",
"formatting": {
"printf_msg": "Card %s (slot%s): status is %s (%s), power status is %s",
"printf_var": [
"%(eqptBoardEntry.eqptSlotActualType)",
"%(eqptBoardEntry.eqptBoardContainerOffset)",
"%(eqptBoardEntry.eqptBoardOperStatus)",
"%(eqptBoardEntry.eqptBoardOperError)",
"%(eqptBoardEntry.eqptSlotPowerStatus)"
],
"display_ok": true
}
}
],
"formatting": {
"custom_message_global": "All ISAM Boards are OK",
"separator": "-"
}
}

View File

@ -24,6 +24,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use DateTime::Format::Strptime;
use DateTime;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
@ -187,15 +188,31 @@ sub set_counters {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'replace-lasttime-format:s' => { name => 'replace_lasttime_format' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
my $pattern = '%m/%d/%Y';
if (defined($self->{option_results}->{replace_lasttime_format}) && $self->{option_results}->{replace_lasttime_format} ne '') {
$pattern = $self->{option_results}->{replace_lasttime_format};
}
$self->{strp} = DateTime::Format::Strptime->new(
pattern => $pattern,
on_error => 'undef'
);
}
my $map_battery_status = {
1 => 'unknown', 2 => 'batteryNormal', 3 => 'batteryLow'
};
@ -313,10 +330,17 @@ sub manage_selection {
if (defined($result->{upsBasicBatteryTimeOnBattery}));
$result2->{upsAdvBatteryRunTimeRemaining} = sprintf("%.0f", $result2->{upsAdvBatteryRunTimeRemaining} / 100 / 60)
if (defined($result2->{upsAdvBatteryRunTimeRemaining}));
$result2->{upsAdvBatteryReplaceIndicator} = 'n/a'
if (!defined($result2->{upsAdvBatteryReplaceIndicator}));
$self->{global} = { %$result, %$result2 };
if (defined($result->{upsBasicBatteryLastReplaceDate}) && $result->{upsBasicBatteryLastReplaceDate} =~ /(\d{2})\/(\d{2})\/(\d{4})/) {
my $dt = DateTime->new(year => $3, month => $1, day => $2, hour => 0, minute => 0, second => 0);
$self->{global}->{last_replace_time} = time() - $dt->epoch;
if (defined($result->{upsBasicBatteryLastReplaceDate}) && $result->{upsBasicBatteryLastReplaceDate} ne '') {
my $dt = $self->{strp}->parse_datetime($result->{upsBasicBatteryLastReplaceDate});
if (defined($dt)) {
$self->{global}->{last_replace_time} = time() - $dt->epoch();
} else {
$self->{output}->output_add(long_msg => "cannot parse date: " . $result->{upsBasicBatteryLastReplaceDate} . ' (please use option --replace-lasttime-format)');
}
}
$self->add_battery_pack(snmp_result => $snmp_result);
@ -338,6 +362,10 @@ Check battery status and battery charge remaining.
Only display some counters (regexp can be used).
Example: --filter-counters='^status|load$'
=item B<--replace-lasttime-format>
Define the date format (default: '%m/%d/%Y').
=item B<--unknown-status>
Define the conditions to match for the status to be UNKNOWN (Default: '%{status} =~ /unknown/i').

View File

@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
@ -32,68 +32,172 @@ sub custom_status_output {
return sprintf("last input line fail cause is '%s'", $self->{result_values}->{last_cause});
}
sub input_long_output {
my ($self, %options) = @_;
return sprintf(
"checking input line '%s' [type: %s]",
$options{instance_value}->{inputNum},
$options{instance_value}->{inputType}
);
}
sub input_bpack_output {
my ($self, %options) = @_;
return sprintf(
"input line '%s' [type: %s] ",
$options{instance_value}->{inputNum},
$options{instance_value}->{inputType}
);
}
sub prefix_phase_output {
my ($self, %options) = @_;
return "phase '" . $options{instance_value}->{phaseNum} . "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'inputs', type => 3, cb_prefix_output => 'prefix_input_output', cb_long_output => 'input_long_output', indent_long_output => ' ', message_multiple => 'All inputs are ok',
group => [
{ name => 'input_global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'phases', display_long => 1, cb_prefix_output => 'prefix_phase_output', message_multiple => 'phases are ok', type => 1, skipped_code => { -10 => 1 } }
]
}
];
$self->{maps_counters}->{global} = [
{ label => 'voltage', set => {
{ label => 'voltage', nlabel => 'lines.input.voltage.volt', set => {
key_values => [ { name => 'voltage' } ],
output_template => 'voltage: %s V',
perfdatas => [
{ label => 'voltage', value => 'voltage', template => '%s',
unit => 'V' },
],
{ template => '%s', unit => 'V' }
]
}
},
{ label => 'frequence', set => {
{ label => 'frequence', nlabel => 'lines.input.frequence.hertz', set => {
key_values => [ { name => 'frequency' } ],
output_template => 'frequence: %s Hz',
perfdatas => [
{ label => 'frequence', value => 'frequency', template => '%s',
unit => 'Hz' },
],
{ template => '%s', unit => 'Hz' }
]
}
},
{ label => 'status', threshold => 0, set => {
{ label => 'status', type => 2, set => {
key_values => [ { name => 'last_cause' } ],
closure_custom_calc => \&catalog_status_calc,
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
];
$self->{maps_counters}->{input_global} = [
{ label => 'line-frequence', nlabel => 'line.input.frequence.hertz', set => {
key_values => [ { name => 'frequency' }, { name => 'inputNum' }, { name => 'inputType' } ],
output_template => 'frequence: %s Hz',
closure_custom_perfdata => sub {
my ($self, %options) = @_;
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
unit => 'Hz',
instances => [$self->{result_values}->{inputType} . '.' . $self->{result_values}->{inputNum}],
value => sprintf('%s', $self->{result_values}->{frequency}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel})
);
}
}
}
];
$self->{maps_counters}->{phases} = [
{ label => 'line-phase-voltage', nlabel => 'line.input.voltage.volt', set => {
key_values => [
{ name => 'voltage' }, { name => 'inputNum' },
{ name => 'inputType' }, { name => 'phaseNum' }
],
output_template => 'voltage: %s V',
closure_custom_perfdata => sub {
my ($self, %options) = @_;
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
unit => 'V',
instances => [$self->{result_values}->{inputType} . '.' . $self->{result_values}->{inputNum}, $self->{result_values}->{phaseNum}],
value => sprintf('%s', $self->{result_values}->{voltage}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel})
);
}
}
},
{ label => 'line-phase-current', nlabel => 'line.input.current.ampere', set => {
key_values => [
{ name => 'current' }, { name => 'inputNum' },
{ name => 'inputType' }, { name => 'phaseNum' }
],
output_template => 'current: %s A',
closure_custom_perfdata => sub {
my ($self, %options) = @_;
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
unit => 'A',
instances => [$self->{result_values}->{inputType} . '.' . $self->{result_values}->{inputNum}, $self->{result_values}->{phaseNum}],
value => sprintf('%s', $self->{result_values}->{current}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel})
);
}
}
},
{ label => 'line-phase-power', nlabel => 'line.input.power.watt', set => {
key_values => [
{ name => 'power' }, { name => 'inputNum' },
{ name => 'inputType' }, { name => 'phaseNum' }
],
output_template => 'power: %.2f W',
closure_custom_perfdata => sub {
my ($self, %options) = @_;
$self->{output}->perfdata_add(
nlabel => $self->{nlabel},
unit => 'W',
instances => [$self->{result_values}->{inputType} . '.' . $self->{result_values}->{inputNum}, $self->{result_values}->{phaseNum}],
value => sprintf('%.2f', $self->{result_values}->{power}),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel})
);
}
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '' },
});
$options{options}->add_options(arguments => {});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status']);
}
my $map_status = {
1 => 'noTransfer', 2 => 'highLineVoltage', 3 => 'brownout', 4 => 'blackout',
5 => 'smallMomentarySag', 6 => 'deepMomentarySag', 7 => 'smallMomentarySpike',
8 => 'largeMomentarySpike', 9 => 'selfTest', 10 => 'rateOfVoltageChange',
};
my $map_input_type = { 1 => 'unknown', 2 => 'main', 3 => 'bypass' };
my $mapping = {
upsAdvInputLineVoltage => { oid => '.1.3.6.1.4.1.318.1.1.1.3.2.1' },
@ -102,7 +206,16 @@ my $mapping = {
upsAdvConfigHighTransferVolt => { oid => '.1.3.6.1.4.1.318.1.1.1.5.2.2' },
upsAdvConfigLowTransferVolt => { oid => '.1.3.6.1.4.1.318.1.1.1.5.2.3' },
upsHighPrecInputLineVoltage => { oid => '.1.3.6.1.4.1.318.1.1.1.3.3.1' },
upsHighPrecInputFrequency => { oid => '.1.3.6.1.4.1.318.1.1.1.3.3.4' },
upsHighPrecInputFrequency => { oid => '.1.3.6.1.4.1.318.1.1.1.3.3.4' }
};
my $mapping_input = {
frequency => { oid => '.1.3.6.1.4.1.318.1.1.1.9.2.2.1.4' }, # upsPhaseInputFrequency
type => { oid => '.1.3.6.1.4.1.318.1.1.1.9.2.2.1.5', map => $map_input_type } # upsPhaseInputType
};
my $mapping_input_phase = {
voltage => { oid => '.1.3.6.1.4.1.318.1.1.1.9.2.3.1.3' }, # upsPhaseInputVoltage
current => { oid => '.1.3.6.1.4.1.318.1.1.1.9.2.3.1.6' }, # upsPhaseInputCurrent
power => { oid => '.1.3.6.1.4.1.318.1.1.1.9.2.3.1.9' } # upsPhaseInputPower
};
sub manage_selection {
@ -130,6 +243,53 @@ sub manage_selection {
frequency => defined($result->{upsHighPrecInputFrequency}) && $result->{upsHighPrecInputFrequency} =~ /\d/ ?
$result->{upsHighPrecInputFrequency} * 0.1 : $result->{upsAdvInputFrequency},
};
my $oid_inputTable = '.1.3.6.1.4.1.318.1.1.1.9.2.2.1';
$snmp_result = $options{snmp}->get_table(
oid => $oid_inputTable,
start => $mapping_input->{frequency}->{oid},
end => $mapping_input->{type}->{oid}
);
$self->{inputs} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping_input->{type}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping_input, results => $snmp_result, instance => $instance);
$self->{inputs}->{$instance} = {
inputNum => $instance,
inputType => $result->{type},
input_global => {
inputNum => $instance,
inputType => $result->{type},
frequency => defined($result->{frequency}) && $result->{frequency} != -1 ? $result->{frequency} * 0.1 : undef
},
phases => {}
};
}
my $oid_inputPhaseTable = '.1.3.6.1.4.1.318.1.1.1.9.2.3.1';
$snmp_result = $options{snmp}->get_table(
oid => $oid_inputPhaseTable,
start => $mapping_input_phase->{voltage}->{oid},
end => $mapping_input_phase->{power}->{oid}
);
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping_input_phase->{voltage}->{oid}\.(\d+)\.(\d+)$/);
my ($input_num, $phase_num) = ($1, $2);
my $result = $options{snmp}->map_instance(mapping => $mapping_input_phase, results => $snmp_result, instance => $input_num . '.' . $phase_num);
$self->{inputs}->{$input_num}->{phases}->{$phase_num} = {
inputNum => $input_num,
inputType => $self->{inputs}->{$input_num}->{inputType},
phaseNum => $phase_num,
voltage => defined($result->{voltage}) && $result->{voltage} != -1 ? $result->{voltage} : undef,
current => defined($result->{current}) && $result->{current} != -1 ? $result->{current} * 0.1 : undef,
power => defined($result->{power}) && $result->{power} != -1 ? $result->{power} : undef
};
}
}
1;
@ -149,18 +309,19 @@ Example: --filter-counters='^frequence|voltage$'
=item B<--warning-status>
Define the conditions to match for the status to be WARNING (Default: '').
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{last_cause}
=item B<--critical-status>
Define the conditions to match for the status to be CRITICAL (Default: '').
Define the conditions to match for the status to be CRITICAL.
You can use the following variables: %{last_cause}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'voltage', 'frequence'.
Can be: 'voltage', 'frequence', 'line-frequence',
'line-phase-voltage', 'line-phase-current', 'line-phase-power'.
=back

View File

@ -26,6 +26,14 @@ use strict;
use warnings;
use Date::Parse;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
sub get_target_time {
my ($self, %options) = @_;

View File

@ -24,66 +24,66 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
return sprintf("output status is '%s'", $self->{result_values}->{status});
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, skipped_code => { -10 => 1 } },
{ name => 'global', type => 0, skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'status', threshold => 0, set => {
{
label => 'status',
type => 2,
unknown_default => '%{status} =~ /unknown/i',
critical_default => '%{status} !~ /onLine|rebooting/i',
set => {
key_values => [ { name => 'status' } ],
closure_custom_calc => \&catalog_status_calc,
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'load', set => {
{ label => 'load', nlabel => 'lines.output.load.percentage', set => {
key_values => [ { name => 'load' } ],
output_template => 'load: %s %%',
perfdatas => [
{ label => 'load', value => 'load', template => '%s',
min => 0, max => 100, unit => '%' },
],
{ template => '%s', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'current', set => {
{ label => 'current', nlabel => 'lines.output.current.ampere', set => {
key_values => [ { name => 'current' } ],
output_template => 'current: %s A',
perfdatas => [
{ label => 'current', value => 'current', template => '%s',
min => 0, unit => 'A' },
],
{ template => '%s', min => 0, unit => 'A' }
]
}
},
{ label => 'voltage', set => {
{ label => 'voltage', nlabel => 'lines.output.voltage.volt', set => {
key_values => [ { name => 'voltage' } ],
output_template => 'voltage: %s V',
perfdatas => [
{ label => 'voltage', value => 'voltage', template => '%s',
unit => 'V' },
],
{ template => '%s', unit => 'V' }
]
}
},
{ label => 'frequence', set => {
{ label => 'frequence', nlabel => 'lines.output.frequence.hertz', set => {
key_values => [ { name => 'frequency' } ],
output_template => 'frequence: %s Hz',
perfdatas => [
{ label => 'frequence', value => 'frequency', template => '%s',
unit => 'Hz' },
],
{ template => '%s', unit => 'Hz' }
]
}
},
}
];
}
@ -92,27 +92,16 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments => {
'unknown-status:s' => { name => 'unknown_status', default => '%{status} =~ /unknown/i' },
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '%{status} !~ /onLine|rebooting/i' },
});
$options{options}->add_options(arguments => {});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']);
}
my $map_status = {
1 => 'unknown', 2 => 'onLine', 3 => 'onBattery', 4 => 'onSmartBoost',
5 => 'timedSleeping', 6 => 'softwareBypass', 7 => 'off',
8 => 'rebooting', 9 => 'switchedBypass', 10 => 'hardwareFailureBypass',
11 => 'sleepingUntilPowerReturn', 12 => 'onSmartTrim',
11 => 'sleepingUntilPowerReturn', 12 => 'onSmartTrim'
};
my $mapping = {
@ -124,7 +113,7 @@ my $mapping = {
upsHighPrecOutputVoltage => { oid => '.1.3.6.1.4.1.318.1.1.1.4.3.1' }, # tenths of VAC
upsHighPrecOutputFrequency => { oid => '.1.3.6.1.4.1.318.1.1.1.4.3.2' }, # tenths of Hz
upsHighPrecOutputLoad => { oid => '.1.3.6.1.4.1.318.1.1.1.4.3.3' }, # tenths of percent
upsHighPrecOutputCurrent => { oid => '.1.3.6.1.4.1.318.1.1.1.4.3.4' }, # tenths of amperes
upsHighPrecOutputCurrent => { oid => '.1.3.6.1.4.1.318.1.1.1.4.3.4' } # tenths of amperes
};
sub manage_selection {

View File

@ -119,14 +119,14 @@ my $mapping = {
uioSensorStatusSensorName => { oid => '.1.3.6.1.4.1.318.1.1.25.1.2.1.3' },
uioSensorStatusTemperatureDegC => { oid => '.1.3.6.1.4.1.318.1.1.25.1.2.1.6' },
uioSensorStatusHumidity => { oid => '.1.3.6.1.4.1.318.1.1.25.1.2.1.7' },
uioSensorStatusAlarmStatus => { oid => '.1.3.6.1.4.1.318.1.1.25.1.2.1.9', map => $map_alarm_status },
uioSensorStatusAlarmStatus => { oid => '.1.3.6.1.4.1.318.1.1.25.1.2.1.9', map => $map_alarm_status }
};
my $mapping_iem = {
iemStatusProbeName => { oid => '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.2' },
iemStatusProbeStatus => { oid => '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.3', map => $map_iem_status },
iemStatusProbeCurrentTemp => { oid => '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.4' },
iemStatusProbeTempUnits => { oid => '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.5', map => $map_iem_unit },
iemStatusProbeCurrentHumid => { oid => '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.6' },
iemStatusProbeCurrentHumid => { oid => '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.6' }
};
my $oid_uioSensorStatusEntry = '.1.3.6.1.4.1.318.1.1.25.1.2.1';
my $oid_iemStatusProbesEntry = '.1.3.6.1.4.1.318.1.1.10.2.3.2.1';
@ -179,9 +179,10 @@ sub check_uoi {
)
);
}
$self->{output}->perfdata_add(
label => 'universal_temp', unit => 'C',
nlabel => 'sensor.universal.temperature.celsius',
nlabel => 'sensor.universal.temperature.celsius',
unit => 'C',
instances => $result->{uioSensorStatusSensorName},
value => $result->{uioSensorStatusTemperatureDegC},
warning => $warn,
@ -202,9 +203,10 @@ sub check_uoi {
)
);
}
$self->{output}->perfdata_add(
label => 'universal_humidity', unit => '%',
nlabel => 'sensor.universal.humidity.percentage',
unit => '%',
instances => $result->{uioSensorStatusSensorName},
value => $result->{uioSensorStatusHumidity},
warning => $warn,
@ -259,8 +261,8 @@ sub check_iem {
)
);
}
$self->{output}->perfdata_add(
label => 'integrated_temp',
unit => $result->{iemStatusProbeTempUnits} eq 'celsius' ? 'C' : 'F',
nlabel => 'sensor.integrated.temperature.' . $result->{iemStatusProbeTempUnits},
instances => $result->{iemStatusProbeName},
@ -283,9 +285,10 @@ sub check_iem {
)
);
}
$self->{output}->perfdata_add(
label => 'integrated_humidity', unit => '%',
nlabel => 'sensor.integrated.humidity.percentage',
unit => '%',
instances => $result->{iemStatusProbeName},
value => $result->{iemStatusProbeCurrentHumid},
warning => $warn,

View File

@ -0,0 +1,77 @@
#
# Copyright 2023 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package hardware::ups::apc::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>
Warning threshold.
=item B<--critical-uptime>
Critical threshold.
=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

@ -27,14 +27,13 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
$self->{modes} = {
'battery-status' => 'hardware::ups::apc::snmp::mode::batterystatus',
'input-lines' => 'hardware::ups::apc::snmp::mode::inputlines',
'output-lines' => 'hardware::ups::apc::snmp::mode::outputlines',
'sensors' => 'hardware::ups::apc::snmp::mode::sensors',
'time' => 'hardware::ups::apc::snmp::mode::ntp',
'uptime' => 'snmp_standard::mode::uptime'
'uptime' => 'hardware::ups::apc::snmp::mode::uptime'
};
return $self;

View File

@ -194,4 +194,4 @@ Default: ^(?!(UtilityPowerRestored|NoticeCondition|ReturnFromLowBattery|AlarmEnt
=back
=cut

View File

@ -24,12 +24,24 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
use centreon::plugins::misc;
sub custom_test_status_output {
my ($self, %options) = @_;
return sprintf(
'test status: %s [detail: %s]',
$self->{result_values}->{status},
$self->{result_values}->{detail}
);
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 }
{ name => 'global', type => 0, skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
@ -40,6 +52,18 @@ sub set_counters {
{ template => '%s', min => 0 }
]
}
},
{
label => 'test-status',
type => 2,
warning_default => '%{status} =~ /doneWarning|aborted/',
critical_default => '%{status} =~ /doneError/',
set => {
key_values => [ { name => 'status' }, { name => 'detail' } ],
closure_custom_output => $self->can('custom_test_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
]
}
@ -49,23 +73,84 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
$options{options}->add_options(arguments => {
'display-alarms' => { name => 'display_alarms' }
});
return $self;
}
my $map_test = {
1 => 'donePass', 2 => 'doneWarning', 3 => 'doneError',
4 => 'aborted', 5 => 'inProgress', 6 => 'noTestsInitiated'
};
my $map_alarm_desc = {
'.1.3.6.1.2.1.33.1.6.3.1' => 'batteryBad',
'.1.3.6.1.2.1.33.1.6.3.2' => 'onBattery',
'.1.3.6.1.2.1.33.1.6.3.3' => 'lowBattery',
'.1.3.6.1.2.1.33.1.6.3.4' => 'depletedBattery',
'.1.3.6.1.2.1.33.1.6.3.5' => 'tempBad',
'.1.3.6.1.2.1.33.1.6.3.6' => 'inputBad',
'.1.3.6.1.2.1.33.1.6.3.7' => 'outputBad',
'.1.3.6.1.2.1.33.1.6.3.8' => 'outputOverload',
'.1.3.6.1.2.1.33.1.6.3.9' => 'onBypass',
'.1.3.6.1.2.1.33.1.6.3.10' => 'bypassBad',
'.1.3.6.1.2.1.33.1.6.3.11' => 'outputOffAsRequested',
'.1.3.6.1.2.1.33.1.6.3.12' => 'upsOffAsRequested',
'.1.3.6.1.2.1.33.1.6.3.13' => 'chargerFailed',
'.1.3.6.1.2.1.33.1.6.3.14' => 'upsOutputOff',
'.1.3.6.1.2.1.33.1.6.3.15' => 'upsSystemOff',
'.1.3.6.1.2.1.33.1.6.3.16' => 'fanFailure',
'.1.3.6.1.2.1.33.1.6.3.17' => 'fuseFailure',
'.1.3.6.1.2.1.33.1.6.3.18' => 'generalFault',
'.1.3.6.1.2.1.33.1.6.3.19' => 'diagnosticTestFailed',
'.1.3.6.1.2.1.33.1.6.3.20' => 'communicationsLost',
'.1.3.6.1.2.1.33.1.6.3.21' => 'awaitingPower',
'.1.3.6.1.2.1.33.1.6.3.22' => 'shutdownPending',
'.1.3.6.1.2.1.33.1.6.3.23' => 'shutdownImminent',
'.1.3.6.1.2.1.33.1.6.3.24' => 'testInProgress'
};
sub manage_selection {
my ($self, %options) = @_;
my $oid_upsAlarmsPresent = '.1.3.6.1.2.1.33.1.6.1.0';
my $oid_upsTestResultsSummary = '.1.3.6.1.2.1.33.1.7.3.0';
my $oid_upsTestResultsDetail = '.1.3.6.1.2.1.33.1.7.4.0';
my $snmp_result = $options{snmp}->get_leef(
oids => [ $oid_upsAlarmsPresent ],
oids => [ $oid_upsAlarmsPresent, $oid_upsTestResultsSummary, $oid_upsTestResultsDetail ],
nothing_quit => 1
);
$self->{global} = {
current_alarms => $snmp_result->{$oid_upsAlarmsPresent}
};
if (defined($snmp_result->{$oid_upsTestResultsSummary}) && defined($map_test->{ $snmp_result->{$oid_upsTestResultsSummary} })) {
$self->{global}->{status} = $map_test->{ $snmp_result->{$oid_upsTestResultsSummary} };
$self->{global}->{detail} = defined($snmp_result->{$oid_upsTestResultsDetail}) && $snmp_result->{$oid_upsTestResultsDetail} ne '' ?
$snmp_result->{$oid_upsTestResultsDetail} : '-';
}
if ($snmp_result->{$oid_upsAlarmsPresent} > 0) {
my $oid_upsAlarmEntry = '.1.3.6.1.2.1.33.1.6.2.1';
my $oid_upsAlarmDescr = '.1.3.6.1.2.1.33.1.6.2.1.2';
my $oid_upsAlarmTime = '.1.3.6.1.2.1.33.1.6.2.1.3';
$snmp_result = $options{snmp}->get_table(oid => $oid_upsAlarmEntry);
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$oid_upsAlarmDescr\.(.*)$/);
if (defined($self->{option_results}->{display_alarms})) {
$self->{output}->output_add(
long_msg => sprintf(
'alarm [since: %s]: %s',
centreon::plugins::misc::change_seconds(value => $snmp_result->{$oid_upsAlarmTime . '.' . $1}),
$map_alarm_desc->{ $snmp_result->{$oid_upsAlarmDescr . '.' . $1} }
)
);
}
}
}
}
1;
@ -78,6 +163,25 @@ Check current alarms.
=over 8
=item B<--display-alarms>
Display alarms in verbose output.
=item B<--unknown-test-status>
Define the conditions to match for the status to be UNKNOWN.
You can use the following variables: %{status}, %{detail}
=item B<--warning-test-status>
Define the conditions to match for the status to be WARNING (default: '%{status} =~ /doneWarning|aborted/').
You can use the following variables: %{status}, %{detail}
=item B<--critical-test-status>
Define the conditions to match for the status to be CRITICAL (default: '%{status} =~ /doneError/').
You can use the following variables: %{status}, %{detail}
=item B<--warning-*> B<--critical-*>
Thresholds.

View File

@ -41,12 +41,20 @@ sub set_counters {
{ label => 'stdev', template => '%.2f' }
]
}
},
{ label => 'frequence', nlabel => 'lines.output.frequence.hertz', set => {
key_values => [ { name => 'frequency' } ],
output_template => 'frequence: %.2f Hz',
perfdatas => [
{ template => '%.2f', unit => 'Hz' }
]
}
}
];
$self->{maps_counters}->{oline} = [
{ label => 'load', nlabel => 'line.output.load.percentage', set => {
key_values => [ { name => 'upsOutputPercentLoad' } ],
key_values => [ { name => 'outputPercentLoad' } ],
output_template => 'load: %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
@ -54,7 +62,7 @@ sub set_counters {
}
},
{ label => 'current', nlabel => 'line.output.current.ampere', set => {
key_values => [ { name => 'upsOutputCurrent' } ],
key_values => [ { name => 'outputCurrent' } ],
output_template => 'current: %.2f A',
perfdatas => [
{ template => '%.2f', min => 0, unit => 'A', label_extra_instance => 1 }
@ -62,7 +70,7 @@ sub set_counters {
}
},
{ label => 'voltage', nlabel => 'line.output.voltage.volt', set => {
key_values => [ { name => 'upsOutputVoltage' } ],
key_values => [ { name => 'outputVoltage' } ],
output_template => 'voltage: %.2f V',
perfdatas => [
{ template => '%.2f', unit => 'V', label_extra_instance => 1 }
@ -70,7 +78,7 @@ sub set_counters {
}
},
{ label => 'power', nlabel => 'line.output.power.watt', set => {
key_values => [ { name => 'upsOutputPower' } ],
key_values => [ { name => 'outputPower' } ],
output_template => 'power: %.2f W',
perfdatas => [
{ template => '%.2f', unit => 'W', label_extra_instance => 1 }
@ -105,38 +113,41 @@ sub stdev {
my $total = 0;
my $num_present = scalar(keys %{$self->{oline}});
foreach my $instance (keys %{$self->{oline}}) {
next if (!defined($self->{oline}->{$instance}->{upsOutputPercentLoad}));
$total += $self->{oline}->{$instance}->{upsOutputPercentLoad};
next if (!defined($self->{oline}->{$instance}->{outputPercentLoad}));
$total += $self->{oline}->{$instance}->{outputPercentLoad};
}
my $mean = $total / $num_present;
$total = 0;
foreach my $instance (keys %{$self->{oline}}) {
next if (!defined($self->{oline}->{$instance}->{upsOutputPercentLoad}));
$total += ($mean - $self->{oline}->{$instance}->{upsOutputPercentLoad}) ** 2;
next if (!defined($self->{oline}->{$instance}->{outputPercentLoad}));
$total += ($mean - $self->{oline}->{$instance}->{outputPercentLoad}) ** 2;
}
my $stdev = sqrt($total / $num_present);
$self->{global} = { stdev => $stdev };
$self->{global}->{stdev} = $stdev;
}
my $mapping = {
upsOutputVoltage => { oid => '.1.3.6.1.2.1.33.1.4.4.1.2' }, # in Volt
upsOutputCurrent => { oid => '.1.3.6.1.2.1.33.1.4.4.1.3' }, # in dA
upsOutputPower => { oid => '.1.3.6.1.2.1.33.1.4.4.1.4' }, # in Watt
upsOutputPercentLoad => { oid => '.1.3.6.1.2.1.33.1.4.4.1.5' }
outputVoltage => { oid => '.1.3.6.1.2.1.33.1.4.4.1.2' }, # in Volt
outputCurrent => { oid => '.1.3.6.1.2.1.33.1.4.4.1.3' }, # in dA
outputPower => { oid => '.1.3.6.1.2.1.33.1.4.4.1.4' }, # in Watt
outputPercentLoad => { oid => '.1.3.6.1.2.1.33.1.4.4.1.5' }
};
my $oid_upsOutputEntry = '.1.3.6.1.2.1.33.1.4.4.1';
my $oid_outputFrequency = '.1.3.6.1.2.1.33.1.4.2.0'; # upsOutputFrequency
my $oid_outputEntry = '.1.3.6.1.2.1.33.1.4.4.1';
my $oid_output = '.1.3.6.1.2.1.33.1.4'; # upsOutput
sub manage_selection {
my ($self, %options) = @_;
$self->{oline} = {};
my $snmp_result = $options{snmp}->get_table(
oid => $oid_upsOutputEntry,
oid => $oid_output,
nothing_quit => 1
);
foreach my $oid (keys %$snmp_result) {
$oid =~ /^$oid_upsOutputEntry\.\d+\.(.*)$/;
next if ($oid !~ /^$oid_outputEntry\.\d+\.(.*)$/);
my $instance = $1;
next if (defined($self->{oline}->{$instance}));
@ -146,13 +157,15 @@ sub manage_selection {
delete $result->{$_} if ($result->{$_} == 0);
}
}
$result->{upsOutputCurrent} *= 0.1 if (defined($result->{upsOutputCurrent}));
$result->{outputCurrent} *= 0.1 if (defined($result->{outputCurrent}));
if (scalar(keys %$result) > 0) {
$self->{oline}->{$instance} = { display => $instance, %$result };
}
}
$self->{global} = {};
$self->{global}->{frequency} = $snmp_result->{$oid_outputFrequency} * 0.1 if (defined($snmp_result->{$oid_outputFrequency}));
if (scalar(keys %{$self->{oline}}) > 1) {
$self->stdev();
}
@ -172,15 +185,10 @@ Check Output lines metrics (load, voltage, current and true power).
Ignore counters equals to 0.
=item B<--warning-*>
=item B<--warning-*> B<--critical-*>
Warning threshold.
Can be: 'load', 'voltage', 'current', 'power'.
=item B<--critical-*>
Critical threshold.
Can be: 'load', 'voltage', 'current', 'power'.
Threshold.
Can be: 'frequency', 'load', 'voltage', 'current', 'power'.
=item B<--warning-stdev-3phases>

View File

@ -375,13 +375,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -141,13 +141,11 @@ Define the OID to be used to filter interfaces (default: ifDesc) (values: ifDesc
Define the OID that will be used to name the interfaces (default: ifDesc) (values: ifDesc, ifAlias).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--add-extra-oid>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -469,13 +469,11 @@ Define the OID that will be used to name the interfaces (default: atrConnCepGenD
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -85,8 +85,7 @@ sub default_oid_display_name {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options,
no_speed => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_speed => 1);
bless $self, $class;
return $self;
}
@ -131,13 +130,11 @@ Define the OID to be used to filter interfaces (default: atrConnCepGenDescr) (va
Define the OID that will be used to name the interfaces (default: atrConnCepGenDescr) (values: atrConnIngDescr, atrConnCepGenDescr).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--add-extra-oid>

View File

@ -29,11 +29,11 @@ my %map_status = (
2 => 'warning',
3 => 'minor',
4 => 'major',
5 => 'critical',
5 => 'critical'
);
my %map_existence = (
1 => 'present',
2 => 'missing',
2 => 'missing'
);
my $mapping = {
@ -59,20 +59,27 @@ sub check {
next if ($oid !~ /^$mapping->{acSysFanTraySeverity}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_acSysFanTrayEntry}, instance => $instance);
next if ($result->{acSysFanTrayExistence} eq 'missing' &&
$self->absent_problem(section => 'fantray', instance => $instance));
$self->absent_problem(section => 'fantray', instance => $instance));
next if ($self->check_filter(section => 'fantray', instance => $instance));
$self->{components}->{fantray}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Fan tray '%s' status is '%s' [instance = %s]",
$instance, $result->{acSysFanTraySeverity}, $instance));
$self->{output}->output_add(
long_msg => sprintf(
"fan tray '%s' status is '%s' [instance: %s]",
$instance, $result->{acSysFanTraySeverity}, $instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'fantray', value => $result->{acSysFanTraySeverity});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan tray '%s' status is '%s'", $instance, $result->{acSysFanTraySeverity}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Fan tray '%s' status is '%s'", $instance, $result->{acSysFanTraySeverity})
);
}
}
}
1;
1;

View File

@ -30,16 +30,16 @@ my %map_status = (
4 => 'moduleBackToServiceStart',
5 => 'moduleMismatch',
6 => 'moduleFaulty',
7 => 'notApplicable',
7 => 'notApplicable'
);
my %map_existence = (
1 => 'present',
2 => 'missing',
2 => 'missing'
);
my $mapping = {
acSysModulePresence => { oid => '.1.3.6.1.4.1.5003.9.10.10.4.21.1.4', map => \%map_existence },
acSysModuleFRUstatus => { oid => '.1.3.6.1.4.1.5003.9.10.10.4.21.1.14', map => \%map_status },
acSysModuleFRUstatus => { oid => '.1.3.6.1.4.1.5003.9.10.10.4.21.1.14', map => \%map_status }
};
my $oid_acSysModuleEntry = '.1.3.6.1.4.1.5003.9.10.10.4.21.1';
@ -60,20 +60,26 @@ sub check {
next if ($oid !~ /^$mapping->{acSysModuleFRUstatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_acSysModuleEntry}, instance => $instance);
next if ($result->{acSysModulePresence} eq 'missing' &&
$self->absent_problem(section => 'module', instance => $instance));
$self->absent_problem(section => 'module', instance => $instance));
next if ($self->check_filter(section => 'module', instance => $instance));
$self->{components}->{module}->{total}++;
$self->{output}->output_add(long_msg => sprintf("module '%s' status is '%s' [instance = %s]",
$instance, $result->{acSysModuleFRUstatus}, $instance));
$self->{output}->output_add(
long_msg => sprintf(
"module '%s' status is '%s' [instance: %s]",
$instance, $result->{acSysModuleFRUstatus}, $instance
)
);
my $exit = $self->get_severity(section => 'module', value => $result->{acSysModuleFRUstatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Module '%s' status is '%s'", $instance, $result->{acSysModuleFRUstatus}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Module '%s' status is '%s'", $instance, $result->{acSysModuleFRUstatus})
);
}
}
}
1;
1;

View File

@ -29,16 +29,16 @@ my %map_status = (
3 => 'warning',
4 => 'minor',
5 => 'major',
6 => 'critical',
6 => 'critical'
);
my %map_existence = (
1 => 'present',
2 => 'missing',
2 => 'missing'
);
my $mapping = {
acSysPowerSupplyExistence => { oid => '.1.3.6.1.4.1.5003.9.10.10.4.23.1.3', map => \%map_existence },
acSysPowerSupplySeverity => { oid => '.1.3.6.1.4.1.5003.9.10.10.4.23.1.6', map => \%map_status },
acSysPowerSupplySeverity => { oid => '.1.3.6.1.4.1.5003.9.10.10.4.23.1.6', map => \%map_status }
};
my $oid_acSysPowerSupplyEntry = '.1.3.6.1.4.1.5003.9.10.10.4.23.1';
@ -59,20 +59,27 @@ sub check {
next if ($oid !~ /^$mapping->{acSysPowerSupplySeverity}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_acSysPowerSupplyEntry}, instance => $instance);
next if ($result->{acSysPowerSupplyExistence} eq 'missing' &&
$self->absent_problem(section => 'psu', instance => $instance));
$self->absent_problem(section => 'psu', instance => $instance));
next if ($self->check_filter(section => 'psu', instance => $instance));
$self->{components}->{psu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s]",
$instance, $result->{acSysPowerSupplySeverity}, $instance));
$self->{output}->output_add(
long_msg => sprintf(
"power supply '%s' status is '%s' [instance: %s]",
$instance, $result->{acSysPowerSupplySeverity}, $instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{acSysPowerSupplySeverity});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $instance, $result->{acSysPowerSupplySeverity}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $instance, $result->{acSysPowerSupplySeverity})
);
}
}
}
1;
1;

View File

@ -25,41 +25,58 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_cpu_output {
my ($self, %options) = @_;
return "CPU '" . $options{instance} . "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, message_separator => ' - ' },
{ name => 'global', type => 0, message_separator => ' - ', skipped_code => { -10 => 1 } },
{ name => 'cpu', type => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPU(s) average usages are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'voip', nlabel => 'cpu.voip.utilization.percentage', set => {
key_values => [ { name => 'voip' } ],
output_template => 'CPU VoIp Usage : %.2f %%',
output_template => 'CPU VoIp usage: %.2f %%',
perfdatas => [
{ label => 'cpu_voip', value => 'voip', template => '%.2f', min => 0, max => 100, unit => '%' },
],
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'data', nlabel => 'cpu.data.utilization.percentage', set => {
key_values => [ { name => 'data' } ],
output_template => 'CPU Data Usage : %.2f %%',
output_template => 'CPU data usage: %.2f %%',
perfdatas => [
{ label => 'cpu_data', value => 'data', template => '%.2f', min => 0, max => 100, unit => '%' },
],
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
}
];
$self->{maps_counters}->{cpu} = [
{ label => 'core-cpu-utilization', nlabel => 'core.cpu.utilization.percentage', set => {
key_values => [ { name => 'cpu_usage' } ],
output_template => 'average usage is: %.2f%%',
perfdatas => [
{ template => '%.2f', unit => '%', min => 0, max => 100, label_extra_instance => 1 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => { });
return $self;
}
@ -68,11 +85,21 @@ sub manage_selection {
my $oid_acSysStateVoIpCpuUtilization = '.1.3.6.1.4.1.5003.9.10.10.2.5.10.0';
my $oid_acSysStateDataCpuUtilization = '.1.3.6.1.4.1.5003.9.10.10.2.5.8.0';
my $snmp_result = $options{snmp}->get_leef(oids => [
$oid_acSysStateVoIpCpuUtilization, $oid_acSysStateDataCpuUtilization
], nothing_quit => 1);
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_acSysStateVoIpCpuUtilization, $oid_acSysStateDataCpuUtilization],
nothing_quit => 1
);
$self->{global} = { data => $snmp_result->{$oid_acSysStateDataCpuUtilization}, voip => $snmp_result->{$oid_acSysStateVoIpCpuUtilization} };
my $oid_acKpiCpuStatsCurrentCpuCpuUtilization = '.1.3.6.1.4.1.5003.15.2.4.1.2.1.1.2';
$snmp_result = $options{snmp}->get_table(oid => $oid_acKpiCpuStatsCurrentCpuCpuUtilization);
$self->{cpu} = {};
foreach (keys %$snmp_result) {
/\.(\d+)$/;
$self->{cpu}->{$1} = { cpu_usage => $snmp_result->{$_} };
}
}
1;
@ -81,7 +108,7 @@ __END__
=head1 MODE
Check CPU usages.
Check CPU usage.
=over 8
@ -90,15 +117,10 @@ Check CPU usages.
Only display some counters (regexp can be used).
Example: --filter-counters='^voip$'
=item B<--warning-*>
=item B<--warning-*> B<--critical-*>
Warning threshold.
Can be: 'voip', 'data'.
=item B<--critical-*>
Critical threshold.
Can be: 'voip', 'data'.
Threshold.
Can be: 'voip', 'data', 'core-cpu-utilization'.
=back

View File

@ -63,7 +63,7 @@ sub snmp_execute {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
@ -77,7 +77,7 @@ __END__
=head1 MODE
Check Hardware.
Check hardware.
=over 8
@ -100,7 +100,6 @@ Can be specific or global: --absent-problem=psu,1
Define the expected status if no components are found (default: critical).
=item B<--threshold-overload>
Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp).

View File

@ -0,0 +1,182 @@
#
# Copyright 2023 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::audiocodes::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>
Define the conditions to match for the status to be WARNING.
You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--critical-status>
Define the conditions to match for the status to be CRITICAL (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 interfaces').
=item B<--name>
Allows you to define the interface (in option --interface) by name instead of OID index. The name matching mode supports regular expressions.
=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>
Define the OID to be used to filter interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-display>
Define the OID that will be used to name the interfaces (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 datas.
=back
=cut

View File

@ -30,10 +30,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
});
$self->{trunks} = {};
$options{options}->add_options(arguments => {});
return $self;
}
@ -43,13 +41,15 @@ sub check_options {
}
my %map_deactivate = (0 => 'notAvailable', 1 => 'deActivated', 2 => 'activated');
my %map_alarm = (0 => 'greyDisabled', 1 => 'greenActive', 2 => 'redLosLof',
3 => 'blueAis', 4 => 'yellowRai', 5 => 'orangeDChannel', 6 => 'purpleLowerLayerDown', 7 => 'darkOrangeNFASAlarm');
my %map_alarm = (
0 => 'greyDisabled', 1 => 'greenActive', 2 => 'redLosLof',
3 => 'blueAis', 4 => 'yellowRai', 5 => 'orangeDChannel', 6 => 'purpleLowerLayerDown', 7 => 'darkOrangeNFASAlarm'
);
my $mapping = {
acTrunkStatusAlarm => { oid => '.1.3.6.1.4.1.5003.9.10.9.2.1.1.1.7', map => \%map_alarm },
acTrunkDeactivate => { oid => '.1.3.6.1.4.1.5003.9.10.9.1.1.1.1.1.11', map => \%map_deactivate },
acTrunkName => { oid => '.1.3.6.1.4.1.5003.9.10.9.1.1.1.1.1.13' },
acTrunkName => { oid => '.1.3.6.1.4.1.5003.9.10.9.1.1.1.1.1.13' }
};
sub manage_selection {
@ -58,10 +58,12 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_multiple_table(oids => [
{ oid => $mapping->{acTrunkStatusAlarm}->{oid} },
{ oid => $mapping->{acTrunkDeactivate}->{oid} },
{ oid => $mapping->{acTrunkName}->{oid} },
{ oid => $mapping->{acTrunkName}->{oid} }
],
return_type => 1, nothing_quit => 1);
return_type => 1, nothing_quit => 1
);
my $results = {};
foreach my $oid (keys %{$snmp_result}) {
next if ($oid !~ /^$mapping->{acTrunkName}->{oid}\.(.*)$/);
my $instance = $1;
@ -72,24 +74,35 @@ sub manage_selection {
next;
}
$self->{trunks}->{$instance} =
{ name => $result->{acTrunkName}, status => $result->{acTrunkStatusAlarm}, state => $result->{acTrunkDeactivate} };
$results->{$instance} = {
name => $result->{acTrunkName},
status => $result->{acTrunkStatusAlarm},
state => $result->{acTrunkDeactivate}
};
}
return $results;
}
sub run {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach my $instance (sort keys %{$self->{trunks}}) {
$self->{output}->output_add(long_msg => '[name = ' . $self->{trunks}->{$instance}->{name} .
"] [status = '" . $self->{trunks}->{$instance}->{status} . "'] [state = '" .
$self->{trunks}->{$instance}->{state} . "']"
);
my $results = $self->manage_selection(%options);
foreach my $instance (sort keys %$results) {
$self->{output}->output_add(
long_msg => sprintf(
'[name: %s] [status: %s] [state: %s]',
$results->{$instance}->{name},
$results->{$instance}->{status},
$results->{$instance}->{state}
)
);
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List trunks:');
$self->{output}->output_add(
severity => 'OK',
short_msg => 'List trunks:'
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -103,10 +116,9 @@ sub disco_format {
sub disco_show {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach my $instance (sort keys %{$self->{trunks}}) {
$self->{output}->add_disco_entry(name => $self->{trunks}->{$instance}->{name},
status => $self->{trunks}->{$instance}->{status}, state => $self->{trunks}->{$instance}->{state});
my $results = $self->manage_selection(%options);
foreach my $instance (sort keys %$results) {
$self->{output}->add_disco_entry(%{$results->{$instance}});
}
}
@ -123,4 +135,3 @@ List trunks.
=back
=cut

View File

@ -25,41 +25,54 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_global_output {
my ($self, %options) = @_;
return 'Memory ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, message_separator => ' - ' },
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'voip', nlabel => 'memory.voip.utilization.percentage', set => {
{ label => 'voip', nlabel => 'memory.voip.usage.percentage', set => {
key_values => [ { name => 'voip' } ],
output_template => 'Memory VoIp Usage : %.2f %%',
output_template => 'VoIp usage: %.2f %%',
perfdatas => [
{ label => 'used_voip', value => 'voip', template => '%.2f', min => 0, max => 100, unit => '%' },
],
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'data', nlabel => 'memory.data.utilization.percentage', set => {
{ label => 'data', nlabel => 'memory.data.usage.percentage', set => {
key_values => [ { name => 'data' } ],
output_template => 'Memory Data Usage : %.2f %%',
output_template => 'data usage: %.2f %%',
perfdatas => [
{ label => 'used_data', value => 'data', template => '%.2f', min => 0, max => 100, unit => '%' },
],
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'system', nlabel => 'memory.system.usage.percentage', set => {
key_values => [ { name => 'system' } ],
output_template => 'system usage: %.2f %%',
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
});
$options{options}->add_options(arguments => {});
return $self;
}
@ -68,11 +81,17 @@ sub manage_selection {
my $oid_acSysStateVoIpMemoryUtilization = '.1.3.6.1.4.1.5003.9.10.10.2.5.11.0';
my $oid_acSysStateDataMemoryUtilization = '.1.3.6.1.4.1.5003.9.10.10.2.5.9.0';
my $snmp_result = $options{snmp}->get_leef(oids => [
$oid_acSysStateVoIpMemoryUtilization, $oid_acSysStateDataMemoryUtilization
], nothing_quit => 1);
$self->{global} = { data => $snmp_result->{$oid_acSysStateDataMemoryUtilization}, voip => $snmp_result->{$oid_acSysStateVoIpMemoryUtilization} };
my $oid_acKpiSystemStatsCurrentGlobalMemoryUtilization = '.1.3.6.1.4.1.5003.15.2.2.1.1.1.0';
my $snmp_result = $options{snmp}->get_leef(
oids => [$oid_acSysStateVoIpMemoryUtilization, $oid_acSysStateDataMemoryUtilization, $oid_acKpiSystemStatsCurrentGlobalMemoryUtilization],
nothing_quit => 1
);
$self->{global} = {
data => $snmp_result->{$oid_acSysStateDataMemoryUtilization},
voip => $snmp_result->{$oid_acSysStateVoIpMemoryUtilization},
system => $snmp_result->{$oid_acKpiSystemStatsCurrentGlobalMemoryUtilization}
};
}
1;
@ -90,15 +109,10 @@ Check memory usages.
Only display some counters (regexp can be used).
Example: --filter-counters='^voip$'
=item B<--warning-*>
=item B<--warning-*> B<--critical-*>
Warning threshold.
Can be: 'voip', 'data'.
=item B<--critical-*>
Critical threshold.
Can be: 'voip', 'data'.
Thresholds.
Can be: 'voip', 'data', 'system'.
=back

View File

@ -0,0 +1,177 @@
#
# Copyright 2023 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package network::audiocodes::snmp::mode::sbccalls;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5;
sub prefix_calls_output {
my ($self, %options) = @_;
return 'number of calls ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'call', type => 0, cb_prefix_output => 'prefix_calls_output', skipped_code => { -10 => 1 } },
{ name => 'session', type => 0, skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{call} = [
{ label => 'sbc-calls-duration-average', nlabel => 'sbc.calls.duration.average.seconds', set => {
key_values => [ { name => 'callsAvgDuration' } ],
output_template => 'average duration: %s s',
perfdatas => [
{ template => '%s', min => 0, unit => 's' }
]
}
},
{ label => 'sbc-calls-active-inbound', nlabel => 'sbc.calls.active.inbound.count', set => {
key_values => [ { name => 'callsInActive' } ],
output_template => 'active inbound: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'sbc-calls-active-outbound', nlabel => 'sbc.calls.active.outbound.count', set => {
key_values => [ { name => 'callsOutActive' } ],
output_template => 'active outbound: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'sbc-calls-established-inbound', nlabel => 'sbc.calls.established.inbound.count', set => {
key_values => [ { name => 'callsInTotalEst', diff => 1 } ],
output_template => 'established inbound: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'sbc-calls-established-outbound', nlabel => 'sbc.calls.established.outbound.count', set => {
key_values => [ { name => 'callsOutTotalEst', diff => 1 } ],
output_template => 'established outbound: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'sbc-calls-notestablished-inbound-failed', nlabel => 'sbc.calls.notestablished.inbound.failed.count', set => {
key_values => [ { name => 'callsInFailedNotEst', diff => 1 } ],
output_template => 'not established inbound failed: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'sbc-calls-notestablished-outbound', nlabel => 'sbc.calls.notestablished.outbound.failed.count', set => {
key_values => [ { name => 'callsOutFailedNotEst', diff => 1 } ],
output_template => 'not established outbound failed: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
}
];
$self->{maps_counters}->{session} = [
{ label => 'sbc-sessions-active', nlabel => 'sbc.sessions.active.count', set => {
key_values => [ { name => 'active' } ],
output_template => 'active sessions: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
callsAvgDuration => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.1' }, # acKpiSbcCallStatsCurrentGlobalAverageCallDuration
callsInActive => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.2' }, # acKpiSbcCallStatsCurrentGlobalActiveCallsIn
callsOutActive => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.3' }, # acKpiSbcCallStatsCurrentGlobalActiveCallsOut
callsInTotalEst => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.8' }, # acKpiSbcCallStatsCurrentGlobalEstablishedCallsInTotal
callsOutTotalEst => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.9' }, # acKpiSbcCallStatsCurrentGlobalEstablishedCallsOutTotal
callsInFailedNotEst => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.19' }, # acKpiSbcCallStatsCurrentGlobalNotEstablishFailedCallsInTotal
callsOutFailedNotEst => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.20' }, # acKpiSbcCallStatsCurrentGlobalNotEstablishFailedCallsOutTotal
activeSessions => { oid => '.1.3.6.1.4.1.5003.15.3.1.1.1.43' } # acKpiSbcCallStatsCurrentGlobalActiveSessions
};
my $snmp_result = $options{snmp}->get_leef(
oids => [ map($_->{oid} . '.0', values(%$mapping)) ],
nothing_quit => 1
);
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0);
$self->{call} = $result;
$self->{session} = { active => $result->{activeSessions} };
$self->{cache_name} = 'audiocodes_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
Digest::MD5::md5_hex(
defined($self->{option_results}->{filter_counters}) ? $self->{option_results}->{filter_counters} : ''
);
}
1;
__END__
=head1 MODE
Check SBC calls.
=over 8
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^calls'
=item B<--warning-*> B<--critical-*>
Threshold.
Can be: 'sbc-calls-duration-average', 'sbc-calls-active-inbound', 'sbc-calls-active-outbound',
'sbc-calls-established-inbound', 'sbc-calls-established-outbound',
'sbc-calls-notestablished-inbound-failed', 'sbc-calls-notestablished-outbound', 'sbc-sessions-active'.
=back
=cut

View File

@ -25,101 +25,78 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'alarm status : ' . $self->{result_values}->{alarm} . ' [state: ' . $self->{result_values}->{state} . ']';
return $msg;
return 'alarm status : ' . $self->{result_values}->{alarm} . ' [state: ' . $self->{result_values}->{state} . ']';
}
sub custom_status_calc {
sub prefix_trunk_output {
my ($self, %options) = @_;
$self->{result_values}->{alarm} = $options{new_datas}->{$self->{instance} . '_alarm'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
$self->{result_values}->{dchannel} = $options{new_datas}->{$self->{instance} . '_dchannel'};
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
return 0;
return "Trunk '" . $options{instance_value}->{display} . "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'trunk', type => 1, cb_prefix_output => 'prefix_vpn_output', message_multiple => 'All trunks are ok' }
{ name => 'trunk', type => 1, cb_prefix_output => 'prefix_trunk_output', message_multiple => 'All trunks are ok' }
];
$self->{maps_counters}->{trunk} = [
{ label => 'status', threshold => 0, set => {
{ label => 'status', type => 2, critical_default => '%{state} =~ /activated/ and %{alarm} !~ /greenActive/i', set => {
key_values => [ { name => 'display' }, { name => 'dchannel' }, { name => 'alarm' }, { name => 'state' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'avg-calls', set => {
{ label => 'avg-calls', nlabel => 'trunk.calls.average.count', set => {
key_values => [ { name => 'acPMTrunkUtilizationAverage' }, { name => 'display' } ],
output_template => 'Average calls : %s',
output_template => 'average calls: %s',
perfdatas => [
{ label => 'avg_calls', value => 'acPMTrunkUtilizationAverage', template => '%d',
min => 0, unit => 'calls', label_extra_instance => 1, instance_use => 'display' },
],
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' },
]
}
},
{ label => 'max-calls', set => {
{ label => 'max-calls', nlabel => 'trunk.calls.max.count', set => {
key_values => [ { name => 'acPMTrunkUtilizationMax' }, { name => 'display' } ],
output_template => 'Max calls : %s',
output_template => 'max calls: %s',
perfdatas => [
{ label => 'max_calls', value => 'acPMTrunkUtilizationMax', template => '%d',
min => 0, unit => 'calls', label_extra_instance => 1, instance_use => 'display' },
],
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' },
]
}
},
{ label => 'count-calls', set => {
{ label => 'count-calls', nlabel => 'trunk.calls.total.count', set => {
key_values => [ { name => 'acPMTrunkUtilizationTotal', diff => 1 }, { name => 'display' } ],
output_template => 'Count calls : %s',
output_template => 'count calls: %s',
perfdatas => [
{ label => 'count_calls', value => 'acPMTrunkUtilizationTotal', template => '%d',
min => 0, unit => 'calls', label_extra_instance => 1, instance_use => 'display' },
],
{ label => 'count_calls', template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' }
]
}
},
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /activated/ and %{alarm} !~ /greenActive/i' },
});
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status']);
}
sub prefix_vpn_output {
my ($self, %options) = @_;
return "Trunk '" . $options{instance_value}->{display} . "' ";
}
my %map_alarm = (0 => 'greyDisabled', 1 => 'greenActive', 2 => 'redLosLof',
3 => 'blueAis', 4 => 'yellowRai', 5 => 'orangeDChannel', 6 => 'purpleLowerLayerDown', 7 => 'darkOrangeNFASAlarm');
my %map_alarm = (
0 => 'greyDisabled', 1 => 'greenActive', 2 => 'redLosLof',
3 => 'blueAis', 4 => 'yellowRai', 5 => 'orangeDChannel', 6 => 'purpleLowerLayerDown', 7 => 'darkOrangeNFASAlarm'
);
my %map_dchannel = (0 => 'dChannelEstablished', 1 => 'dChannelNotEstablished', 10 => 'dChannelNotApplicable');
my %map_deactivate = (0 => 'notAvailable', 1 => 'deActivated', 2 => 'activated');
@ -128,12 +105,12 @@ my $mapping = {
acTrunkStatusDChannel => { oid => '.1.3.6.1.4.1.5003.9.10.9.2.1.1.1.6', map => \%map_dchannel },
acTrunkStatusAlarm => { oid => '.1.3.6.1.4.1.5003.9.10.9.2.1.1.1.7', map => \%map_alarm },
acTrunkDeactivate => { oid => '.1.3.6.1.4.1.5003.9.10.9.1.1.1.1.1.11', map => \%map_deactivate },
acTrunkName => { oid => '.1.3.6.1.4.1.5003.9.10.9.1.1.1.1.1.13' },
acTrunkName => { oid => '.1.3.6.1.4.1.5003.9.10.9.1.1.1.1.1.13' }
},
usage => {
acPMTrunkUtilizationAverage => { oid => '.1.3.6.1.4.1.5003.10.10.2.21.1.4' },
acPMTrunkUtilizationMax => { oid => '.1.3.6.1.4.1.5003.10.10.2.21.1.5' },
acPMTrunkUtilizationTotal => { oid => '.1.3.6.1.4.1.5003.10.10.2.21.1.12' },
acPMTrunkUtilizationTotal => { oid => '.1.3.6.1.4.1.5003.10.10.2.21.1.12' }
}
};
@ -155,33 +132,32 @@ sub manage_selection {
$datas->{$_} = { %{$datas->{$_}}, %{$snmp_result->{ $mapping->{$_}->{$name}->{oid} }} };
}
}
foreach (keys %{$snmp_result->{ $mapping->{status}->{acTrunkStatusAlarm}->{oid} }}) {
/\.(\d+)$/;
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping->{status}, results => $datas->{status}, instance => $instance);
my $result2 = $options{snmp}->map_instance(mapping => $mapping->{usage}, results => $datas->{usage}, instance => $instance . '.0');
my $display = defined($result->{acTrunkName}) && $result->{acTrunkName} ne '' ? $result->{acTrunkName} : $instance;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$display !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $display . "': no matching filter.", debug => 1);
next;
}
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$display !~ /$self->{option_results}->{filter_name}/);
$self->{trunk}->{$instance} = {
display => $display,
alarm => $result->{acTrunkStatusAlarm},
state => $result->{acTrunkDeactivate},
dchannel => $result->{acTrunkStatusDChannel},
%$result2 };
%$result2
};
}
if (scalar(keys %{$self->{trunk}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No trunk found.");
$self->{output}->option_exit();
}
$self->{cache_name} = "audiocodes_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
$self->{cache_name} = 'audiocodes_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
}
@ -207,20 +183,14 @@ You can use the following variables: %{display}, %{alarm}, %{dchannel}, %{state}
=item B<--critical-status>
Define the conditions to match for the status to be CRITICAL (Default: '%{state} =~ /activated/ and %{alarm} !~ /greenActive/i').
Define the conditions to match for the status to be CRITICAL (default: '%{state} =~ /activated/ and %{alarm} !~ /greenActive/i').
You can use the following variables: %{display}, %{alarm}, %{dchannel}, %{state}
=item B<--warning-*>
=item B<--warning-*> B<--critical-*>
Warning threshold.
Thresholds.
Can be: 'avg-calls', 'max-calls', 'count-calls'.
=item B<--critical-*>
Critical threshold.
Can be: 'avg-calls', 'max-calls', 'count-calls'.
=back
=cut

View File

@ -29,15 +29,15 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
%{$self->{modes}} = (
'cpu' => 'network::audiocodes::snmp::mode::cpu',
'hardware' => 'network::audiocodes::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'list-trunks' => 'network::audiocodes::snmp::mode::listtrunks',
'memory' => 'network::audiocodes::snmp::mode::memory',
'trunk-status' => 'network::audiocodes::snmp::mode::trunkstatus',
'cpu' => 'network::audiocodes::snmp::mode::cpu',
'hardware' => 'network::audiocodes::snmp::mode::hardware',
'interfaces' => 'network::audiocodes::snmp::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'list-trunks' => 'network::audiocodes::snmp::mode::listtrunks',
'memory' => 'network::audiocodes::snmp::mode::memory',
'sbc-calls' => 'network::audiocodes::snmp::mode::sbccalls',
'trunk-status' => 'network::audiocodes::snmp::mode::trunkstatus',
);
return $self;

View File

@ -369,13 +369,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -162,13 +162,11 @@ Define the OID to be used to filter interfaces (default: ifName) (values: fcPort
Define the OID that will be used to name the interfaces (default: ifName) (values: fcPortName, ifDesc, ifAlias, ifName).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--add-extra-oid>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -240,13 +240,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -193,13 +193,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ efine the OID that will be used to name the interfaces (default: ifName) (values
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -386,13 +386,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -295,13 +295,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -370,13 +370,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -102,13 +102,11 @@ Choose OID used to filter storage (default: hrStorageDescr) (values: hrStorageDe
Choose OID used to display storage (default: hrStorageDescr) (values: hrStorageDescr, hrFSMountPoint).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value. (security risk!!!)
Modify the storage name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value. (security risk!!!)
Eg: adding --display-transform-src='dev' --display-transform-dst='run' will replace all occurrences of 'dev' with 'run'
=item B<--show-cache>

View File

@ -165,13 +165,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -266,13 +266,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -529,13 +529,11 @@ Define the OID that will be used to name the interfaces (default: ifName) (value
Add an OID to display.
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--show-cache>

View File

@ -107,13 +107,11 @@ Define the OID to be used to filter interfaces (default: atrConnCepGenDescr) (va
Define the OID that will be used to name the interfaces (default: atrConnCepGenDescr) (values: atrConnIngDescr, atrConnCepGenDescr).
=item B<--display-transform-src>
=item B<--display-transform-src> B<--display-transform-dst>
Regexp src to transform display value.
Modify the interface name displayed by using a regular expression.
=item B<--display-transform-dst>
Regexp dst to transform display value.
Eg: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens'
=item B<--add-extra-oid>

Some files were not shown because too many files have changed in this diff Show More