diff --git a/.github/actions/deb-delivery-legacy/action.yml b/.github/actions/deb-delivery-legacy/action.yml index 8a89c964a9..dd70aaab9c 100644 --- a/.github/actions/deb-delivery-legacy/action.yml +++ b/.github/actions/deb-delivery-legacy/action.yml @@ -30,7 +30,7 @@ runs: key: ${{ inputs.cache_key }} fail-on-cache-miss: true - - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 + - uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} diff --git a/.github/actions/deb-delivery/action.yml b/.github/actions/deb-delivery/action.yml index 846772d5ee..0a3fc332aa 100644 --- a/.github/actions/deb-delivery/action.yml +++ b/.github/actions/deb-delivery/action.yml @@ -34,7 +34,7 @@ runs: fail-on-cache-miss: true - if: ${{ ! (inputs.distrib == 'jammy' && inputs.stability == 'stable') }} - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 + uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} diff --git a/.github/actions/package-nfpm/action.yml b/.github/actions/package-nfpm/action.yml index 85f508669b..515ce8644a 100644 --- a/.github/actions/package-nfpm/action.yml +++ b/.github/actions/package-nfpm/action.yml @@ -85,7 +85,7 @@ runs: export DIST="" if [ "${{ inputs.stability }}" == "unstable" ] || [ "${{ inputs.stability }}" == "canary" ]; then export RELEASE="$RELEASE~${{ inputs.distrib }}" - elif [ "${{ inputs.stability }}" == "testing" ]; then + else export RELEASE="1~${{ inputs.distrib }}" fi export APACHE_USER="www-data" diff --git a/.github/actions/promote-to-stable/action.yml b/.github/actions/promote-to-stable/action.yml index dd29900864..9cb76256a7 100644 --- a/.github/actions/promote-to-stable/action.yml +++ b/.github/actions/promote-to-stable/action.yml @@ -17,7 +17,7 @@ inputs: runs: using: "composite" steps: - - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 + - uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} diff --git a/.github/actions/rpm-delivery-legacy/action.yml b/.github/actions/rpm-delivery-legacy/action.yml index 042a38b394..1f801a510e 100644 --- a/.github/actions/rpm-delivery-legacy/action.yml +++ b/.github/actions/rpm-delivery-legacy/action.yml @@ -30,7 +30,7 @@ runs: key: ${{ inputs.cache_key }} fail-on-cache-miss: true - - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 + - uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} diff --git a/.github/actions/rpm-delivery/action.yml b/.github/actions/rpm-delivery/action.yml index b0ec29c495..b5eef4f1bd 100644 --- a/.github/actions/rpm-delivery/action.yml +++ b/.github/actions/rpm-delivery/action.yml @@ -31,7 +31,7 @@ runs: key: ${{ inputs.cache_key }} fail-on-cache-miss: true - - uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 + - uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0 env: JF_URL: https://centreon.jfrog.io JF_ACCESS_TOKEN: ${{ inputs.artifactory_token }} diff --git a/.github/actions/runner-docker/action.yml b/.github/actions/runner-docker/action.yml deleted file mode 100644 index a5558424ba..0000000000 --- a/.github/actions/runner-docker/action.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: run-in-docker -description: Run step in docker container -inputs: - script_name: - description: "script_name" - required: true - image_name: - description: "image_name" - required: true - image_version: - description: "image_version" - required: true - centreon_pat: - description: "Secret" - required: false - registry_url: - description: Docker registry url - required: true - registry_username: - description: Docker registry username - required: true - registry_password: - description: Docker registry password - required: true - params: - description: "params for script" - required: false -runs: - using: "composite" - steps: - - name: Login to Registry (via runner) - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 - with: - registry: ${{ inputs.registry_url }} - username: ${{ inputs.registry_username }} - password: ${{ inputs.registry_password }} - - - run: docker run -i -e TOKEN=${{ inputs.centreon_pat }} --entrypoint /src/.github/scripts/${{ inputs.script_name }}.sh -v "$PWD:/src" ${{ inputs.registry_url }}/${{ inputs.image_name }}:${{ inputs.image_version }} ${{ inputs.params }} - shell: bash diff --git a/.github/scripts/stopwords.t b/.github/scripts/stopwords.t index ef299c3705..9c5c5a58b5 100644 --- a/.github/scripts/stopwords.t +++ b/.github/scripts/stopwords.t @@ -1,15 +1,21 @@ --filter-vdom --force-counters32 Centreon -Fortinet +Datacore Fortigate +Fortinet license-instances-usage-prct +MBean OID oneaccess-sys-mib perfdata powershell +proto +Sansymphony +queue-messages-inflighted SNMP space-usage-prct SSH SureBackup +topic-messages-inflighted Veeam diff --git a/.github/workflows/connector-vmware.yml b/.github/workflows/connector-vmware.yml index 1fcfb77432..2e25a3858e 100644 --- a/.github/workflows/connector-vmware.yml +++ b/.github/workflows/connector-vmware.yml @@ -25,8 +25,8 @@ jobs: version_file: connectors/vmware/src/centreon/script/centreon_vmware.pm package: - needs: - - get-environment + needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} runs-on: ubuntu-22.04 strategy: matrix: @@ -66,7 +66,7 @@ jobs: distrib: ${{ matrix.distrib }} package_extension: ${{ matrix.package_extension }} version: ${{ needs.get-environment.outputs.version }} - release: ${{ needs.get-environment.outputs.release }} + release: 1 commit_hash: ${{ github.sha }} cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }} @@ -75,10 +75,8 @@ jobs: stability: ${{ needs.get-environment.outputs.stability }} deliver-rpm: - needs: - - get-environment - - package - if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} + needs: [get-environment, package] + if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common] strategy: @@ -99,10 +97,8 @@ jobs: artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} deliver-deb: - needs: - - get-environment - - package - if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} + needs: [get-environment, package] + if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common] strategy: @@ -121,3 +117,23 @@ jobs: cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} stability: ${{ needs.get-environment.outputs.stability }} artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + + promote: + needs: [get-environment] + if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) }} + runs-on: [self-hosted, common] + strategy: + matrix: + distrib: [el8, el9, bullseye, bookworm] + + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Promote ${{ matrix.distrib }} to stable + uses: ./.github/actions/promote-to-stable + with: + artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + module: connector-vmware + distrib: ${{ matrix.distrib }} + stability: ${{ needs.get-environment.outputs.stability }} diff --git a/.github/workflows/nrpe.yml b/.github/workflows/nrpe.yml index c51017cddd..7b542e1a49 100644 --- a/.github/workflows/nrpe.yml +++ b/.github/workflows/nrpe.yml @@ -20,7 +20,7 @@ jobs: get-environment: uses: ./.github/workflows/get-environment.yml with: - version_file: nrpe/packaging/centreon-nrpe3-daemon.yaml + version_file: nrpe/packaging/centreon-nrpe4-daemon.yaml package: needs: [get-environment] @@ -59,7 +59,7 @@ jobs: - name: Download nrpe sources run: | - curl -Lo - "https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-${{ needs.get-environment.outputs.version }}/nrpe-${{ needs.get-environment.outputs.version }}.tar.gz" | tar zxpf - + curl -sLo - "https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-${{ needs.get-environment.outputs.version }}/nrpe-${{ needs.get-environment.outputs.version }}.tar.gz" | tar zxpf - mv nrpe-${{ needs.get-environment.outputs.version }} nrpe-src shell: bash @@ -67,7 +67,7 @@ jobs: run: | cd nrpe-src - patch -p1 < ../nrpe/packaging/files/nrpe3_add_centreon_cmd.patch + patch -p1 < ../nrpe/packaging/files/nrpe4_add_centreon_cmd.patch if [ "${{ matrix.package_extension }}" = "deb" ]; then NAGIOS_PLUGINS_PATH="/usr/lib/nagios/plugins" diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 9d988460ba..16ba4b17c8 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -148,14 +148,19 @@ jobs: password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - 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 yum config-manager --set-enabled powertools || true # alma 8 - 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 + yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel + + dnf module reset -y ruby + dnf module enable -y ruby:3.1 + dnf install -y ruby shell: bash - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} @@ -200,7 +205,8 @@ jobs: cp -r ~/rpmbuild/RPMS/noarch/*.rpm . shell: bash - - name: Replace '::' with - in the feature path + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Replace '::' with - in the feature path id: package-name run: | name="${{ matrix.name }}" @@ -209,7 +215,8 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} path: ./*.${{ matrix.package_extension }} @@ -226,56 +233,21 @@ jobs: 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" ] @@ -295,10 +267,9 @@ jobs: - distrib: jammy package_extension: deb image: packaging-plugins-jammy - - name: "DateTime::Format::Duration::ISO8601" - name: "Statistics::Regression" + build_distribs: "bullseye" version: "0.53" - - name: "ZMQ::Constants" - name: "ZMQ::LibZMQ4" use_dh_make_perl: "false" version: "0.01" @@ -311,9 +282,11 @@ jobs: password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Get package version + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Get package version id: package-version run: | apt-get update @@ -363,7 +336,8 @@ jobs: DEB_BUILD_OPTIONS="nocheck nodocs notest" dh-make-perl make --dist ${{ matrix.distrib }} --build --version ${{ steps.package-version.outputs.package_version }}-${{ matrix.distrib }} --cpan ${{ matrix.name }} shell: bash - - name: Replace '::' with - in the feature path + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Replace '::' with - in the feature path id: package-name run: | name="${{ matrix.name }}" @@ -372,7 +346,8 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash}} path: ./*.${{ matrix.package_extension }} @@ -435,7 +410,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + - uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3 with: name: packages-rpm-${{ matrix.distrib }} path: ./ @@ -458,7 +433,7 @@ jobs: matrix: distrib: [bullseye, bookworm, jammy] steps: - - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + - uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3 with: name: packages-deb-${{ matrix.distrib }} path: ./ diff --git a/.github/workflows/perl-crypt-argon2.yml b/.github/workflows/perl-crypt-argon2.yml index ae7c02b5ea..808458b4cd 100644 --- a/.github/workflows/perl-crypt-argon2.yml +++ b/.github/workflows/perl-crypt-argon2.yml @@ -26,6 +26,7 @@ jobs: package: needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} strategy: fail-fast: false @@ -85,24 +86,28 @@ jobs: dnf install -y cpanminus gcc fi - cpanm -v -l /tmp Crypt::Argon2@0.019 + cpanm -v -l /tmp Crypt::Argon2@0.020 shell: bash - name: Set package name and paths according to distrib run: | + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") + + echo "Perl version is $PERL_VERSION" + 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" + PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION" else - PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl5/5.32" + PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION" fi else NAME="perl-Crypt-Argon2" if [ "${{ matrix.distrib }}" = "el8" ]; then PERL_VENDORARCH="/usr/local/lib64/perl5" else - PERL_VENDORARCH="/usr/local/lib64/perl5/5.32" + PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION" fi fi @@ -119,7 +124,7 @@ jobs: distrib: ${{ matrix.distrib }} package_extension: ${{ matrix.package_extension }} arch: ${{ matrix.arch }} - release: 3 + release: 1 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 }} rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }} @@ -130,7 +135,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/perl-filesys-smbclient.yml b/.github/workflows/perl-filesys-smbclient.yml index d18acd2cfa..197541af04 100644 --- a/.github/workflows/perl-filesys-smbclient.yml +++ b/.github/workflows/perl-filesys-smbclient.yml @@ -118,6 +118,10 @@ jobs: include: - image: packaging-plugins-bullseye distrib: bullseye + - image: packaging-plugins-bookworm + distrib: bookworm + - image: packaging-plugins-jammy + distrib: jammy name: package ${{ matrix.distrib }} container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest @@ -135,7 +139,7 @@ jobs: mv dependencies/perl-filesys-smbclient/src/ perl-filesys-smbclient tar czf perl-filesys-smbclient.tar.gz perl-filesys-smbclient - DEB_BUILD_OPTIONS="nocheck nodocs notest noautodbgsym" dh-make-perl make --verbose --build --version 4.0-${{ matrix.distrib }} perl-filesys-smbclient/ + DEB_BUILD_OPTIONS="nocheck nodocs notest noautodbgsym" dh-make-perl make --dist ${{ matrix.distrib }} --verbose --build --version 4.0-${{ matrix.distrib }} perl-filesys-smbclient/ shell: bash - uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 @@ -172,7 +176,7 @@ jobs: strategy: matrix: - distrib: [bullseye] + distrib: [bullseye, bookworm, jammy] steps: - name: Checkout sources @@ -193,7 +197,7 @@ jobs: runs-on: [self-hosted, common] strategy: matrix: - distrib: [el8, el9, bullseye] + distrib: [el8, el9, bullseye, bookworm] steps: - name: Checkout sources diff --git a/.github/workflows/perl-json-path.yml b/.github/workflows/perl-json-path.yml index 0bb26794d3..f3206b70b1 100644 --- a/.github/workflows/perl-json-path.yml +++ b/.github/workflows/perl-json-path.yml @@ -24,6 +24,7 @@ jobs: package: needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} strategy: fail-fast: false @@ -71,13 +72,18 @@ jobs: if [ "${{ matrix.distrib }}" = "el8" ]; then cpanm -v -l /tmp JSON::Path@0.5 else - cpanm -v -l /tmp JSON::Path@1.0.3 + cpanm -v -l /tmp JSON::Path@1.0.4 fi shell: bash - name: Set package name and paths according to distrib run: | - VERSION="1.0.3" + VERSION="1.0.4" + + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") + + echo "Perl version is $PERL_VERSION" + if [[ "${{ matrix.package_extension }}" == "deb" ]]; then NAME="libjson-path-perl" PERL_VENDORLIB="/usr/share/perl5" @@ -87,7 +93,7 @@ jobs: VERSION="0.5" # https://github.com/centreon/centreon-plugins/issues/4540 PERL_VENDORLIB="/usr/local/share/perl5" else - PERL_VENDORLIB="/usr/local/share/perl5/5.32" + PERL_VENDORLIB="/usr/local/share/perl5/$PERL_VERSION" fi fi @@ -116,7 +122,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.distrib }} path: ./*.${{ matrix.package_extension}} @@ -153,7 +159,7 @@ jobs: strategy: matrix: - distrib: [bullseye, bookworm] + distrib: [bullseye, bookworm, jammy] name: Deliver ${{ matrix.distrib }} @@ -176,7 +182,7 @@ jobs: runs-on: [self-hosted, common] strategy: matrix: - distrib: [bullseye, bookworm] + distrib: [el8, el9, bullseye, bookworm] steps: - name: Checkout sources diff --git a/.github/workflows/perl-keepass-reader.yml b/.github/workflows/perl-keepass-reader.yml index 8e2bcc56ed..73aaf88256 100644 --- a/.github/workflows/perl-keepass-reader.yml +++ b/.github/workflows/perl-keepass-reader.yml @@ -18,145 +18,108 @@ on: paths: - "dependencies/perl-keepass-reader/**" +env: + module_name: perl-keepass-reader + jobs: get-environment: uses: ./.github/workflows/get-environment.yml - package-rpm: + package: needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability != 'stable' }} - runs-on: ubuntu-22.04 strategy: + fail-fast: false matrix: include: - image: packaging-plugins-alma8 distrib: el8 + package_extension: rpm - image: packaging-plugins-alma9 distrib: el9 - name: package ${{ matrix.distrib }} - 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 - - - run: | - yum install -y make perl perl-devel perl-ExtUtils-MakeMaker - - mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} - - cp -rp dependencies/perl-keepass-reader/src perl-KeePass-Reader/ - tar czf ~/rpmbuild/SOURCES/perl-KeePass-Reader.tar.gz perl-KeePass-Reader - - rpmbuild -ba dependencies/perl-keepass-reader/packaging/rpm/perl-KeePass-Reader.spec - - cp -r ~/rpmbuild/RPMS/noarch/*.rpm . - shell: bash - - - uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: ./*.rpm - key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + package_extension: rpm + - 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 - sign-rpm: - needs: [package-rpm] runs-on: ubuntu-22.04 - strategy: - matrix: - include: - - image: packaging-alma8 - distrib: el8 - - image: packaging-alma9 - distrib: el9 - name: sign rpm ${{ matrix.distrib }} + container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/rpm-signing:ubuntu - options: -t + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest credentials: username: ${{ secrets.DOCKER_REGISTRY_ID }} password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} - steps: - - run: | - apt-get update - apt-get install -y zstd - shell: bash - - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + name: package ${{ matrix.distrib }} - - uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: ./*.rpm - key: unsigned-${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - run: echo "HOME=/root" >> $GITHUB_ENV - shell: bash + - name: Build library + run: | + if [[ "${{ matrix.package_extension }}" == "rpm" ]]; then + dnf install -y make perl + else + apt-get update + apt-get install -y make perl + fi - - run: rpmsign --addsign ./*.rpm + cd dependencies/perl-keepass-reader/src + perl Makefile.PL INSTALL_BASE=/tmp/perl-keepass-reader + make + make pure_install shell: bash - - uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 - with: - path: ./*.rpm - key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + - name: Set package name and paths according to distrib + run: | + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - with: - name: packages-${{ matrix.distrib }} - path: ./*.rpm - retention-days: 1 + echo "Perl version is $PERL_VERSION" - package-deb: - needs: [get-environment] - if: ${{ needs.get-environment.outputs.stability != 'stable' }} + if [[ "${{ matrix.package_extension }}" == "deb" ]]; then + NAME="libkeepass-reader-perl" + PERL_VENDORLIB="/usr/share/perl5" + else + NAME="perl-KeePass-Reader" + if [[ "${{ matrix.distrib }}" == "el8" ]]; then + PERL_VENDORLIB="/usr/local/share/perl5" + else + PERL_VENDORLIB="/usr/local/share/perl5/$PERL_VERSION" + fi + fi - runs-on: ubuntu-22.04 - strategy: - matrix: - 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 - credentials: - username: ${{ secrets.DOCKER_REGISTRY_ID }} - password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + sed -i "s/@NAME@/$NAME/g" dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml + sed -i "s#@PERL_VENDORLIB@#$PERL_VENDORLIB#g" dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml - - run: | - apt update - apt install -y dh-make-perl perl - - mv dependencies/perl-keepass-reader/src/ perl-keepass-reader - tar czf perl-keepass-reader.tar.gz perl-keepass-reader - - 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/ + cat dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml shell: bash - - uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 + - name: Package + uses: ./.github/actions/package-nfpm with: - path: ./*.deb - key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + nfpm_file_pattern: "dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml" + distrib: ${{ matrix.distrib }} + package_extension: ${{ matrix.package_extension }} + version: "0.2" + release: "3" + arch: all + commit_hash: ${{ github.sha }} + cache_key: cache-${{ github.run_id }}-${{ matrix.package_extension }}-${{ env.module_name }}-${{ 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 }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - with: - name: packages-${{ matrix.distrib }} - path: ./*.deb - retention-days: 1 deliver-rpm: - needs: [get-environment, sign-rpm] + needs: [get-environment, package] if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common] @@ -164,6 +127,8 @@ jobs: matrix: distrib: [el8, el9] + name: Deliver ${{ matrix.distrib }} + steps: - name: Checkout sources uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -171,14 +136,14 @@ jobs: - name: Delivery uses: ./.github/actions/rpm-delivery with: - module_name: perl-keepass-reader + module_name: ${{ env.module_name }} distrib: ${{ matrix.distrib }} artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + cache_key: cache-${{ github.run_id }}-rpm-${{ env.module_name }}-${{ matrix.distrib }} stability: ${{ needs.get-environment.outputs.stability }} deliver-deb: - needs: [get-environment, package-deb] + needs: [get-environment, package] if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common] @@ -186,6 +151,8 @@ jobs: matrix: distrib: [bullseye, bookworm, jammy] + name: Deliver ${{ matrix.distrib }} + steps: - name: Checkout sources uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -193,10 +160,10 @@ jobs: - name: Delivery uses: ./.github/actions/deb-delivery with: - module_name: perl-keepass-reader + module_name: ${{ env.module_name }} distrib: ${{ matrix.distrib }} artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + cache_key: cache-${{ github.run_id }}-deb-${{ env.module_name }}-${{ matrix.distrib }} stability: ${{ needs.get-environment.outputs.stability }} promote: @@ -205,7 +172,7 @@ jobs: runs-on: [self-hosted, common] strategy: matrix: - distrib: [el8, el9, bullseye, bookworm] + distrib: [bullseye, bookworm] steps: - name: Checkout sources @@ -215,6 +182,6 @@ jobs: uses: ./.github/actions/promote-to-stable with: artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} - module: perl-keepass-reader + module: ${{ env.module_name }} distrib: ${{ matrix.distrib }} stability: ${{ needs.get-environment.outputs.stability }} diff --git a/.github/workflows/perl-libssh-session.yml b/.github/workflows/perl-libssh-session.yml index 63cc505ef8..69f068d40d 100644 --- a/.github/workflows/perl-libssh-session.yml +++ b/.github/workflows/perl-libssh-session.yml @@ -24,6 +24,7 @@ jobs: package: needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} strategy: fail-fast: false @@ -88,19 +89,23 @@ jobs: - name: Set package name and paths according to distrib run: | + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") + + echo "Perl version is $PERL_VERSION" + 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" + PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION" else - PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl5/5.32" + PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION" fi else NAME="perl-Libssh-Session" if [ "${{ matrix.distrib }}" = "el8" ]; then PERL_VENDORARCH="/usr/local/lib64/perl5" else - PERL_VENDORARCH="/usr/local/lib64/perl5/5.32" + PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION" fi fi @@ -117,7 +122,7 @@ jobs: distrib: ${{ matrix.distrib }} package_extension: ${{ matrix.package_extension }} arch: ${{ matrix.arch }} - release: 4 + release: 5 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 }} rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }} @@ -128,7 +133,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension}} diff --git a/.github/workflows/perl-net-curl.yml b/.github/workflows/perl-net-curl.yml index 3bf2fc9d79..830c2aaef9 100644 --- a/.github/workflows/perl-net-curl.yml +++ b/.github/workflows/perl-net-curl.yml @@ -24,6 +24,7 @@ jobs: package: needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} strategy: fail-fast: false @@ -83,24 +84,28 @@ jobs: dnf install -y libcurl-devel cpanminus gcc fi - cpanm -v -l /tmp Net::Curl@0.54 + cpanm -v -l /tmp Net::Curl@0.55 shell: bash - name: Set package name and paths according to distrib run: | + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") + + echo "Perl version is $PERL_VERSION" + 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" + PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION" else - PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl5/5.32" + PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION" fi else NAME="perl-Net-Curl" if [ "${{ matrix.distrib }}" = "el8" ]; then PERL_VENDORARCH="/usr/local/lib64/perl5" else - PERL_VENDORARCH="/usr/local/lib64/perl5/5.32" + PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION" fi fi @@ -118,7 +123,7 @@ jobs: package_extension: ${{ matrix.package_extension }} arch: ${{ matrix.arch }} commit_hash: ${{ github.sha }} - release: 3 + release: 1 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 }} @@ -128,7 +133,7 @@ jobs: # set condition to true if artifacts are needed - if: ${{ false }} name: Upload package artifacts - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.distrib }}-${{ matrix.arch }} path: ./*.${{ matrix.package_extension }} diff --git a/.github/workflows/perl-openwsman.yml b/.github/workflows/perl-openwsman.yml index c646015355..fdefc37d59 100644 --- a/.github/workflows/perl-openwsman.yml +++ b/.github/workflows/perl-openwsman.yml @@ -22,6 +22,7 @@ jobs: package: needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} strategy: fail-fast: false @@ -32,37 +33,31 @@ jobs: package_extension: rpm runner: ubuntu-22.04 arch: amd64 - version: 2.7.2 - image: packaging-plugins-alma9 distrib: el9 package_extension: rpm runner: ubuntu-22.04 arch: amd64 - version: 2.7.2 - image: packaging-plugins-bullseye distrib: bullseye package_extension: deb 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 runner: ["self-hosted", "collect-arm64"] arch: arm64 - version: 2.7.2 runs-on: ${{ matrix.runner }} @@ -74,6 +69,10 @@ jobs: name: package ${{ matrix.distrib }} ${{ matrix.arch }} + env: + version: "2.7.2" + release: "6" + steps: - name: Checkout sources uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -110,8 +109,8 @@ jobs: fi cd /tmp - wget -O - https://github.com/Openwsman/openwsman/archive/refs/tags/v${{ matrix.version }}.tar.gz|tar zxvf - - cd openwsman-${{ matrix.version }}/ + wget -O - https://github.com/Openwsman/openwsman/archive/refs/tags/v${{ env.version }}.tar.gz|tar zxvf - + cd openwsman-${{ env.version }}/ mkdir build cd build cmake .. -DBUILD_PYTHON=No -DBUILD_PYTHON3=No -DBUILD_JAVA=No -DBUILD_RUBY=No -DBUILD_PERL=Yes @@ -120,13 +119,23 @@ jobs: - name: Set package name and paths according to distrib run: | + if [[ "${{ matrix.package_extension }}" == "deb" ]]; then + apt-get install -y perl + else + dnf install -y perl + fi + + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") + + echo "Perl version is $PERL_VERSION" + if [[ "${{ matrix.package_extension }}" == "deb" ]]; then NAME_PERL="libopenwsman-perl" USRLIB="/usr/lib/" if [ "${{ matrix.arch }}" = "amd64" ]; then - PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl5/5.32" + PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION" else - PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl5/5.32" + PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION" fi else NAME_PERL="openwsman-perl" @@ -134,15 +143,13 @@ jobs: if [ "${{ matrix.distrib }}" = "el8" ]; then PERL_VENDORARCH="/usr/local/lib64/perl5" else - PERL_VENDORARCH="/usr/local/lib64/perl5/5.32" + PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION" fi fi - sed -i "s/@VERSION@/${{ matrix.version }}/g" dependencies/perl-openwsman/libwsman.yaml sed -i "s#@USRLIB@#$USRLIB#g" dependencies/perl-openwsman/libwsman.yaml sed -i "s/@NAME@/$NAME_PERL/g" dependencies/perl-openwsman/perl-openwsman.yaml - sed -i "s/@VERSION@/${{ matrix.version }}/g" dependencies/perl-openwsman/perl-openwsman.yaml sed -i "s#@PERL_VENDORARCH@#$PERL_VENDORARCH#g" dependencies/perl-openwsman/perl-openwsman.yaml cat dependencies/perl-openwsman/sblim-sfcc.yaml @@ -158,7 +165,8 @@ jobs: distrib: ${{ matrix.distrib }} package_extension: ${{ matrix.package_extension }} arch: ${{ matrix.arch }} - release: 2 + version: ${{ env.version }} + release: ${{ env.release }} commit_hash: ${{ github.sha }} 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 }} @@ -173,7 +181,8 @@ jobs: distrib: ${{ matrix.distrib }} package_extension: ${{ matrix.package_extension }} arch: ${{ matrix.arch }} - release: 4 + version: ${{ env.version }} + release: ${{ env.release }} commit_hash: ${{ github.sha }} 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 }} @@ -188,7 +197,8 @@ jobs: distrib: ${{ matrix.distrib }} package_extension: ${{ matrix.package_extension }} arch: ${{ matrix.arch }} - release: 4 + version: ${{ env.version }} + release: ${{ env.release }} commit_hash: ${{ github.sha }} 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 }} @@ -196,15 +206,6 @@ jobs: 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 }} - name: Upload package artifacts - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - with: - name: packages-${{ matrix.distrib }}-${{ matrix.arch }} - path: ./*.${{ matrix.package_extension}} - retention-days: 1 - deliver-rpm: needs: [get-environment, package] if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} diff --git a/.github/workflows/perl-vmware-vsphere.yml b/.github/workflows/perl-vmware-vsphere.yml index 2d16d5ebc2..7c284e42ec 100644 --- a/.github/workflows/perl-vmware-vsphere.yml +++ b/.github/workflows/perl-vmware-vsphere.yml @@ -23,6 +23,8 @@ jobs: version_file: connectors/vmware/src/centreon/script/centreon_vmware.pm get-sources: + needs: [get-environment] + if: ${{ needs.get-environment.outputs.stability != 'stable' }} runs-on: ubuntu-22.04 steps: - name: Download vsphere cli sources @@ -45,28 +47,43 @@ jobs: key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere package: - needs: - - get-sources - - get-environment - runs-on: ubuntu-22.04 + needs: [get-environment, get-sources] + strategy: matrix: include: - package_extension: rpm image: packaging-plugins-alma8 distrib: el8 + runner: ubuntu-22.04 + arch: amd64 - package_extension: rpm image: packaging-plugins-alma9 distrib: el9 + runner: ubuntu-22.04 + arch: amd64 - package_extension: deb image: packaging-plugins-bullseye distrib: bullseye + runner: ubuntu-22.04 + arch: amd64 - package_extension: deb image: packaging-plugins-bookworm distrib: bookworm + runner: ubuntu-22.04 + arch: amd64 - package_extension: deb image: packaging-plugins-jammy distrib: jammy + runner: ubuntu-22.04 + arch: amd64 + - package_extension: deb + image: packaging-plugins-bullseye-arm64 + distrib: bullseye + runner: ["self-hosted", "collect-arm64"] + arch: arm64 + + runs-on: ${{ matrix.runner }} container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} @@ -74,7 +91,7 @@ jobs: username: ${{ secrets.DOCKER_REGISTRY_ID }} password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} - name: package ${{ matrix.distrib }} + name: package ${{ matrix.distrib }} ${{ matrix.arch }} steps: - name: Checkout sources @@ -87,25 +104,50 @@ jobs: key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere fail-on-cache-miss: true + - name: Set paths according to distrib + run: | + PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g") + + echo "Perl version is $PERL_VERSION" + + if [[ "${{ matrix.package_extension }}" == "deb" ]]; then + if [ "${{ matrix.arch }}" = "amd64" ]; then + PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION" + else + PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION" + fi + else + if [ "${{ matrix.distrib }}" = "el8" ]; then + PERL_VENDORARCH="/usr/local/lib64/perl5" + else + PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION" + fi + fi + + sed -i "s#@PERL_VENDORARCH@#$PERL_VENDORARCH#g" dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml + + cat dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml + shell: bash + - name: 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 }} + arch: ${{ matrix.arch }} commit_hash: ${{ github.sha }} - release: ${{ needs.get-environment.outputs.release }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + version: "7.0.1" + release: "17698549" + cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }} 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 - if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} + needs: [get-environment, package] + if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common] strategy: @@ -119,22 +161,28 @@ jobs: - name: Delivery uses: ./.github/actions/rpm-delivery with: - module_name: perl-vmware-vsphere + module_name: perl-vmware-vsphere-amd64 distrib: ${{ matrix.distrib }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}-amd64 stability: ${{ needs.get-environment.outputs.stability }} artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} deliver-deb: - needs: - - get-environment - - package - if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} + needs: [get-environment, package] + if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common] strategy: matrix: - distrib: [bullseye, bookworm, jammy] + include: + - distrib: bullseye + arch: amd64 + - distrib: bullseye + arch: arm64 + - distrib: bookworm + arch: amd64 + - distrib: jammy + arch: amd64 steps: - name: Checkout sources @@ -143,8 +191,38 @@ jobs: - name: Delivery uses: ./.github/actions/deb-delivery with: - module_name: perl-vmware-vsphere + module_name: perl-vmware-vsphere-${{ matrix.arch }} distrib: ${{ matrix.distrib }} - cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}-${{ matrix.arch }} stability: ${{ needs.get-environment.outputs.stability }} artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + + promote: + needs: [get-environment] + if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) }} + runs-on: [self-hosted, common] + strategy: + matrix: + include: + - distrib: el8 + arch: amd64 + - distrib: el9 + arch: amd64 + - distrib: bullseye + arch: amd64 + - distrib: bookworm + arch: amd64 + - distrib: bullseye + arch: arm64 + + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Promote ${{ matrix.distrib }} ${{ matrix.arch }} to stable + uses: ./.github/actions/promote-to-stable + with: + artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + module: perl-vmware-vsphere-${{ matrix.arch }} + distrib: ${{ matrix.distrib }} + stability: ${{ needs.get-environment.outputs.stability }} diff --git a/.github/workflows/plink.yml b/.github/workflows/plink.yml index e5b55e53e4..1b1f64c235 100644 --- a/.github/workflows/plink.yml +++ b/.github/workflows/plink.yml @@ -102,7 +102,7 @@ jobs: path: ./*.rpm key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: packages-${{ matrix.distrib }} path: ./*.rpm diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index d2287bdf06..c5d579dfd6 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -37,7 +37,7 @@ jobs: with: python-version: '3.9' - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1 id: filter with: base: ${{ github.ref }} @@ -93,7 +93,7 @@ jobs: fetch-depth: 1 - name: Prepare FatPacker - uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0 + uses: shogo82148/actions-setup-perl@28eae78d12c2bba1163aec45d123f6d9228bc307 # v1.29.0 with: perl-version: '5.34' install-modules-with: cpm @@ -155,6 +155,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - if: ${{ matrix.distrib == 'el7' }} + # el7 is not compatible with checkout v4 which uses node20 uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 with: path: ./build/ diff --git a/.github/workflows/spellchecker.yml b/.github/workflows/spellchecker.yml index 4330058fa0..1ccb28fbff 100644 --- a/.github/workflows/spellchecker.yml +++ b/.github/workflows/spellchecker.yml @@ -20,17 +20,17 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1 id: filter with: base: ${{ github.ref }} list-files: shell filters: | plugins: - - added|modified: src/** + - added|modified: 'src/**/*.pm' - name: Install CPAN Libraries - uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0 + uses: shogo82148/actions-setup-perl@28eae78d12c2bba1163aec45d123f6d9228bc307 # v1.29.0 with: perl-version: '5.34' install-modules-with: cpm diff --git a/.github/workflows/tests-functional.yml b/.github/workflows/tests-functional.yml index 88dc3ebc56..c8f470c974 100644 --- a/.github/workflows/tests-functional.yml +++ b/.github/workflows/tests-functional.yml @@ -28,15 +28,15 @@ jobs: sudo apt-get install -qqy snmpsim - name: Install Node.js - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version: 16 + node-version: 20 - name: Install Mockoon CLI - run: npm install -g -D @mockoon/cli@3.1.0 + run: npm install -g -D @mockoon/cli@6.2.0 - name: Install perl dependencies - uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0 + uses: shogo82148/actions-setup-perl@28eae78d12c2bba1163aec45d123f6d9228bc307 # v1.29.0 with: perl-version: '5.34' install-modules-with: cpm diff --git a/README.md b/README.md index 707d1e1a25..dd585e8e1b 100644 --- a/README.md +++ b/README.md @@ -8,26 +8,55 @@ [![Forks][forks-shield]][forks-url] [![Issues][issues-shield]][issues-url] +## What are Centreon Plugins -“centreon-plugins” is a free and open source project to monitor systems. The project can be used with Centreon and all monitoring softwares compatible with Nagios plugins. +[Centreon plugins](https://github.com/centreon/centreon-plugins/) is a free and open source project to monitor systems. The project can be used with Centreon and all monitoring softwares compatible with Nagios plugins. + +### Principles + +[Centreon plugins](https://github.com/centreon/centreon-plugins/) should comply with [Monitoring Plugins Development Guidelines](https://www.monitoring-plugins.org/doc/guidelines.html). + +In short, they return: +- An error code: + - `0` for `OK` + - `1` for `WARNING` + - `2` for `CRITICAL` + - `3` for `UNKNOWN` +- A human understandable output message (example: `OK: CPU(s) average usage is 2.66 % - CPU '0' usage : 2.66 %`). +- A set of metrics provided as *perfdata* after a `|` character (example: `'cpu.utilization.percentage'=2.66%;;;0;100 '0#core.cpu.utilization.percentage'=2.66%;;;0;100`). + +### What can Centreon Plugins monitor? You can monitor many systems: -* application: Apache, Asterisk, Elasticsearch, Github, Jenkins, Kafka, Nginx, Pfsense, Redis, Tomcat, Varnish,... -* cloud: AWS, Azure, Docker, Office365, Nutanix, Prometheus,... -* database: Firebird, Informix, MS SQL, MySQL, Oracle, Postgres, Cassandra -* hardware: printers (rfc3805), UPS (Powerware, Mge, Standard), Sun Hardware, Cisco UCS, SensorIP, HP Proliant, HP Bladechassis, Dell Openmanage, Dell CMC, Raritan,... -* network: Aruba, Brocade, Bluecoat, Brocade, Checkpoint, Cisco AP/IronPort/ASA/Standard, Extreme, Fortigate, H3C, Hirschmann, HP Procurve, F5 BIG-IP, Juniper, PaloAlto, Redback, Riverbed, Ruggedcom, Stonesoft,... -* os: Linux (SNMP, NRPE), Freebsd (SNMP), AIX (SNMP), Solaris (SNMP)... -* storage: EMC Clariion, Netapp, Nimble, HP MSA p2000, Dell EqualLogic, Qnap, Panzura, Synology... +* **Application**: Apache, Asterisk, Elasticsearch, Github, Jenkins, Kafka, Nginx, Pfsense, Redis, Tomcat, Varnish, etc. +* **Cloud**: AWS, Azure, Docker, Office365, Nutanix, Prometheus, etc. +* **Databases**: Firebird, Informix, MS SQL, MySQL, Oracle, Postgres, Cassandra. +* **Hardware**: printers (RFC3805), UPS (Powerware, Mge, Standard), Sun Hardware, Cisco UCS, SensorIP, HP Proliant, HP Bladechassis, Dell Openmanage, Dell CMC, Raritan, etc. +* **Network**: Aruba, Brocade, Bluecoat, Brocade, Checkpoint, Cisco AP/IronPort/ASA/Standard, Extreme, Fortigate, H3C, Hirschmann, HP Procurve, F5 BIG-IP, Juniper, PaloAlto, Redback, Riverbed, Ruggedcom, Stonesoft, etc. +* **Operating systems**: Linux (SNMP, NRPE), Freebsd (SNMP), AIX (SNMP), Solaris (SNMP), etc. +* **Storage**: EMC Clariion, Netapp, Nimble, HP MSA p2000, Dell EqualLogic, Qnap, Panzura, Synology, etc. + +To get a complete list, run: -## Basic Usage +```bash +perl src/centreon_plugins.pl --list-plugin +``` + +### Basic Usage We'll use a basic example to show you how to monitor a system. I have finished the install section and I want to monitor a Linux in SNMP. First, I need to find the plugin to use in the list: - $ perl centreon_plugins.pl --list-plugin | grep -i linux | grep 'PLUGIN' - PLUGIN: os::linux::local::plugin - PLUGIN: os::linux::snmp::plugin +```bash +perl centreon_plugins.pl --list-plugin | grep -i linux | grep 'PLUGIN' +``` + +It will return: + +``` +PLUGIN: os::linux::local::plugin +PLUGIN: os::linux::snmp::plugin +``` It seems that 'os::linux::snmp::plugin' is the good one. So I verify with the option ``--help`` to be sure: @@ -81,7 +110,39 @@ I can set threshold with options ``--warning`` and ``--critical``: For more information or help, please read ['doc/en/user/guide.rst'](./doc/en/user/guide.rst). -## Continuous integration +## Contributions + +### Code contributions/pull requests + +If you want to contribute by submitting new functionalities, enhancements or bug fixes, first thank you for participating :-) +Then have a look, if not already done, to our **[development guide](https://github.com/centreon/centreon-plugins/blob/develop/doc/en/developer/guide.md)**. +Then create a [fork](https://github.com/centreon/centreon-plugins/fork) and a development branch, and once it's done, you may submit a [pull request](https://github.com/centreon/centreon-plugins/pulls) that the corporate development team will examine. + +### Issues/bug reports + +If you encounter a behaviour that is clearly a bug or a regression, you are welcome to submit an [issue](https://github.com/centreon/centreon-plugins/issues). Please be aware that this is an open source project and that there is no guaranteed response time. + +### Questions/search for help + +If you have trouble using our plugins, but are not sure whether it's due to a bug or a misuse, please take the time to ask for help on [The Watch, Data Collection section](https://thewatch.centreon.com/data-collection-6) and become certain that it is a bug before submitting it here. + +### Feature/enhancement request + +There is high demand for new plugins and new functionalities on existing plugins, so we have to rely on our community to help us prioritize them. +How? Post your suggestion on [The Watch Ideas](https://thewatch.centreon.com/ideas) with as much detail as possible and we will pick the most voted topics to add them to our product roadmap. + +To develop a plugin/mode, we need the following information, depending on the protocol: +* **SNMP**: MIB files and full snmpwalk of enterprise branch (`snmpwalk -ObentU -v 2c -c public address .1.3.6.1.4.1 > equipment.snmpwalk`) or [SNMP collections](https://thewatch.centreon.com/product-how-to-21/snmp-collection-tutorial-132). +* **HTTP API (SOAP, Rest/Json, XML-RPC)**: the documentation and some curl examples or HTTP [collections](https://thewatch.centreon.com/data-collection-6/centreon-plugins-discover-collection-modes-131). +* **CLI**: command line examples (command + result). +* **SQL**: queries + results + column types or [SQL collections](https://thewatch.centreon.com/product-how-to-21/sql-collection-tutorial-134). +* **JMX**: mbean names and attributes. + +If some information is confidential, such as logins or IP addresses, obfuscate them in what is sent publicly and we'll get in touch with you by private message if this information is needed. + +Please note that all the developments are open source, we will not commit to a release date. If it is an emergency for you, please contact [Centreon's sales team](https://www.centreon.com/contact/). + +### Continuous integration Please follow documentation [here](./doc/CI.md) diff --git a/connectors/vmware/src/centreon/script/centreon_vmware.pm b/connectors/vmware/src/centreon/script/centreon_vmware.pm index a82c464326..f491dea1e3 100644 --- a/connectors/vmware/src/centreon/script/centreon_vmware.pm +++ b/connectors/vmware/src/centreon/script/centreon_vmware.pm @@ -40,9 +40,9 @@ BEGIN { # it's a hack if you unset that #$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL"; - # The option is not omit to verify the certificate chain. + # The option is not omit to verify the certificate chain. $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; - + eval { # required for new IO::Socket::SSL versions require IO::Socket::SSL; @@ -54,7 +54,7 @@ BEGIN { use base qw(centreon::vmware::script); use vars qw(%centreon_vmware_config); -my $VERSION = '3.2.5'; +my $VERSION = '3.2.6'; my %handlers = (TERM => {}, HUP => {}, CHLD => {}); my @load_modules = ( diff --git a/connectors/vmware/src/centreon/vmware/common.pm b/connectors/vmware/src/centreon/vmware/common.pm index 5c5080ad32..0d58f776fd 100644 --- a/connectors/vmware/src/centreon/vmware/common.pm +++ b/connectors/vmware/src/centreon/vmware/common.pm @@ -45,7 +45,7 @@ sub init_response { my (%options) = @_; $manager_response->{code} = 0; - $manager_response->{vmware_connector_version} = '3.2.5'; + $manager_response->{vmware_connector_version} = '3.2.6'; $manager_response->{short_message} = 'OK'; $manager_response->{extra_message} = ''; $manager_response->{identity} = $options{identity} if (defined($options{identity})); diff --git a/connectors/vmware/src/centreon_vmware.pl b/connectors/vmware/src/centreon_vmware.pl index 050fd2fd19..2aa48ea429 100644 --- a/connectors/vmware/src/centreon_vmware.pl +++ b/connectors/vmware/src/centreon_vmware.pl @@ -1,15 +1,15 @@ #!/usr/bin/perl # Copyright 2015 Centreon (http://www.centreon.com/) # -# Centreon is a full-fledged industry-strength solution that meets -# the needs in IT infrastructure and application monitoring for +# 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 +# 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, @@ -50,7 +50,7 @@ =head1 OPTIONS =head1 DESCRIPTION -B will connect to ESX and/or VirtualCenter. +B will connect to ESX and/or VirtualCenter. Use the plugin 'apps::vmware::connector::plugin' from: https://github.com/centreon/centreon-plugins =cut diff --git a/dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml b/dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml index 943d069dd5..64b1d63d40 100644 --- a/dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml +++ b/dependencies/perl-crypt-argon2/perl-crypt-argon2.yaml @@ -2,7 +2,7 @@ name: "@NAME@" arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "0.019" +version: "0.020" release: "${RELEASE}${DIST}" section: "default" priority: "optional" diff --git a/dependencies/perl-filesys-smbclient/src/Makefile.PL b/dependencies/perl-filesys-smbclient/src/Makefile.PL index abc7dfeb52..5d55eb2912 100644 --- a/dependencies/perl-filesys-smbclient/src/Makefile.PL +++ b/dependencies/perl-filesys-smbclient/src/Makefile.PL @@ -10,4 +10,4 @@ WriteMakefile( DEFINE => '', INC => '-I.', OBJECT => 'libauthSamba.o SmbClient.o', -); \ No newline at end of file +); diff --git a/dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml b/dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml new file mode 100644 index 0000000000..052fa2cf59 --- /dev/null +++ b/dependencies/perl-keepass-reader/packaging/perl-keepass-reader.yaml @@ -0,0 +1,44 @@ +name: "@NAME@" +arch: "${ARCH}" +platform: "linux" +version_schema: "none" +version: "${VERSION}" +release: "${RELEASE}${DIST}" +section: "default" +priority: "optional" +maintainer: "Centreon " +description: | + KeePass::Reader is a perl interface to read KeePass version 4. + Commit: @COMMIT_HASH@ +vendor: "Centreon" +homepage: "https://www.centreon.com" +license: "Apache-2.0" + +contents: + - src: "/tmp/perl-keepass-reader/lib/perl5/KeePass" + dst: "@PERL_VENDORLIB@/Keepass" + type: tree + file_info: + mode: 0644 + + - src: "/tmp/perl-keepass-reader/man/man3/KeePass::Reader.3pm" + dst: "/usr/share/man/man3/" + file_info: + mode: 0644 + +overrides: + rpm: + depends: + - perl(Crypt::Argon2) + provides: + - perl(KeePass::Reader) + deb: + depends: + - libcrypt-argon2-perl + +rpm: + summary: Interface to KeePass V4 database files + compression: zstd + signature: + key_file: ${RPM_SIGNING_KEY_FILE} + key_id: ${RPM_SIGNING_KEY_ID} diff --git a/dependencies/perl-keepass-reader/packaging/rpm/perl-KeePass-Reader.spec b/dependencies/perl-keepass-reader/packaging/rpm/perl-KeePass-Reader.spec deleted file mode 100644 index f492cdca37..0000000000 --- a/dependencies/perl-keepass-reader/packaging/rpm/perl-KeePass-Reader.spec +++ /dev/null @@ -1,48 +0,0 @@ -Name: perl-KeePass-Reader -Version: 0.2 -Release: 2%{?dist} -Summary: Interface to KeePass V4 database files -Group: Development/Libraries -License: Apache2 -URL: https://github.com/garnier-quentin/perl-KeePass-Reader -Source0: %{name}.tar.gz -BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: make -BuildRequires: perl(ExtUtils::MakeMaker) - -Requires: perl(Crypt::Argon2) - -%description -KeePass::Reader is a perl interface to read KeePass version 4. - -%prep -%setup -q -n %{name} - -%build -%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" -make %{?_smp_mflags} - -%install -rm -rf %{buildroot} -make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT -find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';' -find $RPM_BUILD_ROOT -type f -name '*.bs' -a -size 0 -exec rm -f {} ';' -find $RPM_BUILD_ROOT -type d -depth -exec rmdir {} 2>/dev/null ';' -rm -rf $RPM_BUILD_ROOT%{_usr}/bin/hexdump -%{_fixperms} $RPM_BUILD_ROOT/* - -%check -#make test - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%{perl_vendorlib} -%{_mandir}/man3/*.3* - -%changelog - diff --git a/dependencies/perl-keepass-reader/src/lib/KeePass/Reader.pm b/dependencies/perl-keepass-reader/src/lib/KeePass/Reader.pm index 8f3f95f512..f6ad531571 100644 --- a/dependencies/perl-keepass-reader/src/lib/KeePass/Reader.pm +++ b/dependencies/perl-keepass-reader/src/lib/KeePass/Reader.pm @@ -31,7 +31,7 @@ sub new { sub error { my ($self, %options) = @_; - + if (defined($options{message})) { $self->{error_msg} = $options{message}; } @@ -42,7 +42,7 @@ sub error { sub load_db { my ($self, %options) = @_; - $self->{error_msg} = undef; + $self->{error_msg} = undef; $self->{buffer_file} = undef; $self->{master_read_pos} = 0; diff --git a/dependencies/perl-libssh-session/perl-libssh-session.yaml b/dependencies/perl-libssh-session/perl-libssh-session.yaml index a1f9c7116c..1720091391 100644 --- a/dependencies/perl-libssh-session/perl-libssh-session.yaml +++ b/dependencies/perl-libssh-session/perl-libssh-session.yaml @@ -33,7 +33,7 @@ contents: overrides: rpm: depends: - - perl + - perl-interpreter - libssh conflicts: - perl-Libssh-Session-debuginfo diff --git a/dependencies/perl-net-curl/perl-net-curl.yaml b/dependencies/perl-net-curl/perl-net-curl.yaml index 61cdfccf60..29964ff178 100644 --- a/dependencies/perl-net-curl/perl-net-curl.yaml +++ b/dependencies/perl-net-curl/perl-net-curl.yaml @@ -2,7 +2,7 @@ name: "@NAME@" arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "0.54" +version: "0.55" release: "${RELEASE}${DIST}" section: "default" priority: "optional" @@ -40,7 +40,7 @@ contents: overrides: rpm: depends: - - perl + - perl-interpreter - libcurl conflicts: - perl-Net-Curl-debuginfo diff --git a/dependencies/perl-openwsman/libwsman.yaml b/dependencies/perl-openwsman/libwsman.yaml index 637fe83952..4cc1a71226 100644 --- a/dependencies/perl-openwsman/libwsman.yaml +++ b/dependencies/perl-openwsman/libwsman.yaml @@ -2,7 +2,7 @@ name: "libwsman1" arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "@VERSION@" +version: "${VERSION}" release: "${RELEASE}${DIST}" section: "default" priority: "optional" @@ -14,16 +14,21 @@ homepage: "http://www.openwsman.org/" license: "BSD" contents: - - src: "/tmp/openwsman-@VERSION@/build/src/lib/libwsman.so.*" + - src: "/tmp/openwsman-${VERSION}/build/src/lib/libwsman.so.*" dst: "@USRLIB@" + expand: true file_info: mode: 0644 - - src: "/tmp/openwsman-@VERSION@/build/src/lib/libwsman_client.so.*" + + - src: "/tmp/openwsman-${VERSION}/build/src/lib/libwsman_client.so.*" dst: "@USRLIB@" + expand: true file_info: mode: 0644 - - src: "/tmp/openwsman-@VERSION@/build/src/lib/libwsman_curl_client_transport.so.*" + + - src: "/tmp/openwsman-${VERSION}/build/src/lib/libwsman_curl_client_transport.so.*" dst: "@USRLIB@" + expand: true file_info: mode: 0644 diff --git a/dependencies/perl-openwsman/perl-openwsman.yaml b/dependencies/perl-openwsman/perl-openwsman.yaml index b30faae467..6a50a62f9b 100644 --- a/dependencies/perl-openwsman/perl-openwsman.yaml +++ b/dependencies/perl-openwsman/perl-openwsman.yaml @@ -2,7 +2,7 @@ name: "@NAME@" arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "@VERSION@" +version: "${VERSION}" release: "${RELEASE}${DIST}" section: "default" priority: "optional" @@ -14,13 +14,15 @@ homepage: "http://www.openwsman.org/" license: "BSD" contents: - - src: "/tmp/openwsman-@VERSION@/build/bindings/perl/openwsman.so" + - src: "/tmp/openwsman-${VERSION}/build/bindings/perl/openwsman.so" dst: "@PERL_VENDORARCH@/" + expand: true file_info: mode: 0644 - - src: "/tmp/openwsman-@VERSION@/build/bindings/perl/openwsman.pm" + - src: "/tmp/openwsman-${VERSION}/build/bindings/perl/openwsman.pm" dst: "@PERL_VENDORARCH@/" + expand: true file_info: mode: 0644 diff --git a/dependencies/perl-openwsman/sblim-sfcc.yaml b/dependencies/perl-openwsman/sblim-sfcc.yaml index fe6cf25c8b..7dd4a99d65 100644 --- a/dependencies/perl-openwsman/sblim-sfcc.yaml +++ b/dependencies/perl-openwsman/sblim-sfcc.yaml @@ -2,7 +2,7 @@ name: "sblim-sfcc" arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "2.7.2" +version: "${VERSION}" release: "${RELEASE}${DIST}" section: "default" priority: "optional" diff --git a/dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml b/dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml index ec0a6178aa..f582d2d455 100644 --- a/dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml +++ b/dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml @@ -1,9 +1,9 @@ name: "perl-VMware-vSphere" -arch: "amd64" +arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "7.0.0" -release: "17698549${DIST}" +version: "${VERSION}" +release: "${RELEASE}${DIST}" section: "default" priority: "optional" maintainer: "Centreon " @@ -20,18 +20,10 @@ license: "GPLv2+" contents: - src: "../../../vmware-vsphere-cli-distrib/VMware" - dst: "@PERL_SITELIB@/VMware" - packager: rpm - - src: "../../../vmware-vsphere-cli-distrib/VMware" - dst: "/usr/share/perl5/VMware" - packager: deb + dst: "@PERL_VENDORARCH@/VMware" - src: "../../../vmware-vsphere-cli-distrib/WSMan" - dst: "@PERL_SITELIB@/WSMan" - packager: rpm - - src: "../../../vmware-vsphere-cli-distrib/WSMan" - dst: "/usr/share/perl5/WSMan" - packager: deb + dst: "@PERL_VENDORARCH@/WSMan" overrides: rpm: diff --git a/doc/en/developer/plugins_advanced.md b/doc/en/developer/plugins_advanced.md index f4dda783e2..b5f8a8a4b8 100644 --- a/doc/en/developer/plugins_advanced.md +++ b/doc/en/developer/plugins_advanced.md @@ -943,9 +943,9 @@ List of methods: * **new**: class constructor. Overload if you need to add some specific options or to use a statefile. * **check_options**: overload if you need to check your specific options. -* **manage_selection**: overload if *mandatory*. Method to get informations for +* **manage_selection**: overload is *mandatory*. Method to get informations for the equipment. -* **set_counters**: overload if **mandatory**. Method to configure counters. +* **set_counters**: overload is **mandatory**. Method to configure counters. **Class hardware** diff --git a/nrpe/packaging/centreon-nrpe4-daemon.yaml b/nrpe/packaging/centreon-nrpe4-daemon.yaml new file mode 100644 index 0000000000..acf50c8c5e --- /dev/null +++ b/nrpe/packaging/centreon-nrpe4-daemon.yaml @@ -0,0 +1,92 @@ +name: "centreon-nrpe4-daemon" +arch: "amd64" +platform: "linux" +version_schema: "none" +version: "4.1.0" +release: "${RELEASE}${DIST}" +section: "default" +priority: "optional" +maintainer: "Centreon " +description: | + The centreon-nrpe packages contains the Nagios Remote Plug-ins Executor. + Daemon which can execute predefined commands on the remote host. + Commit: @COMMIT_HASH@ +vendor: "Centreon" +homepage: "https://centreon.com" +license: "GPLv2+" + +contents: + - src: "../../nrpe-src/src/nrpe" + dst: "/usr/sbin/centreon-nrpe4" + + - src: "../../nrpe-src/sample-config/nrpe.cfg" + dst: "/etc/nrpe/centreon-nrpe4.cfg" + type: config|noreplace + file_info: + mode: 0644 + + - src: "files/nrpe4.sysconfig" + dst: "/etc/sysconfig/centreon-nrpe4" + packager: rpm + file_info: + mode: 0644 + - src: "files/nrpe4.sysconfig" + dst: "/etc/default/centreon-nrpe4" + packager: deb + file_info: + mode: 0644 + + - src: "files/nrpe4.rpm.service" + dst: "/lib/systemd/system/centreon-nrpe4.service" + packager: rpm + file_info: + mode: 0644 + - src: "files/nrpe4.deb.service" + dst: "/lib/systemd/system/centreon-nrpe4.service" + packager: deb + file_info: + mode: 0644 + + - dst: "/var/log/nrpe" + type: dir + file_info: + mode: 0755 + owner: centreon-engine + group: centreon-engine + + - dst: "/var/log/nrpe/centplugins" + type: dir + file_info: + mode: 0755 + owner: centreon-engine + group: centreon-engine + +scripts: + preinstall: ./scripts/centreon-nrpe4-daemon-preinstall.sh + postinstall: ./scripts/centreon-nrpe4-daemon-postinstall.sh + preremove: ./scripts/centreon-nrpe4-daemon-preremove.sh + +overrides: + rpm: + replaces: + - centreon-nrpe4-daemon-debuginfo + - centreon-nrpe4-daemon-debugsource + conflicts: + - centreon-nrpe4-daemon-debuginfo + - centreon-nrpe4-daemon-debugsource + provides: + - centreon-nrpe4-daemon-debuginfo + - centreon-nrpe4-daemon-debugsource + deb: + replaces: + - centreon-nrpe4-daemon-dbgsym + conflicts: + - centreon-nrpe4-daemon-dbgsym + provides: + - centreon-nrpe4-daemon-dbgsym + +rpm: + summary: Nagios Remote Plugins Execution daemon + signature: + key_file: ${RPM_SIGNING_KEY_FILE} + key_id: ${RPM_SIGNING_KEY_ID} diff --git a/nrpe/packaging/files/nrpe4.deb.service b/nrpe/packaging/files/nrpe4.deb.service new file mode 100644 index 0000000000..cbcb430b6a --- /dev/null +++ b/nrpe/packaging/files/nrpe4.deb.service @@ -0,0 +1,23 @@ +[Unit] +Description=Nagios Remote Program Executor +Documentation=http://www.nagios.org/documentation +After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target +Before=getty@tty1.service plymouth-quit.service xdm.service +Conflicts=nrpe.socket +Requires=network.target + +[Service] +Type=forking +User=centreon-engine +Group=centreon-engine +EnvironmentFile=/etc/default/centreon-nrpe4 +ExecStart=/usr/sbin/centreon-nrpe4 -c /etc/nrpe/centreon-nrpe4.cfg -d $NRPE_OPT +Restart=on-abort +PIDFile=/var/log/nrpe/nrpe4.pid +ExecStopPost=/bin/rm -f /var/log/nrpe/nrpe4.pid +TimeoutStopSec=60 +PrivateTmp=false +OOMScoreAdjust=-500 + +[Install] +WantedBy=multi-user.target diff --git a/nrpe/packaging/files/nrpe4.rpm.service b/nrpe/packaging/files/nrpe4.rpm.service new file mode 100644 index 0000000000..c4b8b6e03f --- /dev/null +++ b/nrpe/packaging/files/nrpe4.rpm.service @@ -0,0 +1,23 @@ +[Unit] +Description=Nagios Remote Program Executor +Documentation=http://www.nagios.org/documentation +After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target +Before=getty@tty1.service plymouth-quit.service xdm.service +Conflicts=nrpe.socket +Requires=network.target + +[Service] +Type=forking +User=centreon-engine +Group=centreon-engine +EnvironmentFile=/etc/sysconfig/centreon-nrpe4 +ExecStart=/usr/sbin/centreon-nrpe4 -c /etc/nrpe/centreon-nrpe4.cfg -d $NRPE_OPT +Restart=on-abort +PIDFile=/var/log/nrpe/nrpe4.pid +ExecStopPost=/bin/rm -f /var/log/nrpe/nrpe4.pid +TimeoutStopSec=60 +PrivateTmp=false +OOMScoreAdjust=-500 + +[Install] +WantedBy=multi-user.target diff --git a/nrpe/packaging/files/nrpe4.sysconfig b/nrpe/packaging/files/nrpe4.sysconfig new file mode 100644 index 0000000000..a1fe957b4e --- /dev/null +++ b/nrpe/packaging/files/nrpe4.sysconfig @@ -0,0 +1,2 @@ +# specify additional command line arguments for nrpe +NRPE_OPT="" diff --git a/nrpe/packaging/files/nrpe4_add_centreon_cmd.patch b/nrpe/packaging/files/nrpe4_add_centreon_cmd.patch new file mode 100644 index 0000000000..7fed46e5f2 --- /dev/null +++ b/nrpe/packaging/files/nrpe4_add_centreon_cmd.patch @@ -0,0 +1,29 @@ +--- a/sample-config/nrpe.cfg.in 2018-09-14 13:40:08.496324915 +0200 ++++ b/sample-config/nrpe.cfg.in 2018-09-14 13:47:57.624296953 +0200 +@@ -40,7 +40,7 @@ + # number. The file is only written if the NRPE daemon is started by the root + # user and is running in standalone mode. + +-pid_file=@piddir@/nrpe.pid ++pid_file=@piddir@/nrpe4.pid + + + +@@ -119,7 +119,7 @@ + # + # Values: 0=do not allow arguments, 1=allow command arguments + +-dont_blame_nrpe=0 ++dont_blame_nrpe=1 + + + +@@ -300,7 +300,7 @@ + command[check_hda1]=@pluginsdir@/check_disk -w 20% -c 10% -p /dev/hda1 + command[check_zombie_procs]=@pluginsdir@/check_procs -w 5 -c 10 -s Z + command[check_total_procs]=@pluginsdir@/check_procs -w 150 -c 200 +- ++command[check_centreon_plugins]=/usr/lib/centreon/plugins/centreon_linux_local.pl --plugin=$ARG1$ --mode=$ARG2$ $ARG3$ + + # The following examples allow user-supplied arguments and can + # only be used if the NRPE daemon was compiled with support for diff --git a/nrpe/packaging/scripts/centreon-nrpe4-daemon-postinstall.sh b/nrpe/packaging/scripts/centreon-nrpe4-daemon-postinstall.sh new file mode 100644 index 0000000000..9623918669 --- /dev/null +++ b/nrpe/packaging/scripts/centreon-nrpe4-daemon-postinstall.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +startNrpeDaemon() { + systemctl daemon-reload ||: + systemctl unmask centreon-nrpe4.service ||: + systemctl preset centreon-nrpe4.service ||: + systemctl enable centreon-nrpe4.service ||: + systemctl restart centreon-nrpe4.service ||: +} + +action="$1" +if [ "$1" = "configure" ] && [ -z "$2" ]; then + # Alpine linux does not pass args, and deb passes $1=configure + action="install" +elif [ "$1" = "configure" ] && [ -n "$2" ]; then + # deb passes $1=configure $2= + action="upgrade" +fi + +case "$action" in + "1" | "install") + startNrpeDaemon + ;; + "2" | "upgrade") + startNrpeDaemon + ;; + *) + # $1 == version being installed + startNrpeDaemon + ;; +esac diff --git a/nrpe/packaging/scripts/centreon-nrpe4-daemon-preinstall.sh b/nrpe/packaging/scripts/centreon-nrpe4-daemon-preinstall.sh new file mode 100644 index 0000000000..e15030f851 --- /dev/null +++ b/nrpe/packaging/scripts/centreon-nrpe4-daemon-preinstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +getent group centreon-engine > /dev/null 2>&1 || groupadd -r centreon-engine +getent passwd centreon-engine > /dev/null 2>&1 || useradd -g centreon-engine --shell /bin/bash -m -d /var/lib/centreon-engine -r centreon-engine > /dev/null 2>&1 ||: +mkdir -p /var/lib/centreon/centplugins/ +chown centreon-engine: /var/lib/centreon/centplugins/ diff --git a/nrpe/packaging/scripts/centreon-nrpe4-daemon-preremove.sh b/nrpe/packaging/scripts/centreon-nrpe4-daemon-preremove.sh new file mode 100644 index 0000000000..7bcbd7beae --- /dev/null +++ b/nrpe/packaging/scripts/centreon-nrpe4-daemon-preremove.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +systemctl stop centreon-nrpe4.service ||: diff --git a/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/deb.json b/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/deb.json new file mode 100644 index 0000000000..9757fe1126 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/deb.json @@ -0,0 +1,4 @@ +{ + "dependencies": [ + ] +} diff --git a/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/pkg.json b/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/pkg.json new file mode 100644 index 0000000000..824189ab21 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/pkg.json @@ -0,0 +1,9 @@ +{ + "pkg_name": "centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi", + "pkg_summary": "Centreon Plugin", + "plugin_name": "centreon_datacore_api.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "storage/datacore/api/" + ] +} diff --git a/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/rpm.json b/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/rpm.json new file mode 100644 index 0000000000..9757fe1126 --- /dev/null +++ b/packaging/centreon-plugin-Hardware-Storage-DataCore-Sansymphony-Restapi/rpm.json @@ -0,0 +1,4 @@ +{ + "dependencies": [ + ] +} diff --git a/packaging/centreon-plugin-Operatingsystems-Linux-Local/deb.json b/packaging/centreon-plugin-Operatingsystems-Linux-Local/deb.json index 8b49667cf1..5c7b077db5 100644 --- a/packaging/centreon-plugin-Operatingsystems-Linux-Local/deb.json +++ b/packaging/centreon-plugin-Operatingsystems-Linux-Local/deb.json @@ -1,5 +1,7 @@ { "dependencies": [ + "libdatetime-perl", + "libxml-libxml-perl", "net-tools", "quota" ] diff --git a/packaging/centreon-plugin-Operatingsystems-Linux-Local/rpm.json b/packaging/centreon-plugin-Operatingsystems-Linux-Local/rpm.json index 9804af0084..f2003e2753 100644 --- a/packaging/centreon-plugin-Operatingsystems-Linux-Local/rpm.json +++ b/packaging/centreon-plugin-Operatingsystems-Linux-Local/rpm.json @@ -2,9 +2,12 @@ "dependencies": [ "net-tools", "quota", + "lsof", "perl(Data::Dumper)", - "perl(Pod::Parser)", + "perl(DateTime)", "perl(Digest::MD5)", - "perl(NetAddr::IP)" + "perl(NetAddr::IP)", + "perl(Pod::Parser)", + "perl(XML::LibXML)" ] } diff --git a/src/apps/mq/activemq/jmx/mode/brokers.pm b/src/apps/mq/activemq/jmx/mode/brokers.pm index c79b790b50..fd0614fb9c 100644 --- a/src/apps/mq/activemq/jmx/mode/brokers.pm +++ b/src/apps/mq/activemq/jmx/mode/brokers.pm @@ -204,7 +204,8 @@ sub new { $options{options}->add_options(arguments => { 'filter-broker-name:s' => { name => 'filter_broker_name' }, 'filter-destination-name:s' => { name => 'filter_destination_name' }, - 'filter-destination-type:s' => { name => 'filter_destination_type' } + 'filter-destination-type:s' => { name => 'filter_destination_type' }, + 'request:s@' => { name => 'request' } }); return $self; @@ -238,6 +239,24 @@ sub manage_selection { ] } ]; + + if (defined($self->{option_results}->{request}) && $self->{option_results}->{request} ne '') { + centreon::plugins::misc::mymodule_load( + output => $self->{output}, module => 'JSON::XS', + error_msg => "Cannot load module 'JSON::XS'." + ); + $request = undef; + foreach (@{$self->{option_results}->{request}}) { + eval { + push @$request, JSON::XS->new->utf8->decode($_); + }; + if ($@) { + $self->{output}->add_option_msg(short_msg => "Cannot use request as it is a malformed JSON: " . $@); + $self->{output}->option_exit(); + } + } + } + my $result = $options{custom}->get_attributes(request => $request, nothing_quit => 1); $self->{cache_name} = 'activemq_' . $self->{mode} . '_' . md5_hex($options{custom}->get_connection_info()) . '_' . @@ -318,6 +337,24 @@ Filter destination name (can be a regexp). Filter destination type (can be a regexp). +=item B<--request> + +EXPERIMENTAL Option : Community-supported only (no support from Centreon at this time) + +Set the MBean and attributes to request (will replace defaults) +in a JSON-formatted fashion. + +This is useful to reduce the size of returned data by providing destination +type and name or broker name instead of filtering afterwards, and grabbing +exactly the wanted attributes. + +This can be set multiple times. + +Example: + +--request='{"mbean":"org.apache.activemq:brokerName=*,destinationName=MyQueue,destinationType=Queue,type=Broker","attributes":[{"name":"QueueSize"}]}' +--request='{"mbean":"org.apache.activemq:brokerName=*,type=Broker,service=Health","attributes":[{"name":"CurrentStatus"}]}' + =item B<--warning-status> Define the conditions to match for the status to be WARNING. diff --git a/src/apps/protocols/http/mode/jsoncontent.pm b/src/apps/protocols/http/mode/jsoncontent.pm index c09929a87d..f9f2c6e327 100644 --- a/src/apps/protocols/http/mode/jsoncontent.pm +++ b/src/apps/protocols/http/mode/jsoncontent.pm @@ -389,7 +389,7 @@ JSON OPTIONS: =item B<--data> -Set file with JSON request +Set the JSON request or specify a file with the request inside. =item B<--lookup> diff --git a/src/apps/protocols/snmp/mode/collection.pm b/src/apps/protocols/snmp/mode/collection.pm index 625bbc5312..0df162493e 100644 --- a/src/apps/protocols/snmp/mode/collection.pm +++ b/src/apps/protocols/snmp/mode/collection.pm @@ -242,7 +242,7 @@ sub collect_snmp_tables { my $used_instance = defined($table->{used_instance}) && $table->{used_instance} ne '' ? $table->{used_instance} : '\.(\d+)$'; my $snmp_result = $options{snmp}->get_table(oid => $table->{oid}); foreach (keys %$snmp_result) { - /$used_instance/; + /$used_instance/ or next; next if (defined($self->{snmp_collected}->{tables}->{ $table->{name} }->{$1})); my $instance = $1; diff --git a/src/centreon/plugins/misc.pm b/src/centreon/plugins/misc.pm index 94789397c8..29d4f7df4f 100644 --- a/src/centreon/plugins/misc.pm +++ b/src/centreon/plugins/misc.pm @@ -311,6 +311,14 @@ sub backtick { return (0, join("\n", @output), $return_code); } +sub is_empty { + my $value = shift; + if (!defined($value) or $value eq '') { + return 1; + } + return 0; +} + sub trim { my ($value) = $_[0]; diff --git a/src/centreon/plugins/templates/hardware.pm b/src/centreon/plugins/templates/hardware.pm index 2c58682fad..213f578eca 100644 --- a/src/centreon/plugins/templates/hardware.pm +++ b/src/centreon/plugins/templates/hardware.pm @@ -277,6 +277,7 @@ sub display { foreach my $comp (sort(keys %{$self->{components}})) { # Skipping short msg when no components next if (!defined($self->{option_results}->{no_component_count}) && $self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0); + next if (defined($self->{option_results}->{component}) && $comp !~ /$self->{option_results}->{component}/ ); if ($self->{count} == 1) { ($exit, $warn, $crit) = $self->get_severity_count(label => $comp, value => $self->{components}->{$comp}->{total}); @@ -488,24 +489,24 @@ Default template for hardware. Should be extended. =item B<--component> -Which component to check (default: '.*'). -Can be: 'xxx', 'yyy'. +Define which component should be monitored based on their names. +This option will be treated as a regular expression. +All components are included by default ('.*'). =item B<--filter> -Exclude the items given as a comma-separated list (example: --filter=xxx --filter=yyyy). -You can also exclude items from specific instances: --filter=xxxxx,instancevalue +Exclude some components. This option can be called several times (example: --filter=component1 --filter=component2). +You can also exclude components from a specific instance (example: --filter=component_name,instance_value). =item B<--absent-problem> -Return an error if an entity is not 'present' (default is skipping) (comma separated list) -Can be specific or global: --absent-problem=xxxx,instancevalue +Return an error if a component is not 'present' (default is skipping). +It can be set globally or for a specific instance: --absent-problem='component_name' or --absent-problem='component_name,instance_value'. =item B<--no-component> Define the expected status if no components are found (default: critical). - =item B<--threshold-overload> Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,[instance,]status,regexp). @@ -513,21 +514,21 @@ Example: --threshold-overload='xxxxx,CRITICAL,^(?!(normal)$)' =item B<--warning> -Set warning threshold for temperatures (syntax: type,instance,threshold) -Example: --warning='xxxxx,.*,30' +Define the warning threshold for temperatures (syntax: type,instance,threshold) +Example: --warning='temperature,.*,30' =item B<--critical> -Set critical threshold for temperatures (syntax: type,instance,threshold) -Example: --critical='xxxxx,.*,40' +Define the critical threshold for temperatures (syntax: type,instance,threshold) +Example: --critical='temperature,.*,40' -=item B<--warning-count-xxxx> +=item B<--warning-count-*> -Set warning threshold for component count. +Define the warning threshold for the number of components of one type (replace '*' with the component type). -=item B<--critical-count-xxxx> +=item B<--critical-count-*> -Set critical threshold for component count. +Define the critical threshold for the number of components of one type (replace '*' with the component type). =back diff --git a/src/contrib/collection/snmp/sputnik-environment.json b/src/contrib/collection/snmp/sputnik-environment.json new file mode 100644 index 0000000000..cdaefa7b5d --- /dev/null +++ b/src/contrib/collection/snmp/sputnik-environment.json @@ -0,0 +1,67 @@ +{ + "constants": {}, + "mapping": {}, + "snmp": { + "tables": [ + { + "name": "upsEnvSensors", + "oid": ".1.3.6.1.4.1.54661.1.1.1.2.2.1", + "used_instance": "\\.2\\.(\\d+)$", + "entries": [ + { + "name": "temperature", + "oid": ".1.3.6.1.4.1.54661.1.1.1.2.2.1.2" + }, + { + "name": "humidity", + "oid": ".1.3.6.1.4.1.54661.1.1.1.2.2.1.3" + } + ] + } + ] + }, + "selection_loop": [ + { + "name": "Sensors", + "source": "%(snmp.tables.upsEnvSensors)", + "expand_table": { + "upsEnvSensors": "%(snmp.tables.upsEnvSensors.[%(upsEnvSensors.instance)])" + }, + "functions": [ + { + "type": "replace", + "src": "%(upsEnvSensors.temperature)", + "expression": "s/(\\d?\\d)(\\d\\d)/$1.$2/" + } + ], + + "perfdatas": [ + { + "nlabel": "environment.temperature.celsius", + "instances": ["%(upsEnvSensors.instance)"], + "value": "%(upsEnvSensors.temperature)", + "critical": "", + "unit": "C" + }, + { + "nlabel": "environment.humidity.percent", + "instances": ["%(upsEnvSensors.instance)"], + "value": "%(upsEnvSensors.humidity)", + "critical": "", + "unit": "%", + "min": 0, + "max": 100 + } + ], + "formatting": { + "printf_msg": "Sensor '%s' temperature is '%s'°C and humidity is '%s'%%", + "printf_var": [ + "%(upsEnvSensors.instance)", + "%(upsEnvSensors.temperature)", + "%(upsEnvSensors.humidity)" + ], + "display_ok": true + } + } + ] +} \ No newline at end of file diff --git a/src/hardware/ups/socomec/netvision/snmp/mode/battery.pm b/src/hardware/ups/socomec/netvision/snmp/mode/battery.pm index fbb6e8c7b0..cb62cf41e7 100644 --- a/src/hardware/ups/socomec/netvision/snmp/mode/battery.pm +++ b/src/hardware/ups/socomec/netvision/snmp/mode/battery.pm @@ -153,7 +153,7 @@ sub manage_selection { my $snmp_result = $options{snmp}->get_leef( oids => [ map($_->{oid} . '.0', values(%{$mapping->{$label}})) ] ); - if (!defined($snmp_result->{ $mapping->{netvision6}->{status} . '.0' })) { + if (!defined($snmp_result->{ $mapping->{netvision6}->{status}->{oid} . '.0' })) { $label = 'netvision5'; $snmp_result = $options{snmp}->get_leef( oids => [ map($_->{oid} . '.0', values(%{$mapping->{$label}})) ], diff --git a/src/storage/datacore/restapi/custom/api.pm b/src/storage/datacore/restapi/custom/api.pm new file mode 100644 index 0000000000..4f0de4d1a8 --- /dev/null +++ b/src/storage/datacore/restapi/custom/api.pm @@ -0,0 +1,172 @@ +# +# Copyright 2024 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +package storage::datacore::restapi::custom::api; +use strict; +use warnings; +use centreon::plugins::http; +use centreon::plugins::statefile; +use JSON::XS; +use centreon::plugins::misc qw(empty); + +sub new { + my ($class, %options) = @_; + if (!defined($options{output})) { + print "Class Custom: Need to specify 'output' argument.\n"; + exit 3; + } + if (!defined($options{options})) { + $options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument."); + $options{output}->option_exit(); + } + my $self = {}; + bless $self, $class; + + + $options{options}->add_options(arguments => { + 'hostname:s' => { name => 'hostname' }, + 'port:s' => { name => 'port', default => 443 }, + 'proto:s' => { name => 'proto', default => 'https' }, + 'timeout:s' => { name => 'timeout' }, + 'username:s' => { name => 'username' }, + 'password:s' => { name => 'password' }, + 'unknown-http-status:s' => { name => 'unknown_http_status' }, + 'warning-http-status:s' => { name => 'warning_http_status' }, + 'critical-http-status:s' => { name => 'critical_http_status' } + }); + + $options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1); + + $self->{output} = $options{output}; + + $self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl'); + + return $self; +} + +sub set_options { + my ($self, %options) = @_; + + $self->{option_results} = $options{option_results}; +} +sub set_defaults {} + +# hostname,username and password are required options +sub check_options { + my ($self, %options) = @_; + $self->{http}->set_options(%{$self->{option_results}}); + + $self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 50; + + if (centreon::plugins::misc::is_empty($self->{option_results}->{hostname})) { + $self->{output}->add_option_msg(short_msg => 'Please set hostname option'); + $self->{output}->option_exit(); + } + if (centreon::plugins::misc::is_empty($self->{option_results}->{username})) { + $self->{output}->add_option_msg(short_msg => 'Please set username option to authenticate against datacore rest api'); + $self->{output}->option_exit(); + } + if (centreon::plugins::misc::is_empty($self->{option_results}->{password})) { + $self->{output}->add_option_msg(short_msg => 'Please set password option to authenticate against datacore rest api'); + $self->{output}->option_exit(); + } + +} + +sub settings { + my ($self, %options) = @_; + + return if (defined($self->{settings_done})); + $self->{http}->add_header(key => 'ServerHost', value => $self->{option_results}->{hostname}); + $self->{http}->set_options(basic => 1, credentials => 1); + $self->{settings_done} = 1; +} + +# wrapper around centreon::plugins::http::request to add authentication and decode json. +# output : deserialized json from the api if not error found in http call. +sub request_api { + my ($self, %options) = @_; + + # datacore api require a ServerHost header with the hostname used to query the api to respond. + # authentication is http standard basic auth. + my $result = $self->{http}->request( + username => $self->{option_results}->{username}, + password => $self->{option_results}->{password}, + unknown_status => $self->{option_results}->{unknown_http_status}, + warning_status => $self->{option_results}->{warning_http_status}, + critical_status => $self->{option_results}->{critical_http_status}, + %options, + ); + # Declare a scalar to deserialize the JSON content string into a perl data structure + my $decoded_content; + eval { + $decoded_content = JSON::XS->new->decode($result); + }; + # Catch the error that may arise in case the data received is not JSON + if ($@) { + $self->{output}->add_option_msg(short_msg => "Cannot decode JSON result"); + $self->{output}->option_exit(); + } + return $decoded_content; + +} +1; + + +__END__ + +=head1 NAME + +Datacore Sansymphony Rest API + +=head1 REST API OPTIONS + +Datacore Sansymphony Rest API + +=over 8 + +=item B<--hostname> + +Address of the Datacore server that hosts the API endpoint. + +=item B<--port> + +Port of the resource to connect to (default: 443). + +=item B<--proto> + +HTTP protocol, either http or https (default: 'https') + +=item B<--username> + +Username to access the endpoint. + +=item B<--password> + +Password to access the endpoint. + +=item B<--timeout> + +Set timeout in seconds (default: 10). + +=back + +=head1 DESCRIPTION + +B. diff --git a/src/storage/datacore/restapi/mode/alerts.pm b/src/storage/datacore/restapi/mode/alerts.pm new file mode 100644 index 0000000000..9307ba4163 --- /dev/null +++ b/src/storage/datacore/restapi/mode/alerts.pm @@ -0,0 +1,174 @@ +# +# Copyright 2024 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +package storage::datacore::restapi::mode::alerts; +use strict; +use warnings; +use centreon::plugins::misc qw(empty); + +use base qw(centreon::plugins::templates::counter); + +my %alerts_level = ('trace' => 0, 'info' => 1, 'warning' => 2, 'error' => 3); + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'alerts', type => 0}, + ]; + $self->{maps_counters}->{alerts} = [ + { + label => 'error', + nlabel => 'datacore.event.error.count', + set => { + key_values => [ { name => 'error' } ], + output_template => 'number of error alerts : %s', + perfdatas => [ { template => '%d', min => 0 } ] + } + }, { + label => 'warning', + nlabel => 'datacore.alerts.warning.count', + set => { + key_values => [ { name => 'warning' } ], + output_template => 'number of warning alerts : %s', + perfdatas => [ { template => '%d', min => 0 } ] + } + }, { + label => 'info', + nlabel => 'datacore.alerts.info.count', + set => { + key_values => [ { name => 'info' } ], + output_template => 'number of info alerts : %s', + perfdatas => [ { template => '%d', min => 0 } ] + } + }, { + label => 'trace', + nlabel => 'datacore.alerts.trace.count', + set => { + key_values => [ { name => 'trace' } ], + output_template => 'number of trace alerts : %s', + perfdatas => [ { template => '%d', min => 0 } ] + } + }, + ]; + +} + +sub new { + my ($class, %options) = @_; + + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); + bless $self, $class; + $options{options}->add_options(arguments => { + 'filter-server:s' => { name => 'filter_server' }, + 'max-alert-age:s' => { name => 'max_alert_age' } }); + + $self->{output} = $options{output}; + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $alerts = $options{custom}->request_api( + url_path => '/RestService/rest.svc/1.0/alerts' + ); + + my %alerts_count = ( + 0 => { count => 0, list => [] }, + 1 => { count => 0, list => [] }, + 2 => { count => 0, list => [] }, + 3 => { count => 0, list => [] }); + + for my $alert (@$alerts) { + + # spec require to filter on time of the log. + $alert->{TimeStamp} =~ /\/Date\((\d+)\)\/$/; + my $alert_date = $1; + if (centreon::plugins::misc::is_empty($alert_date) or $alert_date !~ /^[0-9]*[.,]?\d*$/){ + $self->{output}->output_add(long_msg => "alert on $alert->{MachineName} have an invalid date : $alert->{TimeStamp}\n", debug => 1); + next; + } + + # filter on age of the alert with a user defined max age + next if (defined($self->{option_results}->{max_alert_age}) + and $alert_date < (time - $self->{option_results}->{max_alert_age}) * 1000); + # filter on the machine issuing the alert with a user defined regex + + if (!centreon::plugins::misc::is_empty($self->{option_results}->{filter_server}) + and $alert->{MachineName} !~ $self->{option_results}->{filter_server}) { + $self->{output}->output_add(long_msg => "excluding alert from machine $alert->{MachineName}\n", debug => 1); + next; + } + + $alerts_count{$alert->{Level}}->{count}++; + # we don't want to clog the long output, so we keep only the few first logs. + # we use a array instead of directly adding to long_output because we need to sort errors + if (scalar(@{$alerts_count{$alert->{Level}}->{list}}) < 50) { + push(@{$alerts_count{$alert->{Level}}->{list}}, $alert->{MessageText}) + } + } + + $self->{output}->output_add(long_msg => "error : " . join("\n", @{$alerts_count{$alerts_level{error}}->{list}})); + $self->{output}->output_add(long_msg => "warning : " . join("\n", @{$alerts_count{$alerts_level{warning}}->{list}})); + + + + $self->{alerts} = { + trace => $alerts_count{$alerts_level{trace}}->{count}, + info => $alerts_count{$alerts_level{info}}->{count}, + warning => $alerts_count{$alerts_level{warning}}->{count}, + error => $alerts_count{$alerts_level{error}}->{count}, + }; + +} + +1; + +__END__ + +=head1 MODE + +Check Datacore alerts number exposed through the rest api + +=over 8 + +=item B<--max-alert-age> + +filter alerts to check those newer than this parameter (s) + +=item B<--filter-server> + +Define which devices should be monitored based on the MachineName. This option will be treated as a regular expression. +By default all machine will be checked. + +=item B<--warning/critical-*> + +Warning and critical threshold on the number of alerts of a type before changing state. +Replace * with trace, alert, warning, or error. + +=back + + diff --git a/src/storage/datacore/restapi/mode/listpool.pm b/src/storage/datacore/restapi/mode/listpool.pm new file mode 100644 index 0000000000..104dfe6cce --- /dev/null +++ b/src/storage/datacore/restapi/mode/listpool.pm @@ -0,0 +1,115 @@ +# +# Copyright 2024 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +package storage::datacore::restapi::mode::listpool; +use strict; +use warnings; + +use base qw(centreon::plugins::mode); + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' }, + }); + + + return $self; +} +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + $self->{pools} = (); + my $pool_list = $options{custom}->request_api( + url_path => '/RestService/rest.svc/1.0/pools'); + + if (scalar(@$pool_list) == 0) { + $self->{output}->add_option_msg(short_msg => "No pool found in api response."); + $self->{output}->option_exit(); + } + for my $pool (@$pool_list) { + next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' + && $pool->{Alias} !~ /$self->{option_results}->{filter_name}/); + push(@{$self->{pools}}, { + ExtendedCaption => $pool->{ExtendedCaption}, + Caption => $pool->{Caption}, + Id => $pool->{Id}, + Alias => $pool->{Alias}} + ); + } + +} + +sub run { + my ($self, %options) = @_; + $self->manage_selection(%options); + if (scalar $self->{pools} == 0) { + $self->{output}->add_option_msg(short_msg => "No pool found."); + $self->{output}->option_exit(); + } + foreach (sort @{$self->{pools}}) { + $self->{output}->output_add(long_msg => sprintf("[ExtendedCaption = %s] [Caption = %s] [Id = %s] [Alias = %s]", + $_->{ExtendedCaption}, $_->{Caption}, $_->{Id}, $_->{Alias})); + } + + $self->{output}->output_add( + severity => 'OK', + short_msg => 'List pools : ' + ); + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); + $self->{output}->exit(); +} + +sub disco_format { + my ($self, %options) = @_; + + $self->{output}->add_disco_format(elements => ['ExtendedCaption', 'Caption', 'Id', 'Alias']); +} + +sub disco_show { + my ($self, %options) = @_; + + $self->manage_selection(%options); + + foreach (sort @{$self->{pools}}) { + $self->{output}->add_disco_entry(ExtendedCaption => $_->{ExtendedCaption}, Caption => $_->{Caption}, + Id => $_->{Id}, Id => $_->{Id}, Alias => $_->{Alias}); + } +} +1; + +=head1 MODE + +List pools. + +=over 8 + +=item B<--filter-name> + +Filter pool name (can be a regexp). + +=back + +=cut \ No newline at end of file diff --git a/src/storage/datacore/restapi/mode/monitorstatus.pm b/src/storage/datacore/restapi/mode/monitorstatus.pm new file mode 100644 index 0000000000..faf5f5515b --- /dev/null +++ b/src/storage/datacore/restapi/mode/monitorstatus.pm @@ -0,0 +1,148 @@ +# +# Copyright 2024 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +package storage::datacore::restapi::mode::monitorstatus; +use strict; +use warnings; + +use base qw(centreon::plugins::templates::counter); +use JSON::XS; +use Digest::MD5 qw(md5_hex); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); +use centreon::plugins::misc qw(empty); + +my %monitor_state = (1 => "Undefined", 2 => "Healthy", 4 => "Attention", 8 => "Warning", 16 => "Critical"); + +sub custom_status_output { + my ($self, %options) = @_; + my $res = sprintf( + "'%s' status : '%s', message is '%s'", + $self->{result_values}->{extendedcaption}, + $self->{result_values}->{state}, + $self->{result_values}->{messagetext} + ); + return $res; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 1, message_multiple => 'All memory usages are ok', skipped_code => { -10 => 1 } } + ]; + + $self->{maps_counters}->{global} = [ + { label => 'state', + type => 2, + warning_default => '%{state} =~ /Warning/i', + critical_default => '%{state} =~ /Critical/i', + set => { + key_values => [ { name => 'state' }, { name => 'extendedcaption' }, { name => 'messagetext' } ], + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub {return 0;}, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); + bless $self, $class; + $options{options}->add_options(arguments => { + 'filter-caption:s' => { name => 'filter_caption' } }); + $self->{cache} = centreon::plugins::statefile->new(%options); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + $self->{cache}->check_options(option_results => $self->{option_results}); +} + +sub manage_selection { + my ($self, %options) = @_; + + if ($self->{cache}->read('statefile' => 'datacore_api_monitors' . md5_hex($self->{option_results}->{hostname} . $self->{option_results}->{username})) + and $self->{cache}->get(name => 'expires_on') > time() + 1) { + + return $self->{cache}->get(name => 'monitor_data'); + } + + my $monitor_data = $options{custom}->request_api( + url_path => '/RestService/rest.svc/1.0/monitors'); + + my $datas = { last_timestamp => time(), monitor_data => $monitor_data, expires_on => time() + 60 }; + $self->{cache}->write(data => $datas); + + my $monitored_count = 0; + for my $object (@$monitor_data) { + + if (!centreon::plugins::misc::is_empty($self->{option_results}->{filter_caption}) + and $object->{ExtendedCaption} !~ $self->{option_results}->{filter_caption}) { + next; + } + $self->{global}->{$monitored_count} = { + state => $monitor_state{$object->{State}}, + messagetext => $object->{MessageText}, + extendedcaption => $object->{ExtendedCaption} + }; + $monitored_count++; + } + # for now if no data is given to the counter, output is OK: with status ok, instead of unknown. + # We manage this case in each plugin for now. + if ($monitored_count == 0) { + $self->{output}->add_option_msg(short_msg => 'No monitors where checked, please check filter_caption parameter and api response.'); + $self->{output}->option_exit(); + } +} + +# as --filter-caption allow to filter element to check and this api don't allow parameter filtering, we should cache +# the output in case a client make multiples check a minute. + +1; + +__END__ + +=head1 MODE + +Check Datacore monitor status exposed through the rest api. + +=over 8 + +=item B<--filter-caption> + +Define which element should be monitored based on the extended caption. This option will be treated as a regular expression. +By default all elements will be checked. + +=item B<--warning-state> B<--critical-state> + +define which output from the api should be considered warning or critical. + +warning_default = '%{state} =~ /Warning/i', + +critical_default = '%{state} =~ /Critical/i', + +possible value for state : Undefined, Healthy, Attention, Warning, Critical. + +=back + diff --git a/src/storage/datacore/restapi/mode/poolspaceusage.pm b/src/storage/datacore/restapi/mode/poolspaceusage.pm new file mode 100644 index 0000000000..3fe233bc75 --- /dev/null +++ b/src/storage/datacore/restapi/mode/poolspaceusage.pm @@ -0,0 +1,121 @@ +# +# Copyright 2024 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +package storage::datacore::restapi::mode::poolspaceusage; +use strict; +use warnings; + +use base qw(centreon::plugins::templates::counter); +use JSON::XS; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + # BytesAllocatedPercentage is the disk usage of the pool + # in datacore you can make thin provisionning, where you give to each partition more than what you really have. + # oversubscribed is the number of Bytes allocated minus the number of bytes present in the system. + { name => 'BytesAllocatedPercentage', type => 0 }, + { name => 'oversubscribed', type => 0 }, + ]; + $self->{maps_counters}->{BytesAllocatedPercentage} = [ + + { + label => 'bytesallocatedpercentage', + nlabel => 'datacore.pool.bytesallocated.percentage', + set => { + key_values => [ { name => 'bytesallocatedpercentage' } ], + output_template => 'Bytes Allocated : %s %%', + perfdatas => [ + { template => '%d', unit => '%', min => 0, max => 100 } + ] + } + } ]; + $self->{maps_counters}->{oversubscribed} = [ { + label => 'oversubscribed', + nlabel => 'datacore.pool.oversubscribed.bytes', + set => { + key_values => [ { name => 'oversubscribed' } ], + output_template => 'Over subscribed bytes : %s', + perfdatas => [ + { template => '%d', unit => 'bytes', min => 0 } + ] + } + } ]; +} + +sub new { + my ($class, %options) = @_; + + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); + bless $self, $class; + $options{options}->add_options(arguments => { + 'pool-id:s' => { name => 'pool_id' } }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + if (centreon::plugins::misc::is_empty($self->{option_results}->{pool_id})) { + $self->{output}->add_option_msg(short_msg => 'Please set pool-id option'); + $self->{output}->option_exit(); + } +} + +sub manage_selection { + my ($self, %options) = @_; + + my $data = $options{custom}->request_api( + url_path => '/RestService/rest.svc/1.0/performances/' . $self->{option_results}->{pool_id}, + ); + if (defined($data->[1])) { + $self->{output}->add_option_msg(short_msg => 'multiples pools found in api response, only one is expected. Please check pool_id and datacore versions.'); + $self->{output}->option_exit(); + } + $self->{BytesAllocatedPercentage}->{bytesallocatedpercentage} = $data->[0]->{"BytesAllocatedPercentage"}; + $self->{oversubscribed}->{oversubscribed} = $data->[0]->{"BytesOverSubscribed"}; + +} +1; + +__END__ + +=head1 MODE + +Check Datacore pool space and over subscribed usage exposed through the rest api. + +=over 8 + +=item B<--pool-id> + +Id of the pool to check. See list-pool autodiscovery mode to list pools id (required). + +=item B<--warning-oversubscribed> B<--critical-oversubscribed> + +Warning and critical threshold on the number of Bytes suscribed over the real space of the pool. + +=item B<--warning-bytesallocatedpercentage> B<--critical-bytesallocatedpercentage> + +Warning and critical threshold on the percentage of bytes allocated in the pool. + +=back + + diff --git a/src/storage/datacore/restapi/plugin.pm b/src/storage/datacore/restapi/plugin.pm new file mode 100644 index 0000000000..98aed2f641 --- /dev/null +++ b/src/storage/datacore/restapi/plugin.pm @@ -0,0 +1,27 @@ +package storage::datacore::restapi::plugin; +use strict; +use warnings; +use base qw(centreon::plugins::script_custom); + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + # A version, we don't really use it but could help if your want to version your code + $self->{version} = '0.1'; + + $self->{modes} = { + 'pool-usage' => 'storage::datacore::restapi::mode::poolspaceusage', + 'alerts' => 'storage::datacore::restapi::mode::alerts', + 'list-pool' => 'storage::datacore::restapi::mode::listpool', + 'status-monitor' => 'storage::datacore::restapi::mode::monitorstatus', + }; + $self->{custom_modes}->{api} = 'storage::datacore::restapi::custom::api'; + return $self; +} +1; +=head1 PLUGIN DESCRIPTION + +Check Datacore using rest API. + diff --git a/tests/functional/api/cloud-aws-cloudtrail.robot b/tests/functional/api/cloud-aws-cloudtrail.robot.old similarity index 97% rename from tests/functional/api/cloud-aws-cloudtrail.robot rename to tests/functional/api/cloud-aws-cloudtrail.robot.old index 2252800df3..445a0de15a 100644 --- a/tests/functional/api/cloud-aws-cloudtrail.robot +++ b/tests/functional/api/cloud-aws-cloudtrail.robot.old @@ -153,6 +153,7 @@ AWS CloudTrail check trail status FOR ${checktrailstatus_value} IN @{checktrailstatus_values} ${output} Run ... ${CMD} --mode=checktrailstatus --endpoint=http://localhost:3000/cloudtrail/gettrailstatus/${checktrailstatus_value.trailstatus} --trail-name=${checktrailstatus_value.trailname} + ${output} Strip String ${output} Should Be Equal As Strings ... ${output} ... ${checktrailstatus_value.result} @@ -188,6 +189,7 @@ AWS CloudTrail count events ${command} Catenate ${command} --critical-count=${countevents_value.criticalcount} END ${output} Run ${command} + ${output} Strip String ${output} Should Be Equal As Strings ... ${output} ... ${countevents_value.result} @@ -204,13 +206,7 @@ Start Mockoon ... ${MOCKOON_JSON} ... --port ... 3000 - ... --pname - ... aws-cloudtrail - Wait For Process ${process} + Sleep 5s Stop Mockoon - ${process} Start Process - ... mockoon-cli - ... stop - ... mockoon-aws-cloudtrail - Wait For Process ${process} + Terminate All Processes diff --git a/tests/functional/api/cloud-azure-policyinsights-policystates.robot b/tests/functional/api/cloud-azure-policyinsights-policystates.robot.old similarity index 87% rename from tests/functional/api/cloud-azure-policyinsights-policystates.robot rename to tests/functional/api/cloud-azure-policyinsights-policystates.robot.old index 51b5851f7b..5b9bd61a60 100644 --- a/tests/functional/api/cloud-azure-policyinsights-policystates.robot +++ b/tests/functional/api/cloud-azure-policyinsights-policystates.robot.old @@ -14,29 +14,29 @@ Test Timeout 120s ${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl ${MOCKOON_JSON} ${CURDIR}${/}..${/}..${/}resources${/}mockoon${/}cloud-azure-policyinsights-policystates.json -${LOGIN_ENDPOINT} http://localhost:3000/login +${LOGIN_ENDPOINT} http://localhost:3001/login ${CMD} perl ${CENTREON_PLUGINS} --plugin=cloud::azure::policyinsights::policystates::plugin --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --login-endpoint=${LOGIN_ENDPOINT} &{compliance_value1} -... endpoint=http://localhost:3000/ok +... endpoint=http://localhost:3001/ok ... policyname= ... resourcelocation= ... resourcetype= ... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0; &{compliance_value2} -... endpoint=http://localhost:3000/oknextlink +... endpoint=http://localhost:3001/oknextlink ... policyname=9daedab3-fb2d-461e-b861-71790eead4f6 ... resourcelocation= ... resourcetype= ... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0; &{compliance_value3} -... endpoint=http://localhost:3000/nok1 +... endpoint=http://localhost:3001/nok1 ... policyname=9daedab3-fb2d-461e-b861-71790eead4f6 ... resourcelocation=fr ... resourcetype= ... result=CRITICAL: Compliance state for policy '9daedab3-fb2d-461e-b861-71790eead4f6' on resource 'mypubip1' is 'NonCompliant' | 'policies.non_compliant.count'=1;;;0; &{compliance_value4} -... endpoint=http://localhost:3000/nok2 +... endpoint=http://localhost:3001/nok2 ... policyname=9daedab3-fb2d-461e-b861-71790eead4f6 ... resourcelocation=fr ... resourcetype=ip @@ -66,6 +66,7 @@ Azure PolicyInsights PolicyStates compliance ${command} Catenate ${command} --resource-type=${compliance_value.resourcetype} END ${output} Run ${command} + ${output} Strip String ${output} Should Be Equal As Strings ... ${output} ... ${compliance_value.result} @@ -82,13 +83,7 @@ Start Mockoon ... ${MOCKOON_JSON} ... --port ... 3000 - ... --pname - ... azure-policyinsights - Wait For Process ${process} + Sleep 5s Stop Mockoon - ${process} Start Process - ... mockoon-cli - ... stop - ... mockoon-azure-policyinsights - Wait For Process ${process} + Terminate All Processes diff --git a/tests/functional/api/storage-datacore-restapi.robot b/tests/functional/api/storage-datacore-restapi.robot new file mode 100644 index 0000000000..c1b95d661c --- /dev/null +++ b/tests/functional/api/storage-datacore-restapi.robot @@ -0,0 +1,77 @@ +*** Settings *** +Documentation datacore rest api plugin + +Library Examples +Library OperatingSystem +Library Process +Library String + +Suite Setup Start Mockoon +Suite Teardown Stop Mockoon +Test Timeout 120s + +*** Variables *** +${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl +${MOCKOON_JSON} ${CURDIR}${/}..${/}..${/}resources${/}mockoon${/}storage-datacore-restapi.json + +${CMD} perl ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=3000 --hostname=127.0.0.1 --proto=http + + +*** Test Cases *** +Datacore check pool usage + [Documentation] Check Datacore pool usage + [Tags] storage api + ${output} Run + ... ${CMD} --mode=pool-usage --critical-oversubscribed=${critical-oversubscribed} --warning-oversubscribed=${warning-oversubscribed} --warning-bytesallocatedpercentage=${warning-bytesallocatedpercentage} --critical-bytesallocatedpercentage=${critical-bytesallocatedpercentage} --pool-id=B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:{4dec1b5a-2577-11e5-80c3-00155d651622} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${result} + ... Wrong output result for pool usage :\n\n ${output} \n\n ${result}\n\n + + Examples: warning-bytesallocatedpercentage critical-bytesallocatedpercentage warning-oversubscribed critical-oversubscribed result -- + ... 2 5 -1 3 CRITICAL: Bytes Allocated : 12 % WARNING: Over subscribed bytes : 0 | 'datacore.pool.bytesallocated.percentage'=12%;0:2;0:5;0;100 'datacore.pool.oversubscribed.bytes'=0bytes;0:-1;0:3;0; + ... 70 80 10 20 OK: Bytes Allocated : 12 % - Over subscribed bytes : 0 | 'datacore.pool.bytesallocated.percentage'=12%;0:70;0:80;0;100 'datacore.pool.oversubscribed.bytes'=0bytes;0:10;0:20;0; + +Datacore check alert count + [Documentation] Check Datacore pool usage + [Tags] storage api + ${output} Run + ... ${CMD} --mode=alerts --warning-error=${warning-error} --critical-error=${critical-error} --warning-warning=${warning-warning} --critical-warning=${critical-warning} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${result} + ... Wrong output result for alert count :\n\n ${output} \n\n ${result}\n\n + + Examples: warning-error critical-error warning-warning critical-warning result -- + ... 0 1 5 5 WARNING: number of error alerts : 1 | 'datacore.event.error.count'=1;0:0;0:1;0; 'datacore.alerts.warning.count'=1;0:5;0:5;0; 'datacore.alerts.info.count'=0;;;0; 'datacore.alerts.trace.count'=0;;;0; + ... 5 5 5 5 OK: number of error alerts : 1, number of warning alerts : 1, number of info alerts : 0, number of trace alerts : 0 | 'datacore.event.error.count'=1;0:5;0:5;0; 'datacore.alerts.warning.count'=1;0:5;0:5;0; 'datacore.alerts.info.count'=0;;;0; 'datacore.alerts.trace.count'=0;;;0; + +Datacore check status monitor + [Documentation] Check Datacore pool usage + [Tags] storage api + ${output} Run + ... ${CMD} --mode=status-monitor + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${result} + ... Wrong output result for status monitor :\n${output} \nresult:\n${result}\n\n + + Examples: result -- + ... CRITICAL: 'State of HostVM2' status : 'Critical', message is 'Connected' + +*** Keywords *** +Start Mockoon + ${process} Start Process + ... mockoon-cli + ... start + ... --data + ... ${MOCKOON_JSON} + ... --port + ... 3000 + Sleep 5s + +Stop Mockoon + Terminate All Processes \ No newline at end of file diff --git a/tests/functional/snmp/hardware-sensors-apc-snmp.robot b/tests/functional/snmp/hardware-sensors-apc-snmp.robot new file mode 100644 index 0000000000..995dc39eec --- /dev/null +++ b/tests/functional/snmp/hardware-sensors-apc-snmp.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Hardware Sensors APC SNMP plugin + +Library OperatingSystem +Library String +Library Examples + +Test Timeout 120s + + +*** Variables *** +${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl + +${CMD} perl ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=127.0.0.1 --snmp-version=2c --snmp-port=2024 + +*** Test Cases *** +APC Sensors ${tc}/9 + [Tags] hardware Sensors snmp + ${command} Catenate + ... ${CMD} + ... --snmp-community=hardware/sensors/apc/sensors + + # Append options to command + ${command} Append Option To Command ${command} --warning ${warning} + ${command} Append Option To Command ${command} --critical ${critical} + ${command} Append Option To Command ${command} --component ${component} + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} +#--component 'temperature' --warning='humidity,.,45:65' --critical='humidity,.,35:70' + Examples: tc component warning critical expected_result -- + ... 1 _empty_ _empty_ _empty_ OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;; + ... 2 _empty_ humidity,.,45:65 _empty_ WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;;0;100 'hardware.temperature.count'=2;;;; + ... 3 _empty_ humidity,.,45:65 humidity,.,35:70 WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;35:70;0;100 'hardware.temperature.count'=2;;;; + ... 4 _empty_ _empty_ _empty_ OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;; + ... 5 _empty_ humidity,.,45:65 _empty_ WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;;0;100 'hardware.temperature.count'=2;;;; + ... 6 _empty_ humidity,.,45:65 humidity,.,35:70 WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;35:70;0;100 'hardware.temperature.count'=2;;;; + ... 7 .* _empty_ _empty_ OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;; + ... 8 _empty_ temperature,.,22:25 temperature,.,22:25 OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;22:25;22:25;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;; + ... 9 _empty_ _empty_ _empty_ OK: All 2 components are ok [2/2 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;;;0;100 'hardware.temperature.count'=2;;;; + +*** Keywords *** + +Append Option To Command + [Documentation] Concatenates the first argument (option) with the second (value) after having replaced the value with "" if its content is '_empty_' + [Arguments] ${cmd} ${option} ${value} + ${value} Set Variable If '${value}' == '_empty_' '' ${value} + [return] ${cmd} ${option}=${value} + diff --git a/tests/functional/snmp/hardware-ups-socomec-netvision-snmp.robot b/tests/functional/snmp/hardware-ups-socomec-netvision-snmp.robot new file mode 100644 index 0000000000..ce95f7a57a --- /dev/null +++ b/tests/functional/snmp/hardware-ups-socomec-netvision-snmp.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Hardware UPS Socomec Netvision SNMP plugin + +Library OperatingSystem +Library String +Library Examples + +Test Timeout 120s + + +*** Variables *** +${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl + +${CMD} perl ${CENTREON_PLUGINS} --plugin=hardware::ups::socomec::netvision::snmp::plugin + +*** Test Cases *** +Battery ${tc}/4 + [Tags] hardware UPS snmp + ${command} Catenate + ... ${CMD} + ... --mode=battery + ... --hostname=127.0.0.1 + ... --snmp-version=2c + ... --snmp-port=2024 + ... --snmp-community=hardware/ups/socomec/netvision/snmp/mode/battery + + # Append options to command + ${opt} Append Option --warning-temperature ${w_temperature} + ${command} Catenate ${command} ${opt} + ${opt} Append Option --critical-temperature ${c_temperature} + ${command} Catenate ${command} ${opt} + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + + Examples: tc w_temperature c_temperature expected_result -- + ... 1 30 50 OK: battery status is normal - charge remaining: 100% (0 minutes remaining) | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:30;0:50;; + ... 2 20 50 WARNING: temperature: 22 C | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:20;0:50;; + ... 3 10 20 CRITICAL: temperature: 22 C | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:10;0:20;; + ... 4 _empty_ _empty_ OK: battery status is normal - charge remaining: 100% (0 minutes remaining) | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;;;; + +*** Keywords *** +Append Option + [Documentation] Concatenates the first argument (option) with the second (value) after having replaced the value with "" if its content is '_empty_' + [Arguments] ${option} ${value} + ${value} Set Variable If '${value}' == '_empty_' '' ${value} + [return] ${option}=${value} + diff --git a/tests/functional/snmp/snmp-collection-sputnik-snmp.robot b/tests/functional/snmp/snmp-collection-sputnik-snmp.robot new file mode 100644 index 0000000000..2e380c0aab --- /dev/null +++ b/tests/functional/snmp/snmp-collection-sputnik-snmp.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Hardware UPS Sputnik SNMP plugin + +Library OperatingSystem +Library String +Library Examples + +Test Timeout 120s + + +*** Variables *** +${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl + +${CMD} perl ${CENTREON_PLUGINS} --plugin=apps::protocols::snmp::plugin + +*** Test Cases *** +SNMP Collection - Sputnik Environment ${tc}/3 + [Tags] SNMP Collection + ${command} Catenate + ... ${CMD} + ... --mode=collection + ... --hostname=127.0.0.1 + ... --snmp-version=2c + ... --snmp-port=2024 + ... --snmp-community=hardware-ups/hardware-ups-sputnik + ... --config=${CURDIR}${/}..${/}..${/}..${/}src/contrib/collection/snmp/sputnik-environment.json + + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${output} + ... ${expected_result} + ... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n} + + Examples: tc expected_result -- + ... 1 OK: Sensor '1' temperature is '20.06'°C and humidity is '33'% | '1#environment.temperature.celsius'=20.06C;;;; '1#environment.humidity.percent'=33%;;;0;100 + ... 2 OK: Sensor '1' temperature is '20.06'°C and humidity is '33'% | '1#environment.temperature.celsius'=20.06C;;;; '1#environment.humidity.percent'=33%;;;0;100 + ... 3 OK: Sensor '1' temperature is '20.06'°C and humidity is '33'% | '1#environment.temperature.celsius'=20.06C;;;; '1#environment.humidity.percent'=33%;;;0;100 + +*** Keywords *** +Append Option + [Documentation] Concatenates the first argument (option) with the second (value) after having replaced the value with "" if its content is '_empty_' + [Arguments] ${option} ${value} + ${value} Set Variable If '${value}' == '_empty_' '' ${value} + [return] ${option}=${value} + diff --git a/tests/resources/mockoon/storage-datacore-api.json b/tests/resources/mockoon/storage-datacore-api.json new file mode 100644 index 0000000000..15938230b4 --- /dev/null +++ b/tests/resources/mockoon/storage-datacore-api.json @@ -0,0 +1,174 @@ +{ + "uuid": "317849df-2152-4b89-88f7-f22ea37aab32", + "lastMigration": 27, + "name": "Storage datacore api", + "endpointPrefix": "", + "latency": 0, + "port": 3000, + "hostname": "", + "folders": [], + "routes": [ + { + "uuid": "9d203639-fb39-402b-9759-91c156e247c6", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/pools", + "responses": [ + { + "uuid": "f8d1590b-878f-4884-9214-dea80580eb75", + "body": "[{\r\n \"Caption\" : \"Disk pool 1\",\r\n \"ExtendedCaption\" : \"Disk pool 1 on StorageSvr001\",\r\n \"Id\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551:{d68b8a36-0ec4-11e5-80ba-00155d651622}\",\r\n \"Internal\" : false,\r\n \"SequenceNumber\" : 11963,\r\n \"Alias\" : \"Disk pool 1\",\r\n \"AutoTieringEnabled\" : true,\r\n \"ChunkSize\" : {\r\n \"Value\" : 134217728\r\n },\r\n \"Description\" : null,\r\n \"InSharedMode\" : false,\r\n \"IsAuthorized\" : true,\r\n \"MaxTierNumber\" : 3,\r\n \"PoolMode\" : 1,\r\n \"PoolStatus\" : 0,\r\n \"PresenceStatus\" : 1,\r\n \"SMPAApproved\" : false,\r\n \"ServerId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\r\n \"SharedPoolId\" : null,\r\n \"TierReservedPct\" : 0,\r\n \"Type\" : 0,\r\n \"IsBulk\" : false\r\n},\r\n{\r\n \"Caption\" : \"Shared pool 1\",\r\n \"ExtendedCaption\" : \"Shared pool 1 on StorageSvr002\",\r\n \"Id\" : \"B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:{4dec1b5a-2577-11e5-80c3-00155d651622}\",\r\n \"Internal\" : false,\r\n \"SequenceNumber\" : 11967,\r\n \"Alias\" : \"Shared pool 1\",\r\n \"AutoTieringEnabled\" : true,\r\n \"ChunkSize\" : {\r\n \"Value\" : 134217728\r\n },\r\n \"Description\" : null,\r\n \"InSharedMode\" : true,\r\n \"IsAuthorized\" : true,\r\n \"MaxTierNumber\" : 3,\r\n \"PoolMode\" : 1,\r\n \"PoolStatus\" : 0,\r\n \"PresenceStatus\" : 1,\r\n \"SMPAApproved\" : true,\r\n \"ServerId\" : \"B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D\",\r\n \"SharedPoolId\" : \"{4dec1b5a-2577-11e5-80c3-00155d651622}\",\r\n \"TierReservedPct\" : 0,\r\n \"Type\" : 0,\r\n \"IsBulk\" : false\r\n} ]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "8837f5cd-5ca3-4779-ba8e-6b46692c487b", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/performances/B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:%7B4dec1b5a-2577-11e5-80c3-00155d651622%7D", + "responses": [ + { + "uuid": "a5bf53e2-5edf-437e-a684-68315cfa7824", + "body": "[\n {\n \"CollectionTime\": \"/Date(1486402608775)/\",\n \"NullCounterMap\": 0,\n \"BytesAllocated\": 6174015488,\n \"BytesAllocatedPercentage\": 12,\n \"BytesAvailable\": 47110422528,\n \"BytesAvailablePercentage\": 88,\n \"BytesInReclamation\": 0,\n \"BytesInReclamationPercentage\": 0,\n \"BytesOverSubscribed\": 0,\n \"BytesReserved\": 0,\n \"BytesReservedPercentage\": 0,\n \"BytesTotal\": 53284438016,\n \"EstimatedDepletionTime\": 2592000001,\n \"MaxPoolBytes\": 1108127332171776,\n \"MaxReadTime\" : 0,\n \"MaxReadWriteTime\" : 0,\n \"MaxWriteTime\" : 0,\n \"PercentAllocated\" : 12,\n \"PercentAvailable\" : 88,\n \"TotalBytesMigrated\" : 0,\n \"TotalBytesRead\" : 307200,\n \"TotalBytesTransferred\" : 2036756992,\n \"TotalBytesWritten\" : 2036470272,\n \"TotalOperations\" : 53002,\n \"TotalReadTime\" : 0,\n \"TotalReads\" : 18,\n \"TotalWriteTime\" : 74994,\n \"TotalWrites\" : 52998\n }\n]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "ce9e85c8-c72e-47d4-b70a-0fd3c3a6d703", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/alerts", + "responses": [ + { + "uuid": "b6425c83-2f13-4ffe-a9f6-c73feb54c2ec", + "body": "[ {\n \"Caller\" : \"ServerMachineGroup.UpdateServers\",\n \"HighPriority\" : true,\n \"Id\" : {\n \"MachineId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SequenceNumber\" : 34937\n },\n \"Level\" : 2,\n \"MachineName\" : \"STORAGESVR001\",\n \"MessageData\" : [ \"StorageSvr002\" ],\n \"MessageText\" : \"Connection to server {0} has been lost.\",\n \"NeedsAcknowledge\" : false,\n \"Sources\" : [ {\n \"SourceCaption\" : \"Group1\",\n \"SourceId\" : \"4b428832-fd51-45df-9c21-ce267e1ceb7a\",\n \"SourceType\" : 12\n } ],\n \"TimeStamp\" : \"/Date(1437398005546)/\",\n \"UserId\" : null,\n \"UserName\" : null,\n \"Visibility\" : 64\n}, {\n \"Caller\" : \"BasePerfMonitor`1.SetState\",\n \"HighPriority\" : true,\n \"Id\" : {\n \"MachineId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SequenceNumber\" : 33985\n },\n \"Level\" : 3,\n \"MachineName\" : \"STORAGESVR001\",\n \"MessageData\" : null,\n \"MessageText\" : \"The Replication buffer free space of StorageSvr001 in Group1 is <= 10%\",\n \"NeedsAcknowledge\" : false,\n \"Sources\" : [ {\n \"SourceCaption\" : \"Replication buffer free space of StorageSvr001 in Group1\",\n \"SourceId\" : \"FallingThresholdPerfMonitor`1ReplicationBufferPercentFreeSpace\",\n \"SourceType\" : 3\n }, {\n \"SourceCaption\" : \"StorageSvr001 in Group1\",\n \"SourceId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SourceType\" : 12\n }, {\n \"SourceCaption\" : \"Group1\",\n \"SourceId\" : \"4b428832-fd51-45df-9c21-ce267e1ceb7a\",\n \"SourceType\" : 12\n } ],\n \"TimeStamp\" : \"/Date(1437397587894)/\",\n \"UserId\" : null,\n \"UserName\" : null,\n \"Visibility\" : 64\n}]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + } + ], + "enabled": true, + "responseMode": null + }, + { + "uuid": "a916f10f-b2f2-498a-9b87-3aeffd80c8dc", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/monitors", + "responses": [ + { + "uuid": "d2713bdd-33e9-415a-bffe-16e279b1b753", + "body": "[\n {\n \"Caption\": \"State\",\n \"ExtendedCaption\": \"State of HostVM2\",\n \"Id\": \"ClientMachineStateMonitor\",\n \"Internal\": false,\n \"SequenceNumber\": 9417,\n \"Description\": \"Monitors the state of hosts.\",\n \"MessageText\": \"Connected\",\n \"MonitoredObjectId\": \"ed89ef91d72142dc958e02c5b7014fac\",\n \"State\": 16,\n \"TemplateId\": \"T(DataCore.Executive.Controller.ClientMachineStateMonitor)\",\n \"TimeStamp\": \"/Date(1486136115475-0500)/\"\n },\n {\n \"Caption\": \"I/O latency\",\n \"ExtendedCaption\": \"I/O latency of Mirror of Virtual disk 1 on StorageSvr005\",\n \"Id\": \"RisingThresholdPerfMonitor`1TotalOperationsTime\",\n \"Internal\": false,\n \"SequenceNumber\": 10036,\n \"Description\": \"Monitors the physical disks latency.\",\n \"MessageText\": \"Disabled\",\n \"MonitoredObjectId\": \"V.{2f652562-e7e3-11e6-80d7-00155d651611}-00000001_N.22690030D9218568\",\n \"State\": 1,\n \"TemplateId\": \"T(DataCore.Executive.Controller.RisingThresholdPerfMonitor`1[T]TotalOperationsTime)\",\n \"TimeStamp\": \"/Date(1486148705910-0500)/\"\n }\n]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true + } + ], + "enabled": true, + "responseMode": null + } + ], + "rootChildren": [ + { + "type": "route", + "uuid": "9d203639-fb39-402b-9759-91c156e247c6" + }, + { + "type": "route", + "uuid": "8837f5cd-5ca3-4779-ba8e-6b46692c487b" + }, + { + "type": "route", + "uuid": "ce9e85c8-c72e-47d4-b70a-0fd3c3a6d703" + }, + { + "type": "route", + "uuid": "a916f10f-b2f2-498a-9b87-3aeffd80c8dc" + } + ], + "proxyMode": false, + "proxyHost": "", + "proxyRemovePrefix": false, + "tlsOptions": { + "enabled": false, + "type": "CERT", + "pfxPath": "", + "certPath": "", + "keyPath": "", + "caPath": "", + "passphrase": "" + }, + "cors": true, + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "proxyReqHeaders": [ + { + "key": "", + "value": "" + } + ], + "proxyResHeaders": [ + { + "key": "", + "value": "" + } + ], + "data": [] +} \ No newline at end of file diff --git a/tests/resources/mockoon/storage-datacore-restapi.json b/tests/resources/mockoon/storage-datacore-restapi.json new file mode 100644 index 0000000000..f7aae507ac --- /dev/null +++ b/tests/resources/mockoon/storage-datacore-restapi.json @@ -0,0 +1,179 @@ +{ + "uuid": "8cba072c-7794-4ff7-ab36-158ef1abed39", + "lastMigration": 32, + "name": "Storage datacore api", + "endpointPrefix": "", + "latency": 0, + "port": 3001, + "hostname": "", + "folders": [], + "routes": [ + { + "uuid": "148371c5-aaa7-4bf0-a818-e81a21aa7f9a", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/pools", + "responses": [ + { + "uuid": "003eae6e-f58f-44db-bd03-3b44ca578046", + "body": "[ {\n \"Caption\" : \"Disk pool 1\",\n \"ExtendedCaption\" : \"Disk pool 1 on StorageSvr001\",\n \"Id\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551:{d68b8a36-0ec4-11e5-80ba-00155d651622}\",\n \"Internal\" : false,\n \"SequenceNumber\" : 11963,\n \"Alias\" : \"Disk pool 1\",\n \"AutoTieringEnabled\" : true,\n \"ChunkSize\" : {\n \"Value\" : 134217728\n },\n \"Description\" : null,\n \"InSharedMode\" : false,\n \"IsAuthorized\" : true,\n \"MaxTierNumber\" : 3,\n \"PoolMode\" : 1,\n \"PoolStatus\" : 0,\n \"PresenceStatus\" : 1,\n \"SMPAApproved\" : false,\n \"ServerId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SharedPoolId\" : null,\n \"TierReservedPct\" : 0,\n \"Type\" : 0,\n \"IsBulk\" : false\n},\n{\n \"Caption\" : \"Shared pool 1\",\n \"ExtendedCaption\" : \"Shared pool 1 on StorageSvr002\",\n \"Id\" : \"B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:{4dec1b5a-2577-11e5-80c3-00155d651622}\",\n \"Internal\" : false,\n \"SequenceNumber\" : 11967,\n \"Alias\" : \"Shared pool 1\",\n \"AutoTieringEnabled\" : true,\n \"ChunkSize\" : {\n \"Value\" : 134217728\n },\n \"Description\" : null,\n \"InSharedMode\" : true,\n \"IsAuthorized\" : true,\n \"MaxTierNumber\" : 3,\n \"PoolMode\" : 1,\n \"PoolStatus\" : 0,\n \"PresenceStatus\" : 1,\n \"SMPAApproved\" : true,\n \"ServerId\" : \"B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D\",\n \"SharedPoolId\" : \"{4dec1b5a-2577-11e5-80c3-00155d651622}\",\n \"TierReservedPct\" : 0,\n \"Type\" : 0,\n \"IsBulk\" : false\n} ]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null + }, + { + "uuid": "0c038179-3723-4d67-9bed-fc226629c847", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/performances/B5C140F5-6B13-4CAD-AF9D-F7C4172B3A1D:%7B4dec1b5a-2577-11e5-80c3-00155d651622%7D", + "responses": [ + { + "uuid": "0eb0a2ca-2f12-40af-ba94-0feef989b6a1", + "body": "[\n {\n \"CollectionTime\": \"/Date(1486402608775)/\",\n \"NullCounterMap\": 0,\n \"BytesAllocated\": 6174015488,\n \"BytesAllocatedPercentage\": 12,\n \"BytesAvailable\": 47110422528,\n \"BytesAvailablePercentage\": 88,\n \"BytesInReclamation\": 0,\n \"BytesInReclamationPercentage\": 0,\n \"BytesOverSubscribed\": 0,\n \"BytesReserved\": 0,\n \"BytesReservedPercentage\": 0,\n \"BytesTotal\": 53284438016,\n \"EstimatedDepletionTime\": 2592000001,\n \"MaxPoolBytes\": 1108127332171776,\n \"MaxReadTime\" : 0,\n \"MaxReadWriteTime\" : 0,\n \"MaxWriteTime\" : 0,\n \"PercentAllocated\" : 12,\n \"PercentAvailable\" : 88,\n \"TotalBytesMigrated\" : 0,\n \"TotalBytesRead\" : 307200,\n \"TotalBytesTransferred\" : 2036756992,\n \"TotalBytesWritten\" : 2036470272,\n \"TotalOperations\" : 53002,\n \"TotalReadTime\" : 0,\n \"TotalReads\" : 18,\n \"TotalWriteTime\" : 74994,\n \"TotalWrites\" : 52998\n }\n]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null + }, + { + "uuid": "b9f7dd2b-e1e1-4902-95ba-c6b76a1de390", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/alerts", + "responses": [ + { + "uuid": "a1dece29-074b-4100-a764-f7ddccdec8da", + "body": "[ {\n \"Caller\" : \"ServerMachineGroup.UpdateServers\",\n \"HighPriority\" : true,\n \"Id\" : {\n \"MachineId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SequenceNumber\" : 34937\n },\n \"Level\" : 2,\n \"MachineName\" : \"STORAGESVR001\",\n \"MessageData\" : [ \"StorageSvr002\" ],\n \"MessageText\" : \"Connection to server {0} has been lost.\",\n \"NeedsAcknowledge\" : false,\n \"Sources\" : [ {\n \"SourceCaption\" : \"Group1\",\n \"SourceId\" : \"4b428832-fd51-45df-9c21-ce267e1ceb7a\",\n \"SourceType\" : 12\n } ],\n \"TimeStamp\" : \"/Date(1437398005546)/\",\n \"UserId\" : null,\n \"UserName\" : null,\n \"Visibility\" : 64\n}, {\n \"Caller\" : \"BasePerfMonitor`1.SetState\",\n \"HighPriority\" : true,\n \"Id\" : {\n \"MachineId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SequenceNumber\" : 33985\n },\n \"Level\" : 3,\n \"MachineName\" : \"STORAGESVR001\",\n \"MessageData\" : null,\n \"MessageText\" : \"The Replication buffer free space of StorageSvr001 in Group1 is <= 10%\",\n \"NeedsAcknowledge\" : false,\n \"Sources\" : [ {\n \"SourceCaption\" : \"Replication buffer free space of StorageSvr001 in Group1\",\n \"SourceId\" : \"FallingThresholdPerfMonitor`1ReplicationBufferPercentFreeSpace\",\n \"SourceType\" : 3\n }, {\n \"SourceCaption\" : \"StorageSvr001 in Group1\",\n \"SourceId\" : \"A3E78CFA-DBEC-44E1-A23C-E9E262EC4551\",\n \"SourceType\" : 12\n }, {\n \"SourceCaption\" : \"Group1\",\n \"SourceId\" : \"4b428832-fd51-45df-9c21-ce267e1ceb7a\",\n \"SourceType\" : 12\n } ],\n \"TimeStamp\" : \"/Date(1437397587894)/\",\n \"UserId\" : null,\n \"UserName\" : null,\n \"Visibility\" : 64\n}]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null + }, + { + "uuid": "be0b350e-f8da-4998-a045-a3cf840745c0", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "RestService/rest.svc/1.0/monitors", + "responses": [ + { + "uuid": "6f53cd5e-7417-4fdf-a310-e2a7af4b7c3a", + "body": "[\r\n {\r\n \"Caption\": \"State\",\r\n \"ExtendedCaption\": \"State of HostVM2\",\r\n \"Id\": \"ClientMachineStateMonitor\",\r\n \"Internal\": false,\r\n \"SequenceNumber\": 9417,\r\n \"Description\": \"Monitors the state of hosts.\",\r\n \"MessageText\": \"Connected\",\r\n \"MonitoredObjectId\": \"ed89ef91d72142dc958e02c5b7014fac\",\r\n \"State\": 16,\r\n \"TemplateId\": \"T(DataCore.Executive.Controller.ClientMachineStateMonitor)\",\r\n \"TimeStamp\": \"/Date(1486136115475-0500)/\"\r\n },\r\n {\r\n \"Caption\": \"I/O latency\",\r\n \"ExtendedCaption\": \"I/O latency of Mirror of Virtual disk 1 on StorageSvr005\",\r\n \"Id\": \"RisingThresholdPerfMonitor`1TotalOperationsTime\",\r\n \"Internal\": false,\r\n \"SequenceNumber\": 10036,\r\n \"Description\": \"Monitors the physical disks latency.\",\r\n \"MessageText\": \"Disabled\",\r\n \"MonitoredObjectId\": \"V.{2f652562-e7e3-11e6-80d7-00155d651611}-00000001_N.22690030D9218568\",\r\n \"State\": 1,\r\n \"TemplateId\": \"T(DataCore.Executive.Controller.RisingThresholdPerfMonitor`1[T]TotalOperationsTime)\",\r\n \"TimeStamp\": \"/Date(1486148705910-0500)/\"\r\n }\r\n]", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null + } + ], + "rootChildren": [ + { + "type": "route", + "uuid": "148371c5-aaa7-4bf0-a818-e81a21aa7f9a" + }, + { + "type": "route", + "uuid": "0c038179-3723-4d67-9bed-fc226629c847" + }, + { + "type": "route", + "uuid": "b9f7dd2b-e1e1-4902-95ba-c6b76a1de390" + }, + { + "type": "route", + "uuid": "be0b350e-f8da-4998-a045-a3cf840745c0" + } + ], + "proxyMode": false, + "proxyHost": "", + "proxyRemovePrefix": false, + "tlsOptions": { + "enabled": false, + "type": "CERT", + "pfxPath": "", + "certPath": "", + "keyPath": "", + "caPath": "", + "passphrase": "" + }, + "cors": true, + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "proxyReqHeaders": [ + { + "key": "", + "value": "" + } + ], + "proxyResHeaders": [ + { + "key": "", + "value": "" + } + ], + "data": [], + "callbacks": [] +} \ No newline at end of file diff --git a/tests/resources/snmp/hardware/sensors/apc/sensors.snmpwalk b/tests/resources/snmp/hardware/sensors/apc/sensors.snmpwalk new file mode 100644 index 0000000000..e5380183b2 --- /dev/null +++ b/tests/resources/snmp/hardware/sensors/apc/sensors.snmpwalk @@ -0,0 +1,10 @@ +.1.3.6.1.4.1.318.1.1.10.3.12.11.0 = INTEGER: 1 +.1.3.6.1.4.1.318.1.1.10.4.1.2.1.2.0 = STRING: Main Module +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.1.0.1 = INTEGER: 0 +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.2.0.1 = INTEGER: 1 +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.3.0.1 = STRING: Sonde de temperature +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.4.0.1 = STRING: salle serveur 1 +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.1 = INTEGER: 23 +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.6.0.1 = INTEGER: 35 +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.7.0.1 = INTEGER: 2 +.1.3.6.1.4.1.318.1.1.10.4.2.3.1.8.0.1 = INTEGER: 1 \ No newline at end of file diff --git a/tests/resources/snmp/hardware/ups/socomec/netvision/snmp/mode/battery.snmpwalk b/tests/resources/snmp/hardware/ups/socomec/netvision/snmp/mode/battery.snmpwalk new file mode 100644 index 0000000000..dc7512f491 --- /dev/null +++ b/tests/resources/snmp/hardware/ups/socomec/netvision/snmp/mode/battery.snmpwalk @@ -0,0 +1,11 @@ +.1.3.6.1.4.1.4555.1.1.7.1.2.1.0 = INTEGER: 2 +.1.3.6.1.4.1.4555.1.1.7.1.2.3.0 = INTEGER: 0 +.1.3.6.1.4.1.4555.1.1.7.1.2.4.0 = INTEGER: 100 +.1.3.6.1.4.1.4555.1.1.7.1.2.5.0 = INTEGER: 3391 +.1.3.6.1.4.1.4555.1.1.7.1.2.6.0 = INTEGER: 220 +.1.3.6.1.4.1.4555.1.1.7.1.2.8.0 = INTEGER: 0 +.1.3.6.1.4.1.4555.1.1.1.1.2.1.0 = INTEGER: 2 +.1.3.6.1.4.1.4555.1.1.1.1.2.3.0 = INTEGER: 0 +.1.3.6.1.4.1.4555.1.1.1.1.2.4.0 = INTEGER: 100 +.1.3.6.1.4.1.4555.1.1.1.1.2.5.0 = INTEGER: 3391 +.1.3.6.1.4.1.4555.1.1.1.1.2.6.0 = INTEGER: 22