Merge branch 'develop' into MON-34390-breaking-changes-upload-download-artifacts
This commit is contained in:
commit
e4e5d8efb8
.github
actions
deb-delivery-legacy
deb-delivery
package-nfpm
package
promote-to-stable
rpm-delivery-legacy
rpm-delivery
docker
scripts
workflows
connector-vmware.ymldocker-builder-packaging-plugins.ymlnrpe.ymlperl-cpan-libraries.ymlperl-crypt-argon2.ymlperl-filesys-smbclient.ymlperl-json-path.ymlperl-keepass-reader.ymlperl-libssh-session.ymlperl-net-curl.ymlperl-openwsman.ymlperl-vmware-vsphere.ymlplink.ymlplugin-delivery.ymlplugins-selinux.ymlplugins.ymlspellchecker.ymltests-functional.yml
dependencies
perl-crypt-argon2
perl-json-path
perl-libssh-session
perl-net-curl
perl-openwsman
doc/en/developer
guide.mdplugins_advanced.mdplugins_global.mdtutorial-api.mdtutorial-service_discovery.mdtutorial-snmp.md
packaging
centreon-plugin-Hardware-Storage-Synology-Snmp
centreon-plugin-Notification-Email
centreon-plugin-Virtualization-Vmware2-Connector-Plugin
src
apps
backup/rubrik/restapi
java/jvm/actuator/mode
protocols
virtualization/ovirt/mode
vmware
centreon
common
airespace/snmp/mode
bluearc/snmp/mode
cisco
dell/fastpath/snmp/mode
force10/snmp/mode
fortinet/fortigate/snmp/mode
h3c/snmp/mode
ibm/nos/snmp/mode
jvm/mode
protocols/sql/mode
radlan/snmp/mode
plugins
cloud/prometheus/exporters
contrib
collection/snmp
tutorial/network/mysnmpplugin/snmp
hardware/devices
camera
hikvision/nvr/isapi/mode
polycom/trio/restapi/mode
network
3com/snmp/mode
adva/fsp3000/snmp/mode
alcatel/omniswitch/snmp/mode
allied/snmp/mode
aruba
atrica/snmp/mode
|
@ -24,7 +24,7 @@ runs:
|
|||
using: "composite"
|
||||
steps:
|
||||
- name: Use cache DEB files
|
||||
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.deb
|
||||
key: ${{ inputs.cache_key }}
|
||||
|
|
|
@ -21,30 +21,40 @@ runs:
|
|||
using: "composite"
|
||||
steps:
|
||||
- name: Remove previously delivered DEBs
|
||||
if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
|
||||
run: rm -f ./*.deb
|
||||
shell: bash
|
||||
|
||||
- name: Use cache DEB files
|
||||
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
|
||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.deb
|
||||
key: ${{ inputs.cache_key }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1
|
||||
- if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
|
||||
uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1
|
||||
env:
|
||||
JF_URL: https://centreon.jfrog.io
|
||||
JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }}
|
||||
|
||||
- name: Publish DEBs to artifactory
|
||||
if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }}
|
||||
run: |
|
||||
FILES="*.deb"
|
||||
|
||||
if [[ "${{ inputs.distrib }}" == "jammy" ]]; then
|
||||
REPO_PREFIX="ubuntu"
|
||||
else
|
||||
REPO_PREFIX="apt"
|
||||
fi
|
||||
|
||||
for FILE in $FILES; do
|
||||
echo "[DEBUG] - File: $FILE"
|
||||
|
||||
ARCH=$(echo $FILE | cut -d '_' -f3 | cut -d '.' -f1)
|
||||
|
||||
jf rt upload "$FILE" "apt-plugins-${{ inputs.stability }}/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
|
||||
jf rt upload "$FILE" "${REPO_PREFIX}-plugins-${{ inputs.stability }}/pool/${{ inputs.module_name }}/" --deb "${{ inputs.distrib }}/main/$ARCH"
|
||||
done
|
||||
shell: bash
|
||||
|
|
|
@ -10,6 +10,9 @@ inputs:
|
|||
distrib:
|
||||
description: The package distrib
|
||||
required: true
|
||||
version:
|
||||
description: The package version ([major_version].[minor_version])
|
||||
required: false
|
||||
major_version:
|
||||
description: The major version
|
||||
required: false
|
||||
|
@ -18,7 +21,7 @@ inputs:
|
|||
required: false
|
||||
release:
|
||||
description: The package release number
|
||||
required: false
|
||||
required: true
|
||||
arch:
|
||||
description: The package architecture
|
||||
required: false
|
||||
|
@ -37,6 +40,9 @@ inputs:
|
|||
rpm_gpg_signing_passphrase:
|
||||
description: The rpm gpg signing passphrase
|
||||
required: true
|
||||
stability:
|
||||
description: "Branch stability (stable, testing, unstable, canary)"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
@ -59,8 +65,15 @@ runs:
|
|||
RPM_GPG_SIGNING_KEY_ID: ${{ inputs.rpm_gpg_signing_key_id }}
|
||||
RPM_GPG_SIGNING_PASSPHRASE: ${{ inputs.rpm_gpg_signing_passphrase }}
|
||||
run: |
|
||||
export MAJOR_VERSION="${{ inputs.major_version }}"
|
||||
export VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}"
|
||||
if [ -z ${{ inputs.version }} ]; then
|
||||
export VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}"
|
||||
export MAJOR_VERSION="${{ inputs.major_version }}"
|
||||
export MINOR_VERSION="${{ inputs.minor_version }}"
|
||||
elif [ -z ${{ inputs.major_version }} ]; then
|
||||
export VERSION="${{ inputs.version }}"
|
||||
export MAJOR_VERSION=$( echo $VERSION | cut -d "-" -f1 )
|
||||
export MINOR_VERSION=$( echo $VERSION | cut -d "-" -f2 )
|
||||
fi
|
||||
export RELEASE="${{ inputs.release }}"
|
||||
export ARCH="${{ inputs.arch }}"
|
||||
|
||||
|
@ -70,23 +83,28 @@ runs:
|
|||
export APACHE_GROUP="apache"
|
||||
else
|
||||
export DIST=""
|
||||
if [ "${{ inputs.stability }}" == "unstable" ] || [ "${{ inputs.stability }}" == "canary" ]; then
|
||||
export RELEASE="$RELEASE~${{ inputs.distrib }}"
|
||||
elif [ "${{ inputs.stability }}" == "testing" ]; then
|
||||
export RELEASE="1~${{ inputs.distrib }}"
|
||||
fi
|
||||
export APACHE_USER="www-data"
|
||||
export APACHE_GROUP="www-data"
|
||||
fi
|
||||
|
||||
MAJOR_LEFT=$( echo $MAJOR_VERSION | cut -d "." -f1 )
|
||||
MAJOR_RIGHT=$( echo $MAJOR_VERSION | cut -d "-" -f1 | cut -d "." -f2 )
|
||||
BUMP_MAJOR_RIGHT=$(( MAJOR_RIGHT_PART + 1 ))
|
||||
if [ "$MAJOR_RIGHT" = "04" ]; then
|
||||
BUMP_MAJOR_LEFT="$MAJOR_LEFT"
|
||||
BUMP_MAJOR_RIGHT="10"
|
||||
else
|
||||
BUMP_MAJOR_LEFT=$(( $MAJOR_LEFT + 1 ))
|
||||
BUMP_MAJOR_RIGHT="04"
|
||||
if [ -z "$MAJOR_VERSION" ]; then
|
||||
MAJOR_LEFT=$( echo $VERSION | cut -d "." -f1 )
|
||||
MAJOR_RIGHT=$( echo $VERSION | cut -d "-" -f1 | cut -d "." -f2 )
|
||||
if [ "$MAJOR_RIGHT" == "04" ]; then
|
||||
BUMP_MAJOR_LEFT="$MAJOR_LEFT"
|
||||
BUMP_MAJOR_RIGHT="10"
|
||||
else
|
||||
BUMP_MAJOR_LEFT=$(( $MAJOR_LEFT + 1 ))
|
||||
BUMP_MAJOR_RIGHT="04"
|
||||
fi
|
||||
export NEXT_MAJOR_VERSION="$BUMP_MAJOR_LEFT.$BUMP_MAJOR_RIGHT"
|
||||
fi
|
||||
|
||||
export NEXT_MAJOR_VERSION="$BUMP_MAJOR_LEFT.$BUMP_MAJOR_RIGHT"
|
||||
|
||||
export RPM_SIGNING_KEY_FILE="$(pwd)/key.gpg"
|
||||
export RPM_SIGNING_KEY_ID="$RPM_GPG_SIGNING_KEY_ID"
|
||||
export NFPM_RPM_PASSPHRASE="$RPM_GPG_SIGNING_PASSPHRASE"
|
||||
|
@ -104,12 +122,18 @@ runs:
|
|||
done
|
||||
shell: bash
|
||||
|
||||
- name: Cache packages
|
||||
- if: ${{ inputs.distrib == 'el7' }}
|
||||
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
with:
|
||||
path: ./*.${{ inputs.package_extension }}
|
||||
key: ${{ inputs.cache_key }}
|
||||
|
||||
- if: ${{ inputs.distrib != 'el7' }}
|
||||
uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.${{ inputs.package_extension }}
|
||||
key: ${{ inputs.cache_key }}
|
||||
|
||||
# Update if condition to true to get packages as artifacts
|
||||
- if: ${{ false }}
|
||||
name: Upload package artifacts
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
name: package
|
||||
description: Package module using nfpm
|
||||
inputs:
|
||||
nfpm_file_pattern:
|
||||
description: The pattern of the nfpm configuration file(s)
|
||||
required: true
|
||||
package_extension:
|
||||
description: The package extension (deb or rpm)
|
||||
required: true
|
||||
distrib:
|
||||
description: The package distrib
|
||||
required: true
|
||||
version:
|
||||
description: The package version
|
||||
required: false
|
||||
release:
|
||||
description: The package release number
|
||||
required: false
|
||||
commit_hash:
|
||||
description: The commit hash
|
||||
required: true
|
||||
cache_key:
|
||||
description: The package files cache key
|
||||
required: true
|
||||
rpm_gpg_key:
|
||||
description: The rpm gpg key
|
||||
required: true
|
||||
rpm_gpg_signing_key_id:
|
||||
description: The rpm gpg signing key identifier
|
||||
required: true
|
||||
rpm_gpg_signing_passphrase:
|
||||
description: The rpm gpg signing passphrase
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Import gpg key
|
||||
env:
|
||||
RPM_GPG_SIGNING_KEY: ${{ inputs.rpm_gpg_key }}
|
||||
run: echo -n "$RPM_GPG_SIGNING_KEY" > key.gpg
|
||||
shell: bash
|
||||
|
||||
- name: Build ${{ inputs.package_extension }} files
|
||||
env:
|
||||
RPM_GPG_SIGNING_KEY_ID: ${{ inputs.rpm_gpg_signing_key_id }}
|
||||
RPM_GPG_SIGNING_PASSPHRASE: ${{ inputs.rpm_gpg_signing_passphrase }}
|
||||
run: |
|
||||
export VERSION="${{ inputs.version }}"
|
||||
export RELEASE="${{ inputs.release }}"
|
||||
|
||||
if [ "${{ inputs.package_extension }}" = "rpm" ]; then
|
||||
export DIST=".${{ inputs.distrib }}"
|
||||
else
|
||||
export DIST=""
|
||||
fi
|
||||
|
||||
export RPM_SIGNING_KEY_FILE="$(pwd)/key.gpg"
|
||||
export RPM_SIGNING_KEY_ID="$RPM_GPG_SIGNING_KEY_ID"
|
||||
export NFPM_RPM_PASSPHRASE="$RPM_GPG_SIGNING_PASSPHRASE"
|
||||
|
||||
for FILE in ${{ inputs.nfpm_file_pattern }}; do
|
||||
DIRNAME=$(dirname $FILE)
|
||||
BASENAME=$(basename $FILE)
|
||||
cd $DIRNAME
|
||||
sed -i "s/@COMMIT_HASH@/${{ inputs.commit_hash }}/g" $BASENAME
|
||||
nfpm package --config $BASENAME --packager ${{ inputs.package_extension }}
|
||||
cd -
|
||||
mv $DIRNAME/*.${{ inputs.package_extension }} ./
|
||||
done
|
||||
shell: bash
|
||||
|
||||
- name: Upload package artifacts
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
name: packages-${{ inputs.distrib }}
|
||||
path: ./*.${{ inputs.package_extension }}
|
||||
retention-days: 1
|
||||
|
||||
- name: Cache packages
|
||||
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
with:
|
||||
path: ./*.${{ inputs.package_extension }}
|
||||
key: ${{ inputs.cache_key }}
|
|
@ -60,7 +60,7 @@ runs:
|
|||
shell: bash
|
||||
|
||||
- name: Promote DEB package to stable
|
||||
if: ${{ startsWith(inputs.distrib, 'bullseye') }}
|
||||
if: ${{ startsWith(inputs.distrib, 'bullseye') || startsWith(inputs.distrib, 'bookworm' }}
|
||||
run: |
|
||||
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ runs:
|
|||
using: "composite"
|
||||
steps:
|
||||
- name: Use cache RPM files
|
||||
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: ${{ inputs.cache_key }}
|
||||
|
|
|
@ -25,7 +25,7 @@ runs:
|
|||
shell: bash
|
||||
|
||||
- name: Use cache RPM files
|
||||
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: ${{ inputs.cache_key }}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
ARG REGISTRY_URL
|
||||
|
||||
FROM ${REGISTRY_URL}/debian:bookworm
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# fix locale
|
||||
RUN bash -e <<EOF
|
||||
|
||||
apt-get update
|
||||
apt-get install -y locales
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||
apt-get clean
|
||||
|
||||
EOF
|
||||
|
||||
ENV LANG en_US.utf8
|
||||
|
||||
RUN bash -e <<EOF
|
||||
|
||||
apt-get update
|
||||
|
||||
echo 'http://deb.debian.org/debian' | apt-get install -y pbuilder
|
||||
|
||||
apt-get install -y \
|
||||
dh-make \
|
||||
aptitude \
|
||||
ca-certificates \
|
||||
libssh-dev \
|
||||
lintian \
|
||||
quilt \
|
||||
git-buildpackage \
|
||||
debmake \
|
||||
devscripts \
|
||||
fakeroot \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
python3 \
|
||||
libjson-perl \
|
||||
libapp-fatpacker-perl \
|
||||
libfile-copy-recursive-perl \
|
||||
jq \
|
||||
zstd
|
||||
|
||||
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
||||
apt-get update
|
||||
apt-get install -y nfpm
|
||||
|
||||
apt-get clean
|
||||
|
||||
EOF
|
|
@ -0,0 +1,53 @@
|
|||
ARG REGISTRY_URL
|
||||
|
||||
FROM ${REGISTRY_URL}/ubuntu:jammy
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# fix locale
|
||||
RUN bash -e <<EOF
|
||||
|
||||
apt-get update
|
||||
apt-get install -y locales
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||
apt-get clean
|
||||
|
||||
EOF
|
||||
|
||||
ENV LANG en_US.utf8
|
||||
|
||||
RUN bash -e <<EOF
|
||||
|
||||
apt-get update
|
||||
|
||||
echo 'http://deb.debian.org/debian' | apt-get install -y pbuilder
|
||||
|
||||
apt-get install -y \
|
||||
dh-make \
|
||||
aptitude \
|
||||
ca-certificates \
|
||||
libssh-dev \
|
||||
lintian \
|
||||
quilt \
|
||||
git-buildpackage \
|
||||
debmake \
|
||||
devscripts \
|
||||
fakeroot \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
python3 \
|
||||
libjson-perl \
|
||||
libapp-fatpacker-perl \
|
||||
libfile-copy-recursive-perl \
|
||||
jq \
|
||||
zstd
|
||||
|
||||
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
||||
apt-get update
|
||||
apt-get install -y nfpm
|
||||
|
||||
apt-get clean
|
||||
|
||||
EOF
|
|
@ -0,0 +1,22 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
use Test::Spelling;
|
||||
|
||||
if (!@ARGV) {
|
||||
die "Missing perl file to check.";
|
||||
}
|
||||
|
||||
my $stopword_filename='.github/scripts/stopwords.t';
|
||||
if(defined($ARGV[1])){
|
||||
$stopword_filename=$ARGV[1];
|
||||
}
|
||||
open(FILE, "<", $stopword_filename)
|
||||
or die "Could not open $stopword_filename";
|
||||
printf("stopword file use : ".$stopword_filename." \n");
|
||||
|
||||
add_stopwords(<FILE>);
|
||||
set_spell_cmd('hunspell -l');
|
||||
all_pod_files_spelling_ok($ARGV[0]);
|
||||
close(FILE);
|
|
@ -0,0 +1,5 @@
|
|||
--force-counters32
|
||||
OID
|
||||
oneaccess-sys-mib
|
||||
SNMP
|
||||
SSH
|
|
@ -40,6 +40,12 @@ jobs:
|
|||
- package_extension: deb
|
||||
image: packaging-plugins-bullseye
|
||||
distrib: bullseye
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
|
||||
|
@ -54,7 +60,7 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "connectors/vmware/packaging/centreon-plugin-virtualization-vmware-daemon.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
@ -66,6 +72,7 @@ jobs:
|
|||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
deliver-rpm:
|
||||
needs:
|
||||
|
@ -100,7 +107,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -37,6 +37,12 @@ jobs:
|
|||
- runner: ["self-hosted", "collect-arm64"]
|
||||
dockerfile: packaging-plugins-bullseye
|
||||
image: packaging-plugins-bullseye-arm64
|
||||
- runner: ubuntu-22.04
|
||||
dockerfile: packaging-plugins-bookworm
|
||||
image: packaging-plugins-bookworm
|
||||
- runner: ubuntu-22.04
|
||||
dockerfile: packaging-plugins-jammy
|
||||
image: packaging-plugins-jammy
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
|
@ -45,22 +51,22 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_ID }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
|
||||
|
||||
- name: Login to proxy registry
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_ID }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
|
||||
|
||||
- uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
|
||||
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
||||
|
||||
- uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
|
||||
- uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
|
||||
with:
|
||||
file: .github/docker/Dockerfile.${{ matrix.dockerfile }}
|
||||
context: .
|
||||
|
|
|
@ -38,6 +38,12 @@ jobs:
|
|||
- package_extension: deb
|
||||
image: packaging-plugins-bullseye
|
||||
distrib: bullseye
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
|
||||
|
@ -94,7 +100,7 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "nrpe/packaging/*.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
@ -106,6 +112,7 @@ jobs:
|
|||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
deliver-rpm:
|
||||
needs: [get-environment, package]
|
||||
|
@ -136,7 +143,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -22,7 +22,7 @@ jobs:
|
|||
get-environment:
|
||||
uses: ./.github/workflows/get-environment.yml
|
||||
|
||||
package:
|
||||
package-rpm:
|
||||
needs: [get-environment]
|
||||
if: ${{ needs.get-environment.outputs.stability != 'stable' }}
|
||||
|
||||
|
@ -30,7 +30,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distrib: [el8, el9, bullseye]
|
||||
distrib: [el8, el9]
|
||||
name:
|
||||
[
|
||||
"Authen::SASL::SASLprep",
|
||||
|
@ -98,9 +98,8 @@ jobs:
|
|||
"ZMQ::LibZMQ4"
|
||||
]
|
||||
include:
|
||||
- build_distribs: "el8,el9,bullseye"
|
||||
- build_distribs: "el8,el9"
|
||||
- rpm_dependencies: ""
|
||||
- deb_dependencies: ""
|
||||
- rpm_provides: ""
|
||||
- version: ""
|
||||
- use_dh_make_perl: "true"
|
||||
|
@ -111,30 +110,20 @@ jobs:
|
|||
- distrib: el9
|
||||
package_extension: rpm
|
||||
image: packaging-plugins-alma9
|
||||
- distrib: bullseye
|
||||
package_extension: deb
|
||||
image: packaging-plugins-bullseye
|
||||
- name: "BSON"
|
||||
build_distribs: "el8,el9"
|
||||
rpm_provides: "perl(BSON::Bytes) perl(BSON::Code) perl(BSON::DBRef) perl(BSON::OID) perl(BSON::Raw) perl(BSON::Regex) perl(BSON::Time) perl(BSON::Timestamp) perl(BSON::Types) perl(BSON)"
|
||||
- name: "BSON::XS"
|
||||
build_distribs: "el8,el9"
|
||||
- name: "Convert::Binary::C"
|
||||
build_distribs: "el8,el9"
|
||||
- name: "DateTime::Format::Duration::ISO8601"
|
||||
rpm_provides: "perl(DateTime-Format-Duration-ISO8601)"
|
||||
- name: "DBD::Sybase"
|
||||
build_distribs: "el8,el9"
|
||||
- name: "Device::Modbus::RTU::Client"
|
||||
version: "0.022"
|
||||
- name: "Device::Modbus::TCP::Client"
|
||||
version: "0.026"
|
||||
- name: "EV"
|
||||
build_distribs: "el8,el9"
|
||||
- name: "FFI::CheckLib"
|
||||
build_distribs: "el8,el9"
|
||||
- name: "FFI::Platypus"
|
||||
build_distribs: "el8,el9"
|
||||
rpm_provides: "perl(FFI::Platypus::Buffer) perl(FFI::Platypus::Memory)"
|
||||
- name: "Net::DHCP"
|
||||
rpm_provides: "perl(Net::DHCP::Constants) perl(Net::DHCP::Packet)"
|
||||
|
@ -142,18 +131,15 @@ jobs:
|
|||
version: "0.53"
|
||||
- name: "UUID"
|
||||
use_dh_make_perl: "false"
|
||||
build_distribs: "el8,el9"
|
||||
version: "0.31"
|
||||
- name: "ZMQ::Constants"
|
||||
build_distribs: "el9,bullseye"
|
||||
build_distribs: "el9"
|
||||
- name: "ZMQ::FFI"
|
||||
build_distribs: "el8,el9"
|
||||
rpm_dependencies: "zeromq"
|
||||
- name: "ZMQ::LibZMQ4"
|
||||
use_dh_make_perl: "false"
|
||||
version: "0.01"
|
||||
rpm_dependencies: "zeromq"
|
||||
deb_dependencies: "libzmq5"
|
||||
name: package ${{ matrix.distrib }} ${{ matrix.name }}
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
|
||||
|
@ -164,7 +150,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.package_extension == 'rpm' }}
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
|
||||
run: |
|
||||
yum install -y yum-utils epel-release git
|
||||
yum config-manager --set-enabled crb || true # alma 9
|
||||
|
@ -172,7 +158,7 @@ jobs:
|
|||
yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc ruby libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel
|
||||
shell: bash
|
||||
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.package_extension == 'rpm' && matrix.spec_file == '' }}
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }}
|
||||
run: |
|
||||
if [ -z "${{ matrix.version }}" ]; then
|
||||
PACKAGE_VERSION=""
|
||||
|
@ -205,7 +191,7 @@ jobs:
|
|||
fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }}
|
||||
shell: bash
|
||||
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.package_extension == 'rpm' && matrix.spec_file != '' }}
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }}
|
||||
run: |
|
||||
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||
|
||||
|
@ -214,7 +200,111 @@ jobs:
|
|||
cp -r ~/rpmbuild/RPMS/noarch/*.rpm .
|
||||
shell: bash
|
||||
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.package_extension == 'deb' && matrix.use_dh_make_perl == 'false' }}
|
||||
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
with:
|
||||
name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}
|
||||
path: ./*.${{ matrix.package_extension }}
|
||||
retention-days: 1
|
||||
|
||||
package-deb:
|
||||
needs: [get-environment]
|
||||
if: ${{ needs.get-environment.outputs.stability != 'stable' }}
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
name:
|
||||
[
|
||||
"Authen::SASL::SASLprep",
|
||||
"Authen::SCRAM::Client",
|
||||
"boolean",
|
||||
"Carp::Assert",
|
||||
"Clone",
|
||||
"Clone::Choose",
|
||||
"common::sense",
|
||||
"Convert::EBCDIC",
|
||||
"Crypt::Blowfish_PP",
|
||||
"DateTime::Format::Duration::ISO8601",
|
||||
"Device::Modbus",
|
||||
"Digest::MD5::File",
|
||||
"Digest::SHA1",
|
||||
"Email::Send::SMTP::Gmail",
|
||||
"FFI::CheckLib",
|
||||
"File::SearchPath",
|
||||
"Hash::Merge",
|
||||
"Hash::Ordered",
|
||||
"HTTP::Daemon",
|
||||
"HTTP::Daemon::SSL",
|
||||
"HTTP::ProxyPAC",
|
||||
"JMX::Jmx4Perl",
|
||||
"JSON::Parse",
|
||||
"JSON::WebToken",
|
||||
"LV",
|
||||
"MIME::Types",
|
||||
"MongoDB",
|
||||
"Net::FTPSSL",
|
||||
"Net::HTTPTunnel",
|
||||
"Net::NTP",
|
||||
"Net::SMTPS",
|
||||
"Net::SMTP_auth",
|
||||
"Net::Subnet",
|
||||
"Net::TFTP",
|
||||
"PBKDF2::Tiny",
|
||||
"Schedule::Cron",
|
||||
"Statistics::Descriptive",
|
||||
"Statistics::Regression",
|
||||
"Sys::SigAction",
|
||||
"Term::Clui",
|
||||
"Term::ShellUI",
|
||||
"Unicode::Stringprep",
|
||||
"URI::Encode",
|
||||
"URI::Template",
|
||||
"URL::Encode",
|
||||
"UUID::URandom",
|
||||
"WWW::Selenium",
|
||||
"XML::Filter::BufferText",
|
||||
"XML::LibXML::Simple",
|
||||
"XML::SAX::Writer",
|
||||
"ZMQ::Constants",
|
||||
"ZMQ::LibZMQ4"
|
||||
]
|
||||
include:
|
||||
- build_distribs: "bullseye,bookworm,jammy"
|
||||
- deb_dependencies: ""
|
||||
- rpm_provides: ""
|
||||
- version: ""
|
||||
- use_dh_make_perl: "true"
|
||||
- spec_file: ""
|
||||
- distrib: bullseye
|
||||
package_extension: deb
|
||||
image: packaging-plugins-bullseye
|
||||
- distrib: bookworm
|
||||
package_extension: deb
|
||||
image: packaging-plugins-bookworm
|
||||
- distrib: jammy
|
||||
package_extension: deb
|
||||
image: packaging-plugins-jammy
|
||||
- name: "DateTime::Format::Duration::ISO8601"
|
||||
- name: "Statistics::Regression"
|
||||
version: "0.53"
|
||||
- name: "ZMQ::Constants"
|
||||
- name: "ZMQ::LibZMQ4"
|
||||
use_dh_make_perl: "false"
|
||||
version: "0.01"
|
||||
deb_dependencies: "libzmq5"
|
||||
name: package ${{ matrix.distrib }} ${{ matrix.name }}
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
|
||||
credentials:
|
||||
username: ${{ secrets.DOCKER_REGISTRY_ID }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'false' }}
|
||||
run: |
|
||||
apt update
|
||||
apt install -y cpanminus ruby libcurl4-openssl-dev libssh-dev uuid-dev libczmq-dev
|
||||
|
@ -241,7 +331,7 @@ jobs:
|
|||
fpm -s cpan -t ${{ matrix.package_extension }} --deb-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test -n $PACKAGE_NAME$PACKAGE_DEPENDENCIES$PACKAGE_VERSION ${{ matrix.name }}
|
||||
shell: bash
|
||||
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.package_extension == 'deb' && matrix.use_dh_make_perl == 'true' }}
|
||||
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.use_dh_make_perl == 'true' }}
|
||||
run: |
|
||||
apt update
|
||||
apt install -y cpanminus libcurl4-openssl-dev dh-make-perl libssh-dev uuid-dev libczmq-dev libmodule-install-perl
|
||||
|
@ -262,7 +352,7 @@ jobs:
|
|||
retention-days: 1
|
||||
|
||||
sign-rpm:
|
||||
needs: [package]
|
||||
needs: [package-rpm]
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
|
@ -293,24 +383,27 @@ jobs:
|
|||
- run: rpmsign --addsign ./*.rpm
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
||||
download-and-cache-deb:
|
||||
needs: [package]
|
||||
needs: [package-deb]
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
steps:
|
||||
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
|
||||
with:
|
||||
name: packages-deb-bullseye
|
||||
name: packages-deb-${{ matrix.distrib }}
|
||||
path: ./
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.deb
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-deb-bullseye
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
|
||||
|
||||
deliver-rpm:
|
||||
needs: [get-environment, sign-rpm]
|
||||
|
@ -341,7 +434,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
@ -362,7 +455,7 @@ jobs:
|
|||
runs-on: [self-hosted, common]
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [el8, el9, bullseye]
|
||||
distrib: [el8, el9, bullseye, bookworm]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -46,6 +46,16 @@ jobs:
|
|||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-bullseye-arm64
|
||||
distrib: bullseye
|
||||
package_extension: deb
|
||||
|
@ -68,7 +78,7 @@ jobs:
|
|||
|
||||
- name: Install locally Crypt::Argon2
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
apt-get update
|
||||
apt-get install -y cpanminus gcc
|
||||
else
|
||||
|
@ -80,7 +90,7 @@ jobs:
|
|||
|
||||
- name: Set package name and paths according to distrib
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
NAME="libcrypt-argon2-perl"
|
||||
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl5/5.32"
|
||||
|
@ -109,11 +119,13 @@ jobs:
|
|||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
arch: ${{ matrix.arch }}
|
||||
release: 3
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-perl-crypt-argon2-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-crypt-argon2-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
# set condition to true if artifacts are needed
|
||||
- if: ${{ false }}
|
||||
|
@ -158,6 +170,10 @@ jobs:
|
|||
include:
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: jammy
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
@ -189,6 +205,8 @@ jobs:
|
|||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ jobs:
|
|||
cp -r ~/rpmbuild/RPMS/x86_64/*.rpm .
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -92,7 +92,7 @@ jobs:
|
|||
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -103,7 +103,7 @@ jobs:
|
|||
- run: rpmsign --addsign ./*.rpm
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -138,7 +138,7 @@ jobs:
|
|||
DEB_BUILD_OPTIONS="nocheck nodocs notest noautodbgsym" dh-make-perl make --verbose --build --version 4.0-${{ matrix.distrib }} perl-filesys-smbclient/
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.deb
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
|
||||
|
|
|
@ -38,6 +38,12 @@ jobs:
|
|||
- image: packaging-plugins-bullseye
|
||||
distrib: bullseye
|
||||
package_extension: deb
|
||||
- image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
package_extension: deb
|
||||
- image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
package_extension: deb
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
|
@ -55,7 +61,7 @@ jobs:
|
|||
|
||||
- name: Install locally JSON::Path
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
apt-get update
|
||||
apt-get install -y cpanminus gcc
|
||||
else
|
||||
|
@ -72,7 +78,7 @@ jobs:
|
|||
- name: Set package name and paths according to distrib
|
||||
run: |
|
||||
VERSION="1.0.3"
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
NAME="libjson-path-perl"
|
||||
PERL_VENDORLIB="/usr/share/perl5"
|
||||
else
|
||||
|
@ -98,12 +104,14 @@ jobs:
|
|||
nfpm_file_pattern: "dependencies/perl-json-path/perl-json-path.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
release: 3
|
||||
arch: all
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-json-path-${{ matrix.distrib }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
# set condition to true if artifacts are needed
|
||||
- if: ${{ false }}
|
||||
|
@ -145,8 +153,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
|
||||
distrib: [bullseye, bookworm]
|
||||
|
||||
name: Deliver ${{ matrix.distrib }}
|
||||
|
||||
|
@ -169,7 +176,7 @@ jobs:
|
|||
runs-on: [self-hosted, common]
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -57,7 +57,7 @@ jobs:
|
|||
cp -r ~/rpmbuild/RPMS/noarch/*.rpm .
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -88,7 +88,7 @@ jobs:
|
|||
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -99,7 +99,7 @@ jobs:
|
|||
- run: rpmsign --addsign ./*.rpm
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -120,6 +120,10 @@ jobs:
|
|||
include:
|
||||
- image: bullseye
|
||||
distrib: bullseye
|
||||
- image: bookworm
|
||||
distrib: bookworm
|
||||
- image: jammy
|
||||
distrib: jammy
|
||||
name: package ${{ matrix.distrib }}
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/packaging-plugins-${{ matrix.image }}:latest
|
||||
|
@ -140,7 +144,7 @@ jobs:
|
|||
DEB_BUILD_OPTIONS="nocheck nodocs notest noautodbgsym" dh-make-perl make -p libkeepass-reader-perl --verbose --build --version 0.2-${{ matrix.distrib }} perl-keepass-reader/
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.deb
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
|
||||
|
@ -180,7 +184,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
@ -201,7 +205,7 @@ jobs:
|
|||
runs-on: [self-hosted, common]
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [el8, el9, bullseye]
|
||||
distrib: [el8, el9, bullseye, bookworm]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -44,6 +44,16 @@ jobs:
|
|||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-bullseye-arm64
|
||||
distrib: bullseye
|
||||
package_extension: deb
|
||||
|
@ -66,7 +76,7 @@ jobs:
|
|||
|
||||
- name: Install locally Libssh::Session
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
apt-get update
|
||||
apt-get install -y cpanminus gcc libssh-dev
|
||||
else
|
||||
|
@ -78,7 +88,7 @@ jobs:
|
|||
|
||||
- name: Set package name and paths according to distrib
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
NAME="libssh-session-perl"
|
||||
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl5/5.32"
|
||||
|
@ -107,11 +117,13 @@ jobs:
|
|||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
arch: ${{ matrix.arch }}
|
||||
release: 4
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-perl-libssh-session-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-libssh-session-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
# set condition to true if artifacts are needed
|
||||
- if: ${{ false }}
|
||||
|
@ -158,6 +170,10 @@ jobs:
|
|||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: jammy
|
||||
arch: amd64
|
||||
|
||||
name: Deliver ${{ matrix.distrib }} ${{ matrix.arch }}
|
||||
|
||||
|
@ -187,6 +203,8 @@ jobs:
|
|||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
|
|
@ -44,6 +44,16 @@ jobs:
|
|||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
- image: packaging-plugins-bullseye-arm64
|
||||
distrib: bullseye
|
||||
package_extension: deb
|
||||
|
@ -66,7 +76,7 @@ jobs:
|
|||
|
||||
- name: Install locally Net::Curl
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
apt-get update
|
||||
apt-get install -y libcurl4-openssl-dev cpanminus gcc
|
||||
else
|
||||
|
@ -78,7 +88,7 @@ jobs:
|
|||
|
||||
- name: Set package name and paths according to distrib
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
NAME="libnet-curl-perl"
|
||||
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl5/5.32"
|
||||
|
@ -108,10 +118,12 @@ jobs:
|
|||
package_extension: ${{ matrix.package_extension }}
|
||||
arch: ${{ matrix.arch }}
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-perl-net-curl-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
release: 3
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-net-curl-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
# set condition to true if artifacts are needed
|
||||
- if: ${{ false }}
|
||||
|
@ -119,7 +131,7 @@ jobs:
|
|||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
name: packages-${{ matrix.distrib }}-${{ matrix.arch }}
|
||||
path: ./*.${{ matrix.package_extension}}
|
||||
path: ./*.${{ matrix.package_extension }}
|
||||
retention-days: 1
|
||||
|
||||
deliver-rpm:
|
||||
|
@ -156,6 +168,10 @@ jobs:
|
|||
include:
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: jammy
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
@ -187,6 +203,8 @@ jobs:
|
|||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
|
|
@ -45,6 +45,18 @@ jobs:
|
|||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
version: 2.7.2
|
||||
- image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
version: 2.7.2
|
||||
- image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
package_extension: deb
|
||||
runner: ubuntu-22.04
|
||||
arch: amd64
|
||||
version: 2.7.2
|
||||
- image: packaging-plugins-bullseye-arm64
|
||||
distrib: bullseye
|
||||
package_extension: deb
|
||||
|
@ -68,7 +80,7 @@ jobs:
|
|||
|
||||
- name: Install locally sblim-sfcc
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
apt-get update
|
||||
apt-get install -y libcurl4-openssl-dev
|
||||
cd /tmp
|
||||
|
@ -91,7 +103,7 @@ jobs:
|
|||
|
||||
- name: Build openwsman
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
apt-get install -y cmake libssl-dev libpam-dev swig libxml2-dev
|
||||
else
|
||||
dnf install -y wget cmake gcc-c++ libcurl-devel pam-devel swig libxml2-devel openssl-devel
|
||||
|
@ -104,10 +116,11 @@ jobs:
|
|||
cd build
|
||||
cmake .. -DBUILD_PYTHON=No -DBUILD_PYTHON3=No -DBUILD_JAVA=No -DBUILD_RUBY=No -DBUILD_PERL=Yes
|
||||
make
|
||||
shell: bash
|
||||
|
||||
- name: Set package name and paths according to distrib
|
||||
run: |
|
||||
if [ "${{ matrix.distrib }}" = "bullseye" ]; then
|
||||
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
|
||||
NAME_PERL="libopenwsman-perl"
|
||||
USRLIB="/usr/lib/"
|
||||
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||
|
@ -138,18 +151,20 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
- name: Package sblim-sfcc
|
||||
if: ${{ matrix.distrib == 'bullseye' }}
|
||||
if: ${{ matrix.package_extension == 'deb' }}
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "dependencies/perl-openwsman/sblim-sfcc.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
arch: ${{ matrix.arch }}
|
||||
release: 2
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-sblim-sfcc-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-sblim-sfcc-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
- name: Package libwsman
|
||||
uses: ./.github/actions/package-nfpm
|
||||
|
@ -158,11 +173,13 @@ jobs:
|
|||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
arch: ${{ matrix.arch }}
|
||||
release: 4
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-libwsman-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-libwsman-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
- name: Package perl-openwsman
|
||||
uses: ./.github/actions/package-nfpm
|
||||
|
@ -171,11 +188,13 @@ jobs:
|
|||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
arch: ${{ matrix.arch }}
|
||||
release: 4
|
||||
commit_hash: ${{ github.sha }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension}}-perl-openwsman-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
cache_key: cache-${{ github.sha }}-${{ matrix.package_extension }}-perl-openwsman-${{ matrix.distrib }}-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
# set condition to true if artifacts are needed
|
||||
- if: ${{ false }}
|
||||
|
@ -229,6 +248,10 @@ jobs:
|
|||
include:
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: jammy
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
@ -278,6 +301,8 @@ jobs:
|
|||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: amd64
|
||||
- distrib: bookworm
|
||||
arch: amd64
|
||||
- distrib: bullseye
|
||||
arch: arm64
|
||||
|
||||
|
@ -286,7 +311,7 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Promote sblim-sfcc ${{ matrix.distrib }} ${{ matrix.arch }} to stable
|
||||
if: ${{ matrix.distrib == 'bullseye' }}
|
||||
if: ${{ contains(fromJSON('["bullseye", "bookworm", "jammy"]'), matrix.distrib) }}
|
||||
uses: ./.github/actions/promote-to-stable
|
||||
with:
|
||||
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
|
||||
|
|
|
@ -39,7 +39,7 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
- name: Cache vsphere cli sources
|
||||
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: vmware-vsphere-cli-distrib
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere
|
||||
|
@ -47,6 +47,7 @@ jobs:
|
|||
package:
|
||||
needs:
|
||||
- get-sources
|
||||
- get-environment
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -60,6 +61,12 @@ jobs:
|
|||
- package_extension: deb
|
||||
image: packaging-plugins-bullseye
|
||||
distrib: bullseye
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
|
||||
|
@ -74,23 +81,25 @@ jobs:
|
|||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Import source files
|
||||
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: vmware-vsphere-cli-distrib
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
package_extension: ${{ matrix.package_extension }}
|
||||
commit_hash: ${{ github.sha }}
|
||||
release: ${{ needs.get-environment.outputs.release }}
|
||||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
deliver-rpm:
|
||||
needs:
|
||||
|
@ -125,7 +134,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
cp -r ~/rpmbuild/RPMS/x86_64/*.rpm .
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -86,7 +86,7 @@ jobs:
|
|||
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
@ -97,7 +97,7 @@ jobs:
|
|||
- run: rpmsign --addsign ./*.rpm
|
||||
shell: bash
|
||||
|
||||
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./*.rpm
|
||||
key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
|
||||
|
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
- name: Checkout sources
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./build/
|
||||
key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }}
|
||||
|
@ -96,7 +96,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distrib: [bullseye]
|
||||
distrib: [bullseye, bookworm, jammy]
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
- name: Package
|
||||
uses: ./.github/actions/package
|
||||
uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: "selinux/packaging/centreon-plugins-selinux.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
@ -67,6 +67,7 @@ jobs:
|
|||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
deliver-rpm:
|
||||
needs: [get-environment, package]
|
||||
|
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
|
||||
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
|
@ -93,7 +93,7 @@ jobs:
|
|||
fetch-depth: 1
|
||||
|
||||
- name: Prepare FatPacker
|
||||
uses: shogo82148/actions-setup-perl@v1
|
||||
uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0
|
||||
with:
|
||||
perl-version: '5.34'
|
||||
install-modules-with: cpm
|
||||
|
@ -104,7 +104,7 @@ jobs:
|
|||
COMMIT=$(git log -1 HEAD --pretty=format:%h)
|
||||
perl .github/scripts/plugins-source.container.pl "${{ needs.get-plugins.outputs.plugins }}" "${{ needs.get-environment.outputs.version }} ($COMMIT)"
|
||||
|
||||
- uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./build/
|
||||
key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }}
|
||||
|
@ -129,6 +129,12 @@ jobs:
|
|||
- package_extension: deb
|
||||
image: packaging-plugins-bullseye
|
||||
distrib: bullseye
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-bookworm
|
||||
distrib: bookworm
|
||||
- package_extension: deb
|
||||
image: packaging-plugins-jammy
|
||||
distrib: jammy
|
||||
|
||||
container:
|
||||
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
|
||||
|
@ -141,13 +147,22 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
if: ${{ matrix.distrib == 'el7' }}
|
||||
uses: actions/checkout@v3 # el7 is not compatible with checkout v4 which uses node20
|
||||
# el7 is not compatible with checkout v4 which uses node20
|
||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||
|
||||
- name: Checkout sources
|
||||
if: ${{ matrix.distrib != 'el7' }}
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
- if: ${{ matrix.distrib == 'el7' }}
|
||||
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
with:
|
||||
path: ./build/
|
||||
key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- if: ${{ matrix.distrib != 'el7' }}
|
||||
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
||||
with:
|
||||
path: ./build/
|
||||
key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }}
|
||||
|
@ -213,7 +228,7 @@ jobs:
|
|||
done
|
||||
shell: bash
|
||||
|
||||
- uses: ./.github/actions/package
|
||||
- uses: ./.github/actions/package-nfpm
|
||||
with:
|
||||
nfpm_file_pattern: ".github/packaging/*.yaml"
|
||||
distrib: ${{ matrix.distrib }}
|
||||
|
@ -225,6 +240,7 @@ jobs:
|
|||
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 }}
|
||||
stability: ${{ needs.get-environment.outputs.stability }}
|
||||
|
||||
deliver:
|
||||
needs: [get-environment, package]
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
name: spell-checker
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/spellchecker.yml'
|
||||
- 'src/**'
|
||||
- '.github/scripts/pod_spell_check.t'
|
||||
|
||||
jobs:
|
||||
pod-spell-check:
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'do-not-spell-check') }}
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: filter
|
||||
with:
|
||||
base: ${{ github.ref }}
|
||||
list-files: shell
|
||||
filters: |
|
||||
plugins:
|
||||
- added|modified: src/**
|
||||
|
||||
- name: Install CPAN Libraries
|
||||
uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0
|
||||
with:
|
||||
perl-version: '5.34'
|
||||
install-modules-with: cpm
|
||||
install-modules: Test::More Test::Spelling
|
||||
|
||||
- name: Install librairies
|
||||
continue-on-error: true
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y hunspell
|
||||
shell: bash
|
||||
|
||||
- name: Run spell check
|
||||
id: run_check
|
||||
run: |
|
||||
set +e
|
||||
for f in ${{ steps.filter.outputs.plugins_files }}; do
|
||||
echo "perl .github/scripts/pod_spell_check.t $f"
|
||||
output=$(perl .github/scripts/pod_spell_check.t $f)
|
||||
done
|
||||
shell: bash
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
sudo apt-get install -qqy snmpsim
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
|
||||
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
|
@ -36,7 +36,7 @@ jobs:
|
|||
run: npm install -g -D @mockoon/cli@3.1.0
|
||||
|
||||
- name: Install perl dependencies
|
||||
uses: shogo82148/actions-setup-perl@v1
|
||||
uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0
|
||||
with:
|
||||
perl-version: '5.34'
|
||||
install-modules-with: cpm
|
||||
|
@ -55,7 +55,7 @@ jobs:
|
|||
JSON::XS
|
||||
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
|
||||
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "0.019"
|
||||
release: "2${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "@VERSION@"
|
||||
release: "2${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "0.8"
|
||||
release: "3${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "0.54"
|
||||
release: "2${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "@VERSION@"
|
||||
release: "1${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "@VERSION@"
|
||||
release: "3${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
|
@ -3,7 +3,7 @@ arch: "${ARCH}"
|
|||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "2.7.2"
|
||||
release: "1${DIST}"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
Coming soon
|
|
@ -0,0 +1,422 @@
|
|||
# SNMP plugin tutorial
|
||||
|
||||
All files showed in this section can be found on the centreon-plugins GitHub in
|
||||
the [tutorial](https://github.com/centreon/centreon-plugins/tree/develop/src/contrib/tutorial) **contrib**
|
||||
section.
|
||||
|
||||
> You have to move the contents of `contrib/tutorial/apps/` to `apps/` if you want to run it for testing purposes.
|
||||
>
|
||||
> `cp -R src/contrib/tutorial/network/* src/network/`
|
||||
|
||||
You also need to be able to use linux standard snmpwalk in your development environment.
|
||||
If you can't, you can use [this snmpwalk](https://github.com/centreon/centreon-plugins/blob/develop/tests/resources/snmp/os_linux_snmp_plugin.snmpwalk) coupled with snmpsim (in Docker for example)
|
||||
|
||||
**Description**
|
||||
|
||||
This example explains how to check a single SNMP oid value to check system CPUs.
|
||||
|
||||
## 1. Understand the data
|
||||
|
||||
Understanding the data is very important as it will drive the way you will design
|
||||
the **mode** internals. This is the **first thing to do**, no matter what protocol you
|
||||
are using.
|
||||
|
||||
There are several important properties for a piece of data:
|
||||
|
||||
- Type of the data to process: string, int... There is no limitation in the kind of data you can process
|
||||
- Dimensions of the data, is it **global** or linked to an **instance**?
|
||||
- Data layout, in other words anticipate the kind of **data structure** to manipulate.
|
||||
|
||||
Here we use a very simple example with only one oid value : `hrProcessorLoad` = `.1.3.6.1.2.1.25.3.3.1.2`
|
||||
If you use [this snmpwalk](https://github.com/centreon/centreon-plugins/blob/develop/tests/resources/snmp/os_linux_snmp_plugin.snmpwalk) you have this values :
|
||||
```
|
||||
.1.3.6.1.2.1.25.3.3.1.2.768 = INTEGER: 6
|
||||
.1.3.6.1.2.1.25.3.3.1.2.769 = INTEGER: 16
|
||||
```
|
||||
- the `cpu` node contains integer values (`6`, `16`) referring to specific **instances** (`768`, `769`). The structure is an array of hashes
|
||||
|
||||
## 2. Create directories for a new plugin
|
||||
|
||||
Create directories and files required for your **plugin** and **modes**.
|
||||
|
||||
Go to your centreon-plugins local git and create the appropriate directories and files:
|
||||
|
||||
```shell
|
||||
# path to the main directory and the subdirectory containing modes
|
||||
mkdir -p src/network/mysnmpplugin/snmp/mode
|
||||
# path to the main plugin file
|
||||
touch network/mysnmpplugin/snmp/plugin.pm
|
||||
# path to the specific mode(s) file(s) => for example appsmetrics.pm
|
||||
touch network/mysnmpplugin/snmp/mode/cpu.pm
|
||||
```
|
||||
|
||||
## 3. Create the plugin file : plugin.pm
|
||||
|
||||
Edit **plugin.pm** and add the following lines:
|
||||
|
||||
```perl
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Path to the plugin
|
||||
package network::mysnmpplugin::snmp::plugin;
|
||||
|
||||
# Needed libraries
|
||||
use strict;
|
||||
use warnings;
|
||||
# Use this library to check using SNMP protocol
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
```
|
||||
> **TIP** : Don't forget to edit 'Authors' line.
|
||||
|
||||
Add ```new``` method to instantiate the plugin:
|
||||
|
||||
```perl
|
||||
sub new {
|
||||
my ( $class, %options ) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
# $options->{options} = options object
|
||||
|
||||
# Modes association
|
||||
$self->{modes} = {
|
||||
# Mode name => path to the mode
|
||||
'cpu' => 'network::mysnmpplugin::snmp::mode::cpu'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
```
|
||||
Declare this plugin as a perl module:
|
||||
|
||||
```perl
|
||||
1;
|
||||
```
|
||||
Add a description to the plugin:
|
||||
|
||||
```perl
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check my-plugin-snmp CPU through SNMP.
|
||||
|
||||
=cut
|
||||
```
|
||||
> **TIP** : This description is printed with '--help' option.
|
||||
|
||||
To test if this plugin file works you can run this command:
|
||||
|
||||
`perl centreon_plugins.pl --plugin=apps::mysnmpplugin:::snmp::plugin --list-mode`
|
||||
|
||||
It already outputs a lot of things. Ellipsized lines are basically all standard capabilities
|
||||
inherited from the **script_custom** base.
|
||||
|
||||
```perl
|
||||
Plugin Description:
|
||||
Check CPU through SNMP.
|
||||
|
||||
Global Options:
|
||||
--mode Choose a mode.
|
||||
[...]
|
||||
--version
|
||||
Display plugin version.
|
||||
[...]
|
||||
|
||||
Modes Available:
|
||||
cpu
|
||||
|
||||
```
|
||||
|
||||
## 4. Create the mode file : cpu.pm
|
||||
|
||||
### 4.1 Common declarations and new constructor
|
||||
|
||||
Edit **cpu.pm** and add the following lines:
|
||||
|
||||
```perl
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Path to the plugin
|
||||
package network::mysnmpplugin::snmp::mode::cpu;
|
||||
|
||||
# Consider this as mandatory when writing a new mode.
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
# Needed libraries
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
```
|
||||
|
||||
Add a `new` function (sub) to initialize the mode:
|
||||
|
||||
```perl
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
# All options/properties of this mode, always add the force_new_perfdata => 1 to enable new metric/performance data naming.
|
||||
# It also where you can specify that the plugin uses a cache file for example
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
# Declare options
|
||||
$options{options}->add_options(arguments => {
|
||||
# One the left it's the option name that will be used in the command line. The ':s' at the end is to
|
||||
# define that this options takes a value.
|
||||
# On the right, it's the code name for this option, optionnaly you can define a default value so the user
|
||||
# doesn't have to set it.
|
||||
# option name => variable name
|
||||
'filter-id:s' => { name => 'filter_id' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
```
|
||||
|
||||
### 4.2 Declare your counters
|
||||
|
||||
This part essentially maps the data you want to get from the SNMP with the internal
|
||||
counter mode structure.
|
||||
|
||||
Remember how we categorized the data in the previous section understand-the-data.
|
||||
|
||||
The `$self->{maps_counters_type}` data structure describes these data while the `$self->{maps_counters}->{global}` one defines
|
||||
their properties like thresholds and how they will be displayed to the users.
|
||||
|
||||
```perl
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
# cpu will receive value for both instances (768 and 769) : the type => 1 explicits that
|
||||
# You can define a callback (cb) function to manage the output prefix. This function is called
|
||||
# each time a value is passed to the counter and can be shared across multiple counters.
|
||||
{ name => 'cpu', type => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPUs are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => 'cpu-usage-prct', nlabel => 'cpu.usage.percentage', set => {
|
||||
key_values => [ { name => 'cpu_usage' }, { name => 'name' } ],
|
||||
output_template => '%.2f %%',
|
||||
perfdatas => [
|
||||
# we add the label_extra_instance option to have one perfdata per instance
|
||||
{ label => 'cpu', template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'name' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### 4.3 Create prefix callback functions
|
||||
|
||||
These functions are not mandatory but help to make the output more readable for a human. We will create
|
||||
it now but as you have noticed the mode compiles so you can choose to keep those for the polishing moment.
|
||||
|
||||
During counters definitions, we associated a callback function like this :
|
||||
- `cb_prefix_output => 'prefix_cpu_output'`
|
||||
|
||||
Define those function by adding it to our `cpu.pm` file. It is self-explanatory.
|
||||
|
||||
```perl
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{name} . "' usage: ";
|
||||
}
|
||||
```
|
||||
|
||||
### 4.4 Get raw data from SNMP and understand the data structure
|
||||
|
||||
It's the moment to write the main sub (`manage_selection`) - the most complex, but also the one that
|
||||
will transform your mode to something useful and alive.
|
||||
|
||||
Think about the logic, what we have to do is:
|
||||
|
||||
- Query a specific path corresponding to a SNMP oid
|
||||
- Store and process the result
|
||||
- Spread this result across counters definitions
|
||||
|
||||
```perl
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
###################################################
|
||||
##### Load SNMP informations to a result hash #####
|
||||
###################################################
|
||||
|
||||
# Select relevant oids for CPU monitoring
|
||||
my $mapping = {
|
||||
# hashKey => { oid => 'oid_number_path'}
|
||||
hrProcessorID => { oid => '.1.3.6.1.2.1.25.3.3.1.1' },
|
||||
hrProcessorLoad => { oid => '.1.3.6.1.2.1.25.3.3.1.2' }
|
||||
#
|
||||
};
|
||||
|
||||
# Point at the begining of the SNMP table
|
||||
# Oid to point the table ahead all the oids given in mapping
|
||||
my $oid_hrProcessorTable = '.1.3.6.1.2.1.25.3.3.1';
|
||||
|
||||
# Use SNMP Centreon plugins tools to push SNMP result in hash to handle with.
|
||||
my $cpu_result = $options{snmp}->get_table(
|
||||
oid => $oid_hrProcessorTable,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
###################################################
|
||||
##### SNMP Result table to browse #####
|
||||
###################################################
|
||||
foreach my $oid (keys %{$cpu_result}) {
|
||||
next if ($oid !~ /^$mapping->{hrProcessorID}->{oid}\.(.*)$/);
|
||||
|
||||
# Catch table instance if exist :
|
||||
# Instance is a number availible for a same oid refering to different target
|
||||
my $instance = $1;
|
||||
# Uncomment the lines below to see what instance looks like :
|
||||
|
||||
# use Data::Dumper;
|
||||
# print Dumper($oid);
|
||||
# print Dumper($instance);
|
||||
|
||||
# Data Dumper returns : with oid = hrProcessorID.instance
|
||||
# $VAR1 = '.1.3.6.1.2.1.25.3.3.1.1.769';
|
||||
# $VAR1 = '769';
|
||||
# $VAR1 = '.1.3.6.1.2.1.25.3.3.1.1.768';
|
||||
# $VAR1 = '768';
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $cpu_result, instance => $instance);
|
||||
|
||||
# Here is the way to handle with basic name/id filter.
|
||||
# This filter is compare with hrProcessorID and in case of no match the oid is skipped
|
||||
if (defined($self->{option_results}->{filter_id}) && $self->{option_results}->{filter_id} ne '' &&
|
||||
$result->{hrProcessorID} !~ /$self->{option_results}->{filter_id}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{hrProcessorID} . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
# If the oid is not skipped above, here is convert the target values in result hash.
|
||||
# Here is where the counter magic happens.
|
||||
# $self->{cpu} is your counter definition (see $self->{maps_counters}->{<name>})
|
||||
# Here, we map the obtained string $result->{hrProcessorLoad} with the cpu_usage key_value in the counter.
|
||||
$self->{cpu}->{$instance} = {
|
||||
name => $result->{hrProcessorID},
|
||||
cpu_usage => $result->{hrProcessorLoad}
|
||||
};
|
||||
}
|
||||
|
||||
# IMPORTANT !
|
||||
# If you use a way to filter the values set in result hash,
|
||||
# check if at the end of parsing the result table isn't empty.
|
||||
# If it's the case, add a message for user to explain the filter doesn't match.
|
||||
if (scalar(keys %{$self->{cpu}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No processor ID matching with filter found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Declare this plugin as a perl module:
|
||||
|
||||
```perl
|
||||
1;
|
||||
```
|
||||
|
||||
Execute this command (`--verbose` will display the long output and the details for each `type => 1` counters).
|
||||
This command is based on use Docker SNMPSIM to simulate snmpwalk behavior (hostname, snmp-community and snmp-port).
|
||||
|
||||
```shell
|
||||
perl centreon_plugins.pl --plugin=network::mysnmpplugin::snmp::plugin --mode=cpu --hostname=localhost --snmp-community=local/os_linux_snmp_plugin --snmp-port=2024 --verbose
|
||||
```
|
||||
|
||||
Here is the expected output:
|
||||
|
||||
```shell
|
||||
OK: All CPUs are ok | '.0.0#cpu.usage.percentage'=6.00%;;;0;100 '.0.0#cpu.usage.percentage'=16.00%;;;0;100
|
||||
CPU '.0.0' usage: 6.00 %
|
||||
CPU '.0.0' usage: 16.00 %
|
||||
```
|
||||
|
||||
### 4.5 Help section and assistant to build your centreon objects
|
||||
|
||||
Last but not least, you need to write a help section to explain users what your mode is
|
||||
doing and what options they can use.
|
||||
|
||||
The centreon-plugins framework has a built-in assistant to help you with the list of counters
|
||||
and options.
|
||||
|
||||
Run this command to obtain a summary that will simplify the work of creating Centreon commands and write
|
||||
the mode's help:
|
||||
|
||||
```shell
|
||||
perl centreon_plugins.pl --plugin=network::mysnmpplugin::snmp::plugin --mode=cpu --hostname='anyvalue' --list-counters --verbose
|
||||
```
|
||||
|
||||
Get information from its output (shown below) to start building your mode's help:
|
||||
|
||||
```shell
|
||||
counter list: cpu-usage-prct
|
||||
configuration: --warning-cpu-usage-prct='$_SERVICEWARNINGCPUUSAGEPRCT$' --critical-cpu-usage-prct='$_SERVICECRITICALCPUUSAGEPRCT$'
|
||||
```
|
||||
|
||||
Here is how you can write the help, note that this time you will add the content after the `1;` and add the same
|
||||
`__END__` instruction like you did in the `plugin.pm` file.
|
||||
|
||||
```perl
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system CPUs.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-id>
|
||||
|
||||
Filter on one ID name.
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Warning threshold for CPU.
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Critical threshold for CPU.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
```
|
|
@ -10,6 +10,7 @@
|
|||
"snmp_standard/mode/memory.pm",
|
||||
"snmp_standard/mode/loadaverage.pm",
|
||||
"snmp_standard/mode/storage.pm",
|
||||
"snmp_standard/mode/uptime.pm",
|
||||
"storage/synology/snmp/"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"libemail-sender-perl",
|
||||
"libemail-mime-perl"
|
||||
"libemail-mime-perl",
|
||||
"libhtml-template-perl"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"dependencies": [
|
||||
"perl(Email::MIME)",
|
||||
"perl(Email::Simple)",
|
||||
"perl(Email::Sender)"
|
||||
"perl(Email::Sender)",
|
||||
"perl(HTML::Template)"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"libjson-perl",
|
||||
"zmq-libzmq4-perl",
|
||||
"libzmq-libzmq4-perl",
|
||||
"libuuid-perl"
|
||||
]
|
||||
}
|
|
@ -404,7 +404,7 @@ sub get_cache_file_response {
|
|||
sub cache_jobs_monitoring {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $datas = $self->get_jobs_monitoring(disable_cache => 1, limit => $options{limit});
|
||||
my $datas = $self->get_jobs_monitoring(disable_cache => 1, get_param => $options{get_param});
|
||||
$self->write_cache_file(
|
||||
statefile => 'jobs_monitoring',
|
||||
response => $datas
|
||||
|
@ -422,7 +422,7 @@ sub get_jobs_monitoring {
|
|||
return $self->request_api(
|
||||
endpoint => '/api/v1/job_monitoring',
|
||||
label => 'jobMonitoringInfoList',
|
||||
get_param => ['limit=' . $options{limit}]
|
||||
get_param => $options{get_param}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'limit:s' => { name => 'limit' }
|
||||
'filter-job-type:s' => { name => 'filter_job_type' },
|
||||
'limit:s' => { name => 'limit' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -49,7 +50,12 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$options{custom}->cache_jobs_monitoring(limit => $self->{option_results}->{limit});
|
||||
my $get_param = [ 'limit=' . $self->{option_results}->{limit} ];
|
||||
if (defined($self->{option_results}->{filter_job_type}) && $self->{option_results}->{filter_job_type} ne '') {
|
||||
push @{$get_param}, 'job_type=' . $self->{option_results}->{filter_job_type};
|
||||
}
|
||||
|
||||
$options{custom}->cache_jobs_monitoring(get_param => $get_param);
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
|
@ -67,6 +73,10 @@ Create cache files (job mode could use it with --cache-use option).
|
|||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-job-type>
|
||||
|
||||
Filter jobs by job type.
|
||||
|
||||
=item B<--limit>
|
||||
|
||||
Define the number of entries to retrieve for the pagination (default: 500).
|
||||
|
|
|
@ -92,9 +92,11 @@ sub job_long_output {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking job '%s' [type: %s]",
|
||||
"checking job '%s' [type: %s] [object type: %s] [location name: %s]",
|
||||
$options{instance_value}->{name},
|
||||
$options{instance_value}->{jobType}
|
||||
$options{instance_value}->{jobType},
|
||||
$options{instance_value}->{objectType},
|
||||
$options{instance_value}->{locationName}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -217,6 +219,7 @@ 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' },
|
||||
'filter-object-type:s' => { name => 'filter_object_type' },
|
||||
'unit:s' => { name => 'unit', default => 's' },
|
||||
'limit:s' => { name => 'limit' }
|
||||
});
|
||||
|
@ -244,14 +247,15 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $jobs_exec = $options{custom}->get_jobs_monitoring(limit => $self->{option_results}->{limit});
|
||||
my $jobs_exec = $options{custom}->get_jobs_monitoring(get_param => [ 'limit=' . $self->{option_results}->{limit} ]);
|
||||
|
||||
$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} : '')
|
||||
(defined($self->{option_results}->{filter_job_type}) ? $self->{option_results}->{filter_job_type} : '') . '_' .
|
||||
(defined($self->{option_results}->{filter_object_type}) ? $self->{option_results}->{filter_object_type} : '')
|
||||
)
|
||||
);
|
||||
my $ctime = time();
|
||||
|
@ -267,6 +271,8 @@ sub manage_selection {
|
|||
$job_exec->{objectName} !~ /$self->{option_results}->{filter_job_name}/);
|
||||
next if (defined($self->{option_results}->{filter_job_type}) && $self->{option_results}->{filter_job_type} ne '' &&
|
||||
$job_exec->{jobType} !~ /$self->{option_results}->{filter_job_type}/i);
|
||||
next if (defined($self->{option_results}->{filter_object_type}) && $self->{option_results}->{filter_object_type} ne '' &&
|
||||
$job_exec->{objectType} !~ /$self->{option_results}->{filter_object_type}/i);
|
||||
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}/);
|
||||
|
||||
|
@ -276,6 +282,8 @@ sub manage_selection {
|
|||
$self->{jobs}->{ $job_exec->{objectId} } = {
|
||||
name => $job_exec->{objectName},
|
||||
jobType => $job_exec->{jobType},
|
||||
objectType => $job_exec->{objectType},
|
||||
locationName => $job_exec->{locationName},
|
||||
timers => {},
|
||||
executions => {}
|
||||
};
|
||||
|
@ -289,7 +297,8 @@ sub manage_selection {
|
|||
if (!defined($_->{endTime}) && $_->{jobStatus} =~ /Active/i) {
|
||||
$older_running_exec = $_;
|
||||
}
|
||||
if (!defined($last_exec) && $_->{jobStatus} !~ /Scheduled/i) {
|
||||
|
||||
if ($_->{jobStatus} !~ /Scheduled|Canceled|Canceling|CancelingScheduled/i) {
|
||||
$last_exec = $_;
|
||||
}
|
||||
|
||||
|
@ -382,6 +391,10 @@ Filter jobs by job name.
|
|||
|
||||
Filter jobs by job type.
|
||||
|
||||
=item B<--filter-object-type>
|
||||
|
||||
Filter jobs by object type.
|
||||
|
||||
=item B<--filter-location-name>
|
||||
|
||||
Filter jobs by location name.
|
||||
|
|
|
@ -49,7 +49,9 @@ sub manage_selection {
|
|||
);
|
||||
my $results = {};
|
||||
foreach (@$jobs) {
|
||||
$results->{ $_->{objectId} } = $_;
|
||||
if (defined($_->{objectId})) {
|
||||
$results->{ $_->{objectId} } = $_;
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
@ -63,9 +65,9 @@ sub run {
|
|||
long_msg => sprintf(
|
||||
'[jobId: %s][jobName: %s][jobType: %s][locationName: %s]',
|
||||
$_->{objectId},
|
||||
$_->{objectName},
|
||||
$_->{jobType},
|
||||
$_->{locationName}
|
||||
defined($_->{objectName}) ? $_->{objectName} : 'none',
|
||||
defined($_->{jobType}) ? $_->{jobType} : 'none',
|
||||
defined($_->{locationName}) ? $_->{locationName} : 'none'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -91,9 +93,9 @@ sub disco_show {
|
|||
foreach (values %$results) {
|
||||
$self->{output}->add_disco_entry(
|
||||
jobId => $_->{objectId},
|
||||
jobName => $_->{objectName},
|
||||
jobType => $_->{jobType},
|
||||
locationName => $_->{locationName}
|
||||
jobName => defined($_->{objectName}) ? $_->{objectName} : 'none',
|
||||
jobType => defined($_->{jobType}) ? $_->{jobType} : 'none',
|
||||
locationName => defined($_->{locationName}) ? $_->{locationName} : 'none'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,19 +86,19 @@ WARN : Probably not work for java -version < 7.
|
|||
|
||||
=item B<--warning-system>
|
||||
|
||||
Warning threshold of System cpuload
|
||||
Warning threshold of system CPU load.
|
||||
|
||||
=item B<--critical-system>
|
||||
|
||||
Critical threshold of System cpuload
|
||||
Critical threshold of system CPU load.
|
||||
|
||||
=item B<--warning-process>
|
||||
|
||||
Warning threshold of Process cpuload
|
||||
Warning threshold of process CPU load.
|
||||
|
||||
=item B<--critical-process>
|
||||
|
||||
Critical threshold of Process cpuload
|
||||
Critical threshold of process CPU load.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -1957,7 +1957,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Collect and compute HTTP datas.
|
||||
Collect and compute HTTP data.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Cache SNMP datas in a JSON cache file.
|
||||
Cache SNMP data in a JSON cache file.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -1646,7 +1646,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Collect and compute SNMP datas.
|
||||
Collect and compute SNMP data.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check host cpu utilization.
|
||||
Check host CPU utilization.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cluster cpu usage.
|
||||
Check cluster CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check ESX cpu usage.
|
||||
Check ESX CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check virtual machine cpu usage.
|
||||
Check virtual machine CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu.
|
||||
Check CPU.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ Example: adding --display-transform-src='dev' --display-transform-dst='run' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache storage datas.
|
||||
Display cache storage data.
|
||||
|
||||
=item B<--space-reservation>
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage (AIRESPACE-SWITCHING-MIB).
|
||||
Check CPU usage (AIRESPACE-SWITCHING-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage of web security and mail (ASYNCOS-MAIL-MIB, ASYNCOSWEBSECURITYAPPLIANCE-MIB).
|
||||
Check CPU usage of web security and mail (ASYNCOS-MAIL-MIB, ASYNCOSWEBSECURITYAPPLIANCE-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage (CISCOSBmng.mib).
|
||||
Check CPU usage (CISCOSBmng.mib).
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -265,13 +265,13 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage (CISCO-PROCESS-MIB and CISCO-SYSTEM-EXT-MIB).
|
||||
Check CPU usage (CISCO-PROCESS-MIB and CISCO-SYSTEM-EXT-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--check-order>
|
||||
|
||||
Check cpu in standard cisco mib. If you have some issue (wrong cpu information in a specific mib), you can change the order
|
||||
Check CPU in standard cisco mib. If you have some issue (wrong CPU information in a specific mib), you can change the order
|
||||
(default: 'process,old_sys,system_ext').
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
|
|
@ -456,7 +456,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu load usage.
|
||||
Check CPU load.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage (FASTPATH-SWITCHING-MIB).
|
||||
Check CPU usage (FASTPATH-SWITCHING-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usages.
|
||||
Check CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check system cpu usage (FORTINET-FORTIGATE-MIB).
|
||||
Check system CPU usage (FORTINET-FORTIGATE-MIB).
|
||||
|
||||
=over 8
|
||||
|
||||
|
@ -179,11 +179,11 @@ Can be: 'core', 'average', 'cluster-average'.
|
|||
|
||||
=item B<--cluster>
|
||||
|
||||
Add cluster cpu informations.
|
||||
Add cluster CPU informations.
|
||||
|
||||
=item B<--filter-core>
|
||||
|
||||
Core cpu to monitor (can be a regexp).
|
||||
Core CPU to monitor (can be a regexp).
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ Time in minutes before reloading cache file (default: 180).
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache storage datas.
|
||||
Display cache storage data.
|
||||
|
||||
=item B<--filter-storage-type>
|
||||
|
||||
|
|
|
@ -94,19 +94,19 @@ perl centreon_plugins.pl --plugin=apps::tomcat::jmx::plugin --custommode=jolokia
|
|||
|
||||
=item B<--warning-system>
|
||||
|
||||
Warning threshold of System cpuload
|
||||
Warning threshold of system CPU load.
|
||||
|
||||
=item B<--critical-system>
|
||||
|
||||
Critical threshold of System cpuload
|
||||
Critical threshold of system CPU load.
|
||||
|
||||
=item B<--warning-process>
|
||||
|
||||
Warning threshold of Process cpuload
|
||||
Warning threshold of process CPU load.
|
||||
|
||||
=item B<--critical-process>
|
||||
|
||||
Critical threshold of Process cpuload
|
||||
Critical threshold of process CPU load.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -1534,7 +1534,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Collect and compute SQL datas.
|
||||
Collect and compute SQL data.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -95,14 +95,13 @@ sub check_options {
|
|||
|
||||
$self->{printf_value} = 'value_field';
|
||||
if (defined($self->{option_results}->{printf_value}) && $self->{option_results}->{printf_value} ne '') {
|
||||
$self->{printf_value} = $1
|
||||
if ($self->{option_results}->{printf_value} =~ /\$self->\{result_values}->\{(value_field|key_field)}/);
|
||||
$self->{printf_value} = $1
|
||||
if ($self->{option_results}->{printf_value} =~ /\%\{(value_field|key_field)}/);
|
||||
$self->{printf_value} = $1
|
||||
if ($self->{option_results}->{printf_value} =~ /\%\((value_field|key_field)\)/);
|
||||
$self->{printf_value} = $1
|
||||
if ($self->{option_results}->{printf_value} =~ /\$self->\{result_values\}->\{(value_field|key_field)\}/);
|
||||
$self->{printf_value} = $1
|
||||
if ($self->{option_results}->{printf_value} =~ /\%\{(value_field|key_field)\}/);
|
||||
$self->{printf_value} = $1
|
||||
if ($self->{option_results}->{printf_value} =~ /\%\((value_field|key_field)\)/);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
|
|
|
@ -106,7 +106,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage.
|
||||
Check CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -73,7 +73,13 @@ sub GetOptions {
|
|||
|
||||
# find type of option
|
||||
if ($search_str !~ /,((?:[^,]*?\|){0,}$option(?:\|.*?){0,}(:.*?){0,1}),/) {
|
||||
warn "Unknown option: $option" if ($warn_message == 1);
|
||||
|
||||
# for old format plugins (with run function) that not allowed list-counters options
|
||||
if($option =~ /list-counters/){
|
||||
warn "list-counters option not available yet for this mode." if ($warn_message == 1);
|
||||
}else{
|
||||
warn "Unknown option: $option" if ($warn_message == 1);
|
||||
}
|
||||
$i++;
|
||||
next;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ sub add_option_msg {
|
|||
sub set_ignore_label {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{option_results}->{output_ignore_label} = 1;
|
||||
$self->{option_results}->{output_ignore_label} = 1;
|
||||
}
|
||||
|
||||
sub set_status {
|
||||
|
@ -208,7 +208,7 @@ sub output_add {
|
|||
} else {
|
||||
$self->{global_short_concat_outputs}->{uc($options->{severity})} = $options->{short_msg};
|
||||
}
|
||||
|
||||
|
||||
push @{$self->{global_short_outputs}->{uc($options->{severity})}}, $options->{short_msg};
|
||||
$self->set_status(exit_litteral => $options->{severity});
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ sub perfdata_add {
|
|||
$perfdata->{$_} = $options{$_};
|
||||
}
|
||||
|
||||
if ((defined($self->{option_results}->{use_new_perfdata}) || defined($options{force_new_perfdata})) &&
|
||||
if ((defined($self->{option_results}->{use_new_perfdata}) || defined($options{force_new_perfdata})) &&
|
||||
defined($options{nlabel})) {
|
||||
$perfdata->{label} = $options{nlabel};
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ sub output_json {
|
|||
outputs => [],
|
||||
perfdatas => []
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
foreach my $code_litteral (keys %{$self->{global_short_outputs}}) {
|
||||
foreach (@{$self->{global_short_outputs}->{$code_litteral}}) {
|
||||
|
@ -343,7 +343,7 @@ sub output_xml {
|
|||
my ($self, %options) = @_;
|
||||
my $force_ignore_perfdata = (defined($options{force_ignore_perfdata}) && $options{force_ignore_perfdata} == 1) ? 1 : 0;
|
||||
my $force_long_output = (defined($options{force_long_output}) && $options{force_long_output} == 1) ? 1 : 0;
|
||||
my ($child_plugin_name, $child_plugin_mode, $child_plugin_exit, $child_plugin_output, $child_plugin_perfdata);
|
||||
my ($child_plugin_name, $child_plugin_mode, $child_plugin_exit, $child_plugin_output, $child_plugin_perfdata);
|
||||
|
||||
my $root = $self->{xml_output}->createElement('plugin');
|
||||
$self->{xml_output}->setDocumentElement($root);
|
||||
|
@ -411,7 +411,7 @@ sub output_xml {
|
|||
foreach my $perf (@{$self->{perfdatas}}) {
|
||||
next if ($self->filter_perfdata(perf => $perf));
|
||||
$self->range_perfdata(ranges => [\$perf->{warning}, \$perf->{critical}]);
|
||||
|
||||
|
||||
my ($child_perfdata);
|
||||
$child_perfdata = $self->{xml_output}->createElement('perfdata');
|
||||
$child_plugin_perfdata->addChild($child_perfdata);
|
||||
|
@ -593,8 +593,8 @@ sub display {
|
|||
$self->create_xml_document();
|
||||
if ($self->{is_output_xml}) {
|
||||
$self->output_xml(
|
||||
exit_litteral => $self->get_litteral_status(),
|
||||
nolabel => $nolabel,
|
||||
exit_litteral => $self->get_litteral_status(),
|
||||
nolabel => $nolabel,
|
||||
force_ignore_perfdata => $force_ignore_perfdata, force_long_output => $force_long_output
|
||||
);
|
||||
return ;
|
||||
|
@ -603,7 +603,7 @@ sub display {
|
|||
$self->create_json_document();
|
||||
if ($self->{is_output_json}) {
|
||||
$self->output_json(
|
||||
exit_litteral => $self->get_litteral_status(),
|
||||
exit_litteral => $self->get_litteral_status(),
|
||||
nolabel => $nolabel,
|
||||
force_ignore_perfdata => $force_ignore_perfdata, force_long_output => $force_long_output
|
||||
);
|
||||
|
@ -615,7 +615,7 @@ sub display {
|
|||
}
|
||||
|
||||
$self->output_txt(
|
||||
exit_litteral => $self->get_litteral_status(),
|
||||
exit_litteral => $self->get_litteral_status(),
|
||||
nolabel => $nolabel,
|
||||
force_ignore_perfdata => $force_ignore_perfdata, force_long_output => $force_long_output
|
||||
);
|
||||
|
@ -642,7 +642,7 @@ sub die_exit {
|
|||
$self->output_json(exit_litteral => $exit_litteral, nolabel => $nolabel, force_ignore_perfdata => 1);
|
||||
$self->exit(exit_litteral => $exit_litteral);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$self->output_txt(exit_litteral => $exit_litteral, nolabel => $nolabel, force_ignore_perfdata => 1);
|
||||
$self->exit(exit_litteral => $exit_litteral);
|
||||
|
@ -729,13 +729,13 @@ sub get_litteral_status {
|
|||
|
||||
sub is_status {
|
||||
my ($self, %options) = @_;
|
||||
# $options{value} = string status
|
||||
# $options{value} = string status
|
||||
# $options{litteral} = value is litteral
|
||||
# $options{compare} = string status
|
||||
# $options{compare} = string status
|
||||
|
||||
if (defined($options{litteral})) {
|
||||
my $value = defined($options{value}) ? $options{value} : $self->get_litteral_status();
|
||||
|
||||
|
||||
if (uc($value) eq uc($options{compare})) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ sub parameter {
|
|||
|
||||
sub add_disco_entry {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
push @{$self->{disco_entries}}, {%options};
|
||||
}
|
||||
|
||||
|
@ -950,7 +950,7 @@ sub load_eval {
|
|||
my ($self) = @_;
|
||||
|
||||
my ($code) = centreon::plugins::misc::mymodule_load(
|
||||
output => $self->{output}, module => 'Safe',
|
||||
output => $self->{output}, module => 'Safe',
|
||||
no_quit => 1
|
||||
);
|
||||
if ($code == 0) {
|
||||
|
@ -1140,8 +1140,8 @@ sub apply_pfdata_scale {
|
|||
|
||||
if (defined(${$options{perf}}->{max}) && ${$options{perf}}->{max} ne '') {
|
||||
($value) = centreon::plugins::misc::scale_bytesbit(value => ${$options{perf}}->{max},
|
||||
src_quantity => $src_quantity, src_unit => $src_unit,
|
||||
dst_quantity => defined($dst_unit) ? $dst_quantity : $options{args}->{quantity},
|
||||
src_quantity => $src_quantity, src_unit => $src_unit,
|
||||
dst_quantity => defined($dst_unit) ? $dst_quantity : $options{args}->{quantity},
|
||||
dst_unit => defined($dst_unit) ? $dst_unit : $options{args}->{unit});
|
||||
${$options{perf}}->{max} = sprintf('%.2f', $value);
|
||||
}
|
||||
|
@ -1153,14 +1153,14 @@ sub apply_pfdata_scale {
|
|||
|
||||
if ($result->{start} ne '' && $result->{infinite_neg} == 0) {
|
||||
($result->{start}) = centreon::plugins::misc::scale_bytesbit(value => $result->{start},
|
||||
src_quantity => $src_quantity, src_unit => $src_unit,
|
||||
dst_quantity => defined($dst_unit) ? $dst_quantity : $options{args}->{quantity},
|
||||
src_quantity => $src_quantity, src_unit => $src_unit,
|
||||
dst_quantity => defined($dst_unit) ? $dst_quantity : $options{args}->{quantity},
|
||||
dst_unit => defined($dst_unit) ? $dst_unit : $options{args}->{unit});
|
||||
}
|
||||
if ($result->{end} ne '' && $result->{infinite_pos} == 0) {
|
||||
($result->{end}) = centreon::plugins::misc::scale_bytesbit(value => $result->{end},
|
||||
src_quantity => $src_quantity, src_unit => $src_unit,
|
||||
dst_quantity => defined($dst_unit) ? $dst_quantity : $options{args}->{quantity},
|
||||
src_quantity => $src_quantity, src_unit => $src_unit,
|
||||
dst_quantity => defined($dst_unit) ? $dst_quantity : $options{args}->{quantity},
|
||||
dst_unit => defined($dst_unit) ? $dst_unit : $options{args}->{unit});
|
||||
}
|
||||
|
||||
|
@ -1216,7 +1216,7 @@ sub apply_pfdata_percent {
|
|||
${$options{perf}}->{$threshold} = centreon::plugins::misc::get_threshold_litteral(%$result);
|
||||
}
|
||||
|
||||
${$options{perf}}->{max} = 100;
|
||||
${$options{perf}}->{max} = 100;
|
||||
}
|
||||
|
||||
sub apply_pfdata_eval {
|
||||
|
@ -1364,7 +1364,7 @@ sub parse_perfdata_extend_args {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
# --extend-perfdata=searchlabel,newlabel,method[,[newuom],[min],[max],[warning],[critical]]
|
||||
my ($pfdata_match, $pfdata_substitute, $method, $uom_sub, $min_sub, $max_sub, $warn_sub, $crit_sub) =
|
||||
my ($pfdata_match, $pfdata_substitute, $method, $uom_sub, $min_sub, $max_sub, $warn_sub, $crit_sub) =
|
||||
split /,/, $options{arg};
|
||||
return if ((!defined($pfdata_match) || $pfdata_match eq '') && $options{type} != 3);
|
||||
|
||||
|
@ -1539,29 +1539,29 @@ remove all metrics whose value equals 0 and that don't have a maximum value.
|
|||
=item B<--explode-perfdata-max>
|
||||
|
||||
Create a new metric for each metric that comes with a maximum limit. The new
|
||||
metric will be named identically with a '_max' suffix).
|
||||
metric will be named identically with a '_max' suffix).
|
||||
Example: it will split 'used_prct'=26.93%;0:80;0:90;0;100
|
||||
into 'used_prct'=26.93%;0:80;0:90;0;100 'used_prct_max'=100%;;;;
|
||||
|
||||
|
||||
=item B<--change-perfdata> B<--extend-perfdata>
|
||||
=item B<--change-perfdata> B<--extend-perfdata>
|
||||
|
||||
Change or extend perfdata.
|
||||
Change or extend perfdata.
|
||||
Syntax: --extend-perfdata=searchlabel,newlabel,target[,[newuom],[min],[max]]
|
||||
|
||||
Common examples:
|
||||
|
||||
=over 4
|
||||
|
||||
Convert storage free perfdata into used: --change-perfdata=free,used,invert()
|
||||
Convert storage free perfdata into used: --change-perfdata='free,used,invert()'
|
||||
|
||||
Convert storage free perfdata into used: --change-perfdata=used,free,invert()
|
||||
Convert storage free perfdata into used: --change-perfdata='used,free,invert()'
|
||||
|
||||
Scale traffic values automatically: --change-perfdata=traffic,,scale(auto)
|
||||
Scale traffic values automatically: --change-perfdata='traffic,,scale(auto)'
|
||||
|
||||
Scale traffic values in Mbps: --change-perfdata=traffic_in,,scale(Mbps),mbps
|
||||
Scale traffic values in Mbps: --change-perfdata='traffic_in,,scale(Mbps),mbps'
|
||||
|
||||
Change traffic values in percent: --change-perfdata=traffic_in,,percent()
|
||||
Change traffic values in percent: --change-perfdata='traffic_in,,percent()'
|
||||
|
||||
=back
|
||||
|
||||
|
@ -1622,7 +1622,7 @@ and an output.
|
|||
|
||||
=item B<--output-ignore-label>
|
||||
|
||||
Remove the status label ("OK:", "WARNING:", "UNKNOWN:", CRITICAL:") from the
|
||||
Remove the status label ("OK:", "WARNING:", "UNKNOWN:", CRITICAL:") from the
|
||||
beginning of the output.
|
||||
Example: 'OK: Ram Total:...' will become 'Ram Total:...'
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ use strict;
|
|||
use warnings;
|
||||
use centreon::plugins::values;
|
||||
use centreon::plugins::misc;
|
||||
use JSON::XS;
|
||||
|
||||
my $sort_subs = {
|
||||
num => sub { $a <=> $b },
|
||||
|
@ -173,6 +174,7 @@ sub new {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
@ -181,18 +183,52 @@ sub check_options {
|
|||
$self->SUPER::init(%options);
|
||||
|
||||
if (defined($self->{option_results}->{list_counters})) {
|
||||
my $list_counter = 'counter list:';
|
||||
my $list_counter = '';
|
||||
my $th_counter = '';
|
||||
my $counters;
|
||||
foreach my $key (keys %{$self->{maps_counters}}) {
|
||||
foreach (@{$self->{maps_counters}->{$key}}) {
|
||||
$counters->{metrics}->{$_->{label}}->{nlabel} ="";
|
||||
$counters->{metrics}->{$_->{label}}->{min}="";
|
||||
$counters->{metrics}->{$_->{label}}->{max}="";
|
||||
$counters->{metrics}->{$_->{label}}->{unit}="";
|
||||
$counters->{metrics}->{$_->{label}}->{output_template}="";
|
||||
if(defined($_->{nlabel})) {
|
||||
$counters->{metrics}->{$_->{label}}->{nlabel} = $_->{nlabel};
|
||||
}
|
||||
if(defined($_->{set}->{perfdatas}->[0]->{min})) {
|
||||
$counters->{metrics}->{$_->{label}}->{min} = $_->{set}->{perfdatas}->[0]->{min};
|
||||
}
|
||||
if(defined($_->{set}->{perfdatas}->[0]->{max})) {
|
||||
$counters->{metrics}->{$_->{label}}->{max} = $_->{set}->{perfdatas}->[0]->{max};
|
||||
}
|
||||
if(defined($_->{set}->{perfdatas}->[0]->{unit})) {
|
||||
$counters->{metrics}->{$_->{label}}->{unit} = $_->{set}->{perfdatas}->[0]->{unit};
|
||||
}
|
||||
if(defined($_->{set}->{perfdatas}->[0]->{template})) {
|
||||
$counters->{metrics}->{$_->{label}}->{output_template} = $_->{set}->{perfdatas}->[0]->{template};
|
||||
}
|
||||
my $label = $_->{label};
|
||||
$label =~ s/-//g;
|
||||
$list_counter .= " " . $_->{label};
|
||||
$th_counter .= " --warning-$_->{label}='\$_SERVICEWARNING" . uc($label) . "\$' --critical-$_->{label}='\$_SERVICECRITICAL" . uc($label) . "\$'";
|
||||
$list_counter .= $_->{label}." ";
|
||||
$th_counter .= "--warning-$_->{label}='\$_SERVICEWARNING" . uc($label) . "\$' --critical-$_->{label}='\$_SERVICECRITICAL" . uc($label) . "\$'";
|
||||
|
||||
}
|
||||
}
|
||||
$self->{output}->output_add(short_msg => $list_counter);
|
||||
$self->{output}->output_add(long_msg => 'configuration: ' . $th_counter);
|
||||
$counters->{"counter list"}=$list_counter;
|
||||
$counters->{"pack configuration"}=$th_counter." \$_SERVICEEXTRAOPTIONS\$";
|
||||
|
||||
my $result_data ="";
|
||||
eval {
|
||||
$result_data = JSON::XS->new->indent->space_after->canonical->utf8->encode($counters);
|
||||
};
|
||||
if ($@) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cannot use \$counters as it is a malformed JSON: " . $@);
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{output}->output_add(short_msg => "counter list: ".$list_counter);
|
||||
$self->{output}->output_add(long_msg => $result_data);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ Check containers CPU usage and throttled.
|
|||
|
||||
=item B<--cpu-attribute>
|
||||
|
||||
Set the cpu attribute to match element (must be a PromQL filter, Default: 'cpu="total"')
|
||||
Set the CPU attribute to match element (must be a PromQL filter, Default: 'cpu="total"')
|
||||
|
||||
=item B<--container>
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ Filter on a specific instance (must be a PromQL filter, Default: 'instance=~".*"
|
|||
|
||||
=item B<--cpu>
|
||||
|
||||
Filter on a specific cpu (must be a PromQL filter, Default: 'cpu=~".*"')
|
||||
Filter on a specific CPU (must be a PromQL filter, Default: 'cpu=~".*"')
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ Filter on a specific instance (must be a PromQL filter, Default: 'instance=~".*"
|
|||
|
||||
=item B<--cpu>
|
||||
|
||||
Filter on a specific cpu (must be a PromQL filter, Default: 'cpu=~".*"')
|
||||
Filter on a specific CPU (must be a PromQL filter, Default: 'cpu=~".*"')
|
||||
|
||||
=item B<--type>
|
||||
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"constants": {
|
||||
"okState": "active",
|
||||
"criticalState": "disabled",
|
||||
"criticalConnSecond": null,
|
||||
"criticalCurrConn": null
|
||||
},
|
||||
"mapping": {
|
||||
"poolState": {
|
||||
"1": "active",
|
||||
"2": "disabled",
|
||||
"3": "draining",
|
||||
"4": "unused",
|
||||
"5": "unknown"
|
||||
}
|
||||
},
|
||||
"snmp": {
|
||||
"tables": [
|
||||
{
|
||||
"name": "poolEntry",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.3.2.1",
|
||||
"used_instance": "\\.1\\.3\\.6\\.1\\.4\\.1\\.7146\\.1\\.2\\.3\\.2\\.1\\.\\d+\\.(\\d+(\\.\\d+)+)",
|
||||
"entries": [
|
||||
{
|
||||
"name": "poolName",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.3.2.1.1"
|
||||
},
|
||||
{
|
||||
"name": "poolState",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.3.2.1.14",
|
||||
"map": "poolState"
|
||||
},
|
||||
{
|
||||
"name": "poolTotalConn",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.3.2.1.10",
|
||||
"sampling": 1
|
||||
},
|
||||
{
|
||||
"name": "poolCurrentConn",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.3.2.1.48"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"selection_loop": [
|
||||
{
|
||||
"name": "Pool ZXTM",
|
||||
"source": "%(snmp.tables.poolEntry)",
|
||||
"expand_table": {
|
||||
"poolEntry": "%(snmp.tables.poolEntry.[%(poolEntry.instance)])"
|
||||
},
|
||||
"critical": "%(poolEntry.poolState) =~ /%(constants.criticalState)/ or (defined(%(constants.criticalConnSecond)) and %(poolEntry.poolTotalConnPerSeconds) >= %(constants.criticalConnSecond)) or (defined(%(constants.criticalCurrConn)) and %(poolEntry.poolCurrentConn) >= %(constants.criticalCurrConn))",
|
||||
"perfdatas": [
|
||||
{
|
||||
"nlabel": "connS",
|
||||
"instances": ["%(poolEntry.poolName)"],
|
||||
"value": "%(poolEntry.poolTotalConnPerSeconds)",
|
||||
"critical": "%(constants.criticalConnSecond)",
|
||||
"unit": "conn/s",
|
||||
"min": 0
|
||||
},
|
||||
{
|
||||
"nlabel": "conn",
|
||||
"instances": ["%(poolEntry.poolName)"],
|
||||
"value": "%(poolEntry.poolCurrentConn)",
|
||||
"critical": "%(constants.criticalConn)",
|
||||
"unit": "conn",
|
||||
"min": 0
|
||||
}
|
||||
],
|
||||
"formatting": {
|
||||
"printf_msg": "Device '%s' state is '%s', current connetions are '%d', with conn/s '%.2f'",
|
||||
"printf_var": [
|
||||
"%(poolEntry.poolName)",
|
||||
"%(poolEntry.poolState)",
|
||||
"%(poolEntry.poolCurrentConn)",
|
||||
"%(poolEntry.poolTotalConnPerSeconds)"
|
||||
],
|
||||
"display_ok": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"constants": {
|
||||
"criticalCurrConn": null
|
||||
},
|
||||
"mapping": {
|
||||
},
|
||||
"snmp": {
|
||||
"tables": [
|
||||
{
|
||||
"name": "virtualserverEntry",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.2.2.1",
|
||||
"used_instance": "\\.1\\.3\\.6\\.1\\.4\\.1\\.7146\\.1\\.2\\.2\\.2\\.1\\.\\d+\\.(\\d+(\\.\\d+)+)",
|
||||
"entries": [
|
||||
{
|
||||
"name": "virtualserverName",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.2.2.1.1"
|
||||
},
|
||||
{
|
||||
"name": "virtualserverCurrentConn",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.2.2.1.9"
|
||||
},
|
||||
{
|
||||
"name": "virtualServerMaxConnections",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.2.2.1.10"
|
||||
},
|
||||
{
|
||||
"name": "virtualserverTotalHTTPRequests",
|
||||
"oid": ".1.3.6.1.4.1.7146.1.2.2.2.1.43"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"selection_loop": [
|
||||
{
|
||||
"name": "Virtual Server ZXTM",
|
||||
"source": "%(snmp.tables.virtualserverEntry)",
|
||||
"expand_table": {
|
||||
"virtualserverEntry": "%(snmp.tables.virtualserverEntry.[%(virtualserverEntry.instance)])"
|
||||
},
|
||||
"critical": "defined(%(constants.criticalCurrConn)) and %(virtualserverEntry.virtualserverCurrentConn) >= %(constants.criticalCurrConn)",
|
||||
"perfdatas": [
|
||||
{
|
||||
"nlabel": "conn",
|
||||
"instances": ["%(virtualserverEntry.virtualserverName)"],
|
||||
"value": "%(virtualserverEntry.virtualserverCurrentConn)",
|
||||
"critical": "%(constants.criticalConn)",
|
||||
"unit": "conn",
|
||||
"min": 0
|
||||
}
|
||||
],
|
||||
"formatting": {
|
||||
"printf_msg": "Device '%s' current connections are '%d', max connections are '%d', total HTTP requests are '%d'",
|
||||
"printf_var": [
|
||||
"%(virtualserverEntry.virtualserverName)",
|
||||
"%(virtualserverEntry.virtualserverCurrentConn)",
|
||||
"%(virtualserverEntry.virtualServerMaxConnections)",
|
||||
"%(virtualserverEntry.virtualserverTotalHTTPRequests)"
|
||||
],
|
||||
"display_ok": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Path to the plugin
|
||||
package network::mysnmpplugin::snmp::mode::cpu;
|
||||
|
||||
# Consider this as mandatory when writing a new mode.
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
# Needed libraries
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{name} . "' usage: ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
# app_metrics groups connections and errors and each will receive value for both instances (my-awesome-frontend and my-awesome-db)
|
||||
|
||||
#A compléter
|
||||
|
||||
# the type => 1 explicits that
|
||||
# You can define a callback (cb) function to manage the output prefix. This function is called
|
||||
# each time a value is passed to the counter and can be shared across multiple counters.
|
||||
{ name => 'cpu', type => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPUs are ok' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => 'cpu-usage-prct', nlabel => 'cpu.usage.percentage', set => {
|
||||
key_values => [ { name => 'cpu_usage' }, { name => 'name' } ],
|
||||
output_template => '%.2f %%',
|
||||
perfdatas => [
|
||||
# we add the label_extra_instance option to have one perfdata per instance
|
||||
{ label => 'cpu', template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'name' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
# All options/properties of this mode, always add the force_new_perfdata => 1 to enable new metric/performance data naming.
|
||||
# It also where you can specify that the plugin uses a cache file for example
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
# Declare options
|
||||
$options{options}->add_options(arguments => {
|
||||
# One the left it's the option name that will be used in the command line. The ':s' at the end is to
|
||||
# define that this options takes a value.
|
||||
# On the right, it's the code name for this option, optionnaly you can define a default value so the user
|
||||
# doesn't have to set it.
|
||||
# option name => variable name
|
||||
'filter-id:s' => { name => 'filter_id' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
###################################################
|
||||
##### Load SNMP informations to a result hash #####
|
||||
###################################################
|
||||
|
||||
# Select relevant oids for CPU monitoring
|
||||
my $mapping = {
|
||||
# hashKey => { oid => 'oid_number_path'}
|
||||
hrProcessorID => { oid => '.1.3.6.1.2.1.25.3.3.1.1' },
|
||||
hrProcessorLoad => { oid => '.1.3.6.1.2.1.25.3.3.1.2' }
|
||||
#
|
||||
};
|
||||
|
||||
# Point at the begining of the SNMP table
|
||||
# Oid to point the table ahead all the oids given in mapping
|
||||
my $oid_hrProcessorTable = '.1.3.6.1.2.1.25.3.3.1';
|
||||
|
||||
# Use SNMP Centreon plugins tools to push SNMP result in hash to handle with.
|
||||
# $cpu_result is a hash table where keys are oids
|
||||
my $cpu_result = $options{snmp}->get_table(
|
||||
oid => $oid_hrProcessorTable,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
###################################################
|
||||
##### SNMP Result table to browse #####
|
||||
###################################################
|
||||
foreach my $oid (keys %{$cpu_result}) {
|
||||
next if ($oid !~ /^$mapping->{hrProcessorID}->{oid}\.(.*)$/);
|
||||
|
||||
# Catch table instance if exist :
|
||||
# Instance is a number availible for a same oid refering to different target
|
||||
my $instance = $1;
|
||||
# Uncomment the lines below to see what instance looks like :
|
||||
|
||||
# use Data::Dumper;
|
||||
# print Dumper($oid);
|
||||
# print Dumper($instance);
|
||||
|
||||
# Data Dumper returns : with oid = hrProcessorID.instance
|
||||
# $VAR1 = '.1.3.6.1.2.1.25.3.3.1.1.769';
|
||||
# $VAR1 = '769';
|
||||
# $VAR1 = '.1.3.6.1.2.1.25.3.3.1.1.768';
|
||||
# $VAR1 = '768';
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $cpu_result, instance => $instance);
|
||||
|
||||
# Here is the way to handle with basic name/id filter.
|
||||
# This filter is compare with hrProcessorID and in case of no match the oid is skipped
|
||||
if (defined($self->{option_results}->{filter_id}) && $self->{option_results}->{filter_id} ne '' &&
|
||||
$result->{hrProcessorID} !~ /$self->{option_results}->{filter_id}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $result->{hrProcessorID} . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
# If the oid is not skipped above, here is convert the target values in result hash.
|
||||
# Here is where the counter magic happens.
|
||||
# $self->{cpu} is your counter definition (see $self->{maps_counters}->{<name>})
|
||||
# Here, we map the obtained string $result->{hrProcessorLoad} with the cpu_usage key_value in the counter.
|
||||
$self->{cpu}->{$instance} = {
|
||||
name => $result->{hrProcessorID},
|
||||
cpu_usage => $result->{hrProcessorLoad}
|
||||
};
|
||||
}
|
||||
|
||||
# IMPORTANT !
|
||||
# If you use a way to filter the values set in result hash,
|
||||
# check if at the end of parsing the result table isn't empty.
|
||||
# If it's the case, add a message for user to explain the filter doesn't match.
|
||||
if (scalar(keys %{$self->{cpu}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No processor ID matching with filter found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system CPUs.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-id>
|
||||
|
||||
Filter on one ID name.
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Warning threshold for CPU.
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Critical threshold for CPU.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,47 @@
|
|||
#
|
||||
# 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::mysnmpplugin::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ( $class, %options ) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{modes} = {
|
||||
'cpu' => 'network::mysnmpplugin::snmp::mode::cpu'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check my-plugin-snmp CPU through SNMP.
|
||||
|
||||
=cut
|
|
@ -81,7 +81,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage.
|
||||
Check CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu.
|
||||
Check CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check device cpu, memory and state.
|
||||
Check device CPU, memory and state.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usages.
|
||||
Check CPU usages.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage (AlcatelIND1Health.mib).
|
||||
Check CPU usage (AlcatelIND1Health.mib).
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu usage.
|
||||
Check CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu (worked since firmware 10.10).
|
||||
Check CPU (worked since firmware 10.10).
|
||||
|
||||
=over 8
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ Check system CPUs.
|
|||
|
||||
=item B<--use-ucd>
|
||||
|
||||
Use UCD mib for cpu average.
|
||||
Use UCD mib for CPU average.
|
||||
|
||||
=item B<--warning-average>
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -477,7 +477,7 @@ Example: adding --display-transform-src='eth' --display-transform-dst='ens' wil
|
|||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
Display cache interface data.
|
||||
|
||||
=back
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue