From c5dcf4bc9212e6106eb8127b16af6db0efa1d8d7 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Tue, 3 Sep 2024 09:57:50 +0200 Subject: [PATCH 01/40] add minimal workflow and build files --- .../Dockerfile.packaging-plugins-java-alma8 | 27 ++++ .../Dockerfile.packaging-plugins-java-alma9 | 0 .github/workflows/as400.yml | 139 ++++++++++++++++++ as400/packaging/centreon-as400-daemon.yaml | 27 ++++ 4 files changed, 193 insertions(+) create mode 100644 .github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 create mode 100644 .github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 create mode 100644 .github/workflows/as400.yml create mode 100644 as400/packaging/centreon-as400-daemon.yaml diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 new file mode 100644 index 0000000000..5801a13474 --- /dev/null +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -0,0 +1,27 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:8 + +RUN bash -e <&1 > /dev/null | grep 'java.home' | tr -s ' ' | cut -d ' ' -f 4) + + - name: Build JAR using maven + run: mvn clean install -f connector.as400/pom.xml + + # - name: Package + # uses: ./.github/actions/package-nfpm + # with: + # nfpm_file_pattern: "as400/packaging/centreon-as400-daemon.yaml" + # distrib: ${{ matrix.distrib }} + # package_extension: ${{ matrix.package_extension }} + # version: ${{ needs.get-environment.outputs.version }} + # release: ${{ needs.get-environment.outputs.release }} + # arch: all + # commit_hash: ${{ github.sha }} + # cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-as400-${{ matrix.distrib }} + # rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }} + # rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }} + # rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }} + # stability: ${{ needs.get-environment.outputs.stability }} + + # deliver-rpm: + # needs: [get-environment, package] + # if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} + # runs-on: [self-hosted, common] + + # strategy: + # matrix: + # distrib: [el8, el9] + + # steps: + # - name: Checkout sources + # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + # - name: Delivery + # uses: ./.github/actions/rpm-delivery + # with: + # module_name: nrpe + # distrib: ${{ matrix.distrib }} + # cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} + # stability: ${{ needs.get-environment.outputs.stability }} + # artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} + + # deliver-deb: + # needs: [get-environment, package] + # if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} + # runs-on: [self-hosted, common] + + # strategy: + # matrix: + # distrib: [bullseye, bookworm, jammy] + + # steps: + # - name: Checkout sources + # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + # - name: Delivery + # uses: ./.github/actions/deb-delivery + # with: + # module_name: nrpe + # distrib: ${{ matrix.distrib }} + # cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} + # stability: ${{ needs.get-environment.outputs.stability }} + # artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml new file mode 100644 index 0000000000..4e5e087274 --- /dev/null +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -0,0 +1,27 @@ +name: "centreon-plugin-Operatingsystems-AS400-daemon" +arch: "${ARCH}" +platform: "linux" +version_schema: "none" +version: "${VERSION}" +release: "${RELEASE}${DIST}" +section: "default" +priority: "optional" +maintainer: "Centreon " +description: | + Centreon Connector Server for AS400 +vendor: "Centreon" +homepage: "https://www.centreon.com" +license: "Apache-2.0" + +contents: + +scripts: + preinstall: ./scripts/centreon-bi-engine-preinstall.sh + postinstall: ./scripts/centreon-bi-engine-postinstall.sh + preremove: ./scripts/centreon-bi-engine-preremove.sh + +rpm: + summary: Centreon AS 400 Plugin daemon + signature: + key_file: ${RPM_SIGNING_KEY_FILE} + key_id: ${RPM_SIGNING_KEY_ID} \ No newline at end of file From 9392f0fcb68e632178fe7ae5d913f373698fbe5e Mon Sep 17 00:00:00 2001 From: tuntoja Date: Tue, 3 Sep 2024 10:27:55 +0200 Subject: [PATCH 02/40] fix prepare files for packaging step --- .../docker/packaging/Dockerfile.packaging-plugins-java-alma8 | 5 ++--- .github/workflows/as400.yml | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index 5801a13474..ac8af74fa7 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -5,8 +5,7 @@ FROM ${REGISTRY_URL}/almalinux:8 RUN bash -e <&1 > /dev/null | grep 'java.home' | tr -s ' ' | cut -d ' ' -f 4) WORKDIR /src \ No newline at end of file diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 1de4e01d73..07d30a20f5 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -61,8 +61,8 @@ jobs: run: | find . \ -type f \ - -exec %{__grep} -E '(@CONNECTOR_VERSION@)|(@CONNECTOR_HOME@)|(@CONNECTOR_ETC@)|(@CONNECTOR_LOG@)|(@CONNECTOR_USER@)|(@JAVA_BIN@)' {} ';' \ - -exec %{__sed} -i \ + -exec grep -E '(@CONNECTOR_VERSION@)|(@CONNECTOR_HOME@)|(@CONNECTOR_ETC@)|(@CONNECTOR_LOG@)|(@CONNECTOR_USER@)|(@JAVA_BIN@)' {} ';' \ + -exec sed -i \ -e 's|@CONNECTOR_VERSION@|'"%{version}"'|g' \ -e 's|@CONNECTOR_HOME@|'"%{_datadir}/centreon-as400"'|g' \ -e 's|@CONNECTOR_ETC@|'"/etc/centreon-as400/"'|g' \ From 351dd0c260af941b1e1c89e59602c9357ae1d244 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Tue, 3 Sep 2024 10:39:30 +0200 Subject: [PATCH 03/40] add as400 dirs and files --- as400/LICENSE | 202 +++++++++ as400/changelog | 5 + as400/connector.as400.install/.project | 11 + .../etc/config.properties | 39 ++ as400/connector.as400.install/etc/log4j2.xml | 29 ++ .../init-script/centreon-as400-sysconfig | 8 + .../init-script/centreon-as400.service | 29 ++ as400/connector.as400.install/install.sh | 243 +++++++++++ as400/connector.as400/.classpath | 55 +++ as400/connector.as400/.gitignore | 2 + as400/connector.as400/.project | 24 ++ .../org.eclipse.core.resources.prefs | 6 + .../.settings/org.eclipse.jdt.apt.core.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../.settings/org.eclipse.m2e.core.prefs | 5 + .../.settings/org.maven.ide.eclipse.prefs | 8 + .../org.sonar.ide.eclipse.core.prefs | 5 + .../.settings/org.sonar.ide.eclipse.prefs | 4 + as400/connector.as400/README.md | 25 ++ as400/connector.as400/pom.xml | 241 +++++++++++ .../com/centreon/connector/as400/Conf.java | 143 +++++++ .../connector/as400/ConnectorLogger.java | 151 +++++++ .../com/centreon/connector/as400/Main.java | 162 +++++++ .../centreon/connector/as400/WinService.java | 76 ++++ .../handler/ICachedMessageQueueHandler.java | 30 ++ .../as400/check/handler/ICommandHandler.java | 27 ++ .../as400/check/handler/IDiskHandler.java | 30 ++ .../as400/check/handler/IJobHandler.java | 30 ++ .../as400/check/handler/IJobQueueHandler.java | 34 ++ .../check/handler/IMessageQueueHandler.java | 33 ++ .../check/handler/ISubSystemHandler.java | 33 ++ .../as400/check/handler/ISystemHandler.java | 37 ++ .../check/handler/impl/AbstractHandler.java | 98 +++++ .../check/handler/impl/CommandHandler.java | 74 ++++ .../as400/check/handler/impl/DiskHandler.java | 93 ++++ .../handler/impl/FailedCheckException.java | 37 ++ .../as400/check/handler/impl/JobCache.java | 95 +++++ .../as400/check/handler/impl/JobHandler.java | 71 +++ .../check/handler/impl/JobQueueHandler.java | 87 ++++ .../check/handler/impl/SubSystemHandler.java | 101 +++++ .../check/handler/impl/SystemHandler.java | 221 ++++++++++ .../check/handler/impl/disk/DiskInfo.java | 108 +++++ .../handler/impl/disk/DiskManagement.java | 109 +++++ .../impl/disk/DiskManagementSession.java | 64 +++ .../impl/disk/QyaspolYasp0100PcmlHandler.java | 136 ++++++ .../impl/disk/QyaspolYasp0300PcmlHandler.java | 259 +++++++++++ .../check/handler/impl/disk/Yasp0100Data.java | 46 ++ .../check/handler/impl/disk/Yasp0300Data.java | 317 ++++++++++++++ .../check/handler/impl/jobqueue/Jobq0100.java | 153 +++++++ .../check/handler/impl/jobqueue/Jobq0200.java | 403 ++++++++++++++++++ .../impl/jobqueue/Qsprjobq100Handler.java | 91 ++++ .../impl/jobqueue/Qsprjobq200Handler.java | 144 +++++++ .../msgqueue/CachedMessageQueueHandler.java | 289 +++++++++++++ .../handler/msgqueue/MessageQueueHandler.java | 128 ++++++ .../check/handler/wrkprb/CheckAS400Lang.java | 142 ++++++ .../check/handler/wrkprb/ColorCodes.java | 109 +++++ .../wrkprb/WorkWithProblemHandler.java | 327 ++++++++++++++ .../connector/as400/client/IClient.java | 44 ++ .../as400/client/impl/AbstractClient.java | 116 +++++ .../as400/client/impl/NetworkClient.java | 82 ++++ .../connector/as400/daemon/Daemon.java | 140 ++++++ .../daemon/DelayedConnectionException.java | 37 ++ .../as400/daemon/MapIdentityManager.java | 110 +++++ .../as400/daemon/NewtworkRunnable.java | 68 +++ .../dispatcher/check/CheckDispatcher.java | 241 +++++++++++ .../check/CheckHandlerRunnable.java | 249 +++++++++++ .../as400/dispatcher/check/InputData.java | 61 +++ .../as400/dispatcher/check/ResponseData.java | 82 ++++ .../dispatcher/client/ClientDispatcher.java | 31 ++ .../client/impl/ClientDispatcherImpl.java | 88 ++++ .../as400/parser/InvalidOptionException.java | 39 ++ .../connector/as400/parser/OptionFactory.java | 112 +++++ .../connector/as400/utils/BlowFishUtils.java | 83 ++++ .../connector/as400/utils/HexUtils.java | 60 +++ .../connector/as400/utils/StringUtils.java | 125 ++++++ .../src/main/resources/API.txt | 4 + .../src/main/resources/qsprjobq100.pcml | 55 +++ .../src/main/resources/qsprjobq200.pcml | 153 +++++++ .../src/main/resources/qyaspol100.pcml | 78 ++++ .../src/main/resources/qyaspol300.pcml | 151 +++++++ .../com/centreon/connector/as400/IbmTest.java | 195 +++++++++ .../check/handler/impl/JobHandlerTest.java | 34 ++ .../check/handler/impl/SystemHandlerTest.java | 60 +++ .../CachedMessageQueueHandlerTest.java | 37 ++ .../check/handler/msgqueue/LocalDbTest.java | 61 +++ .../connector/as400/client/TestClient.java | 53 +++ .../check/TestCheckHandlerRunnable.java | 144 +++++++ .../src/test/resources/config.properties | 39 ++ .../src/test/resources/log4j2.xml | 17 + as400/doc/.project | 11 + .../en/exploitation/configurationCentreon.rst | 90 ++++ as400/doc/en/exploitation/index.rst | 14 + as400/doc/en/exploitation/indicator.rst | 32 ++ .../indicators/allJobHaveNoMsgW.rst | 59 +++ .../allJobHaveNoMsgWInSubSystem.rst | 61 +++ .../en/exploitation/indicators/asp1Usage.rst | 55 +++ .../indicators/backupJobExist.rst | 51 +++ .../en/exploitation/indicators/cpuUsage.rst | 56 +++ .../en/exploitation/indicators/diskState.rst | 51 +++ .../en/exploitation/indicators/diskUsage.rst | 57 +++ .../indicators/diskUsageRepartition.rst | 56 +++ .../indicators/executeCommand.rst | 62 +++ .../en/exploitation/indicators/jobExist.rst | 56 +++ .../exploitation/indicators/jobHasNoMsgw.rst | 56 +++ .../indicators/jobQueueStatus.rst | 55 +++ .../indicators/jobQueueWaitJobCount.rst | 60 +++ .../indicators/messageQueueSize.rst | 62 +++ .../indicators/messageQueueSizeFiltered.rst | 67 +++ .../indicators/newMessageInMessageQueue.rst | 74 ++++ .../en/exploitation/indicators/pageFault.rst | 57 +++ .../indicators/specificJobInSubSystem.rst | 82 ++++ .../specificJobRunningInSubSystem.rst | 68 +++ .../indicators/subSystemExist.rst | 55 +++ .../indicators/workWithProblem.rst | 50 +++ as400/doc/en/exploitation/mode.rst | 69 +++ as400/doc/en/installation/prerequisites.rst | 64 +++ as400/doc/en/installation/rpm.rst | 21 + as400/doc/en/installation/tarball.rst | 41 ++ as400/doc/en/upgrade/rpm.rst | 20 + .../fr/exploitation/configurationCentreon.rst | 94 ++++ as400/doc/fr/exploitation/index.rst | 14 + as400/doc/fr/exploitation/indicator.rst | 32 ++ .../indicators/allJobHaveNoMsgW.rst | 59 +++ .../allJobHaveNoMsgWInSubSystem.rst | 61 +++ .../fr/exploitation/indicators/asp1Usage.rst | 55 +++ .../indicators/backupJobExist.rst | 53 +++ .../fr/exploitation/indicators/cpuUsage.rst | 55 +++ .../fr/exploitation/indicators/diskState.rst | 51 +++ .../fr/exploitation/indicators/diskUsage.rst | 57 +++ .../indicators/diskUsageRepartition.rst | 56 +++ .../indicators/executeCommand.rst | 62 +++ .../fr/exploitation/indicators/jobExist.rst | 56 +++ .../exploitation/indicators/jobHasNoMsgw.rst | 56 +++ .../indicators/jobQueueStatus.rst | 55 +++ .../indicators/jobQueueWaitJobCount.rst | 60 +++ .../indicators/messageQueueSize.rst | 62 +++ .../indicators/messageQueueSizeFiltered.rst | 67 +++ .../indicators/newMessageInMessageQueue.rst | 74 ++++ .../fr/exploitation/indicators/pageFault.rst | 57 +++ .../indicators/specificJobInSubSystem.rst | 83 ++++ .../specificJobRunningInSubSystem.rst | 68 +++ .../indicators/subSystemExist.rst | 55 +++ .../indicators/workWithProblem.rst | 50 +++ as400/doc/fr/exploitation/mode.rst | 69 +++ as400/doc/fr/installation/prerequisites.rst | 67 +++ as400/doc/fr/installation/rpm.rst | 21 + as400/doc/fr/installation/tarball.rst | 41 ++ as400/doc/fr/upgrade/rpm.rst | 20 + 148 files changed, 11509 insertions(+) create mode 100644 as400/LICENSE create mode 100644 as400/changelog create mode 100644 as400/connector.as400.install/.project create mode 100644 as400/connector.as400.install/etc/config.properties create mode 100644 as400/connector.as400.install/etc/log4j2.xml create mode 100644 as400/connector.as400.install/init-script/centreon-as400-sysconfig create mode 100644 as400/connector.as400.install/init-script/centreon-as400.service create mode 100755 as400/connector.as400.install/install.sh create mode 100644 as400/connector.as400/.classpath create mode 100644 as400/connector.as400/.gitignore create mode 100644 as400/connector.as400/.project create mode 100644 as400/connector.as400/.settings/org.eclipse.core.resources.prefs create mode 100644 as400/connector.as400/.settings/org.eclipse.jdt.apt.core.prefs create mode 100644 as400/connector.as400/.settings/org.eclipse.jdt.core.prefs create mode 100644 as400/connector.as400/.settings/org.eclipse.m2e.core.prefs create mode 100644 as400/connector.as400/.settings/org.maven.ide.eclipse.prefs create mode 100644 as400/connector.as400/.settings/org.sonar.ide.eclipse.core.prefs create mode 100644 as400/connector.as400/.settings/org.sonar.ide.eclipse.prefs create mode 100644 as400/connector.as400/README.md create mode 100644 as400/connector.as400/pom.xml create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/Conf.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/ConnectorLogger.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/Main.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/WinService.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICachedMessageQueueHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICommandHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IDiskHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobQueueHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IMessageQueueHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISubSystemHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISystemHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/AbstractHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/CommandHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/DiskHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/FailedCheckException.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobCache.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobQueueHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SubSystemHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SystemHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskInfo.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagement.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagementSession.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0100PcmlHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0300PcmlHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0100Data.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0300Data.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0100.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0200.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq100Handler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq200Handler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/MessageQueueHandler.java create mode 100755 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/CheckAS400Lang.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/ColorCodes.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/WorkWithProblemHandler.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/client/IClient.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/AbstractClient.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/NetworkClient.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/Daemon.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/DelayedConnectionException.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/MapIdentityManager.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/NewtworkRunnable.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckDispatcher.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckHandlerRunnable.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/InputData.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/ResponseData.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/ClientDispatcher.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/impl/ClientDispatcherImpl.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/InvalidOptionException.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/OptionFactory.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/BlowFishUtils.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/HexUtils.java create mode 100644 as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/StringUtils.java create mode 100644 as400/connector.as400/src/main/resources/API.txt create mode 100644 as400/connector.as400/src/main/resources/qsprjobq100.pcml create mode 100644 as400/connector.as400/src/main/resources/qsprjobq200.pcml create mode 100644 as400/connector.as400/src/main/resources/qyaspol100.pcml create mode 100644 as400/connector.as400/src/main/resources/qyaspol300.pcml create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/IbmTest.java create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/JobHandlerTest.java create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/SystemHandlerTest.java create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandlerTest.java create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/LocalDbTest.java create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/client/TestClient.java create mode 100644 as400/connector.as400/src/test/java/com/centreon/connector/as400/dispatcher/check/TestCheckHandlerRunnable.java create mode 100644 as400/connector.as400/src/test/resources/config.properties create mode 100644 as400/connector.as400/src/test/resources/log4j2.xml create mode 100644 as400/doc/.project create mode 100644 as400/doc/en/exploitation/configurationCentreon.rst create mode 100644 as400/doc/en/exploitation/index.rst create mode 100644 as400/doc/en/exploitation/indicator.rst create mode 100644 as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst create mode 100644 as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst create mode 100644 as400/doc/en/exploitation/indicators/asp1Usage.rst create mode 100644 as400/doc/en/exploitation/indicators/backupJobExist.rst create mode 100644 as400/doc/en/exploitation/indicators/cpuUsage.rst create mode 100644 as400/doc/en/exploitation/indicators/diskState.rst create mode 100644 as400/doc/en/exploitation/indicators/diskUsage.rst create mode 100644 as400/doc/en/exploitation/indicators/diskUsageRepartition.rst create mode 100644 as400/doc/en/exploitation/indicators/executeCommand.rst create mode 100644 as400/doc/en/exploitation/indicators/jobExist.rst create mode 100644 as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst create mode 100644 as400/doc/en/exploitation/indicators/jobQueueStatus.rst create mode 100644 as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst create mode 100644 as400/doc/en/exploitation/indicators/messageQueueSize.rst create mode 100644 as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst create mode 100644 as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst create mode 100644 as400/doc/en/exploitation/indicators/pageFault.rst create mode 100644 as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst create mode 100644 as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst create mode 100644 as400/doc/en/exploitation/indicators/subSystemExist.rst create mode 100644 as400/doc/en/exploitation/indicators/workWithProblem.rst create mode 100644 as400/doc/en/exploitation/mode.rst create mode 100644 as400/doc/en/installation/prerequisites.rst create mode 100644 as400/doc/en/installation/rpm.rst create mode 100644 as400/doc/en/installation/tarball.rst create mode 100644 as400/doc/en/upgrade/rpm.rst create mode 100644 as400/doc/fr/exploitation/configurationCentreon.rst create mode 100644 as400/doc/fr/exploitation/index.rst create mode 100644 as400/doc/fr/exploitation/indicator.rst create mode 100644 as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst create mode 100644 as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst create mode 100644 as400/doc/fr/exploitation/indicators/asp1Usage.rst create mode 100644 as400/doc/fr/exploitation/indicators/backupJobExist.rst create mode 100644 as400/doc/fr/exploitation/indicators/cpuUsage.rst create mode 100644 as400/doc/fr/exploitation/indicators/diskState.rst create mode 100644 as400/doc/fr/exploitation/indicators/diskUsage.rst create mode 100644 as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst create mode 100644 as400/doc/fr/exploitation/indicators/executeCommand.rst create mode 100644 as400/doc/fr/exploitation/indicators/jobExist.rst create mode 100644 as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst create mode 100644 as400/doc/fr/exploitation/indicators/jobQueueStatus.rst create mode 100644 as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst create mode 100644 as400/doc/fr/exploitation/indicators/messageQueueSize.rst create mode 100644 as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst create mode 100644 as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst create mode 100644 as400/doc/fr/exploitation/indicators/pageFault.rst create mode 100644 as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst create mode 100644 as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst create mode 100644 as400/doc/fr/exploitation/indicators/subSystemExist.rst create mode 100644 as400/doc/fr/exploitation/indicators/workWithProblem.rst create mode 100644 as400/doc/fr/exploitation/mode.rst create mode 100644 as400/doc/fr/installation/prerequisites.rst create mode 100644 as400/doc/fr/installation/rpm.rst create mode 100644 as400/doc/fr/installation/tarball.rst create mode 100644 as400/doc/fr/upgrade/rpm.rst diff --git a/as400/LICENSE b/as400/LICENSE new file mode 100644 index 0000000000..57bc88a15a --- /dev/null +++ b/as400/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/as400/changelog b/as400/changelog new file mode 100644 index 0000000000..2a8a24566c --- /dev/null +++ b/as400/changelog @@ -0,0 +1,5 @@ +2021-12-31 Quentin Garnier - 2.0.1 + * Use log4j 2.17.1 + +2021-10-13 Quentin Garnier - 2.0.0 + * New release diff --git a/as400/connector.as400.install/.project b/as400/connector.as400.install/.project new file mode 100644 index 0000000000..afe70dda0c --- /dev/null +++ b/as400/connector.as400.install/.project @@ -0,0 +1,11 @@ + + + as400.install + + + + + + + + diff --git a/as400/connector.as400.install/etc/config.properties b/as400/connector.as400.install/etc/config.properties new file mode 100644 index 0000000000..ba780d0326 --- /dev/null +++ b/as400/connector.as400.install/etc/config.properties @@ -0,0 +1,39 @@ +daemonListenerHost=localhost + +#as400 login timeout for nagios check (ms) +as400LoginTimeout=10000 + +#as400 read timeout for nagios check (ms) +as400ReadTimeout=300000 + +#Time before cleaning an unused as400 resource (ms) +as400ResourceDuration=7200000 + +#time before killing a dead as400 connection (s) +as400SoLinger=1 + +#Duration of the job & (ms) +cacheTimeout=60000 + +daemonNoRequestTimeout=5000 + +daemonRequestParseTimeout=5000 + +#time before killing a dead as400 connection (s) +daemonSoLinger=1 + +#Time before discaring a check in queue (ms) +workerQueueTimeout=360000 + +# active debug +debug=false + +# active exception +exception=false + +# active trace (in /tmp/trace.log) +trace=false + +# MessageQueueDB Base path +pathMsgQDB=/tmp/ + diff --git a/as400/connector.as400.install/etc/log4j2.xml b/as400/connector.as400.install/etc/log4j2.xml new file mode 100644 index 0000000000..4da5ff7cf3 --- /dev/null +++ b/as400/connector.as400.install/etc/log4j2.xml @@ -0,0 +1,29 @@ + + + + + + + + + + ${sys:CONNECTOR_LOG}/connector.log + ${sys:CONNECTOR_LOG}/connector.%d{yyyy-MM-dd}.log + + [%-20d{dd/MM/yyyy HH:mm:ss}] [%-6p] %m %n + + + + + + + + + + + + + + + + diff --git a/as400/connector.as400.install/init-script/centreon-as400-sysconfig b/as400/connector.as400.install/init-script/centreon-as400-sysconfig new file mode 100644 index 0000000000..1c52ce76e1 --- /dev/null +++ b/as400/connector.as400.install/init-script/centreon-as400-sysconfig @@ -0,0 +1,8 @@ +# centreon-as400 command line options +JAVA_OPTS="-Xms128M -Xmx2G -XX:MaxPermSize=128m" +CONNECTOR_OPTS="--port 8091" +CONNECTOR_HOME=@CONNECTOR_HOME@ +CONNECTOR_ETC=@CONNECTOR_ETC@ +CONNECTOR_LOG=@CONNECTOR_LOG@ +CONNECTOR_TMP=/tmp/ +CONNECTOR_BIN=@CONNECTOR_HOME@/bin/centreon-as400-@CONNECTOR_VERSION@-jar-with-dependencies.jar diff --git a/as400/connector.as400.install/init-script/centreon-as400.service b/as400/connector.as400.install/init-script/centreon-as400.service new file mode 100644 index 0000000000..5120752a4e --- /dev/null +++ b/as400/connector.as400.install/init-script/centreon-as400.service @@ -0,0 +1,29 @@ +## +## Copyright 2019-2021 Centreon +## +## 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. +## +## For more information : contact@centreon.com +## + +[Unit] +Description=Centreon AS400 + +[Service] +EnvironmentFile=/etc/sysconfig/centreon-as400 +ExecStart=@JAVA_BIN@ $JAVA_OPTS -DCONNECTOR_HOME=${CONNECTOR_HOME} -DCONNECTOR_ETC=${CONNECTOR_ETC} -DCONNECTOR_LOG=${CONNECTOR_LOG} -DCONNECTOR_TMP=${CONNECTOR_TMP} -jar $CONNECTOR_BIN $CONNECTOR_OPTS +Type=simple +User=centreon-as400 + +[Install] +WantedBy=multi-user.target diff --git a/as400/connector.as400.install/install.sh b/as400/connector.as400.install/install.sh new file mode 100755 index 0000000000..69d9a33a44 --- /dev/null +++ b/as400/connector.as400.install/install.sh @@ -0,0 +1,243 @@ +#!/bin/bash + +################################################# +##Functions and vars for actions results printing +################################################# + +RES_COL=80 +MOVE_TO_COL="echo -en \\033[${RES_COL}G" +SETCOLOR_INFO="echo -en \\033[1;38m" +SETCOLOR_SUCCESS="echo -en \\033[1;32m" +SETCOLOR_FAILURE="echo -en \\033[1;31m" +SETCOLOR_NORMAL="echo -en \\033[0;39m" +SETCOLOR_WARNING="echo -en \\033[1;33m" + +function echo_success() { + echo -n "$1" + $MOVE_TO_COL + $SETCOLOR_SUCCESS + echo -n "$2" + $SETCOLOR_NORMAL + echo -e "\r" + echo "" +} + +function echo_failure() { + echo -n "$1" + $MOVE_TO_COL + $SETCOLOR_FAILURE + echo -n "$2" + $SETCOLOR_NORMAL + echo -e "\r" + echo "" +} + +function echo_passed() { + echo -n "$1" + $MOVE_TO_COL + $SETCOLOR_WARNING + echo -n "$2" + $SETCOLOR_NORMAL + echo -e "\r" + echo "" +} + +################## +##Static variables +################## + +INIT_FOLDER="init-script/" +INIT_FILE="centreon-as400.service" +SYSCONFIG_FILE="centreon-as400-sysconfig" + +CONNECTOR_VERSION=2.0.0 +CONNECTOR_HOME="/usr/share/centreon-as400/" +CONNECTOR_LOG="/var/log/centreon-as400/" +CONNECTOR_ETC="/etc/centreon-as400/" +LOG_ETC_FILE="log4j.xml" + +CONNECTOR_USER="centreon-as400" +CONNECTOR_GROUP="centreon-as400" + +JAVA_BIN="" + +ETC_PASSWD="/etc/passwd" +ETC_GROUP="/etc/group" +ETC_INITD="/etc/systemd/system/" +ETC_SYSCONFIG="/etc/sysconfig/" + +###### +##INIT +###### + +$SETCOLOR_WARNING +echo "Starting setup..." +$SETCOLOR_NORMAL +echo "" + +############################## +##Getting modules install path +############################## +DONE="no" +CREATE_HOME="no" +temp_folder="$CONNECTOR_HOME" +while [ "$DONE" = "no" ]; do + echo "Centreon AS400 home Directory [$CONNECTOR_HOME]? " + echo -n ">" + read temp_folder + if [ -z "$temp_folder" ]; then + temp_folder="$CONNECTOR_HOME" + fi + temp_folder=`echo "$temp_folder" | sed "s/$/\//"` + + if [ -d "$temp_folder" ]; then + DONE="yes" + else + echo_failure "$temp does not exists" "CRITICAL" + echo "Specified path does not exists, do you want to create it ?[Y/n]" + echo -n ">" + read temp + if [ -z "$temp" ]; then + temp="Y" + fi + while [ "$temp" != "Y" ] && [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ "$temp" != "N" ]; do + echo "Specified path does not exists, do you want to create it ?[Y/n]" + echo -n ">" + read temp + if [ -z "$temp" ]; then + temp="Y" + fi + done + if [ "$temp" = "Y" ] || [ "$temp" = "y" ]; then + DONE="yes" + CREATE_HOME="yes" + fi + fi +done +temp_folder=$(echo $temp_folder | sed "s/\/\/$/\//") +CONNECTOR_HOME=${temp_folder} +echo_success "Centreon AS400 home directory" "$CONNECTOR_HOME" + +############################# +##Getting java home directory +############################# + +JAVA_HOME="/usr/" +temp=$JAVA_HOME +while [ ! -x "$temp/bin/java" ]; do + echo_failure "Cannot find java binary" "FAILURE" + echo "Java home directory?" + echo -n ">" + read temp + if [ -z "$temp" ]; then + temp="$JAVA_HOME" + fi +done +temp=`echo "$temp" | sed "s/$/\//"` +JAVA_BIN=`echo $temp | sed "s/\/\/$/\//"`"bin/java" +echo_success "Java bin path :" "$JAVA_BIN" + +################### +# CONNECTOR INIT SCRIPT +################### + +echo "Do you want to install AS400 systemd script [y/N]?" +echo -n ">" +read response +if [ -z "$response" ]; then + response="N" +fi +while [ "$response" != "Y" ] && [ "$response" != "y" ] && [ "$response" != "N" ] && [ "$response" != "n" ]; do + echo "Do you want to install AS400 systemd script [y/N]?" + echo -n ">" + read response + if [ -z "$response" ]; then + response="N" + fi +done +INSTALL_CONNECTOR_INIT=$response +echo_success "CONNECTOR systemd script :" "$ETC_INITD/$INIT_FILE" + +######################## +## Centreon BI user and Group +######################## +exists=`cat $ETC_PASSWD | grep "^$CONNECTOR_USER:"` +if [ -z "$exists" ]; then + useradd -m $CONNECTOR_USER -d $CONNECTOR_HOME +fi +echo_success "CONNECTOR run user :" "$CONNECTOR_USER" + +exists=`cat $ETC_GROUP | grep "^$CONNECTOR_GROUP:"` +if [ -z "$exists" ]; then + groupadd $CONNECTOR_GROUP +fi +echo_success "CONNECTOR run group :" "$CONNECTOR_GROUP" + +####################### +# DEPLOYING CENTREON BI +####################### +echo "" +echo_success "Creating directories and moving binaries..." "OK" +if [ ! -d "${CONNECTOR_HOME}" ]; then + mkdir -p $CONNECTOR_HOME +fi +if [ ! -d "${CONNECTOR_HOME}/bin" ]; then + mkdir ${CONNECTOR_HOME}/bin +fi + +if [ -d bin/ ] ; then + cp -f bin/*.jar ${CONNECTOR_HOME}/bin/ +fi + +if [ ! -d "${CONNECTOR_LOG}" ]; then + mkdir -p ${CONNECTOR_LOG} +fi +if [ ! -d "${CONNECTOR_ETC}" ]; then + mkdir -p ${CONNECTOR_ETC} +fi + +cp etc/log4j.xml ${CONNECTOR_ETC} +cp etc/config.properties ${CONNECTOR_ETC} + +################### +##Macro replacement +################### + +ETC_FILE=${CONNECTOR_ETC}${CONNECTOR_ETC_FILE} + +if [ "$INSTALL_CONNECTOR_INIT" = "y" ] || [ "$INSTALL_CONNECTOR_INIT" = "Y" ]; then + echo_success "Copying CONNECTOR init script..." "OK" + sed -e 's|@JAVA_BIN@|'"$JAVA_BIN"'|g' \ + $INIT_FOLDER/$INIT_FILE > $ETC_INITD/$INIT_FILE + chmod 644 $ETC_INITD/$INIT_FILE + sed -e 's|@CONNECTOR_HOME@|'"$CONNECTOR_HOME"'|g' \ + -e 's|@JAVA_BIN@|'"$JAVA_BIN"'|g' \ + -e 's|@CONNECTOR_USER@|'"$CONNECTOR_USER"'|g' \ + -e 's|@CONNECTOR_ETC@|'"${CONNECTOR_ETC}"'|g' \ + -e 's|@CONNECTOR_LOG@|'"${CONNECTOR_LOG}"'|g' \ + -e 's|@CONNECTOR_VERSION@|'"${CONNECTOR_VERSION}"'|g' \ + $INIT_FOLDER/$SYSCONFIG_FILE > $ETC_SYSCONFIG/centreon-as400 +fi +echo_success "Deploying Centreon-AS400..." "OK" + +################################################### +##Rights settings on install directory and binaries +################################################### + +chown -R $CONNECTOR_USER.$CONNECTOR_GROUP $CONNECTOR_HOME +chown -R $CONNECTOR_USER.$CONNECTOR_GROUP $CONNECTOR_LOG +chown -R $CONNECTOR_USER.$CONNECTOR_GROUP $CONNECTOR_ETC +chmod -R 775 $CONNECTOR_HOME + +echo_success "Rights settings..." "OK" + +systemctl enable $INIT_FILE + +######### +# THE END +######### + +echo "" +$SETCOLOR_WARNING +echo "Setup finished." +echo "" diff --git a/as400/connector.as400/.classpath b/as400/connector.as400/.classpath new file mode 100644 index 0000000000..c8c0ea78ba --- /dev/null +++ b/as400/connector.as400/.classpath @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/as400/connector.as400/.gitignore b/as400/connector.as400/.gitignore new file mode 100644 index 0000000000..bef4516e36 --- /dev/null +++ b/as400/connector.as400/.gitignore @@ -0,0 +1,2 @@ +.vscode +/target diff --git a/as400/connector.as400/.project b/as400/connector.as400/.project new file mode 100644 index 0000000000..bcb00691f5 --- /dev/null +++ b/as400/connector.as400/.project @@ -0,0 +1,24 @@ + + + as400 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.sonar.ide.eclipse.core.sonarNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/as400/connector.as400/.settings/org.eclipse.core.resources.prefs b/as400/connector.as400/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..29abf99956 --- /dev/null +++ b/as400/connector.as400/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/as400/connector.as400/.settings/org.eclipse.jdt.apt.core.prefs b/as400/connector.as400/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000000..d4313d4b25 --- /dev/null +++ b/as400/connector.as400/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/as400/connector.as400/.settings/org.eclipse.jdt.core.prefs b/as400/connector.as400/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..cf4d3d8103 --- /dev/null +++ b/as400/connector.as400/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/as400/connector.as400/.settings/org.eclipse.m2e.core.prefs b/as400/connector.as400/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000..433ad2d622 --- /dev/null +++ b/as400/connector.as400/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Tue Nov 08 15:01:53 CET 2011 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/as400/connector.as400/.settings/org.maven.ide.eclipse.prefs b/as400/connector.as400/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 0000000000..a5940f4c09 --- /dev/null +++ b/as400/connector.as400/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Tue Nov 08 15:01:08 CET 2011 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/as400/connector.as400/.settings/org.sonar.ide.eclipse.core.prefs b/as400/connector.as400/.settings/org.sonar.ide.eclipse.core.prefs new file mode 100644 index 0000000000..48cc7b6be0 --- /dev/null +++ b/as400/connector.as400/.settings/org.sonar.ide.eclipse.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +extraProperties=sonar.java.coveragePlugin\=jacoco\r\nsonar.language\=java\r\nsonar.jacoco.itReportPath\=/home/jblamotte/git/centreon-connector-as400/connector.as400/../target/jacoco-it.exec\r\nsonar.dynamicAnalysis\=reuseReports +projectKey=com.centreon.connector\:connector-as400 +serverUrl=http\://localhost\:9000 +version=2 diff --git a/as400/connector.as400/.settings/org.sonar.ide.eclipse.prefs b/as400/connector.as400/.settings/org.sonar.ide.eclipse.prefs new file mode 100644 index 0000000000..0ddbd32511 --- /dev/null +++ b/as400/connector.as400/.settings/org.sonar.ide.eclipse.prefs @@ -0,0 +1,4 @@ +#Thu Sep 22 10:02:29 CEST 2011 +eclipse.preferences.version=1 +projectArtifactId=connector-as400 +projectGroupId=com.centreon.connector diff --git a/as400/connector.as400/README.md b/as400/connector.as400/README.md new file mode 100644 index 0000000000..8f5504e7c0 --- /dev/null +++ b/as400/connector.as400/README.md @@ -0,0 +1,25 @@ +# Tools + +## Launch test + +### Build + + mvn clean package + +### Execute + + java \ + -DCONNECTOR_ETC=target/test-classes/ \ + -DCONNECTOR_HOME=target/test-classes/ \ + -DCONNECTOR_LOG=target/test-classes/ \ + -DCONNECTOR_TMP=target/test-classes/ \ + -jar target/centreon-as400-2.0.0-jar-with-dependencies.jar \ + --port 8091 + +### Test + + curl -X POST -d '{"host": "test-as400", "login": "myuser", "password": "mypass", "command": "test" }' http://127.0.0.1:8091 + +## References + +[IBM knowledge center example](https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/rzahh/pcsystemstatexample.htm) diff --git a/as400/connector.as400/pom.xml b/as400/connector.as400/pom.xml new file mode 100644 index 0000000000..2d17ce2193 --- /dev/null +++ b/as400/connector.as400/pom.xml @@ -0,0 +1,241 @@ + + 4.0.0 + com.centreon.connector + centreon-as400 + 2.0.2 + Centreon-AS/400 + Connecteur AS/400 + jar + + + UTF-8 + 4.0.5.RELEASE + 1.6 + 2.17.1 + + jacoco + reuseReports + ${project.basedir}/../target/jacoco-it.exec + java + + + + + qgarnier + Quentin GARNIER + qgarnier@centreon.com + Centreon + + + jblamotte + Jean-Baptiste LAMOTTE + Centreon + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2.1 + + + jar-with-dependencies + + + + + + com.centreon.connector.as400.Main + true + + + + + + package + + single + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + + org.fusesource.mvnplugins + maven-graph-plugin + 1.35 + + + + org.jacoco + jacoco-maven-plugin + + + + + + + + + pre-test + + prepare-agent + + + + post-test + test + + report + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jacoco + + jacoco-maven-plugin + + + [0.8.2,) + + + prepare-agent + + + + + + + + + + + + + + + + + commons-cli + commons-cli + 1.4 + jar + compile + + + org.apache.commons + commons-exec + 1.3 + jar + compile + + + net.sf.jt400 + jt400 + 10.7 + jar + + + + io.undertow + undertow-core + 2.2.11.Final + + + com.google.code.gson + gson + 2.8.9 + + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + + junit + junit + 4.13.1 + test + + + + org.mockito + mockito-all + 1.9.5 + test + + + + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.7 + + false + + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.6 + + + html + xml + + + + + + + diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/Conf.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/Conf.java new file mode 100644 index 0000000000..5efea5781f --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/Conf.java @@ -0,0 +1,143 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * @author Lamotte Jean-Baptiste + */ +public class Conf { + + public static void loadConfiguration(final InputStream in) throws IOException { + final Properties properties = new Properties(); + properties.load(in); + + String param; + + Conf.debug = Boolean.parseBoolean("" + properties.get("debug")); + Conf.exception = Boolean.parseBoolean("" + properties.get("exception")); + Conf.trace = Boolean.parseBoolean("" + properties.get("trace")); + + param = (String)properties.get("daemonListenerHost"); + if (param != null) { + Conf.daemonListenerHost = param; + } + + param = (String)properties.get("daemonNoRequestTimeout"); + if (param != null) { + Conf.daemonNoRequestTimeout = Integer.parseInt(param); + } + param = (String)properties.get("daemonRequestParseTimeout"); + if (param != null) { + Conf.daemonRequestParseTimeout = Integer.parseInt(param); + } + + Conf.authUsername = (String)properties.get("authUsername"); + Conf.authPassword = (String)properties.get("authPassword"); + + param = (String)properties.get("keyStoreType"); + if (param != null) { + Conf.keyStoreType = param; + } + Conf.keyStoreFile = (String)properties.get("keyStoreFile"); + Conf.keyStorePassword = (String)properties.get("keyStorePassword"); + + param = (String)properties.get("sslProtocol"); + if (param != null) { + Conf.sslProtocol = param; + } + + Conf.daemonSoLinger = Integer.parseInt("" + properties.get("daemonSoLinger")); + Conf.as400SoLinger = Integer.parseInt("" + properties.get("as400SoLinger")); + Conf.as400ReadTimeout = Integer.parseInt("" + properties.get("as400ReadTimeout")); + Conf.as400LoginTimeout = Integer.parseInt("" + properties.get("as400LoginTimeout")); + Conf.as400ResourceDuration = Integer.parseInt("" + properties.get("as400ResourceDuration")); + Conf.workerQueueTimeout = Integer.parseInt("" + properties.get("workerQueueTimeout")); + Conf.cacheTimeout = Integer.parseInt("" + properties.get("cacheTimeout")); + Conf.msgqDbPath = "" + properties.get("pathMsgQDB"); + } + + public static boolean debug = true; + static boolean exception = true; + static boolean trace = true; + + public static String msgqDbPath = "/tmp/"; + + public static String daemonListenerHost = "localhost"; + + public static int daemonNoRequestTimeout = 5000; + + public static int daemonRequestParseTimeout = 5000; + + public static String authUsername = null; + + public static String authPassword = null; + + public static String keyStoreType = "PKCS12"; + + public static String keyStoreFile = null; + + public static String keyStorePassword = null; + + public static String sslProtocol = "TLS"; + + /** + * Delai avant fermeture force d'une connexion mal ferme par les plugins de + * check (en mode daemon) unite en seconde + */ + public static int daemonSoLinger = 1; + + /** + * Delai avant fermeture force d'une connexion mal ferme par l'AS/400 unite en + * seconde + */ + public static int as400SoLinger = 1; + + /** + * Timeout lors de la reception d'une reponse de l'AS400 unite en milliseconde + */ + public static int as400ReadTimeout = 5 * 60 * 1000; + + /** + * Timeout lors de la connexion a un as/400 unite en milliseconde + */ + public static int as400LoginTimeout = 10 * 1000; + + /** + * Delai avant de supprimer une connection inactive a un as/400 unite en + * millisecondes + */ + public static long as400ResourceDuration = 120 * 60 * 1000; + + /** + * duree maximale d'attente d'un check dans une queue unite en millisecondes + */ + public static long workerQueueTimeout = 6 * 60 * 1000; + + /** + * cache duration for disk and job (time before next refresh) duration in + * milliseconds + */ + public static long cacheTimeout = 60 * 1000; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/ConnectorLogger.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/ConnectorLogger.java new file mode 100644 index 0000000000..80b290e327 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/ConnectorLogger.java @@ -0,0 +1,151 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400; + +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; +import java.io.File; + +/** + * @author Lamotte Jean-Baptiste + */ +public class ConnectorLogger { + + private static ConnectorLogger instance = null; + + public synchronized static final ConnectorLogger getInstance() { + if (ConnectorLogger.instance == null) { + ConnectorLogger.instance = new ConnectorLogger(Main.getEtcDir()); + } + return ConnectorLogger.instance; + } + + private Logger logger = null; + + private ConnectorLogger(String etcDir) { + if ((etcDir != null) && (etcDir.length() > 0)) { + LoggerContext context = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false); + File file = new File(etcDir + "log4j2.xml"); + context.setConfigLocation(file.toURI()); + } else { + // DOMConfigurator.configure("log4j.xml"); + } + this.logger = LogManager.getRootLogger(); + } + + public synchronized void debug(final String log) { + this.logger.debug(log); + } + + public synchronized void trace(final String log, final Throwable t) { + this.logger.trace(log, t); + } + + public synchronized void trace(final String log) { + this.logger.trace(log); + } + + public synchronized void debug(final String log, final Throwable t) { + if (Conf.exception) { + this.logger.debug(log, t); + } else { + this.logger.debug(log); + this.logger.debug(" --> Message: " + t.getMessage()); + Throwable cause = null; + if ((cause = t.getCause()) != null) { + this.logger.debug(" --> Cause: " + cause.getMessage()); + } + } + } + + public synchronized void error(final String log) { + this.logger.error(log); + } + + public void error(final String log, final Throwable t) { + if (Conf.exception) { + this.logger.error(log, t); + } else { + this.logger.error(log); + this.logger.error(" --> Message: " + t.getMessage()); + Throwable cause = null; + if ((cause = t.getCause()) != null) { + this.logger.error(" --> Cause: " + cause.getMessage()); + } + } + } + + public synchronized void fatal(final String log) { + this.logger.fatal(log); + } + + public synchronized void fatal(final String log, final Throwable t) { + if (Conf.exception) { + this.logger.fatal(log, t); + } else { + this.logger.fatal(log); + this.logger.fatal(" --> Message: " + t.getMessage()); + Throwable cause = null; + if ((cause = t.getCause()) != null) { + this.logger.fatal(" --> Cause: " + cause.getMessage()); + } + } + } + + public synchronized Logger getLogger() { + return this.logger; + } + + public synchronized void info(final String log) { + this.logger.info(log); + } + + public synchronized void info(final String log, final Throwable t) { + if (Conf.exception) { + this.logger.info(log, t); + } else { + this.logger.info(log); + this.logger.info(" --> Message: " + t.getMessage()); + Throwable cause = null; + if ((cause = t.getCause()) != null) { + this.logger.info(" --> Cause: " + cause.getMessage()); + } + } + } + + public synchronized void warn(final String log) { + this.logger.warn(log); + } + + public synchronized void warn(final String log, final Throwable t) { + if (Conf.exception) { + this.logger.warn(log, t); + } else { + this.logger.warn(log); + this.logger.warn(" --> Message: " + t.getMessage()); + Throwable cause = null; + if ((cause = t.getCause()) != null) { + this.logger.warn(" --> Cause: " + cause.getMessage()); + } + } + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/Main.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/Main.java new file mode 100644 index 0000000000..c11b25dc3a --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/Main.java @@ -0,0 +1,162 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.PosixParser; + +import com.ibm.as400.access.Trace; +import com.centreon.connector.as400.daemon.Daemon; +import com.centreon.connector.as400.dispatcher.client.impl.ClientDispatcherImpl; +import com.centreon.connector.as400.parser.OptionFactory; + +/** + * @author Lamotte Jean-Baptiste + */ +class Main { + static public final String CONNECTOR_LOG = "CONNECTOR_LOG"; + static public final String CONNECTOR_ETC = "CONNECTOR_ETC"; + + static private String etcDir; + + static public String getEtcDir() { + return etcDir; + } + + private static void checkProperties() { + etcDir = System.getProperty(Main.CONNECTOR_ETC, "/etc/centreon-as400/"); + String logDir = System.getProperty(Main.CONNECTOR_LOG, "/var/log/centreon-as400/"); + + try { + final File file = new File(etcDir + "log4j2.xml"); + if (!file.exists()) { + ConnectorLogger.getInstance().fatal(etcDir + "log4j2.xml doesnt exist. Engine stopped"); + System.exit(0); + } + + ConnectorLogger.getInstance().info("[Logs] Logs configuration file : " + file.getAbsolutePath()); + + } catch (final Exception e) { + ConnectorLogger.getInstance().fatal("", e); + } + + System.setErr(System.out); + + try { + ConnectorLogger.getInstance().info("[Config] Configuration file : " + etcDir + "config.properties"); + Conf.loadConfiguration(new FileInputStream(etcDir + "config.properties")); + } catch (final IOException e) { + ConnectorLogger.getInstance().fatal("", e); + System.exit(0); + } + + if (Conf.trace == true) { + try { + final String traceLog = logDir + "/trace.log"; + ConnectorLogger.getInstance().debug("Advanced trace log file : " + traceLog); + + Trace.setFileName(traceLog); + Trace.setTraceAllOn(false); + Trace.setTraceOn(true); + Trace.setTraceErrorOn(true); + Trace.setTraceWarningOn(true); + Trace.setTraceInformationOn(true); + + } catch (final Exception e) { + ConnectorLogger.getInstance().debug("", e); + } + } + } + + private static void daemon(final CommandLine cmd) { + try { + int port = 8091; + + if (cmd.hasOption("port")) { + port = Integer.parseInt(cmd.getOptionValue("port")); + } + final Daemon core = new Daemon(); + core.start(port); + } catch (IOException ioe) { + System.out.println("Couldn't start server: " + ioe); + } catch (InterruptedException ie) { + System.out.println("Interrupted exception: " + ie); + } catch (final Exception e) { + ConnectorLogger.getInstance().fatal("Couldn't start server", e); + } finally { + System.exit(0); + } + } + + /** + * Gets the help. + * + * @return the help + */ + + private static String getHelp() { + final HelpFormatter formatter = new HelpFormatter(); + String exemple = "--port \n"; + exemple += "\n"; + + formatter.printHelp(" ", exemple, OptionFactory.getOptions(), ""); + + return ""; + } + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(final String[] args) { + + Runtime.getRuntime().addShutdownHook(new Thread() { + + @Override + public void run() { + ConnectorLogger.getInstance().info("Shutdown Centreon-Connector"); + super.run(); + } + + }); + + Main.checkProperties(); + + try { + + final CommandLineParser parser = new PosixParser(); + final CommandLine cmd = parser.parse(OptionFactory.getOptions(), args); + + Main.daemon(cmd); + } catch (final Exception e) { + ConnectorLogger.getInstance().fatal("", e); + Main.getHelp(); + } + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/WinService.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/WinService.java new file mode 100644 index 0000000000..61930a93a6 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/WinService.java @@ -0,0 +1,76 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400; + +/** + * Launch the Engine from a variety of sources, either through a main() or + * invoked through Apache Daemon. + */ +public class WinService { + + public static void main(final String[] args) throws Exception { + WinService.start(new String[] { "--port", "8091" }); + } + + public static void start(final String[] args) throws Exception { + final String[] tabArgs = new String[(args.length + 1)]; + + tabArgs[0] = "service"; + int i = 1; + for (final String str : args) { + tabArgs[i] = str; + i++; + } + + final Thread thread = new Thread() { + @Override + public void run() { + Main.main(tabArgs); + } + }; + thread.setDaemon(false); + thread.start(); + + // Main.main(new String[] {"service", "--daemon", "8090"}); + // System.out.println("Out:EngineLauncher#start"); + // ConnectorLogger.getInstance().info("EngineLauncher#start"); + + /* + * Thread thread = new Thread() { + * + * @Override public void run() { while (true) { try { Thread.sleep(1000); } + * catch (InterruptedException e) { e.printStackTrace(); } + * System.out.println("Out:EngineLauncher#isRunning"); + * ConnectorLogger.getInstance().info("EngineLauncher#isRunning"); } } + * + * }; + * + * thread.start(); + */ + } + + public static void stop(final String[] args) throws Exception { + System.out.println("Out:EngineLauncher#stop"); + ConnectorLogger.getInstance().info("EngineLauncher#stop"); + System.exit(0); + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICachedMessageQueueHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICachedMessageQueueHandler.java new file mode 100644 index 0000000000..2d1cafde40 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICachedMessageQueueHandler.java @@ -0,0 +1,30 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +public interface ICachedMessageQueueHandler { + + ResponseData getNewMessageInMessageQueue(String messageQueuePath, String messageIdfilterPattern, int minSeverityLevel, + int maxSeverityLevel) throws Exception; + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICommandHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICommandHandler.java new file mode 100644 index 0000000000..b203dec1df --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ICommandHandler.java @@ -0,0 +1,27 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +public interface ICommandHandler { + ResponseData executeCommand(String commandName) throws Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IDiskHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IDiskHandler.java new file mode 100644 index 0000000000..b29f8750e9 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IDiskHandler.java @@ -0,0 +1,30 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface IDiskHandler { + ResponseData listDisks(String diskName) throws Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobHandler.java new file mode 100644 index 0000000000..f510b2e7ad --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobHandler.java @@ -0,0 +1,30 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface IJobHandler { + ResponseData listJobs() throws Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobQueueHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobQueueHandler.java new file mode 100644 index 0000000000..bf7f0ee4f6 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IJobQueueHandler.java @@ -0,0 +1,34 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import java.util.List; +import java.util.Map; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface IJobQueueHandler { + + ResponseData getJobQueues(List> queues) throws Exception; + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IMessageQueueHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IMessageQueueHandler.java new file mode 100644 index 0000000000..1e5b18143e --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/IMessageQueueHandler.java @@ -0,0 +1,33 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface IMessageQueueHandler { + void dumpMessageQueue() throws Exception; + + ResponseData getErrorMessageQueue(String messageQueuePath, String messageIdfilterPattern, + int minSeverityLevel, int maxSeverityLevel) throws Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISubSystemHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISubSystemHandler.java new file mode 100644 index 0000000000..a2655b0ad7 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISubSystemHandler.java @@ -0,0 +1,33 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.ibm.as400.access.Subsystem; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface ISubSystemHandler { + void dumpSubSystem(Subsystem subSystem) throws Exception; + + ResponseData listSubsystems() throws Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISystemHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISystemHandler.java new file mode 100644 index 0000000000..2033ebcfb0 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/ISystemHandler.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler; + +import com.ibm.as400.access.SystemPool; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface ISystemHandler { + void dumpPool(SystemPool pool) throws Exception; + + void dumpSystem() throws Exception; + + ResponseData getPageFault() throws Exception; + + ResponseData getSystem() throws Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/AbstractHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/AbstractHandler.java new file mode 100644 index 0000000000..b94c3ab17b --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/AbstractHandler.java @@ -0,0 +1,98 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.io.IOException; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Locale; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ConnectionEvent; +import com.ibm.as400.access.ConnectionListener; +import com.ibm.as400.access.SocketProperties; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.ConnectorLogger; + +/** + * @author Lamotte Jean-Baptiste + */ +public abstract class AbstractHandler { + + private static NumberFormat formatterNoDecimal; + private static NumberFormat formatterTreeDecimal; + + protected String host = null; + protected String login = null; + protected String password = null; + + public AbstractHandler(final String host, final String login, final String password) { + this.host = host; + this.login = login; + this.password = password; + } + + static { + final DecimalFormat df0 = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH); + df0.applyPattern("#0"); + AbstractHandler.formatterNoDecimal = df0; + + final DecimalFormat df3 = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH); + df3.applyPattern("#0.###"); + AbstractHandler.formatterTreeDecimal = df3; + } + + static NumberFormat getFormatterNoDecimal() { + return AbstractHandler.formatterNoDecimal; + } + + static NumberFormat getFormatterTreeDecimal() { + return AbstractHandler.formatterTreeDecimal; + } + + protected AS400 getNewAs400() throws AS400SecurityException, IOException { + final SocketProperties properties = new SocketProperties(); + properties.setSoLinger(1); + properties.setKeepAlive(false); + properties.setTcpNoDelay(true); + properties.setLoginTimeout(Conf.as400LoginTimeout); + properties.setSoTimeout(Conf.as400ReadTimeout); + + final AS400 system = new AS400(this.host, this.login, this.password); + system.setSocketProperties(properties); + system.addConnectionListener(new ConnectionListener() { + @Override + public void connected(final ConnectionEvent event) { + ConnectorLogger.getInstance().getLogger().debug("Connect event service : " + event.getService()); + } + + @Override + public void disconnected(final ConnectionEvent event) { + ConnectorLogger.getInstance().getLogger().debug("Disconnect event service : " + event.getService()); + } + }); + + system.validateSignon(); + + return system; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/CommandHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/CommandHandler.java new file mode 100644 index 0000000000..c0f07dc417 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/CommandHandler.java @@ -0,0 +1,74 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.util.HashMap; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Message; +import com.ibm.as400.access.CommandCall; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.ICommandHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class CommandHandler extends AbstractHandler implements ICommandHandler { + + public CommandHandler(final String host, final String login, final String password) { + super(host, login, password); + } + + @Override + public ResponseData executeCommand(final String commandName) throws Exception { + final ResponseData data = new ResponseData(); + HashMap attrs = new HashMap(); + attrs.put("cmdName", commandName); + attrs.put("status", "success"); + + final AS400 system = this.getNewAs400(); + + final CommandCall command = new CommandCall(system); + String output = ""; + try { + if (!command.run(commandName)) { + attrs.put("status", "failed"); + attrs.put("message", "command run failed"); + } + for (final AS400Message message : command.getMessageList()) { + output += message.getText() + "\n"; + } + } catch (final Exception e) { + attrs.put("status", "failed"); + attrs.put("message", "exception: " + e.getMessage()); + ConnectorLogger.getInstance().debug("", e); + } + attrs.put("output", output); + data.getResult().add(attrs); + + // Done with the system. + system.disconnectService(AS400.COMMAND); + system.disconnectAllServices(); + + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/DiskHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/DiskHandler.java new file mode 100644 index 0000000000..aa3d12cc91 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/DiskHandler.java @@ -0,0 +1,93 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.io.IOException; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; + +import com.ibm.as400.access.AS400SecurityException; +import com.centreon.connector.as400.check.handler.IDiskHandler; +import com.centreon.connector.as400.check.handler.impl.disk.QyaspolYasp0300PcmlHandler; +import com.centreon.connector.as400.check.handler.impl.disk.Yasp0300Data; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class DiskHandler extends AbstractHandler implements IDiskHandler { + + private QyaspolYasp0300PcmlHandler qyaspolPcmlHandler = null; + + public DiskHandler(final String host, final String login, final String password) + throws AS400SecurityException, IOException { + super(host, login, password); + this.qyaspolPcmlHandler = new QyaspolYasp0300PcmlHandler(host, login, password); + } + + @Override + public ResponseData listDisks(final String diskName) throws Exception { + final ResponseData data = new ResponseData(); + + List disks = null; + + if (diskName == null) { + disks = this.qyaspolPcmlHandler.getDisksList(); + } else { + final Yasp0300Data disk = this.qyaspolPcmlHandler.getDiskByResourceName(diskName); + if (disk == null) { + return new ResponseData(ResponseData.statusError, "Disk " + diskName + " not found"); + } + disks = new ArrayList(); + disks.add(disk); + } + + /* + * 0 - There is no unit control value (noUnitControl) + * 1 - The disk unit is active (active) + * 2 - The disk unit has failed (failed) + * 3 - Some other disk unit in the disk subsystem has failed (otherDiskSubFailed) + * 4 - There is a hardware failure within the disk subsystem that affects performance, but does not affect the function of the disk unit (hwFailurePerf) + * 5 - There is a hardware failure within the disk subsystem that does not affect the function or performance of the disk unit (hwFailureOk) + * 6 - The disk unit's parity protection is being rebuilt (rebuilding) + * 7 - The disk unit is not ready (noReady) + * 8 - The disk unit is write protected (writeProtected) + * 9 - The disk unit is busy. (busy) + * 10 - The disk unit is not operational (notOperational) + * 11 - The disk unit has returned a status that is not recognizable by the system (unknownStatus) + * 12 - The disk unit cannot be accessed (noAccess) + * 13 - The disk unit is read/write protected (rwProtected) + */ + for (final Yasp0300Data disk : disks) { + HashMap attrs = new HashMap(); + + attrs.put("status", disk.getUnitControl()); + attrs.put("name", disk.getResourceName()); + attrs.put("totalSpace", disk.getDiskCapacity() * 1024d * 1024d); + attrs.put("reservedSpace", disk.getDiskStorageReservedForSystem() * 1024d * 1024d); + attrs.put("freeSpace", disk.getDiskStorageAvailable() * 1024d * 1024d); + data.getResult().add(attrs); + } + + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/FailedCheckException.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/FailedCheckException.java new file mode 100644 index 0000000000..03aacb6094 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/FailedCheckException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +/** + * @author Lamotte Jean-Baptiste + */ +public class FailedCheckException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1812060950998874570L; + + public FailedCheckException(final String reason) { + super(reason); + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobCache.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobCache.java new file mode 100644 index 0000000000..1c8ad2166f --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobCache.java @@ -0,0 +1,95 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.util.Collection; +import java.util.Enumeration; +import java.util.LinkedList; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.Job; +import com.ibm.as400.access.JobList; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.ConnectorLogger; + +class JobCache { + private volatile LinkedList lastJobCache = null; + private long lastRefresh = 0; + + JobHandler handler; + Exception lastFailException = new Exception("First check"); + + JobCache(final JobHandler handler) { + this.handler = handler; + } + + Collection getJobListCache(final boolean forceRefresh) throws Exception { + this.refreshJobListCache(forceRefresh); + if (this.lastJobCache == null) { + throw this.lastFailException; + } + return new LinkedList(this.lastJobCache); + } + + Collection getJobListCache() throws Exception { + return this.getJobListCache(false); + } + + private void refreshJobListCache(final boolean forceRefresh) throws Exception { + if (!(((this.lastRefresh + Conf.cacheTimeout) < System.currentTimeMillis()) || forceRefresh)) { + return; + } + final AS400 system = this.handler.getNewAs400(); + + final JobList jobList = new JobList(system); + jobList.addJobAttributeToRetrieve(Job.ACTIVE_JOB_STATUS); + jobList.addJobAttributeToRetrieve(Job.SUBSYSTEM); + jobList.addJobAttributeToRetrieve(Job.JOB_NAME); + jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); + jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE); + jobList.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); + + try { + @SuppressWarnings("unchecked") + final Enumeration enumeration = jobList.getJobs(); + final LinkedList list = new LinkedList(); + + while (enumeration.hasMoreElements()) { + list.add(enumeration.nextElement()); + } + + this.lastJobCache = list; + } catch (final Exception e) { + this.lastFailException = new FailedCheckException("" + e.getMessage()); + this.lastJobCache = null; + ConnectorLogger.getInstance().debug("", e); + } finally { + try { + jobList.close(); + system.disconnectAllServices(); + } catch (final Exception e) { + ConnectorLogger.getInstance().info("Job list close failed (" + system.getSystemName() + ")", e); + } + this.lastRefresh = System.currentTimeMillis(); + } + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobHandler.java new file mode 100644 index 0000000000..18bd800142 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobHandler.java @@ -0,0 +1,71 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.util.Collection; +import java.util.HashMap; + +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.Job; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.IJobHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class JobHandler extends AbstractHandler implements IJobHandler { + private final JobCache jobCache; + + public JobHandler(final String host, final String login, final String password) { + super(host, login, password); + this.jobCache = new JobCache(this); + } + + @Override + public ResponseData listJobs() throws Exception { + final ResponseData data = new ResponseData(); + + Collection jobs = this.jobCache.getJobListCache(); + for (final Job job : jobs) { + HashMap attrs = new HashMap(); + + attrs.put("name", job.getName()); + attrs.put("subSystem", job.getSubsystem()); + attrs.put("status", job.getStatus()); + attrs.put("activeStatus", job.getValue(Job.ACTIVE_JOB_STATUS)); + + String currentLibrary = ""; + try { + job.getCurrentLibrary(); + } catch (final Exception e) { + attrs.put("currentLibraryException", e.getMessage()); + } + attrs.put("currentLibrary", currentLibrary); + + data.getResult().add(attrs); + } + + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobQueueHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobQueueHandler.java new file mode 100644 index 0000000000..3c18f9a6e5 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/JobQueueHandler.java @@ -0,0 +1,87 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.util.List; +import java.util.Map; +import java.util.HashMap; + +import com.ibm.as400.access.AS400; +import com.centreon.connector.as400.check.handler.IJobQueueHandler; +import com.centreon.connector.as400.check.handler.impl.jobqueue.Jobq0100; +import com.centreon.connector.as400.check.handler.impl.jobqueue.Jobq0200; +import com.centreon.connector.as400.check.handler.impl.jobqueue.Qsprjobq100Handler; +import com.centreon.connector.as400.check.handler.impl.jobqueue.Qsprjobq200Handler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class JobQueueHandler extends AbstractHandler implements IJobQueueHandler { + + public JobQueueHandler(final String host, final String login, final String password) { + super(host, login, password); + } + + @Override + public ResponseData getJobQueues(List> queues) throws Exception { + final ResponseData data = new ResponseData(); + + final AS400 system = this.getNewAs400(); + final Qsprjobq200Handler qsprjobq200Handler = new Qsprjobq200Handler(system); + + for (Map queue : queues) { + String name = queue.get("name"); + String library = queue.get("library"); + + if (name == null || library == null) { + return new ResponseData(ResponseData.statusError, + "JobQueue name/library attribute must be set"); + } + + Jobq0200 jobq0200 = null; + try { + jobq0200 = qsprjobq200Handler.loadJobq0200(name, library); + } catch (final Exception e) { + system.disconnectAllServices(); + throw e; + } + + if (jobq0200 == null) { + return new ResponseData(ResponseData.statusError, + "JobQueue " + name + " in library " + library + " not found"); + } + + HashMap attrs = new HashMap(); + attrs.put("name", name); + attrs.put("library", library); + // RELEASED, HELD + attrs.put("status", jobq0200.getJobQueueStatus()); + attrs.put("activeJob", jobq0200.getActiveJobTotal()); + attrs.put("heldJobOnQueue", jobq0200.getHeldJobTotal()); + attrs.put("scheduledJobOnQueue", jobq0200.getScheduledJobTotal()); + data.getResult().add(attrs); + } + + system.disconnectAllServices(); + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SubSystemHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SubSystemHandler.java new file mode 100644 index 0000000000..bff97d3171 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SubSystemHandler.java @@ -0,0 +1,101 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.io.IOException; +import java.util.Enumeration; +import java.util.HashMap; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Exception; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.ObjectDescription; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.ObjectList; +import com.ibm.as400.access.RequestNotSupportedException; +import com.ibm.as400.access.Subsystem; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.ISubSystemHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class SubSystemHandler extends AbstractHandler implements ISubSystemHandler { + + public SubSystemHandler(final String host, final String login, final String password) + throws AS400SecurityException, IOException { + super(host, login, password); + } + + @Override + public void dumpSubSystem(final Subsystem subSystem) throws AS400Exception, AS400SecurityException, + ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { + System.out.println("getCurrentActiveJobs : " + subSystem.getCurrentActiveJobs()); + System.out.println("getDescriptionText : " + subSystem.getDescriptionText()); + System.out.println("getDisplayFilePath : " + subSystem.getDisplayFilePath()); + System.out.println("getLanguageLibrary : " + subSystem.getLanguageLibrary()); + System.out.println("getLibrary : " + subSystem.getLibrary()); + System.out.println("getMaximumActiveJobs : " + subSystem.getMaximumActiveJobs()); + + subSystem.getMonitorJob(); + + System.out.println("getName : " + subSystem.getName()); + System.out.println("getObjectDescription : " + subSystem.getObjectDescription()); + System.out.println("getPath : " + subSystem.getPath()); + System.out.println("getPools (array count) : " + subSystem.getPools().length); + System.out.println("getStatus : " + subSystem.getStatus()); + } + + @Override + public ResponseData listSubsystems() throws Exception { + final ResponseData data = new ResponseData(); + + final AS400 system = this.getNewAs400(); + try { + Subsystem[] list = Subsystem.listAllSubsystems(system); + for (int i = 0; i < list.length; i++) { + HashMap attrs = new HashMap(); + + list[i].refresh(); + attrs.put("name", list[i].getName()); + attrs.put("path", list[i].getPath()); + attrs.put("library", list[i].getLibrary()); + // *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, *STARTING + attrs.put("status", list[i].getStatus()); + attrs.put("currentActiveJobs", list[i].getCurrentActiveJobs()); + data.getResult().add(attrs); + } + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + try { + system.disconnectAllServices(); + } catch (final Exception e1) { + ConnectorLogger.getInstance().debug("", e); + } + throw new Exception(e); + } + system.disconnectAllServices(); + + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SystemHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SystemHandler.java new file mode 100644 index 0000000000..a74d8b46b3 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/SystemHandler.java @@ -0,0 +1,221 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Enumeration; +import java.util.HashMap; + +import com.ibm.as400.access.AS400Bin4; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.AS400Text; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.ProgramCall; +import com.ibm.as400.access.ProgramParameter; +import com.ibm.as400.access.QSYSObjectPathName; +import com.ibm.as400.access.SystemPool; +import com.ibm.as400.access.SystemStatus; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.check.handler.ISystemHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class SystemHandler extends AbstractHandler implements ISystemHandler { + private SystemStatus status = null; + + public SystemHandler(final String host, final String login, final String password) + throws AS400SecurityException, IOException { + this(host, login, password, null); + } + + public SystemHandler(final String host, final String login, final String password, SystemStatus as400Status) + throws AS400SecurityException, IOException { + super(host, login, password); + this.status = as400Status == null ? new SystemStatus(getNewAs400()) : as400Status; + } + + @Override + @SuppressWarnings("deprecation") + public void dumpPool(final SystemPool pool) throws UnsupportedEncodingException, AS400SecurityException, + ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { + + System.out.println("------------------------------------"); + System.out.println("name : " + pool.getName() + " | " + pool.getDescription()); + System.out.println("Identifier : " + pool.getIdentifier()); + System.out.println("ActiveToIneligible : " + pool.getActiveToIneligible() + + " transitions per minute, of transitions of threads from an active condition to an ineligible condition"); + System.out.println("ActiveToWait : " + pool.getActiveToWait() + + " transitions per minute, of transitions of threads from an active condition to a waiting condition"); + System.out.println("WaitToIneligible : " + pool.getWaitToIneligible() + + " transitions per minute, of transitions of threads from a waiting condition to an ineligible condition"); + System.out.println("ActivityLevel : " + pool.getActivityLevel() + + " maximum number of threads that can be active in the pool at any one time"); + System.out.println("DatabaseFaults : " + pool.getDatabaseFaults() + " page faults per second"); + System.out.println("DatabasePages : " + pool.getDatabasePages() + " page per second"); + System.out.println("MaximumActiveThreads : " + pool.getMaximumActiveThreads() + "(deprecated)"); + System.out.println("NonDatabaseFaults : " + pool.getNonDatabaseFaults() + " page faults per second"); + System.out.println("NonDatabasePages : " + pool.getNonDatabasePages() + " page per second"); + System.out.println("PagingOption : " + pool.getPagingOption()); + System.out.println("PoolIdentifier : " + pool.getPoolIdentifier() + "(deprecated)"); + System.out.println("PoolName : " + pool.getPoolName() + "(deprecated)"); + System.out.println("PoolSize : " + pool.getPoolSize() + " (deprecated)"); + System.out.println("ReservedSize : " + pool.getReservedSize() + " kilobytes,"); + System.out.println("Size : " + pool.getSize() + " kilobytes"); + System.out.println("SubsystemLibrary : " + pool.getSubsystemLibrary()); + System.out.println("SubsystemName : " + pool.getSubsystemName()); + System.out.println("System : " + pool.getSystem()); + + pool.getActiveToIneligible(); + } + + @Override + public void dumpSystem() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, + IOException, ObjectDoesNotExistException { + + System.out.println("ActiveJobsInSystem : " + this.status.getActiveJobsInSystem()); + // System.out.println("PercentSystemASPUsed : " + + // status.getPercentSystemASPUsed() + "%"); //<== stockage + // System.out.println("getPercentProcessingUnitUsed : " + + // status.getPercentProcessingUnitUsed() + "%"); + System.out.println("ActiveThreadsInSystem : " + this.status.getActiveThreadsInSystem() + ""); + System.out.println("BatchJobsEndedWithPrinterOutputWaitingToPrint : " + + this.status.getBatchJobsEndedWithPrinterOutputWaitingToPrint() + ""); + System.out.println("BatchJobsEnding : " + this.status.getBatchJobsEnding() + ""); + System.out.println("BatchJobsHeldOnJobQueue : " + this.status.getBatchJobsHeldOnJobQueue() + ""); + System.out.println("BatchJobsHeldWhileRunning : " + this.status.getBatchJobsHeldWhileRunning() + ""); + System.out.println("BatchJobsOnAHeldJobQueue : " + this.status.getBatchJobsOnAHeldJobQueue() + ""); + System.out.println("BatchJobsOnUnassignedJobQueue : " + this.status.getBatchJobsOnUnassignedJobQueue() + ""); + System.out.println("BatchJobsRunning : " + this.status.getBatchJobsRunning() + ""); + System.out.println("BatchJobsWaitingForMessage : " + this.status.getBatchJobsWaitingForMessage() + ""); + System.out.println( + "BatchJobsWaitingToRunOrAlreadyScheduled : " + this.status.getBatchJobsWaitingToRunOrAlreadyScheduled() + ""); + System.out.println("CurrentProcessingCapacity : " + this.status.getCurrentProcessingCapacity() + ""); + System.out.println("CurrentUnprotectedStorageUsed : " + this.status.getCurrentUnprotectedStorageUsed() + ""); + System.out.println("DateAndTimeStatusGathered : " + this.status.getDateAndTimeStatusGathered() + ""); + System.out.println("ElapsedTime : " + this.status.getElapsedTime() + ""); + System.out.println("JobsInSystem : " + this.status.getJobsInSystem() + ""); + System.out.println("MainStorageSize : " + this.status.getMainStorageSize() + ""); + System.out.println("MaximumJobsInSystem : " + this.status.getMaximumJobsInSystem() + ""); + System.out.println("MaximumUnprotectedStorageUsed : " + this.status.getMaximumUnprotectedStorageUsed() + ""); + System.out.println("NumberOfPartitions : " + this.status.getNumberOfPartitions() + ""); + System.out.println("NumberOfProcessors : " + this.status.getNumberOfProcessors() + ""); + System.out.println("PartitionIdentifier : " + this.status.getPartitionIdentifier() + ""); + System.out.println( + "PercentCurrentInteractivePerformance : " + this.status.getPercentCurrentInteractivePerformance() + ""); + System.out.println("PercentDBCapability : " + this.status.getPercentDBCapability() + ""); + System.out + .println("PercentPermanent256MBSegmentsUsed : " + this.status.getPercentPermanent256MBSegmentsUsed() + ""); + System.out.println("PercentPermanent4GBSegmentsUsed : " + this.status.getPercentPermanent4GBSegmentsUsed() + ""); + System.out.println("PercentPermanentAddresses : " + this.status.getPercentPermanentAddresses() + ""); + System.out.println("PercentProcessingUnitUsed : " + this.status.getPercentProcessingUnitUsed() + ""); + System.out.println("PercentSharedProcessorPoolUsed : " + this.status.getPercentSharedProcessorPoolUsed() + ""); + System.out.println("PercentSystemASPUsed : " + this.status.getPercentSystemASPUsed() + ""); + System.out + .println("PercentTemporary256MBSegmentsUsed : " + this.status.getPercentTemporary256MBSegmentsUsed() + ""); + System.out.println("PercentTemporary4GBSegmentsUsed : " + this.status.getPercentTemporary4GBSegmentsUsed() + ""); + System.out.println("PercentTemporaryAddresses : " + this.status.getPercentTemporaryAddresses() + ""); + System.out.println("PercentUncappedCPUCapacityUsed : " + this.status.getPercentUncappedCPUCapacityUsed() + ""); + System.out.println("PoolsNumber : " + this.status.getPoolsNumber() + ""); + System.out.println("ProcessorSharingAttribute : " + this.status.getProcessorSharingAttribute() + ""); + System.out.println("RestrictedStateFlag : " + this.status.getRestrictedStateFlag() + ""); + System.out.println("System : " + this.status.getSystem() + ""); + System.out.println("SystemASP : " + this.status.getSystemASP() + " Mbytes"); + System.out.println("SystemName : " + this.status.getSystemName() + ""); + System.out.println("TotalAuxiliaryStorage : " + this.status.getTotalAuxiliaryStorage() + ""); + System.out.println("UsersCurrentSignedOn : " + this.status.getUsersCurrentSignedOn() + ""); + System.out.println("UsersSignedOffWithPrinterOutputWaitingToPrint : " + + this.status.getUsersSignedOffWithPrinterOutputWaitingToPrint() + ""); + System.out.println("UsersSuspendedByGroupJobs : " + this.status.getUsersSuspendedByGroupJobs() + ""); + System.out.println("UsersSuspendedBySystemRequest : " + this.status.getUsersSuspendedBySystemRequest() + ""); + System.out.println("UsersTemporarilySignedOff : " + this.status.getUsersTemporarilySignedOff() + ""); + + final Enumeration enumeration = this.status.getSystemPools(); + + while (enumeration.hasMoreElements()) { + this.dumpPool((SystemPool) enumeration.nextElement()); + } + } + + @Override + public ResponseData getSystem() throws Exception { + final ResponseData data = new ResponseData(); + HashMap attrs = new HashMap(); + + attrs.put("percentProcessingUnitUsed", this.status.getPercentProcessingUnitUsed()); + attrs.put("percentSystemASPUsed", this.status.getPercentSystemASPUsed()); + attrs.put("maxJobInSystem", this.status.getMaximumJobsInSystem()); + attrs.put("jobInSystem", this.status.getJobsInSystem()); + attrs.put("activeJobInSystem", this.status.getActiveJobsInSystem()); + attrs.put("activeThreadInSystem", this.status.getActiveThreadsInSystem()); + attrs.put("batchJobsEndedWithPrinterOutputWaitingToPrint", this.status + .getBatchJobsEndedWithPrinterOutputWaitingToPrint()); + attrs.put("batchJobEnding", this.status.getBatchJobsEnding()); + attrs.put("batchJobHeldInJobQueue", this.status.getBatchJobsHeldOnJobQueue()); + attrs.put("batchJobHeldWhileRunning", this.status.getBatchJobsHeldWhileRunning()); + attrs.put("batchJobOnHeldJobQueue", this.status.getBatchJobsOnAHeldJobQueue()); + attrs.put("batchJobOnUnassignedJobQueue", this.status.getBatchJobsOnUnassignedJobQueue()); + attrs.put("batchJobRunning", this.status.getBatchJobsRunning()); + attrs.put("batchJobWaitingForMessage", this.status.getBatchJobsWaitingForMessage()); + attrs.put("batchJobWaitingToRunOrAlreadyScheduled", this.status.getBatchJobsWaitingToRunOrAlreadyScheduled()); + data.getResult().add(attrs); + + return data; + } + + @Override + @SuppressWarnings("unchecked") + public ResponseData getPageFault() throws Exception { + final ResponseData data = new ResponseData(); + + for (final Enumeration enumeration = this.status.getSystemPools(); enumeration.hasMoreElements();) { + final SystemPool pool = enumeration.nextElement(); + HashMap attrs = new HashMap(); + + attrs.put("id", pool.getIdentifier()); + attrs.put("name", pool.getPoolName()); + attrs.put("dbPageFault", pool.getDatabaseFaults()); + attrs.put("dbPage", pool.getDatabasePages()); + attrs.put("nonDbPageFault", pool.getNonDatabaseFaults()); + attrs.put("nonDbPage",pool.getNonDatabasePages()); + data.getResult().add(attrs); + } + + return data; + } + + @SuppressWarnings("unchecked") + public SystemPool searchSystemPoolByName(final String poolName) throws AS400SecurityException, + ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { + for (final Enumeration enumeration = this.status.getSystemPools(); enumeration.hasMoreElements();) { + final SystemPool pool = enumeration.nextElement(); + System.out.println("poolName : " + pool.getName()); + if (poolName.equalsIgnoreCase(pool.getName())) { + return pool; + } + } + return null; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskInfo.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskInfo.java new file mode 100644 index 0000000000..435b9965ad --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskInfo.java @@ -0,0 +1,108 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +import java.io.IOException; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Exception; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.AS400Text; +import com.ibm.as400.access.BinaryConverter; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.ProgramCall; +import com.ibm.as400.access.ProgramParameter; + +/** + * @author Lamotte Jean-Baptiste + */ +public class DiskInfo { + AS400 system = null; + + private static final ProgramParameter ERROR_CODE = new ProgramParameter(new byte[8]); + + byte[][] receiverVariables_ = new byte[4][]; + + public DiskInfo(final AS400 system) { + this.system = system; + } + + public void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, + ObjectDoesNotExistException { + this.load(1); + } + + // Retrieve Disk Information (QYASRDI) API + public void load(int format) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, + IOException, ObjectDoesNotExistException { + // Check to see if the format has been loaded already. + if (this.receiverVariables_[format] != null) { + return; + } + if (format == 0) { + format = 1; + } + + final int receiverVariableLength = format == 1 ? 80 : format == 2 ? 148 : 2048; + + final AS400Text param3 = new AS400Text(8, this.system); + // AS400Array param4 = new AS400Array(param3., system); + + final ProgramParameter[] parameters = new ProgramParameter[] { + // 1 Receiver variable Output Char(*) + new ProgramParameter(receiverVariableLength), + // 2 Length of receiver variable Input Binary(4) + new ProgramParameter(BinaryConverter.intToByteArray(receiverVariableLength)), + // 3 Format name Input Char(8) + new ProgramParameter(param3.toBytes("DMIN0100")), + // 4 Disk unit resource name array Input Array of CHAR(10) + new ProgramParameter(("*ALL ").getBytes("ASCII")), + // 5 Number of disk unit resource names Input Binary(4) + new ProgramParameter(BinaryConverter.intToByteArray(1)), DiskInfo.// 6 + // Error + // code + // I/O + // Char(*) + ERROR_CODE }; + + final ProgramCall pc = new ProgramCall(this.system, "/QSYS.LIB/QYASRDI.PGM", parameters); + // QWCRSSTS is not thread safe. + boolean repeatRun; + do { + repeatRun = false; + if (!pc.run()) { + throw new AS400Exception(pc.getMessageList()); + } + + this.receiverVariables_[format] = parameters[0].getOutputData(); + + final int bytesAvailable = BinaryConverter.byteArrayToInt(this.receiverVariables_[format], 0); + final int bytesReturned = BinaryConverter.byteArrayToInt(this.receiverVariables_[format], 4); + if (bytesReturned < bytesAvailable) { + repeatRun = true; + parameters[0] = new ProgramParameter(bytesAvailable); + parameters[1] = new ProgramParameter(BinaryConverter.intToByteArray(bytesAvailable)); + } + } while (repeatRun); + this.receiverVariables_[0] = this.receiverVariables_[format]; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagement.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagement.java new file mode 100644 index 0000000000..cf3ab4d126 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagement.java @@ -0,0 +1,109 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +import java.io.IOException; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Exception; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.AS400Text; +import com.ibm.as400.access.BinaryConverter; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.ProgramCall; +import com.ibm.as400.access.ProgramParameter; + +/** + * @author Lamotte Jean-Baptiste + */ +public class DiskManagement { + AS400 system = null; + DiskManagementSession session = null; + + private static final ProgramParameter ERROR_CODE = new ProgramParameter(new byte[8]); + + byte[][] receiverVariables_ = new byte[4][]; + + public DiskManagement(final AS400 system) { + this.system = system; + this.session = new DiskManagementSession(system); + } + + public void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, + ObjectDoesNotExistException { + this.load(1); + } + + // Retrieve Disk Information (QYASRDI) API + public void load(int format) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, + IOException, ObjectDoesNotExistException { + this.session.load(); + // Check to see if the format has been loaded already. + if (this.receiverVariables_[format] != null) { + return; + } + if (format == 0) { + format = 1; + } + + final int receiverVariableLength = format == 1 ? 80 : format == 2 ? 148 : 2048; + + final AS400Text param3 = new AS400Text(8, this.system); + // AS400Array param4 = new AS400Array(param3., system); + + final ProgramParameter[] parameters = new ProgramParameter[] { + // 1 Receiver variable Output Char(*) + new ProgramParameter(receiverVariableLength), + // 2 Length of receiver variable Input Binary(4) + new ProgramParameter(BinaryConverter.intToByteArray(receiverVariableLength)), + // 3 Format name Input Char(8) + new ProgramParameter(param3.toBytes("DMIN0100")), + // 4 Session handle Input Char(8) + new ProgramParameter(this.session.getHandle()), DiskManagement.// 5 + // Error + // code + // I/O + // Char(*)a + ERROR_CODE }; + + final ProgramCall pc = new ProgramCall(this.system, "/QSYS.LIB/QYASRDI.PGM", parameters); + // QWCRSSTS is not thread safe. + boolean repeatRun; + do { + repeatRun = false; + if (!pc.run()) { + throw new AS400Exception(pc.getMessageList()); + } + + this.receiverVariables_[format] = parameters[0].getOutputData(); + + final int bytesAvailable = BinaryConverter.byteArrayToInt(this.receiverVariables_[format], 0); + final int bytesReturned = BinaryConverter.byteArrayToInt(this.receiverVariables_[format], 4); + if (bytesReturned < bytesAvailable) { + repeatRun = true; + parameters[0] = new ProgramParameter(bytesAvailable); + parameters[1] = new ProgramParameter(BinaryConverter.intToByteArray(bytesAvailable)); + } + } while (repeatRun); + this.receiverVariables_[0] = this.receiverVariables_[format]; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagementSession.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagementSession.java new file mode 100644 index 0000000000..d0a1498836 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/DiskManagementSession.java @@ -0,0 +1,64 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +import java.io.IOException; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.ProgramCall; +import com.ibm.as400.access.ProgramParameter; + +/** + * @author Lamotte Jean-Baptiste + */ +public class DiskManagementSession { + AS400 system = null; + + byte[] session; + + private static final ProgramParameter ERROR_CODE = new ProgramParameter(new byte[8]); + + public DiskManagementSession(final AS400 system) { + this.system = system; + } + + public byte[] getHandle() { + return this.session; + } + + // Retrieve Disk Information (QYASRDI) API + public void load() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, + ObjectDoesNotExistException { + + final ProgramParameter[] parameters = new ProgramParameter[] { + // 1 Session handle Output Char(8) + new ProgramParameter(8), DiskManagementSession.// 2 Error code + // I/O Char(*) + ERROR_CODE }; + + new ProgramCall(this.system, "/QSYS.LIB/QYASSDMS.PGM", parameters); + + this.session = parameters[0].getOutputData(); + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0100PcmlHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0100PcmlHandler.java new file mode 100644 index 0000000000..e0db0cbcd9 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0100PcmlHandler.java @@ -0,0 +1,136 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Message; +import com.ibm.as400.data.PcmlException; +import com.ibm.as400.data.ProgramCallDocument; + +/** + * @author Lamotte Jean-Baptiste + */ +public class QyaspolYasp0100PcmlHandler { + AS400 system = null; + + ProgramCallDocument pcml; // com.ibm.as400.data.ProgramCallDocument + HashMap disks = new HashMap(); + + long lastLoad = 0; + + int totalRecord = -1; + + int rcdsReturned = -1; + + byte[] rqsHandle = null; + + public QyaspolYasp0100PcmlHandler(final AS400 system) { + this.system = system; + + } + + public void addYasp0100Data(final Yasp0100Data data) { + this.disks.put(data.getResourceName(), data); + } + + public boolean callProgram(final String programName) throws PcmlException { + + // Request to call the API + final boolean rc = this.pcml.callProgram(programName); + if (rc == false) { + this.displayMessageError(this.pcml, programName); + return false; + } + return true; + } + + public void displayMessageError(final ProgramCallDocument pcml, final String programmName) throws PcmlException { + // Retrieve list of server messages + final AS400Message[] msgs = pcml.getMessageList(programmName); + + // Iterate through messages and write them to standard output + for (final AS400Message msg : msgs) { + final String msgId = msg.getID(); + final String msgText = msg.getText(); + System.out.println(" " + msgId + " - " + msgText); + } + } + + public Yasp0100Data getDiskByResourceName(final String name) { + return this.disks.get(name); + } + + public List getDisksList() { + final List list = new LinkedList(); + list.addAll(this.disks.values()); + return list; + } + + public List getResourceNameList() { + final LinkedList list = new LinkedList(); + list.addAll(this.disks.keySet()); + return list; + } + + public synchronized void load() throws PcmlException { + if (System.currentTimeMillis() < (this.lastLoad + (10 * 1000))) { + return; + } + this.lastLoad = System.currentTimeMillis(); + + this.pcml = new ProgramCallDocument(this.system, "com.centreon.connector.as400.box.system.disk.qyaspol100.pcml"); + + this.callProgram("qyaspol"); + this.loadListInfo("qyaspol"); + this.addYasp0100Data(this.loadYasp0100(this.pcml, "qyaspol")); + + if (this.totalRecord > 1) { + for (int i = 1; i <= this.totalRecord; i++) { + this.pcml.setValue("qgygtle.requestHandle", this.rqsHandle); + this.pcml.setIntValue("qgygtle.startingRcd", i); + this.callProgram("qgygtle"); + this.addYasp0100Data(this.loadYasp0100(this.pcml, "qgygtle")); + } + } + this.pcml.setValue("qgyclst.requestHandle", this.rqsHandle); + this.callProgram("qgyclst"); + } + + public void loadListInfo(final String programName) throws PcmlException { + this.totalRecord = this.pcml.getIntValue(programName + ".listInfo.totalRcds"); + this.rcdsReturned = this.pcml.getIntValue(programName + ".listInfo.rcdsReturned"); + this.rqsHandle = (byte[]) this.pcml.getValue(programName + ".listInfo.rqsHandle"); + } + + public Yasp0100Data loadYasp0100(final ProgramCallDocument pcml, final String programName) throws PcmlException { + final int[] indices = new int[1]; + indices[0] = 0; + + final Yasp0100Data data = new Yasp0100Data(); + data.setResourceName(pcml.getStringValue(programName + ".receiver.resourceName", indices)); + + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0300PcmlHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0300PcmlHandler.java new file mode 100644 index 0000000000..80715ee28f --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/QyaspolYasp0300PcmlHandler.java @@ -0,0 +1,259 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +import java.io.IOException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Message; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ConnectionEvent; +import com.ibm.as400.access.ConnectionListener; +import com.ibm.as400.access.SocketProperties; +import com.ibm.as400.data.PcmlException; +import com.ibm.as400.data.ProgramCallDocument; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.impl.FailedCheckException; + +/** + * @author Lamotte Jean-Baptiste + */ +public class QyaspolYasp0300PcmlHandler { + String pcmlFile = "qyaspol300.pcml"; + + // AS400 system = null; + + ProgramCallDocument pcml; // com.ibm.as400.data.ProgramCallDocument + HashMap currentDiskLoad = new HashMap(); + HashMap cachedDiskList = null; + Exception lastFailException = new Exception("First check"); + + long lastLoad = 0; + + int totalRecord = -1; + + int rcdsReturned = -1; + + byte[] rqsHandle = null; + + String host = null; + String login = null; + String password = null; + + public QyaspolYasp0300PcmlHandler(final String host, final String login, final String password) { + this.host = host; + this.login = login; + this.password = password; + } + + public void addYasp0300Data(final Yasp0300Data data) { + this.currentDiskLoad.put(data.getResourceName(), data); + } + + public boolean callProgram(final String programName) throws PcmlException { + + // Request to call the API + final boolean rc = this.pcml.callProgram(programName); + if (rc == false) { + this.displayMessageError(this.pcml, programName); + return false; + } + return true; + } + + public void displayMessageError(final ProgramCallDocument pcml, final String programmName) throws PcmlException { + // Retrieve list of server messages + final AS400Message[] msgs = pcml.getMessageList(programmName); + + // Iterate through messages and write them to standard output + for (final AS400Message msg : msgs) { + final String msgId = msg.getID(); + final String msgText = msg.getText(); + System.out.println(" " + msgId + " - " + msgText); + } + } + + public Yasp0300Data getDiskByResourceName(final String name) throws Exception { + this.load(); + if (this.cachedDiskList == null) { + throw this.lastFailException; + } + return this.cachedDiskList.get(name); + } + + public List getDisksList() throws Exception { + this.load(); + if (this.cachedDiskList == null) { + throw this.lastFailException; + } + final List list = new LinkedList(); + list.addAll(this.cachedDiskList.values()); + return list; + } + + public List getResourceNameList() throws Exception { + this.load(); + if (this.cachedDiskList == null) { + throw this.lastFailException; + } + final LinkedList list = new LinkedList(); + list.addAll(this.cachedDiskList.keySet()); + return list; + } + + public void load() throws PcmlException { + if (!((this.lastLoad + Conf.cacheTimeout) < System.currentTimeMillis())) { + return; + } + + AS400 system = null; + try { + this.currentDiskLoad = new HashMap(); + + system = this.getNewAs400(); + this.pcml = new ProgramCallDocument(system, this.pcmlFile); + + this.callProgram("qyaspol"); + this.loadListInfo("qyaspol"); + this.addYasp0300Data(this.loadYasp0300(this.pcml, "qyaspol")); + + if (this.totalRecord > 1) { + for (int i = 1; i <= this.totalRecord; i++) { + this.pcml.setValue("qgygtle.requestHandle", this.rqsHandle); + this.pcml.setIntValue("qgygtle.startingRcd", i); + this.callProgram("qgygtle"); + this.addYasp0300Data(this.loadYasp0300(this.pcml, "qgygtle")); + } + } + + this.pcml.setValue("qgyclst.requestHandle", this.rqsHandle); + this.callProgram("qgyclst"); + + this.cachedDiskList = this.currentDiskLoad; + this.lastLoad = System.currentTimeMillis(); + + } catch (final com.ibm.as400.data.PcmlException e) { + if (e.getCause() != null) { + new FailedCheckException("" + e.getCause().getMessage()); + } else { + new FailedCheckException("" + e.getMessage()); + } + this.cachedDiskList = null; + ConnectorLogger.getInstance().debug("", e); + } catch (final java.net.UnknownHostException e) { + this.lastFailException = new FailedCheckException("Invalid hostname for server: " + e.getMessage()); + this.cachedDiskList = null; + ConnectorLogger.getInstance().debug("", e); + } catch (final Exception e) { + System.out.println("plop " + e.getMessage()); + this.lastFailException = new FailedCheckException("" + e.getMessage()); + this.cachedDiskList = null; + ConnectorLogger.getInstance().debug("", e); + } finally { + this.lastLoad = System.currentTimeMillis(); + if (system != null) { + system.disconnectAllServices(); + } + } + } + + public void loadListInfo(final String programName) throws PcmlException { + this.totalRecord = this.pcml.getIntValue(programName + ".listInfo.totalRcds"); + this.rcdsReturned = this.pcml.getIntValue(programName + ".listInfo.rcdsReturned"); + this.rqsHandle = (byte[]) this.pcml.getValue(programName + ".listInfo.rqsHandle"); + } + + public Yasp0300Data loadYasp0300(final ProgramCallDocument pcml, final String programName) throws PcmlException { + final int[] indices = new int[1]; + indices[0] = 0; + + final Yasp0300Data data = new Yasp0300Data(); + + data.setAspNumber(pcml.getIntValue(programName + ".receiver.aspNumber", indices)); + data.setDiskType(pcml.getStringValue(programName + ".receiver.diskType", indices)); + data.setDiskModel(pcml.getStringValue(programName + ".receiver.diskModel", indices)); + data.setDiskSerialNumber(pcml.getStringValue(programName + ".receiver.diskSerialNumber", indices)); + data.setResourceName(pcml.getStringValue(programName + ".receiver.resourceName", indices)); + data.setDiskUnitNumber(pcml.getIntValue(programName + ".receiver.diskUnitNumber", indices)); + data.setDiskCapacity(pcml.getIntValue(programName + ".receiver.diskCapacity", indices)); + data.setDiskStorageAvailable(pcml.getIntValue(programName + ".receiver.diskStorageAvailable", indices)); + data.setDiskStorageReservedForSystem( + pcml.getIntValue(programName + ".receiver.diskStorageReservedForSystem", indices)); + data.setMirroredUnitProtected(pcml.getStringValue(programName + ".receiver.mirroredUnitProtected", indices)); + data.setMirroredUnitReported(pcml.getStringValue(programName + ".receiver.mirroredUnitReported", indices)); + data.setMirroredUnitStatus(pcml.getStringValue(programName + ".receiver.mirroredUnitStatus", indices)); + data.setReserved(pcml.getStringValue(programName + ".receiver.reserved", indices)); + data.setUnitControl(pcml.getIntValue(programName + ".receiver.unitControl", indices)); + data.setBlockTransferredToMainStorage( + pcml.getIntValue(programName + ".receiver.blockTransferredToMainStorage", indices)); + data.setBlockTransferredFromMainStorage( + pcml.getIntValue(programName + ".receiver.blockTransferredFromMainStorage", indices)); + data.setRequestForDataToMainStorage( + pcml.getIntValue(programName + ".receiver.requestForDataToMainStorage", indices)); + data.setRequestForDataForMainStorage( + pcml.getIntValue(programName + ".receiver.requestForDataForMainStorage", indices)); + data.setRequestForPermanentFromMainStorage( + pcml.getIntValue(programName + ".receiver.requestForPermanentFromMainStorage", indices)); + data.setSampleCount(pcml.getIntValue(programName + ".receiver.sampleCount", indices)); + data.setNotBusyCount(pcml.getIntValue(programName + ".receiver.notBusyCount", indices)); + data.setCompressionStatus(pcml.getStringValue(programName + ".receiver.compressionStatus", indices)); + data.setDiskProtectionType(pcml.getStringValue(programName + ".receiver.diskProtectionType", indices)); + data.setCompressedUnit(pcml.getStringValue(programName + ".receiver.compressedUnit", indices)); + data.setStorageAllocationRestrictedUnit( + pcml.getStringValue(programName + ".receiver.storageAllocationRestrictedUnit", indices)); + data.setAvailabilityParitySetUnit( + pcml.getStringValue(programName + ".receiver.availabilityParitySetUnit", indices)); + data.setMultipleConnectionUnit(pcml.getStringValue(programName + ".receiver.multipleConnectionUnit", indices)); + + return data; + } + + protected AS400 getNewAs400() throws AS400SecurityException, IOException { + final SocketProperties properties = new SocketProperties(); + properties.setSoLinger(1); + properties.setKeepAlive(false); + properties.setTcpNoDelay(true); + properties.setLoginTimeout(Conf.as400LoginTimeout); + properties.setSoTimeout(Conf.as400ReadTimeout); + + final AS400 system = new AS400(this.host, this.login, this.password); + system.setSocketProperties(properties); + system.addConnectionListener(new ConnectionListener() { + @Override + public void connected(final ConnectionEvent event) { + ConnectorLogger.getInstance().getLogger().debug("Connect event service : " + event.getService()); + } + + @Override + public void disconnected(final ConnectionEvent event) { + ConnectorLogger.getInstance().getLogger().debug("Disconnect event service : " + event.getService()); + } + }); + + system.validateSignon(); + + return system; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0100Data.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0100Data.java new file mode 100644 index 0000000000..3841d62b6e --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0100Data.java @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +/** + * @author Lamotte Jean-Baptiste + */ +class Yasp0100Data { + private int aspNumber; + String resourceName; + + public int getAspNumber() { + return this.aspNumber; + } + + public String getResourceName() { + return this.resourceName; + } + + public void setAspNumber(final int aspNumber) { + this.aspNumber = aspNumber; + } + + public void setResourceName(final String resourceName) { + this.resourceName = resourceName; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0300Data.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0300Data.java new file mode 100644 index 0000000000..fdb0cdcec2 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/disk/Yasp0300Data.java @@ -0,0 +1,317 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.disk; + +/** + * @author Lamotte Jean-Baptiste + */ +public class Yasp0300Data { + private int aspNumber; + private String diskType; + private String diskModel; + private String diskSerialNumber; + private String resourceName; + private int diskUnitNumber; + private int diskCapacity; + private int diskStorageAvailable; + private int diskStorageReservedForSystem; + private String mirroredUnitProtected; + private String mirroredUnitReported; + private String mirroredUnitStatus; + private String reserved; + private int unitControl; + private int blockTransferredToMainStorage; + private int blockTransferredFromMainStorage; + private int requestForDataToMainStorage; + private int requestForDataForMainStorage; + private int requestForPermanentFromMainStorage; + private int sampleCount; + private int notBusyCount; + private String compressionStatus; + private String diskProtectionType; + private String compressedUnit; + private String storageAllocationRestrictedUnit; + private String availabilityParitySetUnit; + private String multipleConnectionUnit; + + public int getAspNumber() { + return this.aspNumber; + } + + public String getAvailabilityParitySetUnit() { + return this.availabilityParitySetUnit; + } + + public int getBlockTransferredFromMainStorage() { + return this.blockTransferredFromMainStorage; + } + + public int getBlockTransferredToMainStorage() { + return this.blockTransferredToMainStorage; + } + + public String getCompressedUnit() { + return this.compressedUnit; + } + + public String getCompressionStatus() { + return this.compressionStatus; + } + + public int getDiskCapacity() { + return this.diskCapacity; + } + + public String getDiskModel() { + return this.diskModel; + } + + public String getDiskProtectionType() { + return this.diskProtectionType; + } + + public String getDiskSerialNumber() { + return this.diskSerialNumber; + } + + public int getDiskStorageAvailable() { + return this.diskStorageAvailable; + } + + public int getDiskStorageReservedForSystem() { + return this.diskStorageReservedForSystem; + } + + public String getDiskType() { + return this.diskType; + } + + public int getDiskUnitNumber() { + return this.diskUnitNumber; + } + + public String getMirroredUnitProtected() { + return this.mirroredUnitProtected; + } + + public String getMirroredUnitReported() { + return this.mirroredUnitReported; + } + + public String getMirroredUnitStatus() { + return this.mirroredUnitStatus; + } + + public String getMultipleConnectionUnit() { + return this.multipleConnectionUnit; + } + + public int getNotBusyCount() { + return this.notBusyCount; + } + + public int getRequestForDataForMainStorage() { + return this.requestForDataForMainStorage; + } + + public int getRequestForDataToMainStorage() { + return this.requestForDataToMainStorage; + } + + public int getRequestForPermanentFromMainStorage() { + return this.requestForPermanentFromMainStorage; + } + + public String getReserved() { + return this.reserved; + } + + public String getResourceName() { + return this.resourceName; + } + + public int getSampleCount() { + return this.sampleCount; + } + + public String getStorageAllocationRestrictedUnit() { + return this.storageAllocationRestrictedUnit; + } + + public int getUnitControl() { + return this.unitControl; + } + + public String getUnitControlString() { + /* + * 0 There is no unit control value. 1 The disk unit is active. 2 The disk unit + * has failed. 3 Some other disk unit in the disk subsystem has failed. 4 There + * is a hardware failure within the disk subsystem that affects performance, but + * does not affect the function of the disk unit. 5 There is a hardware failure + * within the disk subsystem that does not affect the function or performance of + * the disk unit. 6 The disk unit's parity protection is being rebuilt. 7 The + * disk unit is not ready. 8 The disk unit is write protected. 9 The disk unit + * is busy. 10 The disk unit is not operational. 11 The disk unit has returned a + * status that is not recognizable by the system. 12 The disk unit cannot be + * accessed. 13 The disk unit is read/write protected. + */ + if (this.getUnitControl() == 0) { + return "There is no unit control value"; + } else if (this.getUnitControl() == 1) { + return "The disk unit is active"; + } else if (this.getUnitControl() == 2) { + return "The disk unit has failed"; + } else if (this.getUnitControl() == 3) { + return "Some other disk unit in the disk subsystem has failed"; + } else if (this.getUnitControl() == 4) { + return "There is a hardware failure within the disk subsystem that affects performance, but does not affect the function of the disk unit"; + } else if (this.getUnitControl() == 5) { + return "There is a hardware failure within the disk subsystem that does not affect the function or performance of the disk unit"; + } else if (this.getUnitControl() == 6) { + return "The disk unit's parity protection is being rebuilt"; + } else if (this.getUnitControl() == 7) { + return "The disk unit is not ready"; + } else if (this.getUnitControl() == 8) { + return "The disk unit is write protected"; + } else if (this.getUnitControl() == 9) { + return "The disk unit is busy"; + } else if (this.getUnitControl() == 10) { + return "The disk unit is not operational"; + } else if (this.getUnitControl() == 11) { + return "The disk unit has returned a status that is not recognizable by the system"; + } else if (this.getUnitControl() == 12) { + return "The disk unit cannot be accessed"; + } else if (this.getUnitControl() == 13) { + return "The disk unit is read/write protected"; + } else { + return "state unknown (" + this.getUnitControl() + ")"; + } + } + + public void setAspNumber(final int aspNumber) { + this.aspNumber = aspNumber; + } + + public void setAvailabilityParitySetUnit(final String availabilityParitySetUnit) { + this.availabilityParitySetUnit = availabilityParitySetUnit; + } + + public void setBlockTransferredFromMainStorage(final int blockTransferredFromMainStorage) { + this.blockTransferredFromMainStorage = blockTransferredFromMainStorage; + } + + public void setBlockTransferredToMainStorage(final int blockTransferredToMainStorage) { + this.blockTransferredToMainStorage = blockTransferredToMainStorage; + } + + public void setCompressedUnit(final String compressedUnit) { + this.compressedUnit = compressedUnit; + } + + public void setCompressionStatus(final String compressionStatus) { + this.compressionStatus = compressionStatus; + } + + public void setDiskCapacity(final int diskCapacity) { + this.diskCapacity = diskCapacity; + } + + public void setDiskModel(final String diskModel) { + this.diskModel = diskModel; + } + + public void setDiskProtectionType(final String diskProtectionType) { + this.diskProtectionType = diskProtectionType; + } + + public void setDiskSerialNumber(final String diskSerialNumber) { + this.diskSerialNumber = diskSerialNumber; + } + + public void setDiskStorageAvailable(final int diskStorageAvailable) { + this.diskStorageAvailable = diskStorageAvailable; + } + + public void setDiskStorageReservedForSystem(final int diskStorageReservedForSystem) { + this.diskStorageReservedForSystem = diskStorageReservedForSystem; + } + + public void setDiskType(final String diskType) { + this.diskType = diskType; + } + + public void setDiskUnitNumber(final int diskUnitNumber) { + this.diskUnitNumber = diskUnitNumber; + } + + public void setMirroredUnitProtected(final String mirroredUnitProtected) { + this.mirroredUnitProtected = mirroredUnitProtected; + } + + public void setMirroredUnitReported(final String mirroredUnitReported) { + this.mirroredUnitReported = mirroredUnitReported; + } + + public void setMirroredUnitStatus(final String mirroredUnitStatus) { + this.mirroredUnitStatus = mirroredUnitStatus; + } + + public void setMultipleConnectionUnit(final String multipleConnectionUnit) { + this.multipleConnectionUnit = multipleConnectionUnit; + } + + public void setNotBusyCount(final int notBusyCount) { + this.notBusyCount = notBusyCount; + } + + public void setRequestForDataForMainStorage(final int requestForDataForMainStorage) { + this.requestForDataForMainStorage = requestForDataForMainStorage; + } + + public void setRequestForDataToMainStorage(final int requestForDataToMainStorage) { + this.requestForDataToMainStorage = requestForDataToMainStorage; + } + + public void setRequestForPermanentFromMainStorage(final int requestForPermanentFromMainStorage) { + this.requestForPermanentFromMainStorage = requestForPermanentFromMainStorage; + } + + public void setReserved(final String reserved) { + this.reserved = reserved; + } + + public void setResourceName(final String resourceName) { + this.resourceName = resourceName; + } + + public void setSampleCount(final int sampleCount) { + this.sampleCount = sampleCount; + } + + public void setStorageAllocationRestrictedUnit(final String storageAllocationRestrictedUnit) { + this.storageAllocationRestrictedUnit = storageAllocationRestrictedUnit; + } + + public void setUnitControl(final int unitControl) { + this.unitControl = unitControl; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0100.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0100.java new file mode 100644 index 0000000000..ae3b7e3aa4 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0100.java @@ -0,0 +1,153 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.jobqueue; + +/** + * @author Lamotte Jean-Baptiste + */ +public class Jobq0100 { + private int bytesReturned; + private int bytesAvailable; + private String jobqName; + private String jobqLibName; + private String operatorControlled; + private String authorityCheck; + private int numberOfJob; + private String jobQueueStatus; + private String subSystemName; + private String textDescription; + private String subSystemLibName; + private int sequenceNumber; + private int maximumActive; + private int currentActive; + + public int getBytesReturned() { + return this.bytesReturned; + } + + public void setBytesReturned(final int bytesReturned) { + this.bytesReturned = bytesReturned; + } + + public int getBytesAvailable() { + return this.bytesAvailable; + } + + public void setBytesAvailable(final int bytesAvailable) { + this.bytesAvailable = bytesAvailable; + } + + public String getJobqName() { + return this.jobqName; + } + + public void setJobqName(final String jobqName) { + this.jobqName = jobqName; + } + + public String getJobqLibName() { + return this.jobqLibName; + } + + public void setJobqLibName(final String jobqLibName) { + this.jobqLibName = jobqLibName; + } + + public String getOperatorControlled() { + return this.operatorControlled; + } + + public void setOperatorControlled(final String operatorControlled) { + this.operatorControlled = operatorControlled; + } + + public String getAuthorityCheck() { + return this.authorityCheck; + } + + public void setAuthorityCheck(final String authorityCheck) { + this.authorityCheck = authorityCheck; + } + + public int getNumberOfJob() { + return this.numberOfJob; + } + + public void setNumberOfJob(final int numberOfJob) { + this.numberOfJob = numberOfJob; + } + + public String getJobQueueStatus() { + return this.jobQueueStatus; + } + + public void setJobQueueStatus(final String jobQueueStatus) { + this.jobQueueStatus = jobQueueStatus; + } + + public String getSubSystemName() { + return this.subSystemName; + } + + public void setSubSystemName(final String subSystemName) { + this.subSystemName = subSystemName; + } + + public String getTextDescription() { + return this.textDescription; + } + + public void setTextDescription(final String textDescription) { + this.textDescription = textDescription; + } + + public String getSubSystemLibName() { + return this.subSystemLibName; + } + + public void setSubSystemLibName(final String subSystemLibName) { + this.subSystemLibName = subSystemLibName; + } + + public int getSequenceNumber() { + return this.sequenceNumber; + } + + public void setSequenceNumber(final int sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + public int getMaximumActive() { + return this.maximumActive; + } + + public void setMaximumActive(final int maximumActive) { + this.maximumActive = maximumActive; + } + + public int getCurrentActive() { + return this.currentActive; + } + + public void setCurrentActive(final int currentActive) { + this.currentActive = currentActive; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0200.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0200.java new file mode 100644 index 0000000000..bb1a4e0953 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Jobq0200.java @@ -0,0 +1,403 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.jobqueue; + +/** + * @author Lamotte Jean-Baptiste + */ +public class Jobq0200 extends Jobq0100 { + + private int maxActiveJobPriority1; + private int maxActiveJobPriority2; + private int maxActiveJobPriority3; + private int maxActiveJobPriority4; + private int maxActiveJobPriority5; + private int maxActiveJobPriority6; + private int maxActiveJobPriority7; + private int maxActiveJobPriority8; + private int maxActiveJobPriority9; + + private int activeJobPriority0; + private int activeJobPriority1; + private int activeJobPriority2; + private int activeJobPriority3; + private int activeJobPriority4; + private int activeJobPriority5; + private int activeJobPriority6; + private int activeJobPriority7; + private int activeJobPriority8; + private int activeJobPriority9; + + private int scheduledJobOnQueuePriority0; + private int scheduledJobOnQueuePriority1; + private int scheduledJobOnQueuePriority2; + private int scheduledJobOnQueuePriority3; + private int scheduledJobOnQueuePriority4; + private int scheduledJobOnQueuePriority5; + private int scheduledJobOnQueuePriority6; + private int scheduledJobOnQueuePriority7; + private int scheduledJobOnQueuePriority8; + private int scheduledJobOnQueuePriority9; + + private int heldJobOnQueuePriority0; + private int heldJobOnQueuePriority1; + private int heldJobOnQueuePriority2; + private int heldJobOnQueuePriority3; + private int heldJobOnQueuePriority4; + private int heldJobOnQueuePriority5; + private int heldJobOnQueuePriority6; + private int heldJobOnQueuePriority7; + private int heldJobOnQueuePriority8; + private int heldJobOnQueuePriority9; + + public int getActiveJobTotal() { + return this.activeJobPriority0 + this.activeJobPriority1 + this.activeJobPriority2 + this.activeJobPriority3 + + this.activeJobPriority4 + this.activeJobPriority5 + this.activeJobPriority6 + this.activeJobPriority7 + + this.activeJobPriority8 + this.activeJobPriority9; + } + + public int getScheduledJobTotal() { + return this.scheduledJobOnQueuePriority0 + this.scheduledJobOnQueuePriority1 + this.scheduledJobOnQueuePriority2 + + this.scheduledJobOnQueuePriority3 + this.scheduledJobOnQueuePriority4 + this.scheduledJobOnQueuePriority5 + + this.scheduledJobOnQueuePriority6 + this.scheduledJobOnQueuePriority7 + this.scheduledJobOnQueuePriority8 + + this.scheduledJobOnQueuePriority9; + } + + public int getHeldJobTotal() { + return this.heldJobOnQueuePriority0 + this.heldJobOnQueuePriority1 + this.heldJobOnQueuePriority2 + + this.heldJobOnQueuePriority3 + this.heldJobOnQueuePriority4 + this.heldJobOnQueuePriority5 + + this.heldJobOnQueuePriority6 + this.heldJobOnQueuePriority7 + this.heldJobOnQueuePriority8 + + this.heldJobOnQueuePriority9; + } + + public int getMaxActiveJobPriority1() { + return this.maxActiveJobPriority1; + } + + public void setMaxActiveJobPriority1(final int maxActiveJobPriority1) { + this.maxActiveJobPriority1 = maxActiveJobPriority1; + } + + public int getMaxActiveJobPriority2() { + return this.maxActiveJobPriority2; + } + + public void setMaxActiveJobPriority2(final int maxActiveJobPriority2) { + this.maxActiveJobPriority2 = maxActiveJobPriority2; + } + + public int getMaxActiveJobPriority3() { + return this.maxActiveJobPriority3; + } + + public void setMaxActiveJobPriority3(final int maxActiveJobPriority3) { + this.maxActiveJobPriority3 = maxActiveJobPriority3; + } + + public int getMaxActiveJobPriority4() { + return this.maxActiveJobPriority4; + } + + public void setMaxActiveJobPriority4(final int maxActiveJobPriority4) { + this.maxActiveJobPriority4 = maxActiveJobPriority4; + } + + public int getMaxActiveJobPriority5() { + return this.maxActiveJobPriority5; + } + + public void setMaxActiveJobPriority5(final int maxActiveJobPriority5) { + this.maxActiveJobPriority5 = maxActiveJobPriority5; + } + + public int getMaxActiveJobPriority6() { + return this.maxActiveJobPriority6; + } + + public void setMaxActiveJobPriority6(final int maxActiveJobPriority6) { + this.maxActiveJobPriority6 = maxActiveJobPriority6; + } + + public int getMaxActiveJobPriority7() { + return this.maxActiveJobPriority7; + } + + public void setMaxActiveJobPriority7(final int maxActiveJobPriority7) { + this.maxActiveJobPriority7 = maxActiveJobPriority7; + } + + public int getMaxActiveJobPriority8() { + return this.maxActiveJobPriority8; + } + + public void setMaxActiveJobPriority8(final int maxActiveJobPriority8) { + this.maxActiveJobPriority8 = maxActiveJobPriority8; + } + + public int getMaxActiveJobPriority9() { + return this.maxActiveJobPriority9; + } + + public void setMaxActiveJobPriority9(final int maxActiveJobPriority9) { + this.maxActiveJobPriority9 = maxActiveJobPriority9; + } + + public int getActiveJobPriority1() { + return this.activeJobPriority1; + } + + public void setActiveJobPriority1(final int activeJobPriority1) { + this.activeJobPriority1 = activeJobPriority1; + } + + public int getActiveJobPriority2() { + return this.activeJobPriority2; + } + + public void setActiveJobPriority2(final int activeJobPriority2) { + this.activeJobPriority2 = activeJobPriority2; + } + + public int getActiveJobPriority3() { + return this.activeJobPriority3; + } + + public void setActiveJobPriority3(final int activeJobPriority3) { + this.activeJobPriority3 = activeJobPriority3; + } + + public int getActiveJobPriority4() { + return this.activeJobPriority4; + } + + public void setActiveJobPriority4(final int activeJobPriority4) { + this.activeJobPriority4 = activeJobPriority4; + } + + public int getActiveJobPriority5() { + return this.activeJobPriority5; + } + + public void setActiveJobPriority5(final int activeJobPriority5) { + this.activeJobPriority5 = activeJobPriority5; + } + + public int getActiveJobPriority6() { + return this.activeJobPriority6; + } + + public void setActiveJobPriority6(final int activeJobPriority6) { + this.activeJobPriority6 = activeJobPriority6; + } + + public int getActiveJobPriority7() { + return this.activeJobPriority7; + } + + public void setActiveJobPriority7(final int activeJobPriority7) { + this.activeJobPriority7 = activeJobPriority7; + } + + public int getActiveJobPriority8() { + return this.activeJobPriority8; + } + + public void setActiveJobPriority8(final int activeJobPriority8) { + this.activeJobPriority8 = activeJobPriority8; + } + + public int getActiveJobPriority9() { + return this.activeJobPriority9; + } + + public void setActiveJobPriority9(final int activeJobPriority9) { + this.activeJobPriority9 = activeJobPriority9; + } + + public int getScheduledJobOnQueuePriority1() { + return this.scheduledJobOnQueuePriority1; + } + + public void setScheduledJobOnQueuePriority1(final int scheduledJobOnQueuePriority1) { + this.scheduledJobOnQueuePriority1 = scheduledJobOnQueuePriority1; + } + + public int getScheduledJobOnQueuePriority2() { + return this.scheduledJobOnQueuePriority2; + } + + public void setScheduledJobOnQueuePriority2(final int scheduledJobOnQueuePriority2) { + this.scheduledJobOnQueuePriority2 = scheduledJobOnQueuePriority2; + } + + public int getScheduledJobOnQueuePriority3() { + return this.scheduledJobOnQueuePriority3; + } + + public void setScheduledJobOnQueuePriority3(final int scheduledJobOnQueuePriority3) { + this.scheduledJobOnQueuePriority3 = scheduledJobOnQueuePriority3; + } + + public int getScheduledJobOnQueuePriority4() { + return this.scheduledJobOnQueuePriority4; + } + + public void setScheduledJobOnQueuePriority4(final int scheduledJobOnQueuePriority4) { + this.scheduledJobOnQueuePriority4 = scheduledJobOnQueuePriority4; + } + + public int getScheduledJobOnQueuePriority5() { + return this.scheduledJobOnQueuePriority5; + } + + public void setScheduledJobOnQueuePriority5(final int scheduledJobOnQueuePriority5) { + this.scheduledJobOnQueuePriority5 = scheduledJobOnQueuePriority5; + } + + public int getScheduledJobOnQueuePriority6() { + return this.scheduledJobOnQueuePriority6; + } + + public void setScheduledJobOnQueuePriority6(final int scheduledJobOnQueuePriority6) { + this.scheduledJobOnQueuePriority6 = scheduledJobOnQueuePriority6; + } + + public int getScheduledJobOnQueuePriority7() { + return this.scheduledJobOnQueuePriority7; + } + + public void setScheduledJobOnQueuePriority7(final int scheduledJobOnQueuePriority7) { + this.scheduledJobOnQueuePriority7 = scheduledJobOnQueuePriority7; + } + + public int getScheduledJobOnQueuePriority8() { + return this.scheduledJobOnQueuePriority8; + } + + public void setScheduledJobOnQueuePriority8(final int scheduledJobOnQueuePriority8) { + this.scheduledJobOnQueuePriority8 = scheduledJobOnQueuePriority8; + } + + public int getScheduledJobOnQueuePriority9() { + return this.scheduledJobOnQueuePriority9; + } + + public void setScheduledJobOnQueuePriority9(final int scheduledJobOnQueuePriority9) { + this.scheduledJobOnQueuePriority9 = scheduledJobOnQueuePriority9; + } + + public int getHeldJobOnQueuePriority1() { + return this.heldJobOnQueuePriority1; + } + + public void setHeldJobOnQueuePriority1(final int heldJobOnQueuePriority1) { + this.heldJobOnQueuePriority1 = heldJobOnQueuePriority1; + } + + public int getHeldJobOnQueuePriority2() { + return this.heldJobOnQueuePriority2; + } + + public void setHeldJobOnQueuePriority2(final int heldJobOnQueuePriority2) { + this.heldJobOnQueuePriority2 = heldJobOnQueuePriority2; + } + + public int getHeldJobOnQueuePriority3() { + return this.heldJobOnQueuePriority3; + } + + public void setHeldJobOnQueuePriority3(final int heldJobOnQueuePriority3) { + this.heldJobOnQueuePriority3 = heldJobOnQueuePriority3; + } + + public int getHeldJobOnQueuePriority4() { + return this.heldJobOnQueuePriority4; + } + + public void setHeldJobOnQueuePriority4(final int heldJobOnQueuePriority4) { + this.heldJobOnQueuePriority4 = heldJobOnQueuePriority4; + } + + public int getHeldJobOnQueuePriority5() { + return this.heldJobOnQueuePriority5; + } + + public void setHeldJobOnQueuePriority5(final int heldJobOnQueuePriority5) { + this.heldJobOnQueuePriority5 = heldJobOnQueuePriority5; + } + + public int getHeldJobOnQueuePriority6() { + return this.heldJobOnQueuePriority6; + } + + public void setHeldJobOnQueuePriority6(final int heldJobOnQueuePriority6) { + this.heldJobOnQueuePriority6 = heldJobOnQueuePriority6; + } + + public int getHeldJobOnQueuePriority7() { + return this.heldJobOnQueuePriority7; + } + + public void setHeldJobOnQueuePriority7(final int heldJobOnQueuePriority7) { + this.heldJobOnQueuePriority7 = heldJobOnQueuePriority7; + } + + public int getHeldJobOnQueuePriority8() { + return this.heldJobOnQueuePriority8; + } + + public void setHeldJobOnQueuePriority8(final int heldJobOnQueuePriority8) { + this.heldJobOnQueuePriority8 = heldJobOnQueuePriority8; + } + + public int getHeldJobOnQueuePriority9() { + return this.heldJobOnQueuePriority9; + } + + public void setHeldJobOnQueuePriority9(final int heldJobOnQueuePriority9) { + this.heldJobOnQueuePriority9 = heldJobOnQueuePriority9; + } + + public int getActiveJobPriority0() { + return this.activeJobPriority0; + } + + public void setActiveJobPriority0(final int activeJobPriority0) { + this.activeJobPriority0 = activeJobPriority0; + } + + public int getScheduledJobOnQueuePriority0() { + return this.scheduledJobOnQueuePriority0; + } + + public void setScheduledJobOnQueuePriority0(final int scheduledJobOnQueuePriority0) { + this.scheduledJobOnQueuePriority0 = scheduledJobOnQueuePriority0; + } + + public int getHeldJobOnQueuePriority0() { + return this.heldJobOnQueuePriority0; + } + + public void setHeldJobOnQueuePriority0(final int heldJobOnQueuePriority0) { + this.heldJobOnQueuePriority0 = heldJobOnQueuePriority0; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq100Handler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq100Handler.java new file mode 100644 index 0000000000..69abbe0a82 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq100Handler.java @@ -0,0 +1,91 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.jobqueue; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Message; +import com.ibm.as400.data.ProgramCallDocument; + +/** + * @author Lamotte Jean-Baptiste + */ +public class Qsprjobq100Handler { + private final String pcmlFile = "qsprjobq100.pcml"; + + private AS400 system = null; + + public Qsprjobq100Handler(final AS400 system) { + this.system = system; + } + + private void displayMessageError(final ProgramCallDocument pcml, final String programmName) throws Exception { + final AS400Message[] msgs = pcml.getMessageList(programmName); + + for (final AS400Message msg : msgs) { + final String msgId = msg.getID(); + final String msgText = msg.getText(); + throw new Exception("" + msgId + " - " + msgText); + } + } + + public Jobq0100 loadJobq0100(final String jobqName, final String lib) throws Exception { + + String qualifiedQueueName = jobqName; + while (qualifiedQueueName.length() < 10) { + qualifiedQueueName += " "; + } + qualifiedQueueName += lib; + + final ProgramCallDocument pcml = new ProgramCallDocument(this.system, this.pcmlFile); + + pcml.setValue("qsprjobq.receiverLength", pcml.getOutputsize("qsprjobq.receiver")); + pcml.setValue("qsprjobq.qualifiedJobQueueName", qualifiedQueueName); + // pcml.setValue("qsprjobq.qualifiedJobQueueName", jobqName); + + // If return code is false, we received messages from the server + if (pcml.callProgram("qsprjobq") == false) { + this.displayMessageError(pcml, "qsprjobq"); + } else { + final int[] indices = new int[1]; + indices[0] = 0; + + final Jobq0100 jobq0100 = new Jobq0100(); + + jobq0100.setAuthorityCheck(pcml.getStringValue("qsprjobq.receiver.authorityCheck", indices)); + jobq0100.setBytesAvailable(pcml.getIntValue("qsprjobq.receiver.bytesAvailable", indices)); + jobq0100.setBytesReturned(pcml.getIntValue("qsprjobq.receiver.bytesReturned", indices)); + jobq0100.setCurrentActive(pcml.getIntValue("qsprjobq.receiver.currentActive", indices)); + jobq0100.setJobqLibName(pcml.getStringValue("qsprjobq.receiver.jobqLibName", indices)); + jobq0100.setJobqName(pcml.getStringValue("qsprjobq.receiver.jobqName", indices)); + jobq0100.setJobQueueStatus(pcml.getStringValue("qsprjobq.receiver.jobQueueStatus", indices)); + jobq0100.setMaximumActive(pcml.getIntValue("qsprjobq.receiver.maximumActive", indices)); + jobq0100.setNumberOfJob(pcml.getIntValue("qsprjobq.receiver.numberOfJob", indices)); + jobq0100.setOperatorControlled(pcml.getStringValue("qsprjobq.receiver.operatorControlled", indices)); + jobq0100.setSequenceNumber(pcml.getIntValue("qsprjobq.receiver.sequenceNumber", indices)); + jobq0100.setSubSystemLibName(pcml.getStringValue("qsprjobq.receiver.subSystemLibName", indices)); + jobq0100.setSubSystemName(pcml.getStringValue("qsprjobq.receiver.subSystemName", indices)); + jobq0100.setTextDescription(pcml.getStringValue("qsprjobq.receiver.textDescription", indices)); + + return jobq0100; + } + return null; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq200Handler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq200Handler.java new file mode 100644 index 0000000000..a4ce2bae68 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/impl/jobqueue/Qsprjobq200Handler.java @@ -0,0 +1,144 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.impl.jobqueue; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400Message; +import com.ibm.as400.data.ProgramCallDocument; + +/** + * @author Lamotte Jean-Baptiste + */ +public class Qsprjobq200Handler { + private final String pcmlFile = "qsprjobq200.pcml"; + + private AS400 system = null; + + public Qsprjobq200Handler(final AS400 system) { + this.system = system; + } + + private void displayMessageError(final ProgramCallDocument pcml, final String programmName) throws Exception { + final AS400Message[] msgs = pcml.getMessageList(programmName); + + for (final AS400Message msg : msgs) { + final String msgId = msg.getID(); + final String msgText = msg.getText(); + throw new Exception("" + msgId + " - " + msgText); + } + } + + public Jobq0200 loadJobq0200(final String jobqName, final String lib) throws Exception { + + String qualifiedQueueName = jobqName; + while (qualifiedQueueName.length() < 10) { + qualifiedQueueName += " "; + } + qualifiedQueueName += lib; + + final ProgramCallDocument pcml = new ProgramCallDocument(this.system, this.pcmlFile); + + pcml.setValue("qsprjobq.receiverLength", pcml.getOutputsize("qsprjobq.receiver")); + pcml.setValue("qsprjobq.qualifiedJobQueueName", qualifiedQueueName); + // pcml.setValue("qsprjobq.qualifiedJobQueueName", jobqName); + + // If return code is false, we received messages from the server + if (pcml.callProgram("qsprjobq") == false) { + this.displayMessageError(pcml, "qsprjobq"); + } else { + final int[] indices = new int[1]; + indices[0] = 0; + + final Jobq0200 jobq0200 = new Jobq0200(); + + jobq0200.setBytesReturned(pcml.getIntValue("qsprjobq.receiver.bytesReturned", indices)); + jobq0200.setBytesAvailable(pcml.getIntValue("qsprjobq.receiver.bytesAvailable", indices)); + jobq0200.setJobqName(pcml.getStringValue("qsprjobq.receiver.jobqName", indices)); + jobq0200.setJobqLibName(pcml.getStringValue("qsprjobq.receiver.jobqLibName", indices)); + jobq0200.setOperatorControlled(pcml.getStringValue("qsprjobq.receiver.operatorControlled", indices)); + jobq0200.setAuthorityCheck(pcml.getStringValue("qsprjobq.receiver.authorityCheck", indices)); + jobq0200.setNumberOfJob(pcml.getIntValue("qsprjobq.receiver.numberOfJob", indices)); + jobq0200.setJobQueueStatus(pcml.getStringValue("qsprjobq.receiver.jobQueueStatus", indices)); + jobq0200.setSubSystemName(pcml.getStringValue("qsprjobq.receiver.subSystemName", indices)); + jobq0200.setSubSystemLibName(pcml.getStringValue("qsprjobq.receiver.subSystemLibName", indices)); + jobq0200.setTextDescription(pcml.getStringValue("qsprjobq.receiver.textDescription", indices)); + jobq0200.setSequenceNumber(pcml.getIntValue("qsprjobq.receiver.sequenceNumber", indices)); + jobq0200.setMaximumActive(pcml.getIntValue("qsprjobq.receiver.maximumActive", indices)); + jobq0200.setCurrentActive(pcml.getIntValue("qsprjobq.receiver.currentActive", indices)); + + jobq0200.setMaxActiveJobPriority1(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority1", indices)); + jobq0200.setMaxActiveJobPriority2(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority2", indices)); + jobq0200.setMaxActiveJobPriority3(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority3", indices)); + jobq0200.setMaxActiveJobPriority4(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority4", indices)); + jobq0200.setMaxActiveJobPriority5(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority5", indices)); + jobq0200.setMaxActiveJobPriority6(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority6", indices)); + jobq0200.setMaxActiveJobPriority7(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority7", indices)); + jobq0200.setMaxActiveJobPriority8(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority8", indices)); + jobq0200.setMaxActiveJobPriority9(pcml.getIntValue("qsprjobq.receiver.maxActiveJobPriority9", indices)); + + jobq0200.setActiveJobPriority0(pcml.getIntValue("qsprjobq.receiver.activeJobPriority0", indices)); + jobq0200.setActiveJobPriority1(pcml.getIntValue("qsprjobq.receiver.activeJobPriority1", indices)); + jobq0200.setActiveJobPriority2(pcml.getIntValue("qsprjobq.receiver.activeJobPriority2", indices)); + jobq0200.setActiveJobPriority3(pcml.getIntValue("qsprjobq.receiver.activeJobPriority3", indices)); + jobq0200.setActiveJobPriority4(pcml.getIntValue("qsprjobq.receiver.activeJobPriority4", indices)); + jobq0200.setActiveJobPriority5(pcml.getIntValue("qsprjobq.receiver.activeJobPriority5", indices)); + jobq0200.setActiveJobPriority6(pcml.getIntValue("qsprjobq.receiver.activeJobPriority6", indices)); + jobq0200.setActiveJobPriority7(pcml.getIntValue("qsprjobq.receiver.activeJobPriority7", indices)); + jobq0200.setActiveJobPriority8(pcml.getIntValue("qsprjobq.receiver.activeJobPriority8", indices)); + jobq0200.setActiveJobPriority9(pcml.getIntValue("qsprjobq.receiver.activeJobPriority9", indices)); + + jobq0200 + .setScheduledJobOnQueuePriority0(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority0", indices)); + jobq0200 + .setScheduledJobOnQueuePriority1(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority1", indices)); + jobq0200 + .setScheduledJobOnQueuePriority2(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority2", indices)); + jobq0200 + .setScheduledJobOnQueuePriority3(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority3", indices)); + jobq0200 + .setScheduledJobOnQueuePriority4(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority4", indices)); + jobq0200 + .setScheduledJobOnQueuePriority5(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority5", indices)); + jobq0200 + .setScheduledJobOnQueuePriority6(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority6", indices)); + jobq0200 + .setScheduledJobOnQueuePriority7(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority7", indices)); + jobq0200 + .setScheduledJobOnQueuePriority8(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority8", indices)); + jobq0200 + .setScheduledJobOnQueuePriority9(pcml.getIntValue("qsprjobq.receiver.scheduledJobOnQueuePriority9", indices)); + + jobq0200.setHeldJobOnQueuePriority0(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority0", indices)); + jobq0200.setHeldJobOnQueuePriority1(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority1", indices)); + jobq0200.setHeldJobOnQueuePriority2(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority2", indices)); + jobq0200.setHeldJobOnQueuePriority3(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority3", indices)); + jobq0200.setHeldJobOnQueuePriority4(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority4", indices)); + jobq0200.setHeldJobOnQueuePriority5(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority5", indices)); + jobq0200.setHeldJobOnQueuePriority6(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority6", indices)); + jobq0200.setHeldJobOnQueuePriority7(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority7", indices)); + jobq0200.setHeldJobOnQueuePriority8(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority8", indices)); + jobq0200.setHeldJobOnQueuePriority9(pcml.getIntValue("qsprjobq.receiver.heldJobOnQueuePriority9", indices)); + + return jobq0200; + } + return null; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandler.java new file mode 100644 index 0000000000..ea8d53de00 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandler.java @@ -0,0 +1,289 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.msgqueue; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.MessageQueue; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.QueuedMessage; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.ICachedMessageQueueHandler; +import com.centreon.connector.as400.check.handler.impl.AbstractHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; +import com.centreon.connector.as400.utils.BlowFishUtils; + +public class CachedMessageQueueHandler extends AbstractHandler implements ICachedMessageQueueHandler { + + static int PAGINATE_SIZE = 50; + private static Map LAST_MESSAGES = java.util.Collections + .synchronizedMap(new HashMap()); + + public static String dumpLightMessage(QueuedMessage m) { + StringBuilder sb = new StringBuilder(); + sb.append("[").append(m.getDate().getTime()).append("] ").append("(").append(m.getSeverity()).append(") ") + .append(m.getID()).append(":").append(m.getText().replace('|', ' ')).append(" [JobName: ") + .append(m.getFromJobName()).append("][JobNumber: ").append(m.getFromJobNumber()).append("][User: ") + .append(m.getUser()).append("]"); + + return sb.toString(); + } + + public static String dumpMessage(QueuedMessage m) { + final String newLine = "\n"; + StringBuilder sb = new StringBuilder(); + sb.append("[").append(m.getDate().getTime()).append("] ").append("(").append(m.getSeverity()).append(") ") + .append(m.getID()).append(":").append(m.getText().replace('|', ' ')).append(" [JobName: ") + .append(m.getFromJobName()).append("][JobNumber: ").append(m.getFromJobNumber()).append("][User: ") + .append(m.getUser()).append("]"); + + sb.append("getModificationDate: ").append(m.getModificationDate()).append(newLine).append("getAlertOption: ") + .append(m.getAlertOption()).append(newLine).append("getCurrentUser: ").append(m.getCurrentUser()) + .append(newLine).append("getDataCcsidConversionStatusIndicator: ") + .append(m.getDataCcsidConversionStatusIndicator()).append(newLine).append("getDefaultReply: ") + .append(m.getDefaultReply()).append(newLine).append("getFileName: ").append(m.getFileName()).append(newLine) + .append("getFromJobName: ").append(m.getFromJobName()).append(newLine).append("getFromJobNumber: ") + .append(m.getFromJobNumber()).append(newLine).append("getFromProgram: ").append(m.getFromProgram()) + .append(newLine).append("getLibraryName: ").append(m.getLibraryName()).append(newLine).append("getQueue: ") + .append(m.getQueue()).append(newLine).append("getMessage: ").append(m.getMessage()).append(newLine) + .append("getMessageFileLibrarySpecified: ").append(m.getMessageFileLibrarySpecified()).append(newLine) + .append("getMessageHelp: ").append(m.getMessageHelp()).append(newLine).append("getMessageHelpFormat: ") + .append(m.getMessageHelpFormat()).append(newLine).append("getMessageHelpReplacement: ") + .append(m.getMessageHelpReplacement()).append(newLine).append("getMessageHelpReplacementandFormat: ") + .append(m.getMessageHelpReplacementandFormat()).append(newLine).append("getPath: ").append(m.getPath()) + .append(newLine).append("getReceivingModuleName: ").append(m.getReceivingModuleName()).append(newLine) + .append("getReceivingProcedureName: ").append(m.getReceivingProcedureName()).append(newLine) + .append("getReceivingProgramInstructionNumber: ").append(m.getReceivingProgramInstructionNumber()) + .append(newLine).append("getReceivingProgramName: ").append(m.getReceivingProgramName()).append(newLine) + .append("getReceivingType: ").append(m.getReceivingType()).append(newLine).append("getReplyStatus: ") + .append(m.getReplyStatus()).append(newLine).append("getRequestStatus: ").append(m.getRequestStatus()) + .append(newLine).append("getReceiverStatementNumbers: ").append(m.getReceiverStatementNumbers()).append(newLine) + .append("getRequestLevel: ").append(m.getRequestLevel()).append(newLine).append("getSenderType: ") + .append(m.getSenderType()).append(newLine).append("getSendingModuleName: ").append(m.getSendingModuleName()) + .append(newLine).append("getSendingProcedureName: ").append(m.getSendingProcedureName()).append(newLine) + .append("getSendingProgramInstructionNumber: ").append(m.getSendingProgramInstructionNumber()).append(newLine) + .append("getSendingProgramName: ").append(m.getSendingProgramName()).append(newLine).append("getSendingType: ") + .append(m.getSendingType()).append(newLine).append("getSendingUserProfile: ").append(m.getSendingUserProfile()) + .append(newLine).append("getSendingStatementNumbers: ").append(m.getSendingStatementNumbers()).append(newLine) + .append("getSeverity: ").append(m.getSeverity()).append(newLine).append("getSubstitutionData: ") + .append(m.getSubstitutionData()).append(newLine).append("getCcsidCodedCharacterSetIdentifierForData: ") + .append(m.getCcsidCodedCharacterSetIdentifierForData()).append(newLine) + .append("getCcsidCodedCharacterSetIdentifierForText: ").append(m.getCcsidCodedCharacterSetIdentifierForText()) + .append(newLine).append("getCcsidconversionStatusIndicatorForData: ") + .append(m.getCcsidconversionStatusIndicatorForData()).append(newLine) + .append("getCcsidConversionStatusIndicatorForText: ").append(m.getCcsidConversionStatusIndicatorForText()) + .append(newLine); + + return sb.toString(); + } + + public CachedMessageQueueHandler(final String host, final String login, final String password) { + super(host, login, password); + } + + @Override + public ResponseData getNewMessageInMessageQueue(final String messageQueuePath, final String messageIdfilterPattern, + final int minSeverityLevel, final int maxSeverityLevel) + throws Exception { + + StringBuilder dbIdentifier = new StringBuilder(); + dbIdentifier.append(messageQueuePath).append(messageIdfilterPattern).append(minSeverityLevel) + .append(maxSeverityLevel); + + final Collection messages = this.synchronizeDB(messageQueuePath, dbIdentifier.toString()); + + if (messages == null) { + return new ResponseData(ResponseData.statusOk, "Initialisation of the local DB"); + } + + final ResponseData data = new ResponseData(); + + for (final QueuedMessage message : messages) { + if ((message.getSeverity() >= minSeverityLevel) && (message.getSeverity() < maxSeverityLevel)) { + if ("A".equals(message.getReplyStatus())) { + // The message has been acknowledge already and we don't take it into account + continue; + } + + final String messageId = message.getID(); + if (messageIdfilterPattern != null && !messageId.matches(messageIdfilterPattern)) { + continue; + } + + HashMap attrs = new HashMap(); + attrs.put("id", messageId); + attrs.put("text", message.getText()); + attrs.put("severity", message.getSeverity()); + attrs.put("date", message.getDate().getTimeInMillis()); + attrs.put("jobName", message.getFromJobName()); + attrs.put("jobNumber", message.getFromJobNumber()); + attrs.put("user", message.getUser()); + data.getResult().add(attrs); + } + } + + return data; + } + + /** + * Synchronize DB and return the new messages + * + * @param messageQueuePath + * @return the new messages + * @throws AS400SecurityException + * @throws IOException + * @throws ErrorCompletingRequestException + * @throws InterruptedException + * @throws ObjectDoesNotExistException + */ + private Collection synchronizeDB(final String messageQueuePath, final String dbIdentifier) + throws AS400SecurityException, IOException, ErrorCompletingRequestException, InterruptedException, + ObjectDoesNotExistException { + + String key = BlowFishUtils.encrypt(host + login + dbIdentifier); + QueuedMessage previousLastMessage = CachedMessageQueueHandler.LAST_MESSAGES.get(key); + + final AS400 system = this.getNewAs400(); + final MessageQueue queue = new MessageQueue(system, messageQueuePath); + queue.setListDirection(false); + + Collection newMessages = null; + + if (previousLastMessage == null) { + final QueuedMessage[] messages = queue.getMessages(0, 1); + CachedMessageQueueHandler.LAST_MESSAGES.put(key, messages[0]); + } else { + newMessages = new LinkedList(); + int position = 0; + final int lenght = queue.getLength(); + boolean foundMessage = false; + boolean firstLoop = true; + + ConnectorLogger.getInstance().trace("*********************************************************"); + ConnectorLogger.getInstance().trace(" Check message for key: " + key); + ConnectorLogger.getInstance().trace(" Last message was: "); + ConnectorLogger.getInstance().trace(CachedMessageQueueHandler.dumpLightMessage(previousLastMessage)); + + while (position < lenght && !foundMessage) { + final QueuedMessage[] messages = queue.getMessages(position, CachedMessageQueueHandler.PAGINATE_SIZE); + position += CachedMessageQueueHandler.PAGINATE_SIZE; + + for (QueuedMessage message : messages) { + if (firstLoop) { + firstLoop = false; + CachedMessageQueueHandler.LAST_MESSAGES.put(key, message); + ConnectorLogger.getInstance().trace(" New message is:"); + ConnectorLogger.getInstance().trace(CachedMessageQueueHandler.dumpLightMessage(message)); + } + if (this.customMessageEquals(message, previousLastMessage) + || message.getDate().before(previousLastMessage.getDate())) { + foundMessage = true; + break; + } else { + newMessages.add(message); + } + } + } + } + system.disconnectService(AS400.COMMAND); + system.disconnectAllServices(); + + return newMessages; + } + + /** + * + * @param a Message to compare with + * @param b Message to compare to + * @return True if all the used fields are equals. False otherwise. + */ + private boolean customMessageEquals(QueuedMessage a, QueuedMessage b) { + if (a == null) { + if (b == null) { + return true; + } else { + return false; + } + } + if (b == null) { + return false; + } + + if (a.getDate() == null) { + if (b.getDate() != null) + return false; + } else { + if (!a.getDate().equals(b.getDate())) + return false; + } + + if (a.getSeverity() != b.getSeverity()) + return false; + + if (a.getID() == null) { + if (b.getID() != null) + return false; + } else { + if (!a.getID().equals(b.getID())) + return false; + } + + if (a.getText() == null) { + if (b.getText() != null) + return false; + } else { + if (!a.getText().equals(b.getText())) + return false; + } + + if (a.getFromJobName() == null) { + if (b.getFromJobName() != null) + return false; + } else { + if (!a.getFromJobName().equals(b.getFromJobName())) + return false; + } + + if (a.getFromJobNumber() == null) { + if (b.getFromJobNumber() != null) + return false; + } else { + if (!a.getFromJobNumber().equals(b.getFromJobNumber())) + return false; + } + + if (a.getUser() == null) { + if (b.getUser() != null) + return false; + } else { + if (!a.getUser().equals(b.getUser())) + return false; + } + return true; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/MessageQueueHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/MessageQueueHandler.java new file mode 100644 index 0000000000..8431de8614 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/msgqueue/MessageQueueHandler.java @@ -0,0 +1,128 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.msgqueue; + +import java.io.IOException; +import java.util.Collection; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.HashMap; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.AS400SecurityException; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.MessageQueue; +import com.ibm.as400.access.ObjectDoesNotExistException; +import com.ibm.as400.access.QueuedMessage; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.IMessageQueueHandler; +import com.centreon.connector.as400.check.handler.impl.AbstractHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public class MessageQueueHandler extends AbstractHandler implements IMessageQueueHandler { + + public MessageQueueHandler(final String host, final String login, final String password) { + super(host, login, password); + } + + @Override + public void dumpMessageQueue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, + IOException, ObjectDoesNotExistException { + final AS400 system = this.getNewAs400(); + /* + * MessageQueue messageQueue = new MessageQueue(system); + * messageQueue.getHelpTextFormatting(); messageQueue.getLength(); + * messageQueue.getListDirection(); messageQueue.getMessages(); + * messageQueue.getMessages(-1, -1); messageQueue.getPath(); + * messageQueue.getSelection(); messageQueue.getSeverity(); + * messageQueue.getSort(); messageQueue.getSystem(); + * messageQueue.getUserStartingMessageKey(); + * messageQueue.getWorkstationStartingMessageKey(); + */ + final MessageQueue queue = new MessageQueue(system, MessageQueue.CURRENT); + + @SuppressWarnings("rawtypes") + final Enumeration e = queue.getMessages(); + + while (e.hasMoreElements()) { + final QueuedMessage message = (QueuedMessage) e.nextElement(); + System.out.println(message.getText().replace('|', ' ')); + } + + } + + @Override + public ResponseData getErrorMessageQueue(final String messageQueuePath, final String messageIdfilterPattern, + final int minSeverityLevel, final int maxSeverityLevel) throws Exception { + final ResponseData data = new ResponseData(); + + final AS400 system = this.getNewAs400(); + try { + final Collection messagesFound = new LinkedList(); + + final MessageQueue queue = new MessageQueue(system, messageQueuePath); + + @SuppressWarnings("rawtypes") + final Enumeration e = queue.getMessages(); + + long errorCount = 0; + while (e.hasMoreElements()) { + + final QueuedMessage message = (QueuedMessage) e.nextElement(); + ConnectorLogger.getInstance() + .debug("Message found : " + message.getID() + " - " + message.getText().replace('|', ' ')); + + if ((message.getSeverity() >= minSeverityLevel) && (message.getSeverity() < maxSeverityLevel)) { + if ("A".equals(message.getReplyStatus())) { + // The message has been acknowledge already and we don't take it into account + continue; + } + + final String messageId = message.getID(); + if (messageIdfilterPattern != null && !messageId.matches(messageIdfilterPattern)) { + continue; + } + + HashMap attrs = new HashMap(); + attrs.put("id", messageId); + attrs.put("text", message.getText()); + attrs.put("severity", message.getSeverity()); + attrs.put("date", message.getDate().getTimeInMillis()); + attrs.put("jobName", message.getFromJobName()); + attrs.put("jobNumber", message.getFromJobNumber()); + attrs.put("user", message.getUser()); + data.getResult().add(attrs); + } + } + } catch (final Exception e) { + system.disconnectService(AS400.COMMAND); + system.disconnectAllServices(); + throw e; + } + system.disconnectService(AS400.COMMAND); + system.disconnectAllServices(); + + return data; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/CheckAS400Lang.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/CheckAS400Lang.java new file mode 100755 index 0000000000..75a5be4f98 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/CheckAS400Lang.java @@ -0,0 +1,142 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.wrkprb; + +public class CheckAS400Lang { + // These constants are referenced during parsing so + // that the correct phrases are found. + + // This is found at the bottom when you type dspjob (name of a job + // that exists) + public String SELECTION = "Selection"; + + // This is the status of job or sbs when you type dspjob or dspsbsd + public String ACTIVE = "ACTIVE"; + + // This is the "DB Capability" dsplay when you type wrksyssts + public String DB_CAPABILITY = "DB capability"; + + // This is le display for the login screen + public String LOGIN_SCREEN = "System . . . . ."; + + // Run dspmsg and it will display "No messages available" if there are no + // messages + public String NO_MESSAGES_AVAILABLE = "No messages available"; + + // The "password has expired"/"password expires" messages are the messages + // you get when you login with an account which has an expired/will expire + // password. + public String PASSWORD_HAS_EXPIRED = "Password has expired"; + public String PASSWORD_EXPIRES = "password expires"; + + // The "Display Messages" is what you get after logging into an account + // which displays any messages before continuing to the menu. + public String DISPLAY_MESSAGES = "Display Messages"; + + // Run wrkoutq blah* and it will say "(No output queues)" + public String NO_OUTPUT_QUEUES = "No output queues"; + + // If you type dspsbsd blah it will say "...not found..." + public static String NOT_FOUND = "not found"; + + // If you type dspjob QINTER, it should complain that there are duplicate + // jobs and print at the bottom of the window "duplicate jobs found" + public String DUPLICATE = "Duplicate"; + + // if you type dspjob blah, it will respond Job //blah not found + // Only put the Job // part. + public String JOB = "Job //"; + + // If try and execute a command that you are not allowed it will say + // "library *LIBL not allowed" + public String LIBRARY_NOT_ALLOWED = "library *LIBL not allowed"; + + // On a login with an expired password we look for "Exit sign-on" on the + // screen before we send the F3 to exit and disconnect. + public static String EXIT_SIGNON = "Exit sign-on request"; + + // If you type WRKACTJOB it may respond "No active jobs to display" + // when there is no job like searched for in the sytem + public String NO_JOB_TO_DISPLAY = "No active jobs to display"; + + // Messages needing a reply OR Messages not needing a reply + public String MSG_NEED_REPLY = "Messages needing a reply"; + public String MSG_NOT_NEED_REPLY = "Messages not needing a reply"; + + // WRKDSKSTS The "Request/Compression/Bottom" message. + public String REQUEST_WORD = "Request"; + public String DSK_STS_COMPRESSION = "Compression"; + public String LIST_END = "Bottom"; + + public CheckAS400Lang(String lang) { + if (lang != null && lang.equals("fr")) { + this.setLangFr(); + } else { + this.setLangEn(); + } + } + + public void setLangFr() { + this.SELECTION = "Selection"; + this.ACTIVE = "ACTIVE"; + this.DB_CAPABILITY = "DB capability"; + this.LOGIN_SCREEN = "System . . . . ."; + this.NO_MESSAGES_AVAILABLE = "No messages available"; + this.PASSWORD_HAS_EXPIRED = "Password has expired"; + this.PASSWORD_EXPIRES = "password expires"; + this.DISPLAY_MESSAGES = "Display Messages"; + this.NO_OUTPUT_QUEUES = "No output queues"; + this.NOT_FOUND = "not found"; + this.DUPLICATE = "Duplicate"; + this.JOB = "Job //"; + this.LIBRARY_NOT_ALLOWED = "library *LIBL not allowed"; + this.EXIT_SIGNON = "Exit sign-on request"; + this.NO_JOB_TO_DISPLAY = "No active jobs to display"; + this.MSG_NEED_REPLY = "Messages needing a reply"; + this.MSG_NOT_NEED_REPLY = "Messages not needing a reply"; + this.REQUEST_WORD = "Request"; + this.DSK_STS_COMPRESSION = "Compression"; + this.LIST_END = "Bottom"; + } + + public void setLangEn() { + this.SELECTION = "Selection"; + this.ACTIVE = "ACTIVE"; + this.DB_CAPABILITY = "DB capability"; + this.LOGIN_SCREEN = "System . . . . ."; + this.NO_MESSAGES_AVAILABLE = "No messages available"; + this.PASSWORD_HAS_EXPIRED = "Password has expired"; + this.PASSWORD_EXPIRES = "password expires"; + this.DISPLAY_MESSAGES = "Display Messages"; + this.NO_OUTPUT_QUEUES = "No output queues"; + this.NOT_FOUND = "not found"; + this.DUPLICATE = "Duplicate"; + this.JOB = "Job //"; + this.LIBRARY_NOT_ALLOWED = "library *LIBL not allowed"; + this.EXIT_SIGNON = "Exit sign-on request"; + this.NO_JOB_TO_DISPLAY = "No active jobs to display"; + this.MSG_NEED_REPLY = "Messages needing a reply"; + this.MSG_NOT_NEED_REPLY = "Messages not needing a reply"; + this.REQUEST_WORD = "Request"; + this.DSK_STS_COMPRESSION = "Compression"; + this.LIST_END = "Bottom"; + } +}; diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/ColorCodes.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/ColorCodes.java new file mode 100644 index 0000000000..2519e8a799 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/ColorCodes.java @@ -0,0 +1,109 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.wrkprb; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +//Example Use +/* + * Color code format WITH background color -> :foreground,background: + * Color code format WITHOUT background color -> :foreground,N: + * Reset Color format -> [RC] + * + * Example Use: + * String ansiColoredString = ColorCodes.ParseColors("Hello, This :blue,n:is[RC] a :red,white:response[RC]."); + * - or - + * String ansiColoredString = ColorCodes.RED + "Hello" + ColorCodes.WHITE + ". This is a " + ColorColorCodes.BLUE + "test"; + */ + +/** + * Class used for ANSI Color manipulation in a console supporting ANSI color + * codes + */ +public class ColorCodes { + + public static final String RESET = "\u001B[0m"; + public static final String BLACK = "\u001B[30;40;1m"; + public static final String RED = "\u001B[31;40;1m"; + public static final String GREEN = "\u001B[32;40;1m"; + public static final String YELLOW = "\u001B[33;40;1m"; + public static final String BLUE = "\u001B[34;40;1m"; + public static final String PURPLE = "\u001B[35;40;1m"; + public static final String CYAN = "\u001B[36;40;1m"; + public static final String WHITE = "\u001B[37;40;1m"; + + /** + * Parses a string with ANSI color codes based on the input + * + * @param input the input string + * @return the parsed ANSI string + */ + public static String ParseColors(final String input) { + String ret = input; + Pattern regexChecker = Pattern.compile(":\\S+,\\S+:"); + Matcher regexMatcher = regexChecker.matcher(input); + while (regexMatcher.find()) { + if (regexMatcher.group().length() != 0) { + String sub = regexMatcher.group().trim(); + sub = sub.replace(":", ""); + String[] colors = sub.split(","); + + ret = (colors[1].equalsIgnoreCase("N")) + ? ret.replace(regexMatcher.group().trim(), "\u001B[3" + getColorID(colors[0]) + ";1m") + : ret.replace(regexMatcher.group().trim(), + "\u001B[3" + getColorID(colors[0]) + ";4" + getColorID(colors[1]) + ";1m"); + ret = ret.replace("[RC]", ColorCodes.WHITE); + } + } + ret = ret + ColorCodes.RESET; + return ret; + } + + /** + * Internal function for getting a colors value + * + * @param color The color as test + * @return The colors integral value + */ + private static int getColorID(String color) { + if (color.equalsIgnoreCase("BLACK")) { + return 0; + } else if (color.equalsIgnoreCase("RED")) { + return 1; + } else if (color.equalsIgnoreCase("GREEN")) { + return 2; + } else if (color.equalsIgnoreCase("YELLOW")) { + return 3; + } else if (color.equalsIgnoreCase("BLUE")) { + return 4; + } else if (color.equalsIgnoreCase("MAGENTA")) { + return 5; + } else if (color.equalsIgnoreCase("CYAN")) { + return 6; + } else if (color.equalsIgnoreCase("WHITE")) { + return 7; + } + + return 7; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/WorkWithProblemHandler.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/WorkWithProblemHandler.java new file mode 100644 index 0000000000..fa3fbbd7e9 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/check/handler/wrkprb/WorkWithProblemHandler.java @@ -0,0 +1,327 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.check.handler.wrkprb; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.Socket; +import java.util.List; +import java.util.HashMap; + +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +import com.centreon.connector.as400.check.handler.wrkprb.CheckAS400Lang; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.check.handler.impl.AbstractHandler; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +@SuppressWarnings("unused") +public class WorkWithProblemHandler extends AbstractHandler { + + private static int INSTANCE_ID = 0; + private static long LOGIN_COUNT = 0; + private static long LOGOUT_COUNT = 0; + private static final int LOG_TRACE = 0; + private static final int LOG_DEBUG = 1; + private static final int LOG_WARN = 2; + private static final int LOG_ERROR = 3; + + private static final int OK = 0; + private static final int WARN = 1; + private static final int CRITICAL = 2; + private static final int UNKNOWN = 3; + // These constants are for the wait recieve, controlling + // any other logic that it should turn on. For example checking + // for invalid login. + private final static int NONE = 0; + private final static int LOGIN = 1; + private final static int GETOUTQ = 2; + private final static int GETJOB = 3; + private final static int GETSBSD = 4; + private final static int GETFD = 5; + + private CheckAS400Lang AS400Lang; + private SSLSocket sslSocket; + private Socket ioSocket; + private PrintWriter ioWriter; + private BufferedReader ioReader; + private final boolean SSL = false; + private final String logPrefix; + + public WorkWithProblemHandler(final String host, final String login, final String password) { + super(host, login, password); + this.logPrefix = "[" + WorkWithProblemHandler.INSTANCE_ID++ + "]"; + } + + private synchronized static long getAndIncrementLoginCount() { + return WorkWithProblemHandler.LOGIN_COUNT++; + } + + private synchronized static long getAndIncrementLogoutCount() { + return WorkWithProblemHandler.LOGOUT_COUNT++; + } + + public ResponseData getProblems(String lang) { + ResponseData response = null; + + this.AS400Lang = new CheckAS400Lang(lang); + ConnectorLogger.getInstance().debug(this.logPrefix + "Establishing connection to server..."); + if (this.open()) { + ConnectorLogger.getInstance().debug(this.logPrefix + "done.\nLogging in..."); + boolean loggedIn = false; + try { + loggedIn = this.login(); + } catch (final Exception e) { + ConnectorLogger.getInstance().debug(this.logPrefix + e.getMessage(), e); + response = new ResponseData(ResponseData.statusError, e.getMessage()); + this.close(); + return response; + } + if (loggedIn) { + ConnectorLogger.getInstance() + .debug(this.logPrefix + "LoginCount = " + WorkWithProblemHandler.getAndIncrementLoginCount()); + ConnectorLogger.getInstance().debug(this.logPrefix + "Login completed.\nSending command (WRKPRB)..."); + + this.send("WRKPRB\r"); + String result = null; + try { + result = this.waitReceive("F3=", WorkWithProblemHandler.NONE); + } catch (final Exception e) { + this.logout(); + response = new ResponseData(ResponseData.statusError, e.getMessage()); + ConnectorLogger.getInstance().error(e.getMessage(), e); + return response; + } + + if (result != null) { + HashMap attrs = new HashMap(); + response = new ResponseData(); + + attrs.put("result", result); + response.getResult().add(attrs); + ConnectorLogger.getInstance().debug(this.logPrefix + "Finished."); + } else { + response = new ResponseData(ResponseData.statusError, "Unexpected output on command"); + } + + this.logout(); + } else { + this.logout(); + response = new ResponseData(ResponseData.statusError, "Unexpected output on login"); + } + } else { + response = new ResponseData(ResponseData.statusError, "Could not open connection to AS400"); + } + + return response; + } + + // open connection to server + public boolean open() { + try { + if (this.SSL) { + final SSLSocket sslSocket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(this.host, 992); + this.ioWriter = new PrintWriter(sslSocket.getOutputStream(), true); + this.ioReader = new BufferedReader(new InputStreamReader(sslSocket.getInputStream())); + } else { + ConnectorLogger.getInstance().debug(this.logPrefix + "Create socket..."); + this.ioSocket = new Socket(this.host, 23); + this.ioSocket.setSoTimeout(6000); + ConnectorLogger.getInstance().debug(this.logPrefix + "Get outputstream"); + this.ioWriter = new PrintWriter(this.ioSocket.getOutputStream(), true); + ConnectorLogger.getInstance().debug(this.logPrefix + "Read from socket"); + this.ioReader = new BufferedReader(new InputStreamReader(this.ioSocket.getInputStream())); + ConnectorLogger.getInstance().debug(this.logPrefix + "Reading done"); + } + + this.send("\n\r"); + + return true; + } catch (final Exception e) { + ConnectorLogger.getInstance().debug(this.logPrefix + "CRITICAL: Network error", e); + return false; + } + } + + // write str to stream + public void send(final String str) { + this.ioWriter.print(str); + this.ioWriter.flush(); + } + + public boolean login() throws Exception { + + ConnectorLogger.getInstance().debug(this.logPrefix + " waiting for screen..."); + /* Wait for the login screen */ + if (this.waitReceive("IBM CORP", WorkWithProblemHandler.NONE) != null) { + ConnectorLogger.getInstance().debug(this.logPrefix + " sending login information for " + this.login + "..."); + int unameLength; + unameLength = this.login.length(); + /* send login user/pass */ + this.send(this.login); + if (unameLength != 10) { + this.send("\t"); + } + + this.send(this.password + "\r"); + + ConnectorLogger.getInstance().debug(this.logPrefix + " waiting for login to process..."); + /* Wait and receive command screen */ + if (this.waitReceive("===>", WorkWithProblemHandler.LOGIN) != null) + return true; + } + return false; + } + + // close connection to server + public boolean close() { + try { + if (this.SSL) { + this.sslSocket.close(); + } else { + if (this.ioSocket != null) { + this.ioSocket.close(); + } + } + if (this.ioReader != null) { + this.ioReader.close(); + } + if (this.ioWriter != null) { + this.ioWriter.close(); + } + return true; + } catch (final IOException e) { + ConnectorLogger.getInstance().debug(this.logPrefix + "CRITICAL: Network error", e); + return false; + } + } + + // Receives all info in stream until it sees the string 'str'. + public String waitReceive(final String str, final int procedure) throws Exception { + final StringBuilder buffer = new StringBuilder(); + boolean flag = true; + + ConnectorLogger.getInstance().debug(this.logPrefix + " waiting for token " + str + "..."); + + try { + while (flag) { + int ch; + while ((ch = this.ioReader.read()) != -1) { + buffer.append((char) ch); + + if (!this.ioReader.ready()) + break; + } + ConnectorLogger.getInstance().trace("\n**BUFFER IS:**\n"); + final String convertedBuffer = ColorCodes.ParseColors(buffer.toString()); + ConnectorLogger.getInstance().trace(convertedBuffer); + ConnectorLogger.getInstance().trace("\n**END OF BUFFER**\n"); + if (procedure == WorkWithProblemHandler.LOGIN) { + if (buffer.indexOf("CPF1107") != -1) { + this.close(); + throw new Exception("CRITICAL - Login ERROR, Invalid password"); + } else if (buffer.indexOf("CPF1120") != -1) { + this.close(); + throw new Exception("CRITICAL - Login ERROR, Invalid username"); + } else if (buffer.indexOf("/" + this.login.toUpperCase() + "/") != -1) { + ConnectorLogger.getInstance() + .debug(this.logPrefix + " responding to allocated to another job message..."); + this.send("\r"); + buffer.setLength(0); + } else if (buffer.indexOf(this.AS400Lang.PASSWORD_HAS_EXPIRED) != -1) { + this.send((char) 27 + "3"); + this.waitReceive("Exit sign-on request", WorkWithProblemHandler.NONE); + this.send("Y\r"); + this.close(); + throw new Exception("WARNING - Expired password, Please change it."); + } else if (buffer.indexOf("CPF1394") != -1) { + this.close(); + throw new Exception("CRITICAL - Login ERROR, User profile " + this.login + " cannot sign on."); + } else if (buffer.indexOf(this.AS400Lang.PASSWORD_EXPIRES) != -1) { + ConnectorLogger.getInstance().debug(this.logPrefix + " responding to password expires message..."); + this.send("\r"); + buffer.setLength(0); + } else if (buffer.indexOf(this.AS400Lang.DISPLAY_MESSAGES) != -1) { + ConnectorLogger.getInstance().debug(this.logPrefix + " continuing through message display..."); + this.send((char) 27 + "3"); + buffer.setLength(0); + } + } else if (procedure == WorkWithProblemHandler.GETOUTQ) { + if (buffer.indexOf(this.AS400Lang.NO_OUTPUT_QUEUES) != -1) { + this.logout(); + throw new Exception("CRITICAL - outq does NOT exist"); + } + } + // check for command not allowed errors + if (procedure != WorkWithProblemHandler.LOGIN) { + if (buffer.indexOf(this.AS400Lang.LIBRARY_NOT_ALLOWED) != -1) { + this.send((char) 27 + "3"); + this.logout(); + throw new Exception("CRITICAL - Command NOT allowed"); + } + } + if (buffer.indexOf(str) != -1) + flag = false; + + } + } catch (final IOException e) { + throw new Exception("CRITICAL: Network error:" + e); + } + + ConnectorLogger.getInstance().debug(this.logPrefix + " token received."); + + return buffer.toString(); + } + + public void logout() { + // send F3 + ConnectorLogger.getInstance().debug(this.logPrefix + "Logging out...\n sending F3..."); + this.send((char) 27 + "3"); + try { + ConnectorLogger.getInstance().debug(this.logPrefix + "Wait for response..."); + this.waitReceive("===>", WorkWithProblemHandler.NONE); + ConnectorLogger.getInstance().debug(this.logPrefix + "Response received. requesting signoff..."); + // send logout + this.send("signoff *nolist\r"); + // waitReceive(";53H",NONE); + ConnectorLogger.getInstance().debug(this.logPrefix + "Signoff sent. Wait for lockscreen..."); + waitReceive("IBM CORP", NONE); + } catch (final Exception e) { + ConnectorLogger.getInstance().error(e.getMessage(), e); + } finally { + this.close(); + } + + ConnectorLogger.getInstance().debug(this.logPrefix + "Job ending immediately"); + this.send("\r"); + // waitReceive(LANG.LOGIN_SCREEN, NONE); + + ConnectorLogger.getInstance().debug(this.logPrefix + " terminating connection..."); + + this.close(); + ConnectorLogger.getInstance().debug(this.logPrefix + "Logged out."); + ConnectorLogger.getInstance() + .debug(this.logPrefix + "LogoutCount = " + WorkWithProblemHandler.getAndIncrementLogoutCount()); + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/IClient.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/IClient.java new file mode 100644 index 0000000000..77a22d2bb4 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/IClient.java @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.client; + +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +public interface IClient { + String getRawRequest(); + + void writeAnswer(ResponseData answer); + + void parseRequest() throws Exception; + + String getAs400Host(); + + String getAs400Login(); + + String getAs400Password(); + + String getAs400CheckType(); + + Object getAs400Arg(String key); +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/AbstractClient.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/AbstractClient.java new file mode 100644 index 0000000000..0c22486d70 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/AbstractClient.java @@ -0,0 +1,116 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.client.impl; + +import java.util.List; +import java.util.Map; +import java.util.ArrayList; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.centreon.connector.as400.dispatcher.check.InputData; + +import com.centreon.connector.as400.client.IClient; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +/** + * @author Lamotte Jean-Baptiste + */ +abstract class AbstractClient implements IClient { + private InputData input = null; + + private String as400Host = null; + private String as400Login = null; + private String as400Password = null; + private String as400CheckType = null; + private String as400Args = null; + private List> argList = new ArrayList>(); + + @Override + public abstract String getRawRequest(); + + protected abstract void writeAnswer(String answer); + + public AbstractClient() { + } + + @Override + public String getAs400Host() { + return this.input.getHost(); + } + + @Override + public String getAs400Login() { + return this.input.getLogin(); + } + + @Override + public String getAs400Password() { + return this.input.getPassword(); + } + + @Override + public String getAs400CheckType() { + return this.input.getCommand(); + } + + @Override + public Object getAs400Arg(String key) { + return this.input.getArg(key); + } + + public List> getAs400ArgList(String key) { + Object arg = this.input.getArg(key); + if (arg == null) { + return null; + } + + Gson gson = new Gson(); + return gson.fromJson(arg.toString(), argList.getClass()); + } + + @Override + public void parseRequest() throws Exception { + Gson gson = new Gson(); + this.input = gson.fromJson(this.getRawRequest(), InputData.class); + + if (this.input.getHost() == null) { + throw new Exception("Invalid option: As/400 host required"); + } + if (this.input.getLogin() == null) { + throw new Exception("Invalid option: As/400 login required"); + } + if (this.input.getPassword() == null) { + throw new Exception("Invalid option: As/400 password required"); + } + if (this.input.getCommand() == null) { + throw new Exception("Invalid option: As/400 command required"); + } + } + + @Override + public void writeAnswer(final ResponseData data) { + Gson gson = new GsonBuilder().create(); + String json = gson.toJson(data); + + this.writeAnswer(json); + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/NetworkClient.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/NetworkClient.java new file mode 100644 index 0000000000..bc3b450893 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/client/impl/NetworkClient.java @@ -0,0 +1,82 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.client.impl; + +import io.undertow.util.HttpString; +import io.undertow.server.HttpServerExchange; +import io.undertow.util.Headers; +import io.undertow.io.Receiver.FullBytesCallback; + +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.client.IClient; + +/** + * @author Lamotte Jean-Baptiste + */ +public class NetworkClient extends AbstractClient implements IClient { + private HttpServerExchange exchange = null; + private String rawRequest = null; + + public NetworkClient(final HttpServerExchange exchange) { + super(); + this.exchange = exchange; + } + + public void readRequest() throws Exception { + HttpString method = exchange.getRequestMethod(); + + if (method.toString().equals("POST") == false) { + throw new Exception("Unsupported method"); + } + + this.exchange.getRequestReceiver().receiveFullBytes(new FullBytesCallback() { + @Override + public void handle(HttpServerExchange exchange, byte[] message) { + rawRequest = new String(message); + } + }); + } + + @Override + protected void writeAnswer(final String answer) { + ConnectorLogger.getInstance().debug("--------------------"); + ConnectorLogger.getInstance().debug("request : " + this.getRawRequest()); + ConnectorLogger.getInstance().debug("answer : \n" + answer); + ConnectorLogger.getInstance().debug("--------------------"); + + this.exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/json"); + this.exchange.getResponseSender().send(answer); + this.exchange.endExchange(); + } + + private void clean() { + } + + @Override + public String getRawRequest() { + return this.rawRequest; + } + + public HttpServerExchange getExchange() { + return this.exchange; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/Daemon.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/Daemon.java new file mode 100644 index 0000000000..85965bc1a5 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/Daemon.java @@ -0,0 +1,140 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.daemon; + +import java.io.IOException; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Collections; +import java.util.List; + +import io.undertow.Undertow; +import io.undertow.UndertowOptions; +import io.undertow.server.HttpHandler; +import io.undertow.server.HttpServerExchange; +import io.undertow.util.HttpString; + +import io.undertow.security.api.AuthenticationMechanism; +import io.undertow.security.api.AuthenticationMode; +import io.undertow.security.api.SecurityContext; +import io.undertow.security.handlers.AuthenticationCallHandler; +import io.undertow.security.handlers.AuthenticationConstraintHandler; +import io.undertow.security.handlers.AuthenticationMechanismsHandler; +import io.undertow.security.handlers.SecurityInitialHandler; +import io.undertow.security.idm.IdentityManager; +import io.undertow.security.impl.BasicAuthenticationMechanism; + +import java.security.KeyStore; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; + +import com.centreon.connector.as400.daemon.MapIdentityManager; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.client.impl.NetworkClient; + +/** + * The Class DaemonCore. + * + * @author Lamotte Jean-Baptiste + */ +public class Daemon { + /** + * execute. + * + */ + public void start(int port) throws Exception, IOException, InterruptedException { + Undertow server; + + Undertow.Builder builder = Undertow.builder(); + + builder.setServerOption(UndertowOptions.NO_REQUEST_TIMEOUT, Conf.daemonNoRequestTimeout) + .setServerOption(UndertowOptions.REQUEST_PARSE_TIMEOUT, Conf.daemonRequestParseTimeout); + + if (Conf.keyStoreFile != null) { + try { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + + KeyStore keyStore = KeyStore.getInstance(Conf.keyStoreType); + FileInputStream stream = new FileInputStream(Conf.keyStoreFile); + if (stream == null) { + throw new Exception("keystore file not found: " + Conf.keyStoreFile); + } + + keyStore.load( + stream, + Conf.keyStorePassword.toCharArray()); + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + keyManagerFactory.init(keyStore, Conf.keyStorePassword.toCharArray()); + + SSLContext sslContext; + sslContext = SSLContext.getInstance(Conf.sslProtocol); + + sslContext.init(keyManagerFactory.getKeyManagers(), null, null); + builder.addHttpsListener(port, Conf.daemonListenerHost, sslContext); + } catch (final Exception e) { + throw new Exception(e); + } + } else { + builder.addHttpListener(port, Conf.daemonListenerHost); + } + + if (Conf.authUsername != null && Conf.authPassword != null) { + final Map users = new HashMap(1); + users.put(Conf.authUsername, Conf.authPassword.toCharArray()); + + final IdentityManager identityManager = new MapIdentityManager(users); + + server = builder.setHandler(addSecurity(new HttpHandler() { + @Override + public void handleRequest(final HttpServerExchange exchange) throws Exception { + NewtworkRunnable network = new NewtworkRunnable(new NetworkClient(exchange)); + network.run(); + } + }, identityManager)) + .build(); + } else { + server = builder.setHandler(new HttpHandler() { + @Override + public void handleRequest(final HttpServerExchange exchange) throws Exception { + NewtworkRunnable network = new NewtworkRunnable(new NetworkClient(exchange)); + network.run(); + } + }).build(); + } + server.start(); + + while (true) { + Thread.sleep(10000); + } + } + + private static HttpHandler addSecurity(final HttpHandler toWrap, final IdentityManager identityManager) { + HttpHandler handler = toWrap; + handler = new AuthenticationCallHandler(handler); + handler = new AuthenticationConstraintHandler(handler); + final List mechanisms = Collections.singletonList(new BasicAuthenticationMechanism("My Realm")); + handler = new AuthenticationMechanismsHandler(handler, mechanisms); + handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, handler); + return handler; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/DelayedConnectionException.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/DelayedConnectionException.java new file mode 100644 index 0000000000..ca14c4cb96 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/DelayedConnectionException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.daemon; + +/** + * @author Lamotte Jean-Baptiste + */ +public class DelayedConnectionException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + DelayedConnectionException(final String reason) { + super(reason); + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/MapIdentityManager.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/MapIdentityManager.java new file mode 100644 index 0000000000..1f1477fbf2 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/MapIdentityManager.java @@ -0,0 +1,110 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.daemon; + +import io.undertow.security.idm.Account; +import io.undertow.security.idm.Credential; +import io.undertow.security.idm.IdentityManager; +import io.undertow.security.idm.PasswordCredential; + +import java.security.Principal; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; +import java.util.Set; + +/** + * A simple {@link IdentityManager} implementation, that just takes a map of users to their + * password. + * + * This is in now way suitable for real world production use. + * + * +* @author Stuart Douglas +*/ +class MapIdentityManager implements IdentityManager { + + private final Map users; + + MapIdentityManager(final Map users) { + this.users = users; + } + + @Override + public Account verify(Account account) { + // An existing account so for testing assume still valid. + return account; + } + + @Override + public Account verify(String id, Credential credential) { + Account account = getAccount(id); + if (account != null && verifyCredential(account, credential)) { + return account; + } + + return null; + } + + @Override + public Account verify(Credential credential) { + // TODO Auto-generated method stub + return null; + } + + private boolean verifyCredential(Account account, Credential credential) { + if (credential instanceof PasswordCredential) { + char[] password = ((PasswordCredential) credential).getPassword(); + char[] expectedPassword = users.get(account.getPrincipal().getName()); + + return Arrays.equals(password, expectedPassword); + } + return false; + } + + private Account getAccount(final String id) { + if (users.containsKey(id)) { + return new Account() { + + private final Principal principal = new Principal() { + + @Override + public String getName() { + return id; + } + }; + + @Override + public Principal getPrincipal() { + return principal; + } + + @Override + public Set getRoles() { + return Collections.emptySet(); + } + + }; + } + return null; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/NewtworkRunnable.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/NewtworkRunnable.java new file mode 100644 index 0000000000..9913114f0f --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/daemon/NewtworkRunnable.java @@ -0,0 +1,68 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.daemon; + +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.client.impl.NetworkClient; +import com.centreon.connector.as400.dispatcher.check.ResponseData; +import com.centreon.connector.as400.dispatcher.client.impl.ClientDispatcherImpl; + +/** + * The Class NewtworkRunnable. + * + * @author Lamotte Jean-Baptiste + */ +class NewtworkRunnable implements Runnable { + private NetworkClient client = null; + + /** + * Instantiates a new newtwork runnable. + * + * @param client the client + */ + NewtworkRunnable(final NetworkClient client) { + this.client = client; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + try { + try { + this.client.readRequest(); + this.client.parseRequest(); + ClientDispatcherImpl.getInstance().dispatch(this.client); + } catch (final java.net.SocketException e) { + ConnectorLogger.getInstance().debug("", e); + this.client.writeAnswer(new ResponseData(ResponseData.statusError, "" + e.getMessage())); + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + this.client.writeAnswer(new ResponseData(ResponseData.statusError, "" + e.getMessage())); + } + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + } + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckDispatcher.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckDispatcher.java new file mode 100644 index 0000000000..bce1102677 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckDispatcher.java @@ -0,0 +1,241 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.dispatcher.check; + +import java.io.IOException; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.RejectedExecutionHandler; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import com.ibm.as400.access.AS400SecurityException; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.check.handler.ICachedMessageQueueHandler; +import com.centreon.connector.as400.check.handler.ICommandHandler; +import com.centreon.connector.as400.check.handler.IDiskHandler; +import com.centreon.connector.as400.check.handler.IJobHandler; +import com.centreon.connector.as400.check.handler.IJobQueueHandler; +import com.centreon.connector.as400.check.handler.IMessageQueueHandler; +import com.centreon.connector.as400.check.handler.ISubSystemHandler; +import com.centreon.connector.as400.check.handler.ISystemHandler; +import com.centreon.connector.as400.check.handler.impl.CommandHandler; +import com.centreon.connector.as400.check.handler.impl.DiskHandler; +import com.centreon.connector.as400.check.handler.impl.JobHandler; +import com.centreon.connector.as400.check.handler.impl.JobQueueHandler; +import com.centreon.connector.as400.check.handler.impl.SubSystemHandler; +import com.centreon.connector.as400.check.handler.impl.SystemHandler; +import com.centreon.connector.as400.check.handler.msgqueue.CachedMessageQueueHandler; +import com.centreon.connector.as400.check.handler.msgqueue.MessageQueueHandler; +import com.centreon.connector.as400.check.handler.wrkprb.WorkWithProblemHandler; +import com.centreon.connector.as400.client.impl.NetworkClient; + +import io.undertow.server.HttpServerExchange; + +/** + * @author Lamotte Jean-Baptiste + */ +public class CheckDispatcher { + + private static class DefaultThreadFactory implements ThreadFactory { + private static final AtomicInteger poolNumber = new AtomicInteger(1); + private final ThreadGroup group; + private final AtomicInteger threadNumber = new AtomicInteger(1); + private final String namePrefix; + + private DefaultThreadFactory(final String host, final String type) { + final SecurityManager s = System.getSecurityManager(); + this.group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); + this.namePrefix = "" + host + "-pool-" + type + "-" + DefaultThreadFactory.poolNumber.getAndIncrement() + + "-thread-"; + } + + @Override + public Thread newThread(final Runnable r) { + final Thread t = new Thread(this.group, r, this.namePrefix + this.threadNumber.getAndIncrement(), 0); + if (t.isDaemon()) { + t.setDaemon(false); + } + if (t.getPriority() != Thread.NORM_PRIORITY) { + t.setPriority(Thread.NORM_PRIORITY); + } + return t; + } + } + + private String host = null; + private String login = null; + private String password = null; + + private volatile ConcurrentHashMap filter = new ConcurrentHashMap(); + + private ISubSystemHandler subSystemHandler = null; + private ISystemHandler systemHandler = null; + private IJobHandler jobHandler = null; + private IDiskHandler diskHandler = null; + private ICommandHandler commandHandler = null; + + private ThreadPoolExecutor executorGlobal = null; + private ThreadPoolExecutor executorJobs = null; + private ThreadPoolExecutor executorDisk = null; + + class ThreadPoolExecutorPostFilter extends ThreadPoolExecutor { + public ThreadPoolExecutorPostFilter(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, + final TimeUnit unit, final BlockingQueue workQueue, final RejectedExecutionHandler handler) { + super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler); + } + + public ThreadPoolExecutorPostFilter(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, + final TimeUnit unit, final BlockingQueue workQueue) { + super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); + } + + public ThreadPoolExecutorPostFilter(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, + final TimeUnit unit, final BlockingQueue workQueue, final ThreadFactory threadFactory) { + super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory); + } + + public ThreadPoolExecutorPostFilter(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, + final TimeUnit unit, final BlockingQueue workQueue, final ThreadFactory threadFactory, + final RejectedExecutionHandler handler) { + super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); + } + + @Override + protected void afterExecute(final Runnable r, final Throwable t) { + if (r instanceof CheckHandlerRunnable) { + final CheckHandlerRunnable runnable = (CheckHandlerRunnable) r; + final NetworkClient client = runnable.getClient(); + final String rawRequest = client.getRawRequest(); + + CheckDispatcher.this.filter.remove(rawRequest); + } + super.afterExecute(r, t); + } + } + + public CheckDispatcher(final String host, final String login, final String password) { + this.host = host; + this.login = login; + this.password = password; + + this.executorGlobal = new ThreadPoolExecutorPostFilter(5, 10, Conf.workerQueueTimeout, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue()); + this.executorGlobal.setThreadFactory(new DefaultThreadFactory(host, "global")); + + this.executorJobs = new ThreadPoolExecutorPostFilter(1, 1, Conf.workerQueueTimeout, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue()); + this.executorJobs.setThreadFactory(new DefaultThreadFactory(host, "job")); + + this.executorDisk = new ThreadPoolExecutorPostFilter(1, 1, Conf.workerQueueTimeout, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue()); + this.executorDisk.setThreadFactory(new DefaultThreadFactory(host, "disk")); + } + + public String getHost() { + return this.host; + } + + public String getLogin() { + return this.login; + } + + public String getPassword() { + return this.password; + } + + public synchronized void dispatch(final NetworkClient client) { + + if (this.filter.containsKey(client.getRawRequest())) { + final long time = this.filter.get(client.getRawRequest()); + client.writeAnswer(new ResponseData(ResponseData.statusError, "Previous request pending (started " + + (System.currentTimeMillis() - time) + + " ms ago). Increase your check interval, and nagios check timeout. Also check your bandwidth availability")); + return; + } + + this.filter.put(client.getRawRequest(), System.currentTimeMillis()); + + final String command = client.getAs400CheckType(); + + if (command.equalsIgnoreCase("listJobs")) { + client.getExchange().dispatch(this.executorJobs, new CheckHandlerRunnable(client, this)); + } else if (command.equalsIgnoreCase("listDisks")) { + client.getExchange().dispatch(this.executorDisk, new CheckHandlerRunnable(client, this)); + } else { + client.getExchange().dispatch(this.executorGlobal, new CheckHandlerRunnable(client, this)); + } + } + + public ICommandHandler getCommandHandler() throws AS400SecurityException, IOException { + if (this.commandHandler == null) { + this.commandHandler = new CommandHandler(this.host, this.login, this.password); + } + return this.commandHandler; + } + + public IDiskHandler getDiskHandler() throws AS400SecurityException, IOException { + if (this.diskHandler == null) { + this.diskHandler = new DiskHandler(this.host, this.login, this.password); + } + return this.diskHandler; + } + + public IJobHandler getJobHandler() throws AS400SecurityException, IOException { + if (this.jobHandler == null) { + this.jobHandler = new JobHandler(this.host, this.login, this.password); + } + return this.jobHandler; + } + + public ISubSystemHandler getSubSystemHandler() throws AS400SecurityException, IOException { + if (this.subSystemHandler == null) { + this.subSystemHandler = new SubSystemHandler(this.host, this.login, this.password); + } + return this.subSystemHandler; + } + + public ISystemHandler getSystemHandler() throws AS400SecurityException, IOException { + if (this.systemHandler == null) { + this.systemHandler = new SystemHandler(this.host, this.login, this.password); + } + return this.systemHandler; + } + + public ICachedMessageQueueHandler getCachedMessageQueueHandler() throws AS400SecurityException, IOException { + return new CachedMessageQueueHandler(this.host, this.login, this.password); + } + + public IMessageQueueHandler getMessageQueueHandler() throws AS400SecurityException, IOException { + return new MessageQueueHandler(this.host, this.login, this.password); + } + + public IJobQueueHandler getJobQueueHandler() throws AS400SecurityException, IOException { + return new JobQueueHandler(this.host, this.login, this.password); + } + + public WorkWithProblemHandler getWrkPrbHandler() throws AS400SecurityException, IOException { + return new WorkWithProblemHandler(this.host, this.login, this.password); + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckHandlerRunnable.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckHandlerRunnable.java new file mode 100644 index 0000000000..ce6b95565f --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/CheckHandlerRunnable.java @@ -0,0 +1,249 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.dispatcher.check; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.ibm.as400.access.AS400SecurityException; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.client.impl.NetworkClient; + +/** + * @author Lamotte Jean-Baptiste + */ +public class CheckHandlerRunnable implements Runnable { + + protected NetworkClient client = null; + protected CheckDispatcher checkDispatcher = null; + + public CheckHandlerRunnable(final NetworkClient client, final CheckDispatcher checkDispatcher) { + this.client = client; + this.checkDispatcher = checkDispatcher; + } + + public NetworkClient getClient() { + return this.client; + } + + private ResponseData getErrorResponse(final String message) { + return new ResponseData(ResponseData.statusError, message); + } + + @Override + public void run() { + this.client.writeAnswer(this.handleAs400Args(this.client.getAs400CheckType())); + } + + protected ResponseData handleAs400Args(final String check) { + ResponseData data = null; + + final String[] args = null; + final long now = System.currentTimeMillis(); + + try { + if (check.equalsIgnoreCase("listDisks")) { + data = this.listDisks(); + } else if (check.equalsIgnoreCase("listSubsystems")) { + data = this.listSubsystems(); + } else if (check.equalsIgnoreCase("listJobs")) { + data = this.listJobs(); + } else if (check.equalsIgnoreCase("getErrorMessageQueue")) { + data = this.getErrorMessageQueue(); + } else if (check.equalsIgnoreCase("pageFault")) { + data = this.checkPageFault(); + } else if (check.equalsIgnoreCase("getSystem")) { + data = this.getSystem(); + } else if (check.equalsIgnoreCase("getJobQueues")) { + data = this.getJobQueues(); + } else if (check.equalsIgnoreCase("executeCommand")) { + data = this.executeCommand(); + } else if (check.equalsIgnoreCase("getNewMessageInMessageQueue")) { + data = this.getNewMessageInMessageQueue(); + } else if (check.equalsIgnoreCase("workWithProblem")) { + data = this.workWithProblem(); + } else if (check.equalsIgnoreCase("dumpAll")) { + this.dumpAll(); + data = new ResponseData(ResponseData.statusOk, "dump done"); + } else { + data = new ResponseData(ResponseData.statusError, "unknown request : " + check); + ConnectorLogger.getInstance().debug("unknown request : " + check); + } + } catch (final NumberFormatException e) { + data = new ResponseData(ResponseData.statusError, e.getMessage()); + ConnectorLogger.getInstance().debug("Error during request", e); + } catch (final AS400SecurityException e) { + String error = ""; + if (e.getCause() != null) { + error = e.getCause().getMessage(); + } else { + error = e.getMessage(); + } + data = new ResponseData(ResponseData.statusError, error); + ConnectorLogger.getInstance().debug("Error during request", e); + } catch (final IOException e) { + data = new ResponseData(ResponseData.statusError, e.getMessage()); + ConnectorLogger.getInstance().debug("Error during request", e); + } catch (final Exception e) { + data = new ResponseData(ResponseData.statusError, e.getMessage()); + ConnectorLogger.getInstance().debug("Error during request", e); + } + + data.setRequestDuration(System.currentTimeMillis() - now); + return data; + } + + private void dumpAll() { + try { + checkDispatcher.getSystemHandler().dumpSystem(); + } catch (Exception e) { + ConnectorLogger.getInstance().error("Failed to dump system measures", e); + throw new IllegalStateException("Failed to dump system measures", e); + } + } + + private ResponseData workWithProblem() throws Exception { + Object lang = this.client.getAs400Arg("lang"); + + final ResponseData data = this.checkDispatcher.getWrkPrbHandler().getProblems( + lang != null ? lang.toString() : null); + + return data; + } + + private ResponseData listDisks() throws Exception { + Object diskName = this.client.getAs400Arg("diskName"); + + final ResponseData data = this.checkDispatcher.getDiskHandler().listDisks( + diskName != null ? diskName.toString() : null); + + return data; + } + + private ResponseData listJobs() throws Exception { + ResponseData data = this.checkDispatcher.getJobHandler().listJobs(); + + return data; + } + + private ResponseData executeCommand() throws Exception { + Object cmdName = this.client.getAs400Arg("cmdName"); + + final ResponseData data = this.checkDispatcher.getCommandHandler().executeCommand( + cmdName != null ? cmdName.toString() : null); + + return data; + } + + private ResponseData getJobQueues() throws Exception { + List> queues = this.client.getAs400ArgList("queues"); + + if (queues == null || queues.size() == 0) { + return this.getErrorResponse("Invalid arguments. please set jobQueueNames"); + } + + final ResponseData data = this.checkDispatcher.getJobQueueHandler().getJobQueues(queues); + + return data; + } + + private ResponseData getSystem() throws Exception { + final ResponseData data = this.checkDispatcher.getSystemHandler().getSystem(); + + return data; + } + + private ResponseData checkPageFault() throws Exception { + final ResponseData data = this.checkDispatcher.getSystemHandler().getPageFault(); + + return data; + } + + private ResponseData getErrorMessageQueue() throws NumberFormatException, Exception { + Object arg = this.client.getAs400Arg("messageQueuePath"); + String messageQueuePath = (arg != null ? arg.toString() : null); + + arg = this.client.getAs400Arg("messageIdfilterPattern"); + String messageIdfilterPattern = (arg != null ? arg.toString() : null); + + if (messageQueuePath == null) { + return this.getErrorResponse("Invalid arguments. please set messageQueuePath"); + } + + int minSeverityLevel; + try { + minSeverityLevel = Integer.parseInt(this.client.getAs400Arg("minSeverityLevel").toString()); + } catch (final Exception e) { + minSeverityLevel = Integer.MIN_VALUE; + } + int maxSeverityLevel; + try { + maxSeverityLevel = Integer.parseInt(this.client.getAs400Arg("maxSeverityLevel").toString()); + } catch (final Exception e) { + maxSeverityLevel = Integer.MAX_VALUE; + } + + final ResponseData data = this.checkDispatcher.getMessageQueueHandler().getErrorMessageQueue( + messageQueuePath, messageIdfilterPattern, minSeverityLevel, maxSeverityLevel); + + return data; + } + + private ResponseData getNewMessageInMessageQueue() throws NumberFormatException, Exception { + Object arg = this.client.getAs400Arg("messageQueuePath"); + String messageQueuePath = (arg != null ? arg.toString() : null); + + arg = this.client.getAs400Arg("messageIdfilterPattern"); + String messageIdfilterPattern = (arg != null ? arg.toString() : null); + + if (messageQueuePath == null) { + return this.getErrorResponse("Invalid arguments. please set messageQueuePath"); + } + + int minSeverityLevel; + try { + minSeverityLevel = Integer.parseInt(this.client.getAs400Arg("minSeverityLevel").toString()); + } catch (final Exception e) { + minSeverityLevel = Integer.MIN_VALUE; + } + int maxSeverityLevel; + try { + maxSeverityLevel = Integer.parseInt(this.client.getAs400Arg("maxSeverityLevel").toString()); + } catch (final Exception e) { + maxSeverityLevel = Integer.MAX_VALUE; + } + + final ResponseData data = this.checkDispatcher.getCachedMessageQueueHandler().getNewMessageInMessageQueue( + messageQueuePath, messageIdfilterPattern, minSeverityLevel, maxSeverityLevel); + + return data; + } + + private ResponseData listSubsystems() throws Exception { + final ResponseData data = this.checkDispatcher.getSubSystemHandler().listSubsystems(); + + return data; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/InputData.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/InputData.java new file mode 100644 index 0000000000..61916b6c8d --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/InputData.java @@ -0,0 +1,61 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.dispatcher.check; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Garnier Quentin + */ +public class InputData { + private String login = null; + private String password = null; + private String host = null; + private String command = null; + Map args = null; + + public InputData() { + } + + public String getLogin() { + return this.login; + } + + public String getPassword() { + return this.password; + } + + public String getHost() { + return this.host; + } + + public String getCommand() { + return this.command; + } + + public Object getArg(String name) { + if (args == null) { + return null; + } + return this.args.get(name); + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/ResponseData.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/ResponseData.java new file mode 100644 index 0000000000..a88065daa0 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/check/ResponseData.java @@ -0,0 +1,82 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.dispatcher.check; + +import java.util.ArrayList; +import java.util.HashMap; + +/** + * @author Lamotte Jean-Baptiste + */ +public class ResponseData { + public static final int statusOk = 0; + public static final int statusError = 1; + + private long requestDuration = 0; + private int code = 0; + private String message = null; + private ArrayList result = new ArrayList(); + + public ResponseData() { + } + + public ResponseData(final int code, final String message) { + this.message = message; + this.code = code; + } + + public int getCode() { + return this.code; + } + + public void setCode(final int code) { + this.code = code; + } + + public ArrayList getResult() { + return this.result; + } + + public Object getAttrResult(int index, String attr) { + HashMap attrs = (HashMap)this.result.get(index); + return attrs.get(attr); + } + + public void setResult(final ArrayList result) { + this.result = result; + } + + public String getMessage() { + return this.message; + } + + public void setMessage(final String message) { + this.message = message; + } + + public long getRequestDuration() { + return this.requestDuration; + } + + public void setRequestDuration(final long requestDuration) { + this.requestDuration = requestDuration; + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/ClientDispatcher.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/ClientDispatcher.java new file mode 100644 index 0000000000..8743906ee0 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/ClientDispatcher.java @@ -0,0 +1,31 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.dispatcher.client; + +import java.io.IOException; + +import com.ibm.as400.access.AS400SecurityException; +import com.centreon.connector.as400.client.impl.NetworkClient; +import com.centreon.connector.as400.daemon.DelayedConnectionException; + +public interface ClientDispatcher { + void dispatch(final NetworkClient client) throws AS400SecurityException, IOException, DelayedConnectionException, Exception; +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/impl/ClientDispatcherImpl.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/impl/ClientDispatcherImpl.java new file mode 100644 index 0000000000..5fa0b5ca1b --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/dispatcher/client/impl/ClientDispatcherImpl.java @@ -0,0 +1,88 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.dispatcher.client.impl; + +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import com.ibm.as400.access.AS400SecurityException; +import com.centreon.connector.as400.ConnectorLogger; +import com.centreon.connector.as400.client.impl.NetworkClient; +import com.centreon.connector.as400.daemon.DelayedConnectionException; +import com.centreon.connector.as400.dispatcher.check.CheckDispatcher; +import com.centreon.connector.as400.dispatcher.client.ClientDispatcher; + +/** + * @author Lamotte Jean-Baptiste + */ +public class ClientDispatcherImpl implements ClientDispatcher { + + private volatile Map pool = null; + + private static ClientDispatcherImpl instance = null; + + public static synchronized ClientDispatcherImpl getInstance() { + if (ClientDispatcherImpl.instance == null) { + ClientDispatcherImpl.instance = new ClientDispatcherImpl(); + } + return ClientDispatcherImpl.instance; + } + + private ClientDispatcherImpl() { + this.pool = new ConcurrentHashMap(); + } + + private synchronized CheckDispatcher createNewCheckDispatcher(final String host, final String login, + final String password) throws AS400SecurityException, IOException, DelayedConnectionException, Exception { + + ConnectorLogger.getInstance().info("create new As400 : " + host); + + CheckDispatcher resource = null; + resource = new CheckDispatcher(host, login, password); + + this.pool.put(resource, System.currentTimeMillis()); + + return resource; + } + + private CheckDispatcher getAs400(final String host, final String login, final String password) + throws AS400SecurityException, IOException, DelayedConnectionException, Exception { + + for (final CheckDispatcher resource : this.pool.keySet()) { + if (resource.getHost().equalsIgnoreCase(host) && resource.getLogin().equalsIgnoreCase(login) + && resource.getPassword().equalsIgnoreCase(password)) { + this.pool.put(resource, System.currentTimeMillis()); + return resource; + } + } + + return this.createNewCheckDispatcher(host, login, password); + } + + @Override + public synchronized void dispatch(final NetworkClient client) + throws AS400SecurityException, IOException, DelayedConnectionException, Exception { + final CheckDispatcher checkDispatcher = this.getAs400(client.getAs400Host(), client.getAs400Login(), + client.getAs400Password()); + checkDispatcher.dispatch(client); + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/InvalidOptionException.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/InvalidOptionException.java new file mode 100644 index 0000000000..6848ec6b1c --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/InvalidOptionException.java @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.parser; + +import org.apache.commons.cli.ParseException; + +/** + * @author Lamotte Jean-Baptiste + */ +public class InvalidOptionException extends ParseException { + + /** + * + */ + private static final long serialVersionUID = 3542190890196517483L; + + public InvalidOptionException(final String reason) { + super(reason); + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/OptionFactory.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/OptionFactory.java new file mode 100644 index 0000000000..9e889cf5cf --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/parser/OptionFactory.java @@ -0,0 +1,112 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.parser; + +import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.OptionGroup; +import org.apache.commons.cli.Options; + +/** + * @author Lamotte Jean-Baptiste + */ +public class OptionFactory { + + private OptionFactory() { + + } + + private static synchronized Options addAs400Options(final Options options) { + + OptionBuilder.withArgName("host"); + OptionBuilder.hasArg(); + OptionBuilder.withDescription("dns name or ip address"); + OptionBuilder.withLongOpt("host"); + final Option host = OptionBuilder.create('H'); + + OptionBuilder.withArgName("login"); + OptionBuilder.hasArg(); + OptionBuilder.withDescription("login"); + OptionBuilder.withLongOpt("login"); + final Option login = OptionBuilder.create('l'); + + OptionBuilder.withArgName("password"); + OptionBuilder.hasArg(); + OptionBuilder.withDescription("password"); + OptionBuilder.withLongOpt("password"); + final Option password = OptionBuilder.create('p'); + + OptionBuilder.withArgName("check"); + OptionBuilder.hasArgs(); + OptionBuilder.withDescription("check command type"); + OptionBuilder.withLongOpt("check"); + final Option check = OptionBuilder.create('C'); + + OptionBuilder.withArgName("args"); + OptionBuilder.hasArgs(); + OptionBuilder.withDescription("arguments for as400 request"); + OptionBuilder.withLongOpt("args"); + final Option args = OptionBuilder.create('A'); + + options.addOption(host); + options.addOption(login); + options.addOption(password); + options.addOption(check); + options.addOption(args); + + return options; + } + + /** + * Gets the options. + * + * @return the options + */ + public static synchronized Options getOptions() { + Options options = new Options(); + + final Option daemon = Option.builder("D") + .argName("port") + .hasArg() + .desc("Start the daemon on the specified port") + .longOpt("port") + .build(); + + // Création des option générique + final Option help = new Option("h", "help", false, "print this message"); + final Option version = new Option("v", "version", false, "print the version information and exit"); + final Option jmx = new Option("I", "as400", false, "Request type : as400"); + + // Ajout des options de groupe unique + final OptionGroup startType = new OptionGroup(); + startType.addOption(daemon); + startType.addOption(jmx); + startType.addOption(help); + startType.addOption(version); + startType.setRequired(true); + options.addOptionGroup(startType); + + options = OptionFactory.addAs400Options(options); + + return options; + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/BlowFishUtils.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/BlowFishUtils.java new file mode 100644 index 0000000000..22d680a528 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/BlowFishUtils.java @@ -0,0 +1,83 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.utils; + +import java.security.GeneralSecurityException; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import com.centreon.connector.as400.ConnectorLogger; + +public final class BlowFishUtils { + + private static final String BLOWFISH = "Blowfish"; //$NON-NLS-1$ + private static final String TRANSFORMATION = "Blowfish/CBC/PKCS5Padding"; //$NON-NLS-1$ + private static final byte[] KEY = "3fe7b4d9e0b50a".getBytes(StringUtils.CHARSET); //$NON-NLS-1$ + private static final byte[] IV_BYTES = "00000000".getBytes(StringUtils.CHARSET); //$NON-NLS-1$ + + public static final String decrypt(final String cryptedMessage) { + if (cryptedMessage == null) { + return StringUtils.EMPTY_STRING; + } + try { + final byte[] buffer = HexUtils.hexToBuffer(cryptedMessage); + return new String(BlowFishUtils.decrypt(buffer, BlowFishUtils.KEY), StringUtils.CHARSET); + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + return StringUtils.EMPTY_STRING; + } + } + + public static final String encrypt(final String message) { + if (message == null) { + return StringUtils.EMPTY_STRING; + } + try { + final byte[] crypted = BlowFishUtils.encrypt(message.getBytes(StringUtils.CHARSET), BlowFishUtils.KEY); + return HexUtils.bufferToHex(crypted); + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + return StringUtils.EMPTY_STRING; + } + } + + private static final byte[] decrypt(final byte[] encrypted, final byte[] key) throws GeneralSecurityException { + final SecretKeySpec skeySpec = new SecretKeySpec(key, BlowFishUtils.BLOWFISH); + final Cipher cipher = Cipher.getInstance(BlowFishUtils.TRANSFORMATION); + final IvParameterSpec ivs = new IvParameterSpec(BlowFishUtils.IV_BYTES); + cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivs); + return cipher.doFinal(encrypted); + } + + private static final byte[] encrypt(final byte[] messageBytes, final byte[] key) throws GeneralSecurityException { + final SecretKeySpec skeySpec = new SecretKeySpec(key, BlowFishUtils.BLOWFISH); + final Cipher cipher = Cipher.getInstance(BlowFishUtils.TRANSFORMATION); + final IvParameterSpec ivs = new IvParameterSpec(BlowFishUtils.IV_BYTES); + cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivs); + return cipher.doFinal(messageBytes); + } + + private BlowFishUtils() { + // hide + } +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/HexUtils.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/HexUtils.java new file mode 100644 index 0000000000..3ed749f383 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/HexUtils.java @@ -0,0 +1,60 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.utils; + +public final class HexUtils { + + private static final char[] K_HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', + 'F' }; + + public static String bufferToHex(final byte[] buffer) { + return HexUtils.bufferToHex(buffer, 0, buffer.length); + } + + public static byte[] hexToBuffer(final String hex) { + final byte[] bytes = new byte[hex.length() / 2]; + for (int i = 0; i < (hex.length() - 1); i += 2) { + final String output = hex.substring(i, i + 2); + bytes[i / 2] = (byte) Integer.parseInt(output, 16); + } + return bytes; + } + + private static void appendHexPair(final byte b, final StringBuilder hexString) { + final char highNibble = HexUtils.K_HEX_CHARS[(b & 0xF0) >> 4]; + final char lowNibble = HexUtils.K_HEX_CHARS[b & 0x0F]; + hexString.append(highNibble); + hexString.append(lowNibble); + } + + private static String bufferToHex(final byte[] buffer, final int startOffset, final int length) { + final StringBuilder hexString = new StringBuilder(2 * length); + final int endOffset = startOffset + length; + for (int i = startOffset; i < endOffset; i++) { + HexUtils.appendHexPair(buffer[i], hexString); + } + return hexString.toString(); + } + + private HexUtils() { + } + +} diff --git a/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/StringUtils.java b/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/StringUtils.java new file mode 100644 index 0000000000..35c20a5922 --- /dev/null +++ b/as400/connector.as400/src/main/java/com/centreon/connector/as400/utils/StringUtils.java @@ -0,0 +1,125 @@ +/* + * Copyright 2021 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 com.centreon.connector.as400.utils; + +import java.nio.charset.Charset; + +import com.centreon.connector.as400.ConnectorLogger; + +public final class StringUtils { + + public static final Charset CHARSET = Charset.forName("UTF-8"); //$NON-NLS-1$ + + public static final String NEW_LINE = System.getProperty("line.separator"); //$NON-NLS-1$ + public static final String EMPTY_STRING = ""; //$NON-NLS-1$ + public static final String SLASH = "/"; //$NON-NLS-1$ + public static final String VIRGULE = ","; //$NON-NLS-1$ + + public static boolean isNullEmptyOrBlank(final String string) { + if (string == null) { + return true; + } + if (string.length() == 0) { + return true; + } + if (string.trim().length() == 0) { + return true; + } + return "null".equalsIgnoreCase(string.trim()); //$NON-NLS-1$ + } + + public static boolean isOneNullEmptyOrBlank(final String... args) { + for (final String arg : args) { + if (StringUtils.isNullEmptyOrBlank(arg)) { + return true; + } + } + return false; + } + + public static String nonNullString(final String string) { + if (string == null) { + return StringUtils.EMPTY_STRING; + } + return string; + } + + public static double parseDouble(final String input) { + return StringUtils.parseDouble(input, -1d); + } + + public static double parseDouble(final String input, final double errorValue) { + if ((input == null) || (input.length() == 0)) { + return errorValue; + } + try { + return Double.parseDouble(input); + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + return errorValue; + } + } + + public static int parseInt(final String input) { + return StringUtils.parseInt(input, -1); + } + + public static int parseInt(final String input, final int errorValue) { + if ((input == null) || (input.length() == 0)) { + return errorValue; + } + try { + return Integer.parseInt(input); + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + return errorValue; + } + } + + public static long parseLong(final String input) { + return StringUtils.parseLong(input, Long.MIN_VALUE); + } + + public static long parseLong(final String input, final long errorValue) { + if ((input == null) || (input.length() == 0)) { + return errorValue; + } + try { + return Long.parseLong(input); + } catch (final Exception e) { + ConnectorLogger.getInstance().error("", e); + return errorValue; + } + } + + public static String toHex(final int value, final int length) { + String hex = Integer.toHexString(value); + while (hex.length() < length) { + hex = '0' + hex; + } + return hex; + } + + private StringUtils() { + // hide constructor + } + +} diff --git a/as400/connector.as400/src/main/resources/API.txt b/as400/connector.as400/src/main/resources/API.txt new file mode 100644 index 0000000000..2329fbe8f6 --- /dev/null +++ b/as400/connector.as400/src/main/resources/API.txt @@ -0,0 +1,4 @@ +Open List of Jobs (QGYOLJOB) API +Retrieve Job Queue Information (QSPRJOBQ) API +List Subsystem Job Queues (QWDLSJBQ) API +Open List of ASPs (QYASPOL) API \ No newline at end of file diff --git a/as400/connector.as400/src/main/resources/qsprjobq100.pcml b/as400/connector.as400/src/main/resources/qsprjobq100.pcml new file mode 100644 index 0000000000..1eec2206b2 --- /dev/null +++ b/as400/connector.as400/src/main/resources/qsprjobq100.pcml @@ -0,0 +1,55 @@ + + +Offset Type Field +Dec Hex +0 0 BINARY(4) Bytes returned +4 4 BINARY(4) Bytes availablea +8 8 CHAR(10) Job queue name +18 12 CHAR(10) Job queue library name +28 1C CHAR(10) Operator controlled +38 26 CHAR(10) Authority to check +48 30 BINARY(4) Number of jobs +52 34 CHAR(10) Job queue status +62 3E CHAR(10) Subsystem name +72 48 CHAR(50) Text description +122 7A CHAR(10) Subsystem library name +132 84 BINARY(4) Sequence number +136 88 BINARY(4) Maximum active +140 8C BINARY(4) Current active + + + + + + + + + + + + + + + + + + + + + +1 Receiver variable Output Char(*) +2 Length of receiver variable Input Binary(4) +3 Format name Input Char(8) +4 Qualified job queue name Input Char(20) +5 Error Code I/O Char(*) + + + + + + + + + + + \ No newline at end of file diff --git a/as400/connector.as400/src/main/resources/qsprjobq200.pcml b/as400/connector.as400/src/main/resources/qsprjobq200.pcml new file mode 100644 index 0000000000..e6b597868b --- /dev/null +++ b/as400/connector.as400/src/main/resources/qsprjobq200.pcml @@ -0,0 +1,153 @@ + + +Offset Type Field +Dec Hex +0 0 BINARY(4) Bytes returned +4 4 BINARY(4) Bytes available +8 8 CHAR(10) Job queue name +18 12 CHAR(10) Job queue library name +28 1C CHAR(10) Operator controlled +38 26 CHAR(10) Authority to check +48 30 BINARY(4) Number of jobs +52 34 CHAR(10) Job queue status +62 3E CHAR(10) Subsystem name +72 48 CHAR(10) Subsystem library name +82 52 CHAR(50) Text description +132 84 BINARY(4) Sequence Number +136 88 BINARY(4) Maximum active +140 8C BINARY(4) Current active + +144 90 BINARY(4) Maximum active jobs with priority 1 +148 94 BINARY(4) Maximum active jobs with priority 2 +152 98 BINARY(4) Maximum active jobs with priority 3 +156 9C BINARY(4) Maximum active jobs with priority 4 +160 A0 BINARY(4) Maximum active jobs with priority 5 +164 A4 BINARY(4) Maximum active jobs with priority 6 +168 A8 BINARY(4) Maximum active jobs with priority 7 +172 AC BINARY(4) Maximum active jobs with priority 8 +176 B0 BINARY(4) Maximum active jobs with priority 9 + +180 B4 BINARY(4) Active jobs with priority 0 +184 B8 BINARY(4) Active jobs with priority 1 +188 BC BINARY(4) Active jobs with priority 2 +192 C0 BINARY(4) Active jobs with priority 3 +196 C4 BINARY(4) Active jobs with priority 4 +200 C8 BINARY(4) Active jobs with priority 5 +204 CC BINARY(4) Active jobs with priority 6 +208 D0 BINARY(4) Active jobs with priority 7 +212 D4 BINARY(4) Active jobs with priority 8 +216 D8 BINARY(4) Active jobs with priority 9 + +220 DC BINARY(4) Released jobs on queue with priority 0 +224 E0 BINARY(4) Released jobs on queue with priority 1 +228 E4 BINARY(4) Released jobs on queue with priority 2 +232 E8 BINARY(4) Released jobs on queue with priority 3 +236 EC BINARY(4) Released jobs on queue with priority 4 +240 F0 BINARY(4) Released jobs on queue with priority 5 +244 F4 BINARY(4) Released jobs on queue with priority 6 +248 F8 BINARY(4) Released jobs on queue with priority 7 +252 FC BINARY(4) Released jobs on queue with priority 8 +256 100 BINARY(4) Released jobs on queue with priority 9 + +260 104 BINARY(4) Scheduled jobs on queue with priority 0 +264 108 BINARY(4) Scheduled jobs on queue with priority 1 +268 10C BINARY(4) Scheduled jobs on queue with priority 2 +272 110 BINARY(4) Scheduled jobs on queue with priority 3 +276 114 BINARY(4) Scheduled jobs on queue with priority 4 +280 118 BINARY(4) Scheduled jobs on queue with priority 5 +284 11C BINARY(4) Scheduled jobs on queue with priority 6 +288 120 BINARY(4) Scheduled jobs on queue with priority 7 +292 124 BINARY(4) Scheduled jobs on queue with priority 8 +296 128 BINARY(4) Scheduled jobs on queue with priority 9 + +300 12C BINARY(4) Held jobs on queue with priority 0 +304 130 BINARY(4) Held jobs on queue with priority 1 +308 134 BINARY(4) Held jobs on queue with priority 2 +312 138 BINARY(4) Held jobs on queue with priority 3 +316 13C BINARY(4) Held jobs on queue with priority 4 +320 140 BINARY(4) Held jobs on queue with priority 5 +324 144 BINARY(4) Held jobs on queue with priority 6 +328 148 BINARY(4) Held jobs on queue with priority 7 +332 14C BINARY(4) Held jobs on queue with priority 8 +336 150 BINARY(4) Held jobs on queue with priority 9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 Receiver variable Output Char(*) +2 Length of receiver variable Input Binary(4) +3 Format name Input Char(8) +4 Qualified job queue name Input Char(20) +5 Error Code I/O Char(*) + + + + + + + + + + + \ No newline at end of file diff --git a/as400/connector.as400/src/main/resources/qyaspol100.pcml b/as400/connector.as400/src/main/resources/qyaspol100.pcml new file mode 100644 index 0000000000..a936055624 --- /dev/null +++ b/as400/connector.as400/src/main/resources/qyaspol100.pcml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/as400/connector.as400/src/main/resources/qyaspol300.pcml b/as400/connector.as400/src/main/resources/qyaspol300.pcml new file mode 100644 index 0000000000..259648a6ec --- /dev/null +++ b/as400/connector.as400/src/main/resources/qyaspol300.pcml @@ -0,0 +1,151 @@ + + + + + +0 0 BINARY(4) ASP number +4 4 CHAR(4) Disk type +8 8 CHAR(4) Disk model +12 C CHAR(10) Disk serial number +22 16 CHAR(10) Resource name +32 20 BINARY(4) Disk unit number +36 24 BINARY(4) Disk capacity +40 28 BINARY(4) Disk storage available +44 2C BINARY(4) Disk storage reserved for system +48 30 CHAR(1) Mirrored unit protected +49 31 CHAR(1) Mirrored unit reported +50 32 CHAR(1) Mirrored unit status +51 33 CHAR(1) Reserved +52 34 BINARY(4) Unit control +56 38 BINARY(4) Blocks transferred to main storage +60 3C BINARY(4) Blocks transferred from main storage +64 40 BINARY(4) Requests for data transfer to main storage +68 44 BINARY(4) Requests for data transfer from main storage +72 48 BINARY(4) Permanent blocks transferred from main storage +76 4C BINARY(4) Requests for permanent data transfer from main storage +80 50 BINARY(4) Sample count +84 64 BINARY(4) Not busy count +88 68 CHAR(1) Compression status +89 69 CHAR(1) Disk protection type +90 6A CHAR(1) Compressed unit +91 6B CHAR(1) Storage allocation restricted unit +92 6C CHAR(1) Availability parity set unit +93 6D CHAR(1) Multiple connection unit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 0 BINARY(4) Total records +4 4 BINARY(4) Records returned +8 8 CHAR(4) Request handle +12 C BINARY(4) Record length +16 10 CHAR(1) Information complete indicator +17 11 CHAR(13) Date and time created +30 1E CHAR(1) List status indicator +31 1F CHAR(1) Reserved +32 20 BINARY(4) Length of information returned +36 24 BINARY(4) First record in receiver variable +40 28 CHAR(40) Reserved + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 Receiver variable Output Char(*) +2 Length of receiver variable Input Binary(4) +3 Request handle Input Char(4) +4 List information Output Char(80) +5 Number of records to return Input Binary(4) +6 Starting record Input Binary(4) +7 Error code I/O Char(*) + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/IbmTest.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/IbmTest.java new file mode 100644 index 0000000000..8b98c3297f --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/IbmTest.java @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////// +// +// Program call example. This program calls the QWCRSSTS server program +// to retrieve the status of the system. +// +// Command syntax: +// PCSystemStatusExample system +// +// This source is an example of IBM Toolbox for Java "ProgramCall". +// +///////////////////////////////////////////////////////////////////////// + +package com.centreon.connector.as400; + +import com.ibm.as400.access.*; + +public class IbmTest extends Object { + public static void main(String[] parameters) { + System.out.println(" "); + + // if a system was not specified, display help text and exit. + + if (parameters.length >= 3) { + + try { + // Create an AS400 object for the server that contains the + // program. Assume the parameters are the system name, the login + // and the password. + + AS400 as400 = new AS400(parameters[0], parameters[1], parameters[2]); + + // Create the path to the program. + + QSYSObjectPathName programName = new QSYSObjectPathName("QSYS", "QWCRSSTS", "PGM"); + + // Create the program call object. Assocate the object with the + // AS400 object that represents the server we get status from. + + ProgramCall getSystemStatus = new ProgramCall(as400); + + // Create the program parameter list. This program has five + // parameters that will be added to this list. + + ProgramParameter[] parmlist = new ProgramParameter[5]; + + // The server program returns data in parameter 1. It is an output + // parameter. Allocate 64 bytes for this parameter. + + parmlist[0] = new ProgramParameter(64); + + // Parameter 2 is the buffer size of parm 1. It is a numeric input + // parameter. Sets its value to 64, convert it to the server format, + // then add the parm to the parm list. + + AS400Bin4 bin4 = new AS400Bin4(); + Integer iStatusLength = 64; + byte[] statusLength = bin4.toBytes(iStatusLength); + parmlist[1] = new ProgramParameter(statusLength); + + // Parameter 3 is the status-format parameter. It is a string input + // parameter. Set the string value, convert it to the server format, + // then add the parameter to the parm list. + + AS400Text text1 = new AS400Text(8, as400); + byte[] statusFormat = text1.toBytes("SSTS0200"); + parmlist[2] = new ProgramParameter(statusFormat); + + // Parameter 4 is the reset-statistics parameter. It is a string input + // parameter. Set the string value, convert it to the server format, + // then add the parameter to the parm list. + + AS400Text text3 = new AS400Text(10, as400); + byte[] resetStats = text3.toBytes("*NO "); + parmlist[3] = new ProgramParameter(resetStats); + + // Parameter 5 is the error info parameter. It is an input/output + // parameter. Add it to the parm list. + + byte[] errorInfo = new byte[32]; + parmlist[4] = new ProgramParameter(errorInfo, 0); + + // Set the program to call and the parameter list to the program + // call object. + + getSystemStatus.setProgram(programName.getPath(), parmlist); + + // Run the program then sleep. We run the program twice because + // the first set of results are inflated. If we discard the first + // set of results and run the command again five seconds later the + // number will be more accurate. + + getSystemStatus.run(); + Thread.sleep(5000); + + // Run the program + + if (getSystemStatus.run() != true) { + + // If the program did not run get the list of error messages + // from the program object and display the messages. The error + // would be something like program-not-found or not-authorized + // to the program. + + AS400Message[] msgList = getSystemStatus.getMessageList(); + + System.out.println("The program did not run. Server messages:"); + + for (int i = 0; i < msgList.length; i++) { + System.out.println(msgList[i].getText()); + } + } + + // Else the program did run. + + else { + + // Create a server to Java numeric converter. This converter + // will be used in the following section to convert the numeric + // output from the server format to Java format. + + AS400Bin4 as400Int = new AS400Bin4(); + + // Get the results of the program. Output data is in + // a byte array in the first parameter. + + byte[] as400Data = parmlist[0].getOutputData(); + + // CPU utilization is a numeric field starting at byte + // 32 of the output buffer. Convert this number from the + // server format to Java format and output the number. + + Integer cpuUtil = (Integer) as400Int.toObject(as400Data, 32); + cpuUtil = cpuUtil.intValue() / 10; + System.out.print("CPU Utilization: "); + System.out.print(cpuUtil); + System.out.println("%"); + + // DASD utilization is a numeric field starting at byte + // 52 of the output buffer. Convert this number from the + // server format to Java format and output the number. + + Integer dasdUtil = (Integer) as400Int.toObject(as400Data, 52); + dasdUtil = dasdUtil.intValue() / 10000; + System.out.print("Dasd Utilization: "); + System.out.print(dasdUtil); + System.out.println("%"); + + // Number of jobs is a numeric field starting at byte + // 36 of the output buffer. Convert this number from the + // server format to Java format and output the number. + + Integer nj = (Integer) as400Int.toObject(as400Data, 36); + System.out.print("Active jobs: "); + System.out.println(nj); + + } + + // This program is done running program so disconnect from + // the command server on the server. Program call and command + // call use the same server on the server. + + as400.disconnectService(AS400.COMMAND); + } catch (Exception e) { + // If any of the above operations failed say the program failed + // and output the exception. + + System.out.println("Program call failed"); + System.out.println(e); + } + } + + // Display help text when parameters are incorrect. + + else { + System.out.println(""); + System.out.println(""); + System.out.println(""); + System.out.println("Parameters are not correct. Command syntax is:"); + System.out.println(""); + System.out.println(" PCSystemStatusExample myServer myLogin myPassword"); + System.out.println(""); + System.out.println("Where"); + System.out.println(""); + System.out.println(" myServer = get status of this server "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" PCSystemStatusExample mySystem myUser myUserPwd"); + System.out.println(""); + System.out.println(""); + } + + System.exit(0); + } +} \ No newline at end of file diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/JobHandlerTest.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/JobHandlerTest.java new file mode 100644 index 0000000000..d031cbe175 --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/JobHandlerTest.java @@ -0,0 +1,34 @@ +// package com.centreon.connector.as400.check.handler.impl; +// +// import static org.junit.Assert.*; +// +// import org.junit.After; +// import org.junit.AfterClass; +// import org.junit.Before; +// import org.junit.BeforeClass; +// import org.junit.Test; +// +// public class JobHandlerTest { +// +// @BeforeClass +// public static void setUpBeforeClass() throws Exception { +// } +// +// @AfterClass +// public static void tearDownAfterClass() throws Exception { +// } +// +// @Before +// public void setUp() throws Exception { +// } +// +// @After +// public void tearDown() throws Exception { +// } +// +// @Test +// public void test() { +// fail("Not yet implemented"); +// } +// +// } diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/SystemHandlerTest.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/SystemHandlerTest.java new file mode 100644 index 0000000000..9139082bea --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/impl/SystemHandlerTest.java @@ -0,0 +1,60 @@ +package com.centreon.connector.as400.check.handler.impl; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Vector; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.ArrayList; + +import com.ibm.as400.access.AS400; +import com.ibm.as400.access.ProgramCall; +import com.ibm.as400.access.ProgramParameter; +import com.ibm.as400.access.SystemStatus; +import com.centreon.connector.as400.Conf; +import com.centreon.connector.as400.dispatcher.check.ResponseData; + +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +public class SystemHandlerTest { + + private AtomicInteger runs = new AtomicInteger(0); + + @Test + public void dumpAll_should_print_measures() throws Exception { + ByteArrayOutputStream outContent = new ByteArrayOutputStream(); + PrintStream originalOut = System.out; + System.setOut(new PrintStream(outContent)); + try { + SystemStatus as400 = mock(SystemStatus.class); + when(as400.getSystemPools()).thenReturn(new Vector().elements()); + SystemHandler sh = new SystemHandler(null, null, null, as400); + sh.dumpSystem(); + } finally { + System.setOut(originalOut); + } + assertEquals(DUMP_OUTPUT_EXPECTED, outContent.toString()); + } + + private final String DUMP_OUTPUT_EXPECTED = "ActiveJobsInSystem : 0\nActiveThreadsInSystem : 0\n" + + "BatchJobsEndedWithPrinterOutputWaitingToPrint : 0\nBatchJobsEnding : 0\nBatchJobsHeldOnJobQueue : 0\n" + + "BatchJobsHeldWhileRunning : 0\nBatchJobsOnAHeldJobQueue : 0\nBatchJobsOnUnassignedJobQueue : 0\nBatchJobsRunning : 0\n" + + "BatchJobsWaitingForMessage : 0\nBatchJobsWaitingToRunOrAlreadyScheduled : 0\nCurrentProcessingCapacity : 0.0\n" + + "CurrentUnprotectedStorageUsed : 0\nDateAndTimeStatusGathered : null\nElapsedTime : 0\nJobsInSystem : 0\nMainStorageSize : 0\n" + + "MaximumJobsInSystem : 0\nMaximumUnprotectedStorageUsed : 0\nNumberOfPartitions : 0\nNumberOfProcessors : 0\nPartitionIdentifier : 0\n" + + "PercentCurrentInteractivePerformance : 0.0\nPercentDBCapability : 0.0\nPercentPermanent256MBSegmentsUsed : 0.0\n" + + "PercentPermanent4GBSegmentsUsed : 0.0\nPercentPermanentAddresses : 0.0\nPercentProcessingUnitUsed : 0.0\n" + + "PercentSharedProcessorPoolUsed : 0.0\nPercentSystemASPUsed : 0.0\nPercentTemporary256MBSegmentsUsed : 0.0\n" + + "PercentTemporary4GBSegmentsUsed : 0.0\nPercentTemporaryAddresses : 0.0\nPercentUncappedCPUCapacityUsed : 0.0\n" + + "PoolsNumber : 0\nProcessorSharingAttribute : 0\nRestrictedStateFlag : false\nSystem : null\nSystemASP : 0 Mbytes\n" + + "SystemName : null\nTotalAuxiliaryStorage : 0\nUsersCurrentSignedOn : 0\nUsersSignedOffWithPrinterOutputWaitingToPrint : 0\n" + + "UsersSuspendedByGroupJobs : 0\nUsersSuspendedBySystemRequest : 0\nUsersTemporarilySignedOff : 0\n"; + +} diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandlerTest.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandlerTest.java new file mode 100644 index 0000000000..b631177d45 --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/CachedMessageQueueHandlerTest.java @@ -0,0 +1,37 @@ +// package com.centreon.connector.as400.check.handler.msgqueue; +// +// import org.junit.After; +// import org.junit.AfterClass; +// import org.junit.Before; +// import org.junit.BeforeClass; +// import org.junit.Test; +// import org.mockito.Mockito; +// +// import com.ibm.as400.access.QueuedMessage; +// +// public class CachedMessageQueueHandlerTest { +// +// @BeforeClass +// public static void setUpBeforeClass() throws Exception { +// } +// +// @AfterClass +// public static void tearDownAfterClass() throws Exception { +// } +// +// @Before +// public void setUp() throws Exception { +// } +// +// @After +// public void tearDown() throws Exception { +// } +// +// @Test +// public void test() { +// new CachedMessageQueueHandler("localhost", "toto", "tutu"); +// +// Mockito.mock(QueuedMessage.class); +// } +// +// } diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/LocalDbTest.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/LocalDbTest.java new file mode 100644 index 0000000000..8dafe6939a --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/check/handler/msgqueue/LocalDbTest.java @@ -0,0 +1,61 @@ +//package com.centreon.connector.as400.check.handler.msgqueue; +// +//import java.sql.Date; +//import java.sql.SQLException; +//import java.util.Calendar; +// +//import org.junit.After; +//import org.junit.AfterClass; +//import org.junit.Before; +//import org.junit.BeforeClass; +//import org.junit.Test; +//import org.mockito.Mockito; +// +//import com.ibm.as400.access.QueuedMessage; +// +//public class LocalDbTest { +// +// @BeforeClass +// public static void setUpBeforeClass() throws Exception { +// } +// +// @AfterClass +// public static void tearDownAfterClass() throws Exception { +// } +// +// @Before +// public void setUp() throws Exception { +// } +// +// @After +// public void tearDown() throws Exception { +// } +// +// private QueuedMessage createMockedObject(final String msgId, final int severity, final String text, final int type, final String user, final Date date, +// final Date createDate) { +// +// final QueuedMessage msg = Mockito.mock(QueuedMessage.class); +// Mockito.when(msg.getID()).thenReturn(msgId); +// Mockito.when(msg.getSeverity()).thenReturn(severity); +// Mockito.when(msg.getText()).thenReturn(text); +// Mockito.when(msg.getType()).thenReturn(type); +// Mockito.when(msg.getUser()).thenReturn(user); +// Mockito.when(msg.getDate()).thenReturn(new Calendar.Builder().setDate(1, 1, 1).build()); +// Mockito.when(msg.getCreateDate()).thenReturn(createDate); +// +// return msg; +// } +// +// @Test +// public void testAddEntry() throws SQLException { +// final LocalDb db = new LocalDb("/tmp/test123"); +// final QueuedMessage msg = this.createMockedObject("123", 5, "This is an output", 2, "user", new Date(0), new Date(0)); +// db.addEntry(msg); +// } +// +// @Test +// public void testGetQueuedMessage() { +// // Assert.fail("Not yet implemented"); +// } +// +//} diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/client/TestClient.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/client/TestClient.java new file mode 100644 index 0000000000..608f53bd1c --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/client/TestClient.java @@ -0,0 +1,53 @@ +// package com.centreon.connector.as400.client; +// +// import java.io.IOException; +// +// import org.junit.After; +// import org.junit.AfterClass; +// import org.junit.Before; +// import org.junit.BeforeClass; +// import org.junit.Test; +// import org.mockito.Mockito; +// +// import com.ibm.as400.access.AS400SecurityException; +// import com.centreon.connector.as400.client.impl.CommandLineClient; +// import com.centreon.connector.as400.daemon.DelayedConnectionException; +// import com.centreon.connector.as400.dispatcher.check.CheckDispatcher; +// import com.centreon.connector.as400.dispatcher.check.CheckHandlerRunnable; +// +// public class TestClient { +// @BeforeClass +// public static void setUpBeforeClass() throws Exception { +// } +// +// @AfterClass +// public static void tearDownAfterClass() throws Exception { +// } +// +// @Before +// public void setUp() throws Exception { +// +// } +// +// @After +// public void tearDown() throws Exception { +// } +// +// @Test +// public void testCommandLine() throws AS400SecurityException, IOException, +// DelayedConnectionException, Exception { +// final String args[] = { "-I", "-H", "localhost", "--login", "test", +// "--password", "test", "-C", "cpu", "-A", "80,90" }; +// final IClient client = new CommandLineClient(args); +// // ClientDispatcherImpl.getInstance().dispatch(client); +// +// final CheckDispatcher dispatcher = Mockito.mock(CheckDispatcher.class); +// +// final CheckHandlerRunnable runnable = new CheckHandlerRunnable(client, +// dispatcher); +// runnable.run(); +// // final CheckDispatcher checkDispatcher = new +// // CheckDispatcher("localhost", "test", "test"); +// // checkDispatcher.dispatch(client); +// } +// } diff --git a/as400/connector.as400/src/test/java/com/centreon/connector/as400/dispatcher/check/TestCheckHandlerRunnable.java b/as400/connector.as400/src/test/java/com/centreon/connector/as400/dispatcher/check/TestCheckHandlerRunnable.java new file mode 100644 index 0000000000..d433f1fb87 --- /dev/null +++ b/as400/connector.as400/src/test/java/com/centreon/connector/as400/dispatcher/check/TestCheckHandlerRunnable.java @@ -0,0 +1,144 @@ +package com.centreon.connector.as400.dispatcher.check; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import com.centreon.connector.as400.check.handler.ICommandHandler; +import com.centreon.connector.as400.check.handler.IDiskHandler; +import com.centreon.connector.as400.check.handler.IJobHandler; +import com.centreon.connector.as400.check.handler.IJobQueueHandler; +import com.centreon.connector.as400.check.handler.IMessageQueueHandler; +import com.centreon.connector.as400.check.handler.ISubSystemHandler; +import com.centreon.connector.as400.check.handler.ISystemHandler; + +public class TestCheckHandlerRunnable extends CheckHandlerRunnable { + + public TestCheckHandlerRunnable() { + super(null, null); + + } + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Before + public void setUp() throws Exception { + new ResponseData(ResponseData.statusOk, "OK"); + + final ISubSystemHandler subSystemHandler = Mockito.mock(ISubSystemHandler.class, new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + final ISystemHandler systemHandler = Mockito.mock(ISystemHandler.class, new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + final IJobHandler jobHandler = Mockito.mock(IJobHandler.class, new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + final IDiskHandler diskHandler = Mockito.mock(IDiskHandler.class, new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + final ICommandHandler commandHandler = Mockito.mock(ICommandHandler.class, new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + final IMessageQueueHandler messageQueueHandler = Mockito.mock(IMessageQueueHandler.class, + new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + final IJobQueueHandler jobQueueHandler = Mockito.mock(IJobQueueHandler.class, new Answer() { + @Override + public ResponseData answer(final InvocationOnMock invocation) throws Throwable { + return new ResponseData(ResponseData.statusOk, "OK"); + } + }); + + this.checkDispatcher = Mockito.mock(CheckDispatcher.class); + + Mockito.when(this.checkDispatcher.getJobHandler()).thenReturn(jobHandler); + Mockito.when(this.checkDispatcher.getCommandHandler()).thenReturn(commandHandler); + Mockito.when(this.checkDispatcher.getSubSystemHandler()).thenReturn(subSystemHandler); + Mockito.when(this.checkDispatcher.getDiskHandler()).thenReturn(diskHandler); + Mockito.when(this.checkDispatcher.getSystemHandler()).thenReturn(systemHandler); + Mockito.when(this.checkDispatcher.getMessageQueueHandler()).thenReturn(messageQueueHandler); + Mockito.when(this.checkDispatcher.getJobQueueHandler()).thenReturn(jobQueueHandler); + } + + @After + public void tearDown() throws Exception { + } + + private void testCommand(final String command, final int exceptedStatus) { + final ResponseData data = this.handleAs400Args(command); + Assert.assertEquals(data.getMessage(), exceptedStatus, data.getCode()); + } + + @Test + public void testListDisks() throws NumberFormatException, Exception { + this.testCommand("listDisks", ResponseData.statusError); + } + + @Test + public void testListSubsystems() throws NumberFormatException, Exception { + this.testCommand("listSubsystems", ResponseData.statusOk); + } + + @Test + public void testListJobs() throws NumberFormatException, Exception { + this.testCommand("listJobs", ResponseData.statusOk); + } + + @Test + public void testGetErrorMessageQueue() throws NumberFormatException, Exception { + this.testCommand("getErrorMessageQueue", ResponseData.statusError); + } + + @Test + public void testPageFault() throws NumberFormatException, Exception { + this.testCommand("pageFault", ResponseData.statusOk); + } + + @Test + public void testGetJobQueues() throws NumberFormatException, Exception { + this.testCommand("getJobQueues", ResponseData.statusError); + } + + @Test + public void testExecuteCommand() throws NumberFormatException, Exception { + this.testCommand("executeCommand", ResponseData.statusError); + } + + @Test + public void testUnknown() throws NumberFormatException, Exception { + this.testCommand("blabla", ResponseData.statusError); + } +} diff --git a/as400/connector.as400/src/test/resources/config.properties b/as400/connector.as400/src/test/resources/config.properties new file mode 100644 index 0000000000..ba780d0326 --- /dev/null +++ b/as400/connector.as400/src/test/resources/config.properties @@ -0,0 +1,39 @@ +daemonListenerHost=localhost + +#as400 login timeout for nagios check (ms) +as400LoginTimeout=10000 + +#as400 read timeout for nagios check (ms) +as400ReadTimeout=300000 + +#Time before cleaning an unused as400 resource (ms) +as400ResourceDuration=7200000 + +#time before killing a dead as400 connection (s) +as400SoLinger=1 + +#Duration of the job & (ms) +cacheTimeout=60000 + +daemonNoRequestTimeout=5000 + +daemonRequestParseTimeout=5000 + +#time before killing a dead as400 connection (s) +daemonSoLinger=1 + +#Time before discaring a check in queue (ms) +workerQueueTimeout=360000 + +# active debug +debug=false + +# active exception +exception=false + +# active trace (in /tmp/trace.log) +trace=false + +# MessageQueueDB Base path +pathMsgQDB=/tmp/ + diff --git a/as400/connector.as400/src/test/resources/log4j2.xml b/as400/connector.as400/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..65a7c6f27a --- /dev/null +++ b/as400/connector.as400/src/test/resources/log4j2.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/as400/doc/.project b/as400/doc/.project new file mode 100644 index 0000000000..f7597a8ab5 --- /dev/null +++ b/as400/doc/.project @@ -0,0 +1,11 @@ + + + doc + + + + + + + + diff --git a/as400/doc/en/exploitation/configurationCentreon.rst b/as400/doc/en/exploitation/configurationCentreon.rst new file mode 100644 index 0000000000..d006b58fe3 --- /dev/null +++ b/as400/doc/en/exploitation/configurationCentreon.rst @@ -0,0 +1,90 @@ +.. _configurationCentreon: + +###################### +Centreon configuration +###################### + +Template configuration in Centreon are on necessary when using the tarball installation. +To fully exploit Centreon-Connector-AS400, it is recommanded to perform a series of actions. + +Create a generic check command +============================== + +Go to the « Configuration → Commande » menu and create a " check_as400_generic " command. + +Insert the command: + ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| $USER1$/check_centreon_as400_generic \-\-connector "$_HOSTDAEMONHOST$:$_HOSTDAEMONPORT$" \-\-host "$HOSTADDRESS$" \-\-user "$_HOSTAS400USER$" \-\-password "$_HOSTAS400PASSWORD$" \-\-check "$_SERVICECHECK$" \-\-args "$_SERVICEARGS$" | ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +This command has a series of macros used at different level of host templates , hosts, service templates, services. + +Macro prefixed with HOST are retrieved from the host definition (or host template). +Macros prefixed with SERVICE are retrieved from the service definition. (or service template) . + ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| Macro name | Macro value | Resource where the macro must be defined (recommanded) | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| DAEMONHOST | IP or hostname of the server running the daemon AS/400 | Lowest level AS/400 host template | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| DAEMONPORT | Daemon port | Lowest level AS/400 host template | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| AS400USER | AS/400 user name | AS/400 Host | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| AS400PASSWORD | AS/400 password | AS/400 Host | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| CHECK | Check command | Service or AS/400 model service of the highest level | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ +| ARGS | Check command arguments | Service or AS/400 model service of the highest level | ++---------------+--------------------------------------------------------+--------------------------------------------------------+ + +Create a generic host template +============================== + +Go to the menu « Configuration → Hosts → Templates » and create an host template « as400 ». +This model will be the lowest level host template for all AS/400 hosts. Other higher level host template can be created . +Configure all the fields as shown in Centreon documentation. + +Define the following macros : + ++------------+-----------------------+ +| Macro name | Macro value | ++------------+-----------------------+ +| DAEMONHOST | Exemple : 10.30.10.30 | ++------------+-----------------------+ +| DAEMONPORT | Exemple : 8091 | ++------------+-----------------------+ + +Create an as400 host +==================== + +Go to the " Configuration → Hosts " menu and create an host based on the host template "as400" generic (or a higher-level host template based on the template "as400" generic) . + +Define the following macros: + ++---------------+-----------------------+ +| Macro name | Macro value | ++---------------+-----------------------+ +| AS400USER | Exemple : USER123 | ++---------------+-----------------------+ +| AS400PASSWORD | Exemple : PASSWORD123 | ++---------------+-----------------------+ + + +Create a service template or service +==================================== + +Go « Configuration → Services » or « Template », and create a service or service template + +Define the following maccro + ++------------+--------------------+ +| Macro name | Macro value | ++------------+--------------------+ +| CHECK | Exemple : cpuUsage | ++------------+--------------------+ +| ARGS | Exemple : 80!90 | ++------------+--------------------+ + +The various commands and arguments are explained in the " List of indicators " diff --git a/as400/doc/en/exploitation/index.rst b/as400/doc/en/exploitation/index.rst new file mode 100644 index 0000000000..981101ea93 --- /dev/null +++ b/as400/doc/en/exploitation/index.rst @@ -0,0 +1,14 @@ +.. _exploitation: + +############ +Exploitation +############ + +.. toctree:: + :glob: + + mode + configurationCentreon + indicator + + \ No newline at end of file diff --git a/as400/doc/en/exploitation/indicator.rst b/as400/doc/en/exploitation/indicator.rst new file mode 100644 index 0000000000..84d9c5daad --- /dev/null +++ b/as400/doc/en/exploitation/indicator.rst @@ -0,0 +1,32 @@ +.. _indicator: + +############## +Indicator list +############## + +Depending of the used API, user rights on AS/400 may vary. +They are specified in each control. + +.. toctree:: + + indicators/cpuUsage + indicators/asp1Usage + indicators/diskState + indicators/diskUsage + indicators/diskUsageRepartition + indicators/subSystemExist + indicators/pageFault + indicators/jobExist + indicators/jobHasNoMsgw + indicators/allJobHaveNoMsgW + indicators/allJobHaveNoMsgWInSubSystem + indicators/backupJobExist + indicators/jobQueueStatus + indicators/jobQueueWaitJobCount + indicators/specificJobInSubSystem + indicators/specificJobRunningInSubSystem + indicators/messageQueueSize + indicators/messageQueueSizeFiltered + indicators/newMessageInMessageQueue + indicators/executeCommand + indicators/workWithProblem diff --git a/as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst b/as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst new file mode 100644 index 0000000000..61808f2197 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst @@ -0,0 +1,59 @@ +.. _allJobHaveNoMsgW: + +********************************************************************** +Check the amount of jobs with a message wait (MSGW) (allJobHaveNoMsgW) +********************************************************************** + +Description +^^^^^^^^^^^ + ++--------------------+------------------------------------------------------------------------------------------------+ +| Description | Control all jobs , the as400 , and check that they are not waiting for a message ( MSGW ) | ++--------------------+------------------------------------------------------------------------------------------------+ +| Operation | OK if the number of job waiting for a message is less or equal to the warning count | +| | WARNING if the number of job waiting for a message is less than the critical count | +| | CRITICAL if the number of job waiting for a message is equal or greater to the critical count | ++--------------------+------------------------------------------------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+------------------------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+-------------------------------+-----------------+-----------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+-------------------------------+-----------------+-----------------------------+---------+ +| allJobHaveNoMsgW | 1 | Arguments order | Description | Exemple | ++------------------+-------------------------------+-----------------+-----------------------------+---------+ +| | | Argument 1 | Warning threshold (amount) | 1 | ++------------------+-------------------------------+-----------------+-----------------------------+---------+ +| | | Argument 2 | Critical threshold (amount) | 2 | ++------------------+-------------------------------+-----------------+-----------------------------+---------+ +| Metrics returned | totalJob=1234 jobMSGW=1 | | | | ++------------------+-------------------------------+-----------------+-----------------------------+---------+ +| Output returned | Job name waiting for messages | | | | ++------------------+-------------------------------+-----------------+-----------------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++------------------------------+-------------------------------+-----------------------------+ +| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | ++------------------------------+-------------------------------+-----------------------------+ +| 1 (theoretic) | 77 o | 2,3 o | ++------------------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+------------------+ +| Macro name | Macro value | ++------------+------------------+ +| CHECK | allJobHaveNoMsgW | ++------------+------------------+ +| ARGS | 1!2 | ++------------+------------------+ diff --git a/as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst b/as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst new file mode 100644 index 0000000000..340cb60555 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst @@ -0,0 +1,61 @@ +.. _allJobHaveNoMsgWInSubSystem: + +*********************************************************************************************************** +Check the amount of jobs with a message wait (MSGW) in a specific file system (allJobHaveNoMsgWInSubSystem) +*********************************************************************************************************** + +Description +^^^^^^^^^^^ + ++--------------------+--------------------------------------------------------------------------------------------------------+ +| Description | Control all jobs in a specific file system, and check that they are not waiting for a message ( MSGW ) | ++--------------------+--------------------------------------------------------------------------------------------------------+ +| Operation | OK if the number of job waiting for a message is less or equal to the warning count | +| | WARNING if the number of job waiting for a message is less than the critical count | +| | CRITICAL if the number of job waiting for a message is equal or greater to the critical count | ++--------------------+--------------------------------------------------------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+--------------------------------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+--------------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| allJobHaveNoMsgWInSubSystem | 1 | Arguments order | Description | Exemple | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| | | Argument 1 | SubSystem name | QBASE | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| | | Argument 2 | Seuil Warning (quantité) | 1 | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| | | Argument 3 | Seuil Critical (quantité) | 2 | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| Metrics returned | totalJob=1234 jobMSGW=1 | | | | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ +| Output returned | Job name waiting for messages | | | | ++-----------------------------+-------------------------------+-----------------+---------------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++------------------------------+-------------------------------+-----------------------------+ +| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | ++------------------------------+-------------------------------+-----------------------------+ +| 1 (theoretic) | 77 o | 2,3 o | ++------------------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------------------+ +| Macro name | Macro value | ++------------+-----------------------------+ +| CHECK | allJobHaveNoMsgWInSubSystem | ++------------+-----------------------------+ +| ARGS | QBASE!1!2 | ++------------+-----------------------------+ diff --git a/as400/doc/en/exploitation/indicators/asp1Usage.rst b/as400/doc/en/exploitation/indicators/asp1Usage.rst new file mode 100644 index 0000000000..3c37f60093 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/asp1Usage.rst @@ -0,0 +1,55 @@ +.. _asp1Usage: + +**************************************** +Check the usage rate of ASP1 (asp1Usage) +**************************************** + +Description +^^^^^^^^^^^ + ++--------------------+--------------------------------------------------------+ +| Description | Contrôle le taux d'occupation de l'ASP1. | ++--------------------+--------------------------------------------------------+ +| Operation | Ok if the usage rate is below warning threshold | +| | Warning if the usage rate is above warning threshold | +| | Critical if the usage rate is above critical threshold | ++--------------------+--------------------------------------------------------+ +| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | ++--------------------+--------------------------------------------------------+ +| Required authority | *USE | ++--------------------+--------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+------------------------+---------+ +| asp1Usage | | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+------------------------+---------+ +| | | Argument 1 | Warning threshold (%) | 80 | ++------------------+---------------------+-----------------+------------------------+---------+ +| | | Argument 2 | Critical threshold (%) | 90 | ++------------------+---------------------+-----------------+------------------------+---------+ +| Metrics returned | usage=xx% | | | | ++------------------+---------------------+-----------------+------------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 1,5 ko | 1.1 ko | ++---------------------------------+-------------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | asp1Usage | ++------------+-------------+ +| ARGS | 80!90 | ++------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/backupJobExist.rst b/as400/doc/en/exploitation/indicators/backupJobExist.rst new file mode 100644 index 0000000000..3123cac5c7 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/backupJobExist.rst @@ -0,0 +1,51 @@ +.. _backupJobExist: + +******************************************** +Existence of the backup job (backupJobExist) +******************************************** + +Description +^^^^^^^^^^^ + ++--------------------+-----------------------------------------------------------------------------------+ +| Description | Control the existence of the backup job RBT_DDMMYY . Does not control it's status | ++--------------------+-----------------------------------------------------------------------------------+ +| Operation | Ok if job exist | +| | Critical if the job does not exist. | +| | DDMMYY is the day of the check eecution. Date is the date from as400 server | ++--------------------+-----------------------------------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+-----------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+-----------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+-------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+-------------+---------+ +| backupJobExist | | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+-------------+---------+ +| | | Argument 1 | X | X | ++------------------+---------------------+-----------------+-------------+---------+ +| Metrics returned | | | | | ++------------------+---------------------+-----------------+-------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------+ +| Macro name | Macro value | ++------------+----------------+ +| CHECK | backupJobExist | ++------------+----------------+ diff --git a/as400/doc/en/exploitation/indicators/cpuUsage.rst b/as400/doc/en/exploitation/indicators/cpuUsage.rst new file mode 100644 index 0000000000..efd2ac1c78 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/cpuUsage.rst @@ -0,0 +1,56 @@ +.. _cpuUsage: + +********* +CPU usage +********* + +Description +^^^^^^^^^^^ + ++--------------------+-----------------------------------------------------------+-+ +| Description | Controls the time rate AS/400 CPU was used | | ++--------------------+-----------------------------------------------------------+-+ +| Operation | Ok if the CPU time rate is below warning threshold | | +| | Warning if the cpu time rate goes above warning threshold | | +| | Critical if the cpu time goes above critical threshold | | +| | Can exceed 100% on uncapped partition | | ++--------------------+-----------------------------------------------------------+-+ +| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | | ++--------------------+-----------------------------------------------------------+-+ +| Required authority | *USE | | ++--------------------+-----------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+------------------------+---------+ +| cpuUsage | 2 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+------------------------+---------+ +| | | Argument 1 | Warning threshold (%) | 80 | ++------------------+---------------------+-----------------+------------------------+---------+ +| | | Argument 2 | Critical threshold (%) | 90 | ++------------------+---------------------+-----------------+------------------------+---------+ +| Metrics returned | usage=xx% | | | | ++------------------+---------------------+-----------------+------------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------+---------------------------------+ +| Download (as400 vers connector) | Download (as400 vers connector) | ++---------------------------------+---------------------------------+ +| 1,7 ko | 1.5 ko | ++---------------------------------+---------------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | cpuUsage | ++------------+-------------+ +| ARGS | 80!90 | ++------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/diskState.rst b/as400/doc/en/exploitation/indicators/diskState.rst new file mode 100644 index 0000000000..a98f60dc35 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/diskState.rst @@ -0,0 +1,51 @@ +.. _diskState: + +************************************************************ +Check the operating status of all physical disks (diskState) +************************************************************ + +Description +^^^^^^^^^^^ + ++--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Description | Check the operating status of all physical disks | ++--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Operation | A physical disk may take several state : no control, active, failed, hardware failure, rebuild, not ready, protected, busy, not operational, unknown state (13 états au total). | +| | Ok if all disks are active | +| | Critical if at least 1 disk is in a different state than active | ++--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Used API | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | ++--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+--------------------------+-----------------+-------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+--------------------------+-----------------+-------------+---------+ +| diskState | 0 | Arguments order | Description | Exemple | ++------------------+--------------------------+-----------------+-------------+---------+ +| | | X | X | X | ++------------------+--------------------------+-----------------+-------------+---------+ +| Metrics returned | totaldisk=x activedisk=x | | | | ++------------------+--------------------------+-----------------+-------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 4,1 ko | 4,3 ko | ++---------------------------------+-------------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | diskState | ++------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/diskUsage.rst b/as400/doc/en/exploitation/indicators/diskUsage.rst new file mode 100644 index 0000000000..ca342a17e9 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/diskUsage.rst @@ -0,0 +1,57 @@ +.. _diskUsage: + +*********************************************** +Check usage rate of a physical disk (Diskusage) +*********************************************** + +Description +^^^^^^^^^^^ + ++--------------------+-------------------------------------------------------------------+-+ +| Description | Check usage rate of a physical disk | | ++--------------------+-------------------------------------------------------------------+-+ +| Operation | Ok if usage is below the warning threshold. | | +| | Warning si le taux d'occupation est au dessus du seuil warning. | | +| | Critical si le taux d'occupation est au dessus du seuil critique. | | ++--------------------+-------------------------------------------------------------------+-+ +| Used API | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | | ++--------------------+-------------------------------------------------------------------+-+ +| Required authority | *USE | | ++--------------------+-------------------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ +| diskUsage | 3 | Arguments order | Description | Exemple | ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ +| | | Argument 1 | Disk name | DD003 | ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ +| | | Argument 2 | Warning threshold (%) | 80 | ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ +| | | Argument 3 | Critical threshold (%) | 90 | ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ +| Metrics returned | totalSpace=123456B usedSpace=12345B systemSpace=1234B | | | | ++------------------+-------------------------------------------------------+-----------------+------------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++-------------------------------+-----------------------------+ +| Download (as400 to connector) | Upload (connector to as400) | ++-------------------------------+-----------------------------+ +| 700 o | 700 o | ++-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | diskUsage | ++------------+-------------+ +| ARGS | DD003!80!90 | ++------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/diskUsageRepartition.rst b/as400/doc/en/exploitation/indicators/diskUsageRepartition.rst new file mode 100644 index 0000000000..dbdb218fa1 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/diskUsageRepartition.rst @@ -0,0 +1,56 @@ +.. _diskUsageRepartition: + +************************************************************* +Check the gap usage rate between the different physical disks +************************************************************* + +Description +^^^^^^^^^^^ + ++--------------------+---------------------------------------------------------------------------------------+-+ +| Description | Check the gap usage rate between the different physical disks. | | ++--------------------+---------------------------------------------------------------------------------------+-+ +| Operation | Calculate the difference between the minimum and maximum usage of all physical disks. | | +| | Ok if the difference is below the warning threshold. | | +| | Warning if the difference is above the warning threshold. | | +| | Critical if the difference is above the critical threshold. | | ++--------------------+---------------------------------------------------------------------------------------+-+ +| Used API | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | | ++--------------------+---------------------------------------------------------------------------------------+-+ +| Required authority | *USE | | ++--------------------+---------------------------------------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++----------------------+---------------------+-----------------+-----------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++----------------------+---------------------+-----------------+-----------------------+---------+ +| diskUsageRepartition | 2 | Arguments order | Description | Exemple | ++----------------------+---------------------+-----------------+-----------------------+---------+ +| | | Argument 1 | Warning threshold (%) | 0.5 | ++----------------------+---------------------+-----------------+-----------------------+---------+ +| | | Argument 2 | Warning threshold (%) | 2 | ++----------------------+---------------------+-----------------+-----------------------+---------+ +| Metrics returned | gap=xx% | | | | ++----------------------+---------------------+-----------------+-----------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++-------------------------------+-----------------------------+ +| Download (as400 to connector) | Upload (connector to as400) | ++-------------------------------+-----------------------------+ +| 750 o | 750 o | ++-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------------+ +| Macro name | Macro value | ++------------+----------------------+ +| CHECK | diskUsageRepartition | ++------------+----------------------+ +| ARGS | 0.5!2 | ++------------+----------------------+ diff --git a/as400/doc/en/exploitation/indicators/executeCommand.rst b/as400/doc/en/exploitation/indicators/executeCommand.rst new file mode 100644 index 0000000000..86e8a34b83 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/executeCommand.rst @@ -0,0 +1,62 @@ +.. _executeCommand: + +************************** +Execute a command on as400 +************************** + +Description +^^^^^^^^^^^ + ++--------------------+--------------------------------------------------------+-+ +| Description | Execute a command on as400 | | ++--------------------+--------------------------------------------------------+-+ +| Operation | Ok if the comamnd is successful | | +| | Critical if the command does not execute successfully. | | ++--------------------+--------------------------------------------------------+-+ +| Used API | | | ++--------------------+--------------------------------------------------------+-+ +| Required authority | | | ++--------------------+--------------------------------------------------------+-+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+--------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+--------------+---------+ +| executeCommand | 1 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+--------------+---------+ +| | | Argument 1 | Command name | TEST | ++------------------+---------------------+-----------------+--------------+---------+ +| Metrics returned | None | | | | ++------------------+---------------------+-----------------+--------------+---------+ +| Output | Command return | | | | ++------------------+---------------------+-----------------+--------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++-------------------------------+-----------------------------+ +| Download (as400 to connector) | Upload (connector to as400) | ++-------------------------------+-----------------------------+ +| variable | 800 o | ++-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------+ +| Macro name | Macro value | ++------------+----------------+ +| CHECK | executeCommand | ++------------+----------------+ +| ARGS | TEST | ++------------+----------------+ + +Note: The output will only be available if messages have been generated by the executed command. + +Generating a message from an AS/400 CL program: + ++----------------------------------------------------------------------------------------------------------+ +| SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) \+ MSGDTA('Ceci est un message') \+ TOPGMQ(*EXT) MSGTYPE(*STATUS) | ++----------------------------------------------------------------------------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/jobExist.rst b/as400/doc/en/exploitation/indicators/jobExist.rst new file mode 100644 index 0000000000..1eee6bec31 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/jobExist.rst @@ -0,0 +1,56 @@ +.. _jobExist: + +******************************************************************* +Check the existence of a job. Does not control its state (jobExist) +******************************************************************* + +Description +^^^^^^^^^^^ + ++--------------------+----------------------------------------------------------+ +| Description | Check the existence of a job. Does not control its state | ++--------------------+----------------------------------------------------------+ +| Operation | Ok if the job exist | +| | Critical if the job doesn't exist | ++--------------------+----------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+----------------------------------------------------------+ +| Required authority | *USE | ++--------------------+----------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+----------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+----------------+---------+ +| jobExist | 1 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+----------------+---------+ +| | | Argument 1 | Job name | QCTL | ++------------------+---------------------+-----------------+----------------+---------+ +| | | Argument 2 | Subsystem name | QBASE | ++------------------+---------------------+-----------------+----------------+---------+ +| Metrics returned | | | | | ++------------------+---------------------+-----------------+----------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------+-------------------------------+-----------------------------+ +| Job count on server | Download (as400 to connector) | Upload (connector to as400) | ++---------------------+-------------------------------+-----------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | jobExist | ++------------+-------------+ +| ARGS | QCTL !QBASE | ++------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst b/as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst new file mode 100644 index 0000000000..8686b582c3 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst @@ -0,0 +1,56 @@ +.. _jobHasNoMsgw: + +************************************************************************* +Check the existence of a job. Check if the job has no MSGW (jobHasNoMsgw) +************************************************************************* + +Description +^^^^^^^^^^^ + ++--------------------+--------------------------------------------------------------------------+ +| Description | Check the existence of a job. Check if the job has no MSGW | ++--------------------+--------------------------------------------------------------------------+ +| Fonctionnement | Ok if the job exist | +| | Critical if the job doesn't exist, or the job has a message wait (MSGW) | ++--------------------+--------------------------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+--------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+--------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+----------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+----------------+---------+ +| jobHasNoMsgw | 1 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+----------------+---------+ +| | | Argument 1 | Job name | QCTL | ++------------------+---------------------+-----------------+----------------+---------+ +| | | Argument 2 | Subsystem name | QBASE | ++------------------+---------------------+-----------------+----------------+---------+ +| Metrics returned | | | | | ++------------------+---------------------+-----------------+----------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------+-------------------------------+-----------------------------+ +| Job count on server | Download (as400 to connector) | Upload (connector to as400) | ++---------------------+-------------------------------+-----------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------+-------------------------------+-----------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+--------------+ +| Macro name | Macro value | ++------------+--------------+ +| CHECK | jobHasNoMsgw | ++------------+--------------+ +| ARGS | QCTL!QBASE | ++------------+--------------+ diff --git a/as400/doc/en/exploitation/indicators/jobQueueStatus.rst b/as400/doc/en/exploitation/indicators/jobQueueStatus.rst new file mode 100644 index 0000000000..dc78c5e2b3 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/jobQueueStatus.rst @@ -0,0 +1,55 @@ +.. _jobQueueStatus: + +************************************************************* +Check the existence and status of a jobQueue (jobQueueStatus) +************************************************************* + +Description +^^^^^^^^^^^ + ++--------------------+------------------------------------------------------------------------------------------------------------------+ +| Description | Check the existence and status of a jobQueue | ++--------------------+------------------------------------------------------------------------------------------------------------------+ +| Operation | A jobQueue can have status RELEASED or HELD. | +| | OK if the jobQueue is in RELEASED state | +| | Critical if the jobQueue is in HELD status or doesn't exist | ++--------------------+------------------------------------------------------------------------------------------------------------------+ +| Used API | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | ++--------------------+------------------------------------------------------------------------------------------------------------------+ +| Required authority | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue* JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | ++--------------------+------------------------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+---------------+-----------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+---------------+-----------+ +| jobQueueStatus | 2 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+---------------+-----------+ +| | | Argument 1 | JobQueue name | QSYSNOMAX | ++------------------+---------------------+-----------------+---------------+-----------+ +| | | Argument 2 | Library name | QSYS | ++------------------+---------------------+-----------------+---------------+-----------+ +| Metrics returned | X | | | | ++------------------+---------------------+-----------------+---------------+-----------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 1,7 ko | 1,9 ko | ++---------------------------------+-------------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------+ +| Macro name | Macro value | ++------------+----------------+ +| CHECK | jobQueueStatus | ++------------+----------------+ +| ARGS | QSYSNOMAX!QSYS | ++------------+----------------+ diff --git a/as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst b/as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst new file mode 100644 index 0000000000..8d02ea5a20 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst @@ -0,0 +1,60 @@ +.. _jobQueueWaitJobCount: + +********************************************************************************************* +Check amount of job waiting in a jobQueue disregarding jobs priorities (jobQueueWaitJobCount) +********************************************************************************************* + +Description +^^^^^^^^^^^ + ++------------------+-----------------------------------------------------------------------------------------------------------------+-+ +| Description | Check amount of job waiting in a jobQueue disregarding jobs priorities | | ++------------------+-----------------------------------------------------------------------------------------------------------------+-+ +| Fonctionnement | The jobs in a jobs queue can be ACTIVE, HELD, ou SCHEDULED. | | +| | Ok if the job count in HELD state is below the warning threshold. | | +| | Warning if the job count in HELD state is above the warning threshold. | | +| | Critical if job count in HELD state is above the critical threshold. | | ++------------------+-----------------------------------------------------------------------------------------------------------------+-+ +| API utilisée | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | | ++------------------+-----------------------------------------------------------------------------------------------------------------+-+ +| Autorité requise | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue*JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | | ++------------------+-----------------------------------------------------------------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| Command name | Number of arguments | Arguments | | | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| jobQueueWaitJobCount | 4 | Arguments order | Description | Exemple | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| | | Argument 1 | JobQueue name | QSYSNOMAX | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| | | Argument 2 | Library name | QSYS | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| | | Argument 3 | Warning threshold (amount) | 1 | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| | | Argument 4 | Critical threshold (amount) | 2 | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ +| Metrics returned | activeJob=44 heldJobOnQueue=0 scheduledJobOnQueue=0 | | | | ++----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ + +Network usage +^^^^^^^^^^^^^ + ++-------------------------------+-----------------------------+ +| Download (as400 to connector) | Upload (connector to as400) | ++-------------------------------+-----------------------------+ +| 750 o | 800 o | ++-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------------+ +| Macro name | Macro value | ++------------+----------------------+ +| CHECK | jobQueueWaitJobCount | ++------------+----------------------+ +| ARGS | QSYSNOMAX!QSYS!1!2 | ++------------+----------------------+ diff --git a/as400/doc/en/exploitation/indicators/messageQueueSize.rst b/as400/doc/en/exploitation/indicators/messageQueueSize.rst new file mode 100644 index 0000000000..8ae73fc4b2 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/messageQueueSize.rst @@ -0,0 +1,62 @@ +.. _messageQueueSize: + +*************************************************** +Check the size of a MessageQueue (messageQueueSize) +*************************************************** + +Description +^^^^^^^^^^^ + ++--------------------+-------------------------------------------------------------------------------------+-+ +| Description | Check the size of a MessageQueue | | ++--------------------+-------------------------------------------------------------------------------------+-+ +| Operation | Retrieves all messages whose severity is greater or equal to minimum severity level | | +| | Ok if the number of messages is below the warning threshold. | | +| | Warning message if the number is above the warning threshold. | | +| | Critical if the message number is above the critical threshold. | | ++--------------------+-------------------------------------------------------------------------------------+-+ +| Used API | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | ++--------------------+-------------------------------------------------------------------------------------+-+ +| Required authority | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | | ++--------------------+-------------------------------------------------------------------------------------+-+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| messageQueueSize | 4 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 1 | MessageQueue name | /QSYS.LIB/QSYSOPR.MSGQ | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 2 | Minimum severity level | 40 | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 3 | Warning threshold (amount) | 2000 | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 4 | Critical threshold (amount) | 2500 | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ +| Metrics returned | count=1234 | | | | ++------------------+---------------------+-----------------+-----------------------------+------------------------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------------+-------------------------------+-----------------------------+ +| Amount of message in the messageQueue | Download (as400 to connector) | Upload (connector to as400) | ++---------------------------------------+-------------------------------+-----------------------------+ +| 1 (théorique) | 2,26 ko | 66 o | ++---------------------------------------+-------------------------------+-----------------------------+ +| 5000 | 11 mo | 325 ko | ++---------------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------------------------------+ +| Macro name | Macro value | ++------------+-------------------------------------+ +| CHECK | messageQueueSize | ++------------+-------------------------------------+ +| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!40!2000!2500 | ++------------+-------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst b/as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst new file mode 100644 index 0000000000..1dfe692fb0 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst @@ -0,0 +1,67 @@ +.. _messageQueueSizeFiltered: + +******************************************************************************************************************* +Check to count message in messageQueue (MSGQ) according to their severity and message ID (messageQueueSizeFiltered) +******************************************************************************************************************* + +Description +^^^^^^^^^^^ + ++--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ +| Description | Count amount of messages in messageQueue (MSGQ) according to their severity and message ID (messageQueueSizeFiltered) | | ++--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ +| Operation | Retrieves all messages whose severity is between min and max severity level, and whose message ID match the regex | | +| | Ok if the number of messages is below the warning threshold. | | +| | Warning message if the number is above the warning threshold. | | +| | Critical if the message number is above the critical threshold. | | ++--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ +| Used API | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | ++--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ +| Required authority | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | | ++--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| Command name | Number of arguments | Arguments | | | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| messageQueueSizeFiltered | 6 | Arguments order | Description | Exemple | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 1 | messageQueue name | /QSYS.LIB/QSYSOPR.MSGQ | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 2 | Regex filtering message ID | ^CP.*$ | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 3 | Minimal severity level | 60 | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 4 | Maximal severity level | 80 | +| | | | Maximal severity exluded | | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 5 | Warning threshold (amount) | 1 | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 6 | Critical threshold (amount) | 2 | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ +| Metrics returned | count=1234 | | | | ++--------------------------+---------------------+-----------------+-----------------------------+------------------------+ + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------------+-------------------------------+-----------------------------+ +| Amount of message in the messageQueue | Download (as400 to connector) | Upload (connector to as400) | ++---------------------------------------+-------------------------------+-----------------------------+ +| 1 (théorique) | 2,26 ko | 66 o | ++---------------------------------------+-------------------------------+-----------------------------+ +| 5000 | 11 mo | 325 ko | ++---------------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------------------------------+ +| Macro name | Macro value | ++------------+-----------------------------------------+ +| CHECK | messageQueueSize | ++------------+-----------------------------------------+ +| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | ++------------+-----------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst b/as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst new file mode 100644 index 0000000000..f284b92d73 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst @@ -0,0 +1,74 @@ +.. _newMessageInMessageQueue: + +**************************************************************************************************************************************** +Check to count the amount of new messages in a messageQueue (MSGQ) according to their severity and message ID (newMessageInMessageQueue) +**************************************************************************************************************************************** + +Description +^^^^^^^^^^^ + ++--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ +| Description | Count amount of new messages in a messageQueue (MSGQ) according to their severity and message ID. Display the new logs in output | | ++--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ +| Operation | Retrieves all messages and store them in a light database. Return the new messages matching criteria in the output. | | +| | Ok if the number of new messages is below the warning threshold. | | +| | Warning if the number of new messages is above the warning threshold. | | +| | Critical if the number of new messages is above the critical threshold. | | ++--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ +| Used API | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | ++--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ +| Required authority | *USE on the messageQueue, *EXECUTE one the messageQueue library | | ++--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| Command name | Number of arguments | Arguments | | | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| newMessageInMessageQueue | 6 | Arguments order | Description | Exemple | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 1 | messageQueue name | /QSYS.LIB/QSYSOPR.MSGQ | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 2 | Regex filtering message ID | ^CP.*$ | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 3 | Minimal severity level | 60 | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 4 | Maximal severity level | 80 | +| | | | Maximal severity exluded | | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 5 | Warning threshold (amount) | 1 | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| | | Argument 6 | Critical threshold (amount) | 2 | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ +| Metrics returned | criteriaMessage=1 newMessage=3 | | | | ++--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ + +Local database configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The location of the local database can be configured in the file /etc/centreon-connector-as400/config.properties. +Variable is : pathMsgQDB. +/!\\ Take care with the others options ! + +Network usage +^^^^^^^^^^^^^ + ++---------------------------------------+-------------------------------+-----------------------------+ +| Amount of message in the messageQueue | Download (as400 to connector) | Upload (connector to as400) | ++---------------------------------------+-------------------------------+-----------------------------+ +| 1 (théorique) | 2,26 ko | 66 o | ++---------------------------------------+-------------------------------+-----------------------------+ +| 5000 | 11 mo | 325 ko | ++---------------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------------------------------+ +| Macro name | Macro value | ++------------+-----------------------------------------+ +| CHECK | newMessageInMessageQueue | ++------------+-----------------------------------------+ +| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | ++------------+-----------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/pageFault.rst b/as400/doc/en/exploitation/indicators/pageFault.rst new file mode 100644 index 0000000000..752f2846f0 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/pageFault.rst @@ -0,0 +1,57 @@ +.. _pageFault: + +**************************************** +Check the rate of page fault (pagefault) +**************************************** + +Description +^^^^^^^^^^^ + ++--------------------+----------------------------------------------------------------------------------------------+-+ +| Description | Check the rate of page fault | | ++--------------------+----------------------------------------------------------------------------------------------+-+ +| Operation | Get the page rate per second, and the page fault rate per second, database and non-database. | | +| | Calculate the rate of page fault relative to the page. | | +| | Ok if this rate is below the warning threshold. | | +| | Warning if this rate is above the warning threshold. | | +| | Critical if this rate is above the critical threshold. | | ++--------------------+----------------------------------------------------------------------------------------------+-+ +| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | | ++--------------------+----------------------------------------------------------------------------------------------+-+ +| Required authority | *USE | | ++--------------------+----------------------------------------------------------------------------------------------+-+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+----------------------------------------------+-----------------+------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+----------------------------------------------+-----------------+------------------------+---------+ +| pageFault | 2 | Arguments order | Description | Exemple | ++------------------+----------------------------------------------+-----------------+------------------------+---------+ +| | | Argument 1 | Warning threshold (%) | 50 | ++------------------+----------------------------------------------+-----------------+------------------------+---------+ +| | | Argument 2 | Critical threshold (%) | 70 | ++------------------+----------------------------------------------+-----------------+------------------------+---------+ +| Metrics returned | dbPageFaultRatio=10% nonDbPageFaultRatio=20% | | | | ++------------------+----------------------------------------------+-----------------+------------------------+---------+ + +Network usage +^^^^^^^^^^^^^ + ++-------------------------------+-----------------------------+ +| Download (as400 to connector) | Upload (connector to as400) | ++-------------------------------+-----------------------------+ +| 15 ko | 12 ko | ++-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | pageFault | ++------------+-------------+ +| ARGS | 50!70 | ++------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst b/as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst new file mode 100644 index 0000000000..e158c05336 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst @@ -0,0 +1,82 @@ +.. _allJobHaveNoMsgWInSubSystem: + +********************************************************* +Check amount of job in a subsystem with a specific status +********************************************************* + +Description +^^^^^^^^^^^ + ++--------------------+-------------------------------------------------------------------------------------------------+ +| Description | Check amount of job in a subsystem with a specific status | ++--------------------+-------------------------------------------------------------------------------------------------+ +| Operation | OK si le nombre de job en attente de message est inférieur ou égal au warning count | +| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | +| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | ++--------------------+-------------------------------------------------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+-------------------------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+-------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| Command name | Number of arguments | Arguments | | | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| specificJobInSubSystem | 8 | arguments order | Description | Exemple | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 1 | Job pattern (regex) | ^JOBC.*$ | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 2 | SubSystem | QBASE | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 3 | Status | *ANY | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 4 | StatusActive | ANY | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 5 | Warning minimal threshold (amount) | 2 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 6 | Warning maximal threshold (amount) | 5 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 7 | Critical minimal threshold (amount) | 1 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 8 | Critical maximal threshold (amount) | 10 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| Metrics returned | foundJob=123 statusMatchingJob=1 | | | | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| Output returned | Amount of job found matching pattern and status | | | | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ + +All Status and StatusActive can be found here : +http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qusrjobi.htm + +Centreon-Connector-AS400 add 1 status (*ANY) and 1 statusActive (ANY), to match all existing status. + +Status can have value: *ANY, *OUTQ, *ACTIVE, *JOBQ +StatusActive can have value: BSCA, BSCW, CMNA, CMNW, CMTW ... (see IBM documentation) + + + + +Network usage +^^^^^^^^^^^^^ + ++------------------------------+-------------------------------+-----------------------------+ +| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | ++------------------------------+-------------------------------+-----------------------------+ +| 1 (theoretic) | 77 o | 2,3 o | ++------------------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+------------------------+ +| Macro name | Macro value | ++------------+------------------------+ +| CHECK | specificJobInSubSystem | ++------------+------------------------+ +| ARGS | QBASE!1!2 | ++------------+------------------------+ diff --git a/as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst b/as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst new file mode 100644 index 0000000000..4571928be0 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst @@ -0,0 +1,68 @@ +.. _allJobHaveNoMsgWInSubSystem: + +*********************************************************************** +Controle le nombre de job running (RUN) dans un sous systeme spécifique +*********************************************************************** + +Description +^^^^^^^^^^^ + ++------------------+-------------------------------------------------------------------------------------------------+ +| Description | Controle l'ensemble des jobs d'un sous systeme en état running | ++------------------+-------------------------------------------------------------------------------------------------+ +| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | +| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | +| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | ++------------------+-------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+-------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ +String jobPattern, String subSystem, int warningMin, int warningMax, int criticalMin, int criticalMax + ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| specificJobRunningInSubSystem | 6 | Ordre des arguments | Description | Exemple | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 1 | Job pattern (regex) | ^JOBC.*$ | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 2 | Sous system | QBASE | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 3 | Seuil Warning minimal (quantité) | 2 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 4 | Seuil Warning maximal (quantité) | 5 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 5 | Seuil Critical minimal (quantité) | 1 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 6 | Seuil Critical maximal (quantité) | 10 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| Métriques renvoyées | totalJob=123 jobMSGW=1 | | | | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| Output renvoyé | Le nom des jobs en attente de message | | | | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ + +Network usage +^^^^^^^^^^^^^ + ++------------------------------+-------------------------------+-----------------------------+ +| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | ++------------------------------+-------------------------------+-----------------------------+ +| 1 (theoretic) | 77 o | 2,3 o | ++------------------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------------------+ +| Macro name | Macro value | ++------------+-----------------------------+ +| CHECK | allJobHaveNoMsgWInSubSystem | ++------------+-----------------------------+ +| ARGS | QBASE!1!2 | ++------------+-----------------------------+ diff --git a/as400/doc/en/exploitation/indicators/subSystemExist.rst b/as400/doc/en/exploitation/indicators/subSystemExist.rst new file mode 100644 index 0000000000..7e61402623 --- /dev/null +++ b/as400/doc/en/exploitation/indicators/subSystemExist.rst @@ -0,0 +1,55 @@ +.. _subSystemExist: + +**************************************************** +Check the existence of a sub system (subSystemExist) +**************************************************** + +Description +^^^^^^^^^^^ + ++--------------------+---------------------------------------------------------------------------------------------------------+ +| Description | Check the existence of a sub system | ++--------------------+---------------------------------------------------------------------------------------------------------+ +| Fonctionnement | A subsystem may take status: *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, or *STARTING. | +| | Ok if the subsystem is in state *ACTIVE. | +| | Critical if the subsystem is in an other status than * ACTIVE or that the subsystem has not been found. | ++--------------------+---------------------------------------------------------------------------------------------------------+ +| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | ++--------------------+---------------------------------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+---------------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------+-----------------+----------------+----------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------+-----------------+----------------+----------+ +| subSystemExist | 1 | Arguments order | Description | Exemple | ++------------------+---------------------+-----------------+----------------+----------+ +| | | Argument 1 | Subsystem name | QBATCH | ++------------------+---------------------+-----------------+----------------+----------+ +| | | Argument 2 | Library name | QSYS.LIB | ++------------------+---------------------+-----------------+----------------+----------+ +| Metrics returned | X | | | | ++------------------+---------------------+-----------------+----------------+----------+ + +Network usage +^^^^^^^^^^^^^ + ++-------------------------------+-----------------------------+ +| Download (as400 to connector) | Upload (connector to as400) | ++-------------------------------+-----------------------------+ +| 5,5 ko | 2,1 ko | ++-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+------------------+ +| Macro name | Macro value | ++------------+------------------+ +| CHECK | subSystemExist | ++------------+------------------+ +| ARGS | QBATCH !QSYS.LIB | ++------------+------------------+ diff --git a/as400/doc/en/exploitation/indicators/workWithProblem.rst b/as400/doc/en/exploitation/indicators/workWithProblem.rst new file mode 100644 index 0000000000..aa5e03bbaf --- /dev/null +++ b/as400/doc/en/exploitation/indicators/workWithProblem.rst @@ -0,0 +1,50 @@ +.. _workWithProblem: + +************************************************************* +Get the number of problems detected by the system or the user +************************************************************* + +Description +^^^^^^^^^^^ + ++------------------+----------------------------------------------------------------------------+ +| Description | Get the number of problems detected by the system or the user | ++------------------+----------------------------------------------------------------------------+ +| Fonctionnement | OK if the number of problems is lower or equal to the warning count | +| | WARNING if the number or problems is lower to the critical count | +| | CRITICAL if the number of problem is higher or equal to the critical count | ++------------------+----------------------------------------------------------------------------+ +| API utilisée | | ++------------------+----------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+----------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ + ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| Command name | Number of arguments | Arguments | | | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| allJobHaveNoMsgW | n * 2 + 1 | Argument's order | Description | Example | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| | | Argument 1 | Types of problems wanted | 1 | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| | | Argument 2 | Warning Threashold | 2 | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| | Repeat threashold for each type of problem wanted | Argument 3 | Critical Threashold | 2 | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| Sent metric | open=1;;;2;4 ready=0;;2;3 | | | | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ +| Sent output | OK: There are 1 OPENED / 0 READY statys problems | | | | ++------------------+---------------------------------------------------+------------------+--------------------------+---------+ + +Configuration example +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------+ +| Macro name | Macro value | ++------------+-----------------+ +| CHECK | workWithProblem | ++------------+-----------------+ +| ARGS | 1!2 | ++------------+-----------------+ diff --git a/as400/doc/en/exploitation/mode.rst b/as400/doc/en/exploitation/mode.rst new file mode 100644 index 0000000000..63ce9a0f94 --- /dev/null +++ b/as400/doc/en/exploitation/mode.rst @@ -0,0 +1,69 @@ +.. _mode: + +############## +Operating mode +############## + +Centreon-Connector-AS400 can run in daemon mode or command line. +It's also packaged with check plugin, connecting to the daemon, and responsible to transmitt the results to engine/nagios. + +Command line +============ + +With command line, a java virtual machine is started each time. This mode should be used only for testing purposes, toi avoid high CPU / memory consomption:: + + +-------------------------------------------------------------------------------------------------------------+ + | java -jar connector-as400-1.x.x.jar -I -H %HOST% --login %LOGIN% --password %PASSWORD% -C %CHECK% -A %ARGS% | + +-------------------------------------------------------------------------------------------------------------+ + +Enter the different arguments: + ++-----------+---------------------------------------+-------------+ +| Attribute | Description | Exemple | ++===========+=======================================+=============+ +| HOST | IP address or host name of the AS/400 | 10.30.10.30 | ++-----------+---------------------------------------+-------------+ +| LOGIN | AS/400 user name | USER123 | ++-----------+---------------------------------------+-------------+ +| PASSWORD | AS/400 password | PASSWORD123 | ++-----------+---------------------------------------+-------------+ +| CHECK | Check command | cpuUsage | ++-----------+---------------------------------------+-------------+ +| ARGS | Check command arguments | 80!90 | ++-----------+---------------------------------------+-------------+ + +Note: The command arguments are separated by " ! " . + +Daemon +====== + +The daemon mode permit to launch the same commands than from command line without having to restart a java virtual machine at each use. +The daemon listens on a port, waiting for query. +A check plugin ( check_centreon_as400_generic ) is available to connect to the daemon and return a result to the Nagios format. +Check plugin arguments are similar to the java program. However, it is necessary to specify the address and port of the daemon:: + + +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | check_centreon_as400_generic \-\-connector %DAEMONHOST%:%DAEMONPORT% \-\-host %HOST% \-\-user %USER% \-\-password %PASSWORD% \-\-check %CHECK% \-\-args %ARGS% | + +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +Enter the different arguments: + ++------------+--------------------------------------------------------+-------------+ +| Attribut | Description | Exemple | ++============+========================================================+=============+ +| DAEMONHOST | IP address or host name of the server executing daemon | 10.30.10.20 | ++------------+--------------------------------------------------------+-------------+ +| DAEMONPORT | Daemon port | 8091 | ++------------+--------------------------------------------------------+-------------+ +| HOST | IP address or host name of the AS/400 | 10.30.10.30 | ++------------+--------------------------------------------------------+-------------+ +| LOGIN | AS/400 user name | USER123 | ++------------+--------------------------------------------------------+-------------+ +| PASSWORD | AS/400 password | PASSWORD123 | ++------------+--------------------------------------------------------+-------------+ +| CHECK | Check command | cpuUsage | ++------------+--------------------------------------------------------+-------------+ +| ARGS | Check command arguments | 80!90 | ++------------+--------------------------------------------------------+-------------+ + +Note: The command arguments are separated by " ! " . diff --git a/as400/doc/en/installation/prerequisites.rst b/as400/doc/en/installation/prerequisites.rst new file mode 100644 index 0000000000..8859bbce32 --- /dev/null +++ b/as400/doc/en/installation/prerequisites.rst @@ -0,0 +1,64 @@ +.. _rpm: + +############# +Prerequisites +############# + ++----------+--------------+-+ +| Software | Minimum | | ++----------+--------------+-+ +| Centreon | 2.2.x | | ++----------+--------------+-+ +| Nagios | 3.x | | ++----------+--------------+-+ +| Java | JRE 6 Oracle | | ++----------+--------------+-+ +| AS/400 | V4R5\+ | | ++----------+--------------+-+ + +Hardware recommendations +************************ + +It is necessary to evaluate material resources before installing Centreon-Connector-AS400 on a server. + +- ** ** RAM: 512 MB ​​minimum (may increase significantly with the number of control). + +   - Count 2 GB for 2500 services with a 10 minute interval between each control. + +- ** CPU **: prerequisite identical to the collection server + +List of used ports +****************** + ++-----------+-----------+--------------------------+----------------+ +| Source | Target | Port | Can be changed | ++-----------+-----------+--------------------------+----------------+ +| Plugin | Connector | Custom | Yes | ++-----------+-----------+--------------------------+----------------+ + +List of ports between the connector and the AS400 +------------------------------------------------- + ++----------+------+ +| Standard | SSL | ++----------+------+ +| 446 | 448 | ++----------+------+ +| 449 | | ++----------+------+ +| 8470 | 9470 | ++----------+------+ +| 8471 | 9471 | ++----------+------+ +| 8472 | 9472 | ++----------+------+ +| 8473 | 9473 | ++----------+------+ +| 8474 | 9474 | ++----------+------+ +| 8475 | 9475 | ++----------+------+ +| 8476 | 9476 | ++----------+------+ + +A detailed list of the ports used by the AS400 can be found `on this page `_. diff --git a/as400/doc/en/installation/rpm.rst b/as400/doc/en/installation/rpm.rst new file mode 100644 index 0000000000..08a3c853e4 --- /dev/null +++ b/as400/doc/en/installation/rpm.rst @@ -0,0 +1,21 @@ +.. _rpm: + +############################# +Installing from package (RPM) +############################# + +Prerequisites +************* + +A recent installation of CES with centreon-plugin-pack. + +Installation +************ + +Run the command:: + + $ yum install centreon-connector-as400-server ces-plugins-Operatingsystems-As400 ces-pack-Operatingsystems-As400 + +Then start the daemon:: + + $ /etc/init.d/centreon-connector-as400 start \ No newline at end of file diff --git a/as400/doc/en/installation/tarball.rst b/as400/doc/en/installation/tarball.rst new file mode 100644 index 0000000000..6e7fbef7fa --- /dev/null +++ b/as400/doc/en/installation/tarball.rst @@ -0,0 +1,41 @@ +.. _tarball: + +################################ +Installing from tarball (tar.gz) +################################ + +Tarball installation is not recommended + +Prerequisites +************* + +To build Centreon-Connector-AS400 check plugin, you will need the following external dependencies: + +a C++ compilation environment. +CMake (>= 2.8), a cross-platform build system. +the Qt (>= 4.7.4) framework with QtCore, and QtXml modules. +GnuTLS (>= 2.0), a secure communications library. + +Installing daemon +***************** + +Unzip tarball:: + + $ cd /tmp/ && tar xvzf centreon-connector-as400-server-1.x.x.tar.gz + + Start the installation:: + + $ /tmp/centreon-connector-as400-server-1.x.x/install.sh + +Installing check plugin +*********************** + +Check plugin must be compiled:: + + $ cd /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/ + $ cmake && make + +Then copy the as400 check plugin to the nagios libexec folder :: + + $ cp /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/as400_generic/check_centreon_as400 %nagios%/libexec/ + diff --git a/as400/doc/en/upgrade/rpm.rst b/as400/doc/en/upgrade/rpm.rst new file mode 100644 index 0000000000..c2d6a5dcf7 --- /dev/null +++ b/as400/doc/en/upgrade/rpm.rst @@ -0,0 +1,20 @@ +.. _rpm: + +############################ +Upgrading from package (RPM) +############################ + +Upgrade +******* + +Stop the connector service:: + + $ /etc/init.d/centreon-connector-as400 stop + +Upgrade the rpm:: + + $ yum update centreon-connector-as400-server ces-plugins-Operatingsystems-As400 + +Restart the connector service:: + + $ /etc/init.d/centreon-connector-as400 start diff --git a/as400/doc/fr/exploitation/configurationCentreon.rst b/as400/doc/fr/exploitation/configurationCentreon.rst new file mode 100644 index 0000000000..98725344a2 --- /dev/null +++ b/as400/doc/fr/exploitation/configurationCentreon.rst @@ -0,0 +1,94 @@ +.. _configurationCentreon: + +###################### +Configuration Centreon +###################### + +La configuration des templates Centreon n'est nécéssaire que lors de l'installation par tarball. +Afin d'exploiter pleinement Centreon-Connector-AS400, il est recommandé d'effectuer une série d'action préalablement. + + +Création d'une commande de check générique +========================================== + +Aller dans le menu « Configuration → Commande » et créer une commande « check_as400_generic ». + +Insérer la commande :  + ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| $USER1$/check_centreon_as400_generic \-\-connector "$_HOSTDAEMONHOST$:$_HOSTDAEMONPORT$" \-\-host "$HOSTADDRESS$" \-\-user "$_HOSTAS400USER$" \-\-password "$_HOSTAS400PASSWORD$" \-\-check "$_SERVICECHECK$" \-\-args "$_SERVICEARGS$" | ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +Cette commande comporte une série de macros utilisées à différents niveau des modèles d'hôtes, hôtes, modèles de services, services. + +Les macro précédé de HOST sont récupérés au niveau de la définition de l'hôte (ou le modèle d'hôte). Les macros précédé de SERVICE sont récupérés u niveau de la définition du service. (ou le modèle de service). + ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| Macro name | Macro value | Ressource ou la macro doit être défini (recommandé) | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| HOSTDAEMONHOST | IP ou nom d'hôte du serveur exécutant le daemon AS/400 | Modèle d'hôte AS/400 de plus bas niveau | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| HOSTDAEMONPORT | Port du daemon | Modèle d'hôte AS/400 de plus bas niveau | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| HOSTAS400USER | Nom d'utilisateur AS/400 | Hôte AS/400 | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| HOSTAS400PASSWORD | Mot de passe AS/400 | Hôte AS/400 | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| SERVICECHECK | Commande de check | Service ou modèle de service AS/400 de plus haut niveau | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ +| SERVICEARGS | Arguments de la commande de check | Service ou modèle de service AS/400 de plus haut niveau | ++-------------------+--------------------------------------------------------+---------------------------------------------------------+ + +Création d'un modele d'hote AS400 générique +=========================================== + +Aller dans le menu « Configuration → Hosts → Templates » et créer un modèle d'hôte « as400 ». Ce modèle d'hôte sera le modèle de plus bas niveau pour tous les hôtes AS/400. D'autres modèle de plus haut niveau pourront être créé. Configurer l'ensemble des champs comme indiqué dans la documentation Centreon. + +Définir les macros suivante :  + ++------------+-----------------------+ +| Macro name | Macro value | ++------------+-----------------------+ +| DAEMONHOST | Exemple : 10.30.10.30 | ++------------+-----------------------+ +| DAEMONPORT | Exemple : 8091 | ++------------+-----------------------+ + +**None** + + +Création d'un hôte AS400 +======================== + +Aller dans le menu « Configuration → Hosts » et créer un hôte basé sur le modèle « as400 » générique (ou un modèle de plus haut niveau basé sur le modèle « as400 » générique ). + +Définir les macros suivante :  + ++---------------+-----------------------+ +| Macro name | Macro value | ++---------------+-----------------------+ +| AS400USER | Exemple : USER123 | ++---------------+-----------------------+ +| AS400PASSWORD | Exemple : PASSWORD123 | ++---------------+-----------------------+ + + + +Création d'un modele de service AS400 +===================================== + +Aller dans le menu « Configuration → Services » ou « Template », et créer un service et ou modèle de service. + +Définir les macros suivante :  + ++------------+--------------------+ +| Macro name | Macro value | ++------------+--------------------+ +| CHECK | Exemple : cpuUsage | ++------------+--------------------+ +| ARGS | Exemple : 80!90 | ++------------+--------------------+ + +Les différentes commandes et arguments sont expliqués dans la partie "Liste des indicateurs" + + diff --git a/as400/doc/fr/exploitation/index.rst b/as400/doc/fr/exploitation/index.rst new file mode 100644 index 0000000000..981101ea93 --- /dev/null +++ b/as400/doc/fr/exploitation/index.rst @@ -0,0 +1,14 @@ +.. _exploitation: + +############ +Exploitation +############ + +.. toctree:: + :glob: + + mode + configurationCentreon + indicator + + \ No newline at end of file diff --git a/as400/doc/fr/exploitation/indicator.rst b/as400/doc/fr/exploitation/indicator.rst new file mode 100644 index 0000000000..447f1c1144 --- /dev/null +++ b/as400/doc/fr/exploitation/indicator.rst @@ -0,0 +1,32 @@ +.. _indicator: + +##################### +Liste des indicateurs +##################### + +Selon les API utilisés, les droits des utilisateurs AS/400 peuvent varier. +Ils sont précisés dans chaque contrôle. + +.. toctree:: + + indicators/cpuUsage + indicators/asp1Usage + indicators/diskState + indicators/diskUsage + indicators/diskUsageRepartition + indicators/subSystemExist + indicators/pageFault + indicators/jobExist + indicators/jobHasNoMsgw + indicators/allJobHaveNoMsgW + indicators/allJobHaveNoMsgWInSubSystem + indicators/backupJobExist + indicators/jobQueueStatus + indicators/jobQueueWaitJobCount + indicators/specificJobInSubSystem + indicators/specificJobRunningInSubSystem + indicators/messageQueueSize + indicators/messageQueueSizeFiltered + indicators/newMessageInMessageQueue + indicators/executeCommand + indicators/workWithProblem diff --git a/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst b/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst new file mode 100644 index 0000000000..a1e7e9e533 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst @@ -0,0 +1,59 @@ +.. _allJobHaveNoMsgW: + +****************************************************** +Controle le nombre de job en attente de message (MSGW) +****************************************************** + +Description +^^^^^^^^^^^ + ++------------------+------------------------------------------------------------------------------------------------------+ +| Description | Controle l'ensemble des jobs, de l'as400, et vérifie qu'ils ne sont pas en attente de message (MSGW) | ++------------------+------------------------------------------------------------------------------------------------------+ +| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | +| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | +| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | ++------------------+------------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ +| allJobHaveNoMsgW | 1 | Ordre des arguments | Description | Exemple | ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 1 | Seuil Warning (quantité) | 1 | ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 2 | Seuil Critical (quantité) | 2 | ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ +| Métriques renvoyées | totalJob=1234 jobMSGW=1 | | | | ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ +| Output renvoyé | Le nom des jobs en attente de message | | | | ++---------------------+---------------------------------------+---------------------+---------------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+------------------+ +| Macro name | Macro value | ++------------+------------------+ +| CHECK | allJobHaveNoMsgW | ++------------+------------------+ +| ARGS | 1!2 | ++------------+------------------+ diff --git a/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst b/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst new file mode 100644 index 0000000000..e40a3a60e5 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst @@ -0,0 +1,61 @@ +.. _allJobHaveNoMsgWInSubSystem: + +************************************************************************************* +Controle le nombre de job en attente de message (MSGW) dans un sous system spécifique +************************************************************************************* + +Description +^^^^^^^^^^^ + ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| Description | Controle l'ensemble des jobs dans un sous system spécifique, et vérifie qu'ils ne sont pas en attente de message (MSGW) | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | +| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | +| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| allJobHaveNoMsgWInSubSystem | 1 | Ordre des arguments | Description | Exemple | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 1 | Sous system | QBASE | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 2 | Seuil Warning (quantité) | 1 | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 3 | Seuil Critical (quantité) | 2 | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| Métriques renvoyées | totalJob=123 jobMSGW=1 | | | | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ +| Output renvoyé | Le nom des jobs en attente de message | | | | ++-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------------------+ +| Macro name | Macro value | ++------------+-----------------------------+ +| CHECK | allJobHaveNoMsgWInSubSystem | ++------------+-----------------------------+ +| ARGS | QBASE!1!2 | ++------------+-----------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/asp1Usage.rst b/as400/doc/fr/exploitation/indicators/asp1Usage.rst new file mode 100644 index 0000000000..dd763861ab --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/asp1Usage.rst @@ -0,0 +1,55 @@ +.. _asp1Usage: + +*************************** +Taux d'occupation de l'ASP1 +*************************** + +Description +^^^^^^^^^^^ + ++------------------+---------------------------------------------------------------------+ +| Description | Contrôle le taux d'occupation de l'ASP1. | ++------------------+---------------------------------------------------------------------+ +| Fonctionnement | Ok si le taux d'occupation est en dessous du seuil warning. | +| | Warning si le taux d'occupation passe au dessus du seuil warning. | +| | Critique si le taux d'occupation passe au dessus du seuil critique. | ++------------------+---------------------------------------------------------------------+ +| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | ++------------------+---------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+---------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+--------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+--------------------+---------+ +| asp1Usage | | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+--------------------+---------+ +| | | Argument 1 | Seuil warning (%) | 80 | ++---------------------+-------------------+---------------------+--------------------+---------+ +| | | Argument 2 | Seuil critique (%) | 90 | ++---------------------+-------------------+---------------------+--------------------+---------+ +| Métriques renvoyées | usage=xx% | | | | ++---------------------+-------------------+---------------------+--------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 1,5 ko | 1.1 ko | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | asp1Usage | ++------------+-------------+ +| ARGS | 80!90 | ++------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/backupJobExist.rst b/as400/doc/fr/exploitation/indicators/backupJobExist.rst new file mode 100644 index 0000000000..a58f7a3451 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/backupJobExist.rst @@ -0,0 +1,53 @@ +.. _backupJobExist: + +************************** +Existence du job de backup +************************** + +Description +^^^^^^^^^^^ + ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| Description | Contrôle l’existence du job de backup RBT_DDMMYY. Ne contrôle pas son état. | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Ok si le job existe. | +| | Critical si le job n'existe pas. | +| | DDMMYY correspond au jour au moment de l’exécution du check. La date utilisé est celle du serveur hébergeant le daemon. | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-------------------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+-------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+-------------+---------+ +| backupJobExist | | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+-------------+---------+ +| | | Argument 1 | X | X | ++---------------------+-------------------+---------------------+-------------+---------+ +| Métriques renvoyées | | | | | ++---------------------+-------------------+---------------------+-------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------+ +| Macro name | Macro value | ++------------+----------------+ +| CHECK | backupJobExist | ++------------+----------------+ diff --git a/as400/doc/fr/exploitation/indicators/cpuUsage.rst b/as400/doc/fr/exploitation/indicators/cpuUsage.rst new file mode 100644 index 0000000000..0c2c66419c --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/cpuUsage.rst @@ -0,0 +1,55 @@ +.. _cpuUsage: + +*** +CPU +*** + +Description +^^^^^^^^^^^ + ++------------------+--------------------------------------------------------------------------------------------------------------------------------------+ +| Description | Contrôle le temps pendant lequel les CPU de l'AS/400 étaient utilisés. | ++------------------+--------------------------------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Ok si le temps cpu est en dessous du seuil warning. | +| | Warning si le temps cpu passe au dessus du seuil warning. | +| | Critique si le temps cpu passe au dessus du seuil critique.Il peut dépasser 100% sur les partitions non bridés (uncapped partition). | ++------------------+--------------------------------------------------------------------------------------------------------------------------------------+ +| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | ++------------------+--------------------------------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+--------------------------------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+--------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+--------------------+---------+ +| cpuUsage | 2 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+--------------------+---------+ +| | | Argument 1 | Seuil warning (%) | 80 | ++---------------------+-------------------+---------------------+--------------------+---------+ +| | | Argument 2 | Seuil critique (%) | 90 | ++---------------------+-------------------+---------------------+--------------------+---------+ +| Métriques renvoyées | usage=xx% | | | | ++---------------------+-------------------+---------------------+--------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+---------------------------------+ +| Download (as400 vers connector) | Download (as400 vers connector) | ++---------------------------------+---------------------------------+ +| 1,7 ko | 1.5 ko | ++---------------------------------+---------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | cpuUsage | ++------------+-------------+ +| ARGS | 80!90 | ++------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/diskState.rst b/as400/doc/fr/exploitation/indicators/diskState.rst new file mode 100644 index 0000000000..430c2e7a69 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/diskState.rst @@ -0,0 +1,51 @@ +.. _diskState: + +******************************************** +Etat de fonctionnement des disques physiques +******************************************** + +Description +^^^^^^^^^^^ + ++------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Description | Contrôle l'état de fonctionnement de l'ensemble des disques physiques | ++------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Un disque physique peut prendre plusieurs état : no control, active, failed, hardware failure, rebuild, not ready, protected, busy, not operational, unknown state (13 états au total). | +| | Ok si tous les disques sont actifs (active) | +| | Critique si au moins un disque est dans un état différent de actif. | ++------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| API utilisée | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | ++------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+--------------------------+---------------------+-------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+--------------------------+---------------------+-------------+---------+ +| diskState | 0 | Ordre des arguments | Description | Exemple | ++---------------------+--------------------------+---------------------+-------------+---------+ +| | | X | X | X | ++---------------------+--------------------------+---------------------+-------------+---------+ +| Métriques renvoyées | totaldisk=x activedisk=x | | | | ++---------------------+--------------------------+---------------------+-------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 4,1 ko | 4,3 ko | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | diskState | ++------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/diskUsage.rst b/as400/doc/fr/exploitation/indicators/diskUsage.rst new file mode 100644 index 0000000000..950a3f5c58 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/diskUsage.rst @@ -0,0 +1,57 @@ +.. _diskUsage: + +************************************** +Taux d'occupation d'un disque physique +************************************** + +Description +^^^^^^^^^^^ + ++------------------+-------------------------------------------------------------------+ +| Description | Contrôle le taux d'occupation d'un disque physique. | ++------------------+-------------------------------------------------------------------+ +| Fonctionnement | Ok si le taux d'occupation est en dessous du seuil warning. | +| | Warning si le taux d'occupation est au dessus du seuil warning. | +| | Critical si le taux d'occupation est au dessus du seuil critique. | ++------------------+-------------------------------------------------------------------+ +| API utilisée | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | ++------------------+-------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ +| diskUsage | 3 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ +| | | Argument 1 | Nom du disque | DD003 | ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ +| | | Argument 2 | Seuil warning (%) | 80 | ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ +| | | Argument 3 | Seuil critique (%) | 90 | ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ +| Métriques renvoyées | totalSpace=123456B usedSpace=12345B systemSpace=1234B | | | | ++---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 700 o | 700 o | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | diskUsage | ++------------+-------------+ +| ARGS | DD003!80!90 | ++------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst b/as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst new file mode 100644 index 0000000000..edf065db86 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst @@ -0,0 +1,56 @@ +.. _diskUsageRepartition: + +************************************************* +Ecart des taux d'occupation des disques physiques +************************************************* + +Description +^^^^^^^^^^^ + ++------------------+----------------------------------------------------------------------------------------------------+ +| Description | Compare les taux d'utilisation des différents disques physiques. | ++------------------+----------------------------------------------------------------------------------------------------+ +| Fonctionnement | Calcul l'écart entre le taux d'utilisation minimal et maximal de l'ensemble des disques physiques. | +| | Ok si l’écart est en dessous du seuil warning. | +| | Warning si l’écart est au dessus du seuil warning. | +| | Critical si l’écart est au dessus du seuil critique. | ++------------------+----------------------------------------------------------------------------------------------------+ +| API utilisée | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | ++------------------+----------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+----------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++----------------------+-------------------+---------------------+--------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++----------------------+-------------------+---------------------+--------------------+---------+ +| diskUsageRepartition | 2 | Ordre des arguments | Description | Exemple | ++----------------------+-------------------+---------------------+--------------------+---------+ +| | | Argument 1 | Seuil warning (%) | 0.5 | ++----------------------+-------------------+---------------------+--------------------+---------+ +| | | Argument 2 | Seuil critique (%) | 2 | ++----------------------+-------------------+---------------------+--------------------+---------+ +| Métriques renvoyées | gap=xx% | | | | ++----------------------+-------------------+---------------------+--------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 750 o | 750 o | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------------+ +| Macro name | Macro value | ++------------+----------------------+ +| CHECK | diskUsageRepartition | ++------------+----------------------+ +| ARGS | 0.5!2 | ++------------+----------------------+ diff --git a/as400/doc/fr/exploitation/indicators/executeCommand.rst b/as400/doc/fr/exploitation/indicators/executeCommand.rst new file mode 100644 index 0000000000..023e04d7d1 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/executeCommand.rst @@ -0,0 +1,62 @@ +.. _executeCommand: + +*********************************** +Execution d'une commande spécifique +*********************************** + +Description +^^^^^^^^^^^ + ++------------------+-----------------------------------------------------------+ +| Description | Permet l'execution d'une commande spécifique | ++------------------+-----------------------------------------------------------+ +| Fonctionnement | Ok si la commande s'est déroulée avec succès. | +| | Critical si la commande ne s'est pas déroulé avec succes. | ++------------------+-----------------------------------------------------------+ +| API utilisée | | ++------------------+-----------------------------------------------------------+ +| Autorité requise | | ++------------------+-----------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+--------------------------+---------------------+--------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+--------------------------+---------------------+--------------------+---------+ +| executeCommand | 1 | Ordre des arguments | Description | Exemple | ++---------------------+--------------------------+---------------------+--------------------+---------+ +| | | Argument 1 | Nom de la commande | TEST | ++---------------------+--------------------------+---------------------+--------------------+---------+ +| Métriques renvoyées | | | | | ++---------------------+--------------------------+---------------------+--------------------+---------+ +| Output | Le retour de la commande | | | | ++---------------------+--------------------------+---------------------+--------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| variable | 800 o | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------+ +| Macro name | Macro value | ++------------+----------------+ +| CHECK | executeCommand | ++------------+----------------+ +| ARGS | TEST | ++------------+----------------+ + +Note : Un output sera disponible uniquement si des messages ont été généré par la commande exécutée. + +Génération d'un message depuis un programme AS/400 CL : + ++----------------------------------------------------------------------------------------------------------+ +| SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) \+ MSGDTA('Ceci est un message') \+ TOPGMQ(*EXT) MSGTYPE(*STATUS) | ++----------------------------------------------------------------------------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobExist.rst b/as400/doc/fr/exploitation/indicators/jobExist.rst new file mode 100644 index 0000000000..58bc02969c --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/jobExist.rst @@ -0,0 +1,56 @@ +.. _jobExist: + +****************** +Existence d'un job +****************** + +Description +^^^^^^^^^^^ + ++------------------+----------------------------------------------------------+ +| Description | Contrôle l’existence d'un job. Ne contrôle pas son état. | ++------------------+----------------------------------------------------------+ +| Fonctionnement | Ok si le job existe. | +| | Critical si le job n'existe pas. | ++------------------+----------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+----------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+----------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+---------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+---------------------+---------+ +| jobExist | 1 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+---------------------+---------+ +| | | Argument 1 | Nom du job | QCTL | ++---------------------+-------------------+---------------------+---------------------+---------+ +| | | Argument 2 | Nom du sous systeme | QBASE | ++---------------------+-------------------+---------------------+---------------------+---------+ +| Métriques renvoyées | | | | | ++---------------------+-------------------+---------------------+---------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | jobExist | ++------------+-------------+ +| ARGS | QCTL !QBASE | ++------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst b/as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst new file mode 100644 index 0000000000..abe579e349 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst @@ -0,0 +1,56 @@ +.. _jobHasNoMsgw: + +************************************************************************ +Controle l'existance d'un job et son statut en attente de message (MSGW) +************************************************************************ + +Description +^^^^^^^^^^^ + ++------------------+---------------------------------------------------------------------+ +| Description | Contrôle l’existence d'un job. Contrôle que le job n'a pas de MSGW. | ++------------------+---------------------------------------------------------------------+ +| Fonctionnement | Ok si le job existe. | +| | Critical si le job n'existe pas, ou que le job a un MSGW. | ++------------------+---------------------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+---------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+---------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+---------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+---------------------+---------+ +| jobHasNoMsgw | 1 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+---------------------+---------+ +| | | Argument 1 | Nom du job | QCTL | ++---------------------+-------------------+---------------------+---------------------+---------+ +| | | Argument 2 | Nom du sous systeme | QBASE | ++---------------------+-------------------+---------------------+---------------------+---------+ +| Métriques renvoyées | | | | | ++---------------------+-------------------+---------------------+---------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+--------------+ +| Macro name | Macro value | ++------------+--------------+ +| CHECK | jobHasNoMsgw | ++------------+--------------+ +| ARGS | QCTL !QBASE | ++------------+--------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobQueueStatus.rst b/as400/doc/fr/exploitation/indicators/jobQueueStatus.rst new file mode 100644 index 0000000000..70d65908a2 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/jobQueueStatus.rst @@ -0,0 +1,55 @@ +.. _jobQueueStatus: + +************************** +Etat d'une jobQueue (JOBQ) +************************** + +Description +^^^^^^^^^^^ + ++------------------+------------------------------------------------------------------------------------------------------------------+ +| Description | Contrôle l’existence et l'état d'une jobQueue. | ++------------------+------------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Une jobQueue peut avoir l’état RELEASED ou HELD. | +| | OK si la jobqueue est en état RELEASED. | +| | Critical si la jobqueue est en état HELD ou n'existe pas. | ++------------------+------------------------------------------------------------------------------------------------------------------+ +| API utilisée | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | ++------------------+------------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue* JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | ++------------------+------------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+---------------------+-----------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+---------------------+-----------+ +| jobQueueStatus | 2 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+---------------------+-----------+ +| | | Argument 1 | Nom de la JobQueue | QSYSNOMAX | ++---------------------+-------------------+---------------------+---------------------+-----------+ +| | | Argument 2 | Nom de la librairie | QSYS | ++---------------------+-------------------+---------------------+---------------------+-----------+ +| Métriques renvoyées | X | | | | ++---------------------+-------------------+---------------------+---------------------+-----------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 1,7 ko | 1,9 ko | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------+ +| Macro name | Macro value | ++------------+----------------+ +| CHECK | jobQueueStatus | ++------------+----------------+ +| ARGS | QSYSNOMAX!QSYS | ++------------+----------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst b/as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst new file mode 100644 index 0000000000..c24eafb2c5 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst @@ -0,0 +1,60 @@ +.. _jobQueueWaitJobCount: + +************************************************** +Nombre de jobs en attente dans une jobqueue (JOBQ) +************************************************** + +Description +^^^^^^^^^^^ + ++------------------+-----------------------------------------------------------------------------------------------------------------+ +| Description | Contrôle le nombre de job en attente dans une jobQueue sans tenir compte des priorités des jobs. | ++------------------+-----------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Les jobs dans une jobqueue peuvent avoir plusieurs états :ACTIVE, HELD, ou SCHEDULED. | +| | Ok si le nombre de job en état HELD est inférieur au seuil warning. | +| | Warning si le nombre de job en état HELD est au dessus du seuil warning. | +| | Critical si le nombre de job en état HELD est au dessus du seuil critical. | ++------------------+-----------------------------------------------------------------------------------------------------------------+ +| API utilisée | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | ++------------------+-----------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue*JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | ++------------------+-----------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| jobQueueWaitJobCount | 4 | Ordre des arguments | Description | Exemple | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| | | Argument 1 | Nom de la JobQueue | QSYSNOMAX | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| | | Argument 2 | Nom de la librairie | QSYS | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| | | Argument 3 | Seuil warning (quantité) | 1 | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| | | Argument 4 | Seuil critique (quantité) | 2 | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ +| Métriques renvoyées | activeJob=44 heldJobOnQueue=0 scheduledJobOnQueue=0 | | | | ++----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 750 o | 800 o | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+----------------------+ +| Macro name | Macro value | ++------------+----------------------+ +| CHECK | jobQueueWaitJobCount | ++------------+----------------------+ +| ARGS | QSYSNOMAX!QSYS!1!2 | ++------------+----------------------+ diff --git a/as400/doc/fr/exploitation/indicators/messageQueueSize.rst b/as400/doc/fr/exploitation/indicators/messageQueueSize.rst new file mode 100644 index 0000000000..91ddbfb32c --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/messageQueueSize.rst @@ -0,0 +1,62 @@ +.. _messageQueueSize: + +*********************************************** +Nombre de message dans une message queue (MSGQ) +*********************************************** + +Description +^^^^^^^^^^^ + ++------------------+------------------------------------------------------------------------------------------------------+ +| Description | Contrôle la taille de la messageQueue. | ++------------------+------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Récupère tous les message dont la sévérité est supérieur ou égale à celle défini dans les arguments. | +| | Ok si le nombre de message est en dessous du seuil warning. | +| | Warning si le nombre de message est au dessus du seuil warning. | +| | Critical si le nombre de message est au dessus du seuil critical. | ++------------------+------------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | ++------------------+------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | ++------------------+------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| messageQueueSize | 4 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 1 | Nom de la messageQueue | /QSYS.LIB/QSYSOPR.MSGQ | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 2 | Niveau de sévérité minimum pour comptabiliser le message | 40 | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 3 | Seuil warning (quantité) | 2000 | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 4 | Seuil critique (quantité) | 2500 | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ +| Métriques renvoyées | count=1234 | | | | ++---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++-------------------------------------------------+---------------------------------+-------------------------------+ +| Nombre de message présent dans la message queue | Download (as400 vers connector) | Upload (connector vers as400) | ++-------------------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 2,26 ko | 66 o | ++-------------------------------------------------+---------------------------------+-------------------------------+ +| 5000 | 11 mo | 325 ko | ++-------------------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------------------------------+ +| Macro name | Macro value | ++------------+-------------------------------------+ +| CHECK | messageQueueSize | ++------------+-------------------------------------+ +| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!40!2000!2500 | ++------------+-------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst b/as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst new file mode 100644 index 0000000000..55e34ae342 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst @@ -0,0 +1,67 @@ +.. _messageQueueSizeFiltered: + +************************************************************************* +Nombre de message dans une message queue (MSGQ) filtré par ID et severité +************************************************************************* + +Description +^^^^^^^^^^^ + ++------------------+------------------------------------------------------------------------------------------------------+ +| Description | Controle le nombre de message dans une message queue en filtrant par ID et sevérité | ++------------------+------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Récupère tous les message dont la sévérité est supérieur ou égale à celle défini dans les arguments. | +| | Ok si le nombre de message est en dessous du seuil warning. | +| | Warning si le nombre de message est au dessus du seuil warning. | +| | Critical si le nombre de message est au dessus du seuil critical. | ++------------------+------------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | ++------------------+------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | ++------------------+------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| Nom de la commande | Nombre d'arguments | Arguments | | | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| messageQueueSizeFiltered | 6 | Ordre des arguments | Description | Exemple | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 1 | Nom de la messageQueue | /QSYS.LIB/QSYSOPR.MSGQ | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 2 | Regex filtrant sur l'ID du message | ^CP.*$ | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 3 | Niveau de sévérité minimum pour comptabiliser le message | 60 | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 4 | Niveau de sévérité maximum pour comptabiliser le message | 80 | +| | | | Sévérité maximum exclue | | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 5 | Seuil warning (quantité) | 1 | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| | | Argument 6 | Seuil critique (quantité) | 2 | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ +| Métriques renvoyées | count=1234 | | | | ++--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++-------------------------------------------------+---------------------------------+-------------------------------+ +| Nombre de message présent dans la message queue | Download (as400 vers connector) | Upload (connector vers as400) | ++-------------------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 2,26 ko | 66 o | ++-------------------------------------------------+---------------------------------+-------------------------------+ +| 5000 | 11 mo | 325 ko | ++-------------------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++-----------------+-----------------------------------------+ +| Nom de la macro | Valeur de la macro | ++-----------------+-----------------------------------------+ +| CHECK | messageQueueSize | ++-----------------+-----------------------------------------+ +| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | ++-----------------+-----------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst b/as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst new file mode 100644 index 0000000000..6308eccaeb --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst @@ -0,0 +1,74 @@ +.. _newMessageInMessageQueue: + +********************************************************************************** +Nombre de nouveau messages dans une message queue (MSGQ) filtré par ID et severité +********************************************************************************** + +Description +^^^^^^^^^^^ + ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ +| Description | Controle le nombre de nouveaux messages dans une message queue en filtrant par ID et sevérité | | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ +| Fonctionnement | Récupère tous les message et les stocks dans une base de donnée légère. Compte le nombre de nouveaus messages dont la sévérité est supérieur ou égale à celle défini dans les arguments. | | +| | Ok si le nombre de nouveau message est en dessous du seuil warning. | | +| | Warning si le nombre de nouveau message est au dessus du seuil warning. | | +| | Critical si le nombre de nouveau message est au dessus du seuil critical. | | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ +| API utilisée | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ +| Autorité requise | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| Nom de la commande | Nombre d'arguments | Arguments | | | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| newMessageInMessageQueue | 6 | Arguments order | Description | Exemple | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| | | Argument 1 | Nom de la messageQueue | /QSYS.LIB/QSYSOPR.MSGQ | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| | | Argument 2 | Regex filtrant sur l'ID du message | ^CP.*$ | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| | | Argument 3 | Niveau de sévérité minimum pour comptabiliser le message | 60 | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| | | Argument 4 | Niveau de sévérité maximum pour comptabiliser le message | 80 | +| | | | Sévérité maximum non inclu | | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| | | Argument 5 | Seuil warning (quantité) | 1 | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| | | Argument 6 | Seuil critique (quantité) | 2 | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ +| Métriques renvoyées | criteriaMessage=1 newMessage=3 | | | | ++--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ + +Base de donnée locale +^^^^^^^^^^^^^^^^^^^^^ + +L'emplacement de la base de donnée locale peut etre configuré dans le fichier : /etc/centreon-connector-as400/config.properties. +La variable est : pathMsgQDB. +/!\\ Attention aux autres options dont les modifications peuvent avoir des impacts importants sur le fonctionnement du connecteur. + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++-------------------------------------------------+---------------------------------+-------------------------------+ +| Nombre de message présent dans la message queue | Download (as400 vers connector) | Upload (connector vers as400) | ++-------------------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 2,26 ko | 66 o | ++-------------------------------------------------+---------------------------------+-------------------------------+ +| 5000 | 11 mo | 325 ko | ++-------------------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++-----------------+-----------------------------------------+ +| Nom de la macro | Valeur de la macro | ++-----------------+-----------------------------------------+ +| CHECK | newMessageInMessageQueue | ++-----------------+-----------------------------------------+ +| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | ++-----------------+-----------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/pageFault.rst b/as400/doc/fr/exploitation/indicators/pageFault.rst new file mode 100644 index 0000000000..c177e8dfff --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/pageFault.rst @@ -0,0 +1,57 @@ +.. _pageFault: + +***************** +Taux de pageFault +***************** + +Description +^^^^^^^^^^^ + ++------------------+-------------------------------------------------------------------------------------------------------+ +| Description | Contrôle le taux de page fault. | ++------------------+-------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Récupère le taux de page par seconde, et le taux de page fault par seconde, database et non database. | +| | Calcul le pourcentage de page fault par rapport au page. | +| | Ok si ce pourcentage est en dessous du seuil warning. | +| | Warning si ce pourcentage est au dessus du seuil warning. | +| | Critical si ce pourcentage est au dessus du seuil critical. | ++------------------+-------------------------------------------------------------------------------------------------------+ +| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | ++------------------+-------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+----------------------------------------------+---------------------+--------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+----------------------------------------------+---------------------+--------------------+---------+ +| pageFault | 2 | Ordre des arguments | Description | Exemple | ++---------------------+----------------------------------------------+---------------------+--------------------+---------+ +| | | Argument 1 | Seuil warning (%) | 50 | ++---------------------+----------------------------------------------+---------------------+--------------------+---------+ +| | | Argument 2 | Seuil critique (%) | 70 | ++---------------------+----------------------------------------------+---------------------+--------------------+---------+ +| Métriques renvoyées | dbPageFaultRatio=10% nonDbPageFaultRatio=20% | | | | ++---------------------+----------------------------------------------+---------------------+--------------------+---------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 15 ko | 12 ko | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-------------+ +| Macro name | Macro value | ++------------+-------------+ +| CHECK | pageFault | ++------------+-------------+ +| ARGS | 50!70 | ++------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst b/as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst new file mode 100644 index 0000000000..9c80501946 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst @@ -0,0 +1,83 @@ +.. _allJobHaveNoMsgWInSubSystem: + +************************************************************************ +Controle le nombre de job dans un sous systeme avec un status specifique +************************************************************************ + +Description +^^^^^^^^^^^ + ++--------------------+-------------------------------------------------------------------------------------------------+ +| Description | Check amount of job in a subsystem with a specific status | ++--------------------+-------------------------------------------------------------------------------------------------+ +| Operation | OK si le nombre de job en attente de message est inférieur ou égal au warning count | +| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | +| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | ++--------------------+-------------------------------------------------------------------------------------------------+ +| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++--------------------+-------------------------------------------------------------------------------------------------+ +| Required authority | *USE | ++--------------------+-------------------------------------------------------------------------------------------------+ + +Command argument +^^^^^^^^^^^^^^^^ +String jobPattern, String subSystem, int warningMin, int warningMax, int criticalMin, int criticalMax + ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| Command name | Number of arguments | Arguments | | | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| specificJobInSubSystem | 8 | arguments order | Description | Exemple | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 1 | Job pattern (regex) | ^JOBC.\*$| ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 2 | SubSystem | QBASE | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 3 | Status | \*ANY | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 4 | StatusActive | ANY | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 5 | Warning minimal threshold (amount) | 2 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 6 | Warning maximal threshold (amount) | 5 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 7 | Critical minimal threshold (amount) | 1 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| | | Argument 8 | Critical maximal threshold (amount) | 10 | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| Metrics returned | foundJob\=123 statusMatchingJob\=1 | | | | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ +| Output returned | Amount of job found matching pattern and status | | | | ++------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ + +All Status and StatusActive can be found here : +http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qusrjobi.htm + +Centreon-Connector-AS400 add 1 status (*ANY) and 1 statusActive (ANY), to match all existing status. + +Status can have value: *ANY, *OUTQ, *ACTIVE, *JOBQ +StatusActive can have value: BSCA, BSCW, CMNA, CMNW, CMTW ... (see IBM documentation) + + + + +Network usage +^^^^^^^^^^^^^ + ++------------------------------+-------------------------------+-----------------------------+ +| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | ++------------------------------+-------------------------------+-----------------------------+ +| 1 (theoretic) | 77 o | 2,3 o | ++------------------------------+-------------------------------+-----------------------------+ +| 10000 | 750 ko | 23 ko | ++------------------------------+-------------------------------+-----------------------------+ + +Configuration exemple +^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------------------+ +| Macro name | Macro value | ++------------+-----------------------------+ +| CHECK | allJobHaveNoMsgWInSubSystem | ++------------+-----------------------------+ +| ARGS | QBASE!1!2 | ++------------+-----------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst b/as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst new file mode 100644 index 0000000000..4d0ed2d01c --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst @@ -0,0 +1,68 @@ +.. _allJobHaveNoMsgWInSubSystem: + +*********************************************************************** +Controle le nombre de job running (RUN) dans un sous systeme spécifique +*********************************************************************** + +Description +^^^^^^^^^^^ + ++------------------+-------------------------------------------------------------------------------------------------+ +| Description | Controle l'ensemble des jobs d'un sous systeme en état running | ++------------------+-------------------------------------------------------------------------------------------------+ +| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | +| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | +| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | ++------------------+-------------------------------------------------------------------------------------------------+ +| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | ++------------------+-------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+-------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ +String jobPattern, String subSystem, int warningMin, int warningMax, int criticalMin, int criticalMax + ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| specificJobRunningInSubSystem | 6 | Ordre des arguments | Description | Exemple | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 1 | Job pattern (regex) | ^JOBC.*$ | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 2 | Sous system | QBASE | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 3 | Seuil Warning minimal (quantité) | 2 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 4 | Seuil Warning maximal (quantité) | 5 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 5 | Seuil Critical minimal (quantité) | 1 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| | | Argument 6 | Seuil Critical maximal (quantité) | 10 | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| Métriques renvoyées | totalJob=123 jobMSGW=1 | | | | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ +| Output renvoyé | Le nom des jobs en attente de message | | | | ++-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------+---------------------------------+-------------------------------+ +| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------------+---------------------------------+-------------------------------+ +| 1 (théorique) | 77 o | 2,3 o | ++---------------------------------------+---------------------------------+-------------------------------+ +| 10000 | 750 ko | 23 ko | ++---------------------------------------+---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+------------------+ +| Macro name | Macro value | ++------------+------------------+ +| CHECK | allJobHaveNoMsgW | ++------------+------------------+ +| ARGS | QBASE!1!2 | ++------------+------------------+ diff --git a/as400/doc/fr/exploitation/indicators/subSystemExist.rst b/as400/doc/fr/exploitation/indicators/subSystemExist.rst new file mode 100644 index 0000000000..98f3b39bef --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/subSystemExist.rst @@ -0,0 +1,55 @@ +.. _subSystemExist: + +********************************** +Existance d'un sous systeme (SBSD) +********************************** + +Description +^^^^^^^^^^^ + ++------------------+------------------------------------------------------------------------------------------------------------+ +| Description | Contrôle la présence et l'état d'un sous système | ++------------------+------------------------------------------------------------------------------------------------------------+ +| Fonctionnement | Un sous système peut prendre les états *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, et *STARTING. | +| | Ok si le sous système est en état *ACTIVE. | +| | Critical si le sous système est dans un autre état que *ACTIVE, ou que le sous système n'a pas été trouvé. | ++------------------+------------------------------------------------------------------------------------------------------------+ +| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | ++------------------+------------------------------------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+------------------------------------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------+---------------------+---------------------+----------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------+---------------------+---------------------+----------+ +| subSystemExist | 1 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------+---------------------+---------------------+----------+ +| | | Argument 1 | Nom du sous système | QBATCH | ++---------------------+-------------------+---------------------+---------------------+----------+ +| | | Argument 2 | Nom de la librairie | QSYS.LIB | ++---------------------+-------------------+---------------------+---------------------+----------+ +| Métriques renvoyées | X | | | | ++---------------------+-------------------+---------------------+---------------------+----------+ + +Consommation réseau +^^^^^^^^^^^^^^^^^^^ + ++---------------------------------+-------------------------------+ +| Download (as400 vers connector) | Upload (connector vers as400) | ++---------------------------------+-------------------------------+ +| 5,5 ko | 2,1 ko | ++---------------------------------+-------------------------------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+------------------+ +| Macro name | Macro value | ++------------+------------------+ +| CHECK | subSystemExist | ++------------+------------------+ +| ARGS | QBATCH !QSYS.LIB | ++------------+------------------+ diff --git a/as400/doc/fr/exploitation/indicators/workWithProblem.rst b/as400/doc/fr/exploitation/indicators/workWithProblem.rst new file mode 100644 index 0000000000..9a73c935f2 --- /dev/null +++ b/as400/doc/fr/exploitation/indicators/workWithProblem.rst @@ -0,0 +1,50 @@ +.. _workWithProblem: + +************************************************************************ +Retourne le nombre de problèmes détectés par le système ou l'utilisateur +************************************************************************ + +Description +^^^^^^^^^^^ + ++------------------+---------------------------------------------------------------------------------+ +| Description | Retourne le nombre de problèmes détectés par le système ou l'utilisateur | ++------------------+---------------------------------------------------------------------------------+ +| Fonctionnement | OK si le nombre de problèmes inférieur ou égal au warning count | +| | WARNING si le nombre de problèmes est inferieur au "critical count » | +| | CRITICAL si le nombre de problèmes est superieur ou égal au « critical count ». | ++------------------+---------------------------------------------------------------------------------+ +| API utilisée | | ++------------------+---------------------------------------------------------------------------------+ +| Autorité requise | *USE | ++------------------+---------------------------------------------------------------------------------+ + +Arguments de la commande +^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| Nom de la commande | Nombre d'argument | Arguments | | | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| allJobHaveNoMsgW | n * 2 + 1 | Ordre des arguments | Description | Exemple | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 1 | Types de problèmes voulus | 1 | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| | | Argument 2 | Seuil Critical (quantité) | 2 | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| | Répéter les seuils pour chaque type de problème voulu | Argument 3 | Seuil Critical (quantité) | 2 | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| Métriques renvoyées | open=1;;;2;4 ready=0;;2;3 | | | | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ +| Output renvoyé | OK: There are 1 OPENED / 0 READY statys problems | | | | ++---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ + +Exemple de configuration +^^^^^^^^^^^^^^^^^^^^^^^^ + ++------------+-----------------+ +| Macro name | Macro value | ++------------+-----------------+ +| CHECK | workWithProblem | ++------------+-----------------+ +| ARGS | 1!2 | ++------------+-----------------+ diff --git a/as400/doc/fr/exploitation/mode.rst b/as400/doc/fr/exploitation/mode.rst new file mode 100644 index 0000000000..a19ff7fba6 --- /dev/null +++ b/as400/doc/fr/exploitation/mode.rst @@ -0,0 +1,69 @@ +.. _mode: + +###################### +Mode de fonctionnement +###################### + +Centreon-Connector-AS400 peut fonctionner en mode daemon ou en ligne de commande. +Il est complété par un plugin Nagios de contrôle, se connectant au daemon, et chargé de transmettre les résultats à Nagios. + +Ligne de commande +================= + +En ligne de commande, une machine virtuelle java est démarrée à chaque exécution. Ce mode ne doit être utilisé qu'à des fins de tests, afin d'éviter une forte consommation CPU/mémoire:: + + +-------------------------------------------------------------------------------------------------------------+ + | java -jar connector-as400-1.x.x.jar -I -H %HOST% --login %LOGIN% --password %PASSWORD% -C %CHECK% -A %ARGS% | + +-------------------------------------------------------------------------------------------------------------+ + +Saisir les differents arguments : + ++----------+-----------------------------------------+-------------+ +| Attribut | Description | Exemple | ++==========+=========================================+=============+ +| HOST | L'adresse IP ou le nom de l'hôte AS/400 | 10.30.10.30 | ++----------+-----------------------------------------+-------------+ +| LOGIN | Le nom d'utilisateur AS/400 | USER123 | ++----------+-----------------------------------------+-------------+ +| PASSWORD | Le mot de passe AS/400 | PASSWORD123 | ++----------+-----------------------------------------+-------------+ +| CHECK | La commande de check | cpuUsage | ++----------+-----------------------------------------+-------------+ +| ARGS | Les arguments de la commande | 80!90 | ++----------+-----------------------------------------+-------------+ + +Note : les arguments de la commande sont séparés par des « ! ». + +Daemon +====== + +Le mode daemon permet de lancer les mêmes commandes qu'en ligne de commande sans devoir redémarrer une machine virtuelle java à chaque utilisation. +Le daemon écoute sur un port, en attente de requête. +Un plugin de contrôle (check_centreon_as400_generic) est disponible pour se connecter au daemon, et renvoyer un résultat au format Nagios. +Les arguments du plugin sont similaires à ceux du programme java. Il est cependant nécessaire de préciser l'adresse et le port du daemon:: + + +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | check_centreon_as400_generic \-\-connector %DAEMONHOST%:%DAEMONPORT% \-\-host %HOST% \-\-user %USER% \-\-password %PASSWORD% \-\-check %CHECK% \-\-args %ARGS% | + +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +Saisir les differents arguments : + ++------------+------------------------------------------------------+-------------+ +| Attribut | Description | Exemple | ++------------+------------------------------------------------------+-------------+ +| DAEMONHOST | L'adresse IP ou le nom de l'hôte exécutant le daemon | 10.30.10.20 | ++------------+------------------------------------------------------+-------------+ +| DAEMONPORT | Le port du daemon | 8091 | ++------------+------------------------------------------------------+-------------+ +| HOST | L'adresse IP ou le nom de l'hôte AS/400 | 10.30.10.30 | ++------------+------------------------------------------------------+-------------+ +| LOGIN | Le nom d'utilisateur AS/400 | USER123 | ++------------+------------------------------------------------------+-------------+ +| PASSWORD | Le mot de passe AS/400 | PASSWORD123 | ++------------+------------------------------------------------------+-------------+ +| CHECK | La commande de check | cpuUsage | ++------------+------------------------------------------------------+-------------+ +| ARGS | Les arguments de la commande | 80!90 | ++------------+------------------------------------------------------+-------------+ + +Note : les arguments de la commande sont séparés par des « ! ». diff --git a/as400/doc/fr/installation/prerequisites.rst b/as400/doc/fr/installation/prerequisites.rst new file mode 100644 index 0000000000..e0763bfc1a --- /dev/null +++ b/as400/doc/fr/installation/prerequisites.rst @@ -0,0 +1,67 @@ +.. _rpm: + +########## +Pré-requis +########## + ++-----------+-----------------+ +| Logiciels | Version minimum | ++-----------+-----------------+ +| Centreon | 2.2.x | ++-----------+-----------------+ +| Nagios | 3.x | ++-----------+-----------------+ +| Java | JRE 6 Oracle | ++-----------+-----------------+ +| AS/400 | V4R5\+ | ++-----------+-----------------+ + +Préconisations matérielles +************************** + +Il est nécessaire d'évaluer les ressources matérielles nécessaires avant d'installer Centreon-Connector-AS400 sur un serveur. + +- **mémoire vive** : 512 Mo minimum (Peut sensiblement augmenter en fonction du nombre de contrôle). + + - Compter 2 Go pour 2500 services avec un intervalle de 10 minutes entre chaque contrôle. + +- **CPU** : même pré-requis que pour le serveur de collecte + + +List des ports utilisés +*********************** + ++-----------+-------------+--------------------------+------------------+ +| Source | Destination | Port | Peut être changé | ++-----------+-------------+--------------------------+------------------+ +| Plugin | Connector | Non défini | Oui | ++-----------+-------------+--------------------------+------------------+ + + +Liste des ports entre le connecteur et l'AS400 +---------------------------------------------- + ++----------+------+ +| Standard | SSL | ++----------+------+ +| 446 | 448 | ++----------+------+ +| 449 | | ++----------+------+ +| 8470 | 9470 | ++----------+------+ +| 8471 | 9471 | ++----------+------+ +| 8472 | 9472 | ++----------+------+ +| 8473 | 9473 | ++----------+------+ +| 8474 | 9474 | ++----------+------+ +| 8475 | 9475 | ++----------+------+ +| 8476 | 9476 | ++----------+------+ + + +Une liste complète des ports utilisés par l'AS400 peut être trouvée `sur cette page `_. diff --git a/as400/doc/fr/installation/rpm.rst b/as400/doc/fr/installation/rpm.rst new file mode 100644 index 0000000000..e07d03fb2f --- /dev/null +++ b/as400/doc/fr/installation/rpm.rst @@ -0,0 +1,21 @@ +.. _rpm: + +############################# +Installation du package (RPM) +############################# + +Pré-Requis +********** + +Une installation recente de CES avec centreon-plugin-pack. + +Installation +************ + +Lancez la commande:: + + $ yum install centreon-connector-as400-server ces-plugins-Operatingsystems-As400 ces-pack-Operatingsystems-As400 + +Puis démarrez le daemon:: + + $ /etc/init.d/centreon-connector-as400 start \ No newline at end of file diff --git a/as400/doc/fr/installation/tarball.rst b/as400/doc/fr/installation/tarball.rst new file mode 100644 index 0000000000..62391ba3d6 --- /dev/null +++ b/as400/doc/fr/installation/tarball.rst @@ -0,0 +1,41 @@ +.. _tarball: + +####################################### +Installation depuis le tarball (tar.gz) +####################################### + +L'installation par tarball est déconseillé. + +Pré-Requis +********** + +To build Centreon-Connector-AS400 check plugin, you will need the following external dependencies: + +a C++ compilation environment. +CMake (>= 2.8), a cross-platform build system. +the Qt (>= 4.7.4) framework with QtCore, and QtXml modules. +GnuTLS (>= 2.0), a secure communications library. + +Installation du daemon +********************** + +Décompresser l'archive:: + + $ cd /tmp/ && tar xvzf centreon-connector-as400-server-1.x.x.tar.gz + + Lancez l'instalation:: + + $ /tmp/centreon-connector-as400-server-1.x.x/install.sh + +Installation des sondes +*********************** + +Les sondes doivent etre compilées:: + + $ cd /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/ + $ cmake && make + +Copiez ensuite la sonde as400 vers le dossier libexec nagios:: + + $ cp /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/as400_generic/check_centreon_as400 %nagios%/libexec/ + diff --git a/as400/doc/fr/upgrade/rpm.rst b/as400/doc/fr/upgrade/rpm.rst new file mode 100644 index 0000000000..5ecdc59b51 --- /dev/null +++ b/as400/doc/fr/upgrade/rpm.rst @@ -0,0 +1,20 @@ +.. _rpm: + +###################################### +Mise à jour à partir des package (RPM) +###################################### + +Mise à jour +*********** + +Arrêter service du connecteur:: + + $ /etc/init.d/centreon-connector-as400 stop + +Mettre à jour les rpm:: + + $ yum update centreon-connector-as400-server ces-plugins-Operatingsystems-As400 + +Redémarrer le service du connecteur:: + + $ /etc/init.d/centreon-connector-as400 start From f6febb8fe6b9cdc1ae14d861d32538f91c75f9b6 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Tue, 3 Sep 2024 17:28:35 +0200 Subject: [PATCH 04/40] use java 1.8 as require and target --- as400/connector.as400/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/as400/connector.as400/pom.xml b/as400/connector.as400/pom.xml index 2d17ce2193..e1c7ddaf6d 100644 --- a/as400/connector.as400/pom.xml +++ b/as400/connector.as400/pom.xml @@ -11,7 +11,7 @@ UTF-8 4.0.5.RELEASE - 1.6 + 1.8 2.17.1 jacoco @@ -73,8 +73,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 1.8 + 1.8 From 67548298308b665f3f9502d79d7c0a44344b5bb2 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 15:37:46 +0200 Subject: [PATCH 05/40] remove java 17 from java packaging container --- .../Dockerfile.packaging-plugins-java-alma8 | 1 - as400/packaging/centreon-as400-daemon.yaml | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index ac8af74fa7..bd62995373 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -9,7 +9,6 @@ dnf install -y \ git \ wget \ zstd \ - https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm echo '[goreleaser] name=GoReleaser diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index 4e5e087274..351cb9c65e 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -8,18 +8,28 @@ section: "default" priority: "optional" maintainer: "Centreon " description: | - Centreon Connector Server for AS400 + Centreon Connector Server for AS400. vendor: "Centreon" homepage: "https://www.centreon.com" license: "Apache-2.0" contents: + - src: "../centreon-plugins/as400/connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE + dst: "/usr/share/centreon-as400/bin/centreon-as400-2.0.2-jar-with-dependencies.jar" scripts: preinstall: ./scripts/centreon-bi-engine-preinstall.sh postinstall: ./scripts/centreon-bi-engine-postinstall.sh preremove: ./scripts/centreon-bi-engine-preremove.sh +overrides: + rpm: + depends: + - java-1.8.0-openjdk + deb: + depends: + - java-1.8.0-openjdk + rpm: summary: Centreon AS 400 Plugin daemon signature: From db6ec0c543a775f3e55aadaee747ac80b72495b4 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 15:46:17 +0200 Subject: [PATCH 06/40] add minimal rpm packaging --- .github/workflows/as400.yml | 36 +++++++++++----------- as400/packaging/centreon-as400-daemon.yaml | 4 +-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 07d30a20f5..26183ea6e8 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -32,9 +32,9 @@ jobs: - package_extension: rpm image: packaging-plugins-alma8 distrib: el8 - - package_extension: rpm - image: packaging-plugins-alma9 - distrib: el9 + # - package_extension: rpm + # image: packaging-plugins-alma9 + # distrib: el9 # - package_extension: deb # image: packaging-plugins-bullseye # distrib: bullseye @@ -78,21 +78,21 @@ jobs: - name: Build JAR using maven run: mvn clean install -f connector.as400/pom.xml - # - name: Package - # uses: ./.github/actions/package-nfpm - # with: - # nfpm_file_pattern: "as400/packaging/centreon-as400-daemon.yaml" - # distrib: ${{ matrix.distrib }} - # package_extension: ${{ matrix.package_extension }} - # version: ${{ needs.get-environment.outputs.version }} - # release: ${{ needs.get-environment.outputs.release }} - # arch: all - # commit_hash: ${{ github.sha }} - # cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-as400-${{ 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 }} + - name: Package + uses: ./.github/actions/package-nfpm + with: + nfpm_file_pattern: "as400/packaging/centreon-as400-daemon.yaml" + distrib: ${{ matrix.distrib }} + package_extension: ${{ matrix.package_extension }} + version: ${{ needs.get-environment.outputs.version }} + release: ${{ needs.get-environment.outputs.release }} + arch: all + commit_hash: ${{ github.sha }} + cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-as400-${{ matrix.distrib }} + rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }} + rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }} + rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }} + stability: ${{ needs.get-environment.outputs.stability }} # deliver-rpm: # needs: [get-environment, package] diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index 351cb9c65e..e7497fcd7a 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -2,7 +2,7 @@ name: "centreon-plugin-Operatingsystems-AS400-daemon" arch: "${ARCH}" platform: "linux" version_schema: "none" -version: "${VERSION}" +version: "2.0.2" release: "${RELEASE}${DIST}" section: "default" priority: "optional" @@ -15,7 +15,7 @@ license: "Apache-2.0" contents: - src: "../centreon-plugins/as400/connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE - dst: "/usr/share/centreon-as400/bin/centreon-as400-2.0.2-jar-with-dependencies.jar" + dst: "/usr/share/centreon-as400/bin/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE scripts: preinstall: ./scripts/centreon-bi-engine-preinstall.sh From a6f173ece1fe0098a5c1b26424574412308f20d8 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 15:50:02 +0200 Subject: [PATCH 07/40] update docker image name for packaging in as400 workflow --- .github/workflows/as400.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 26183ea6e8..f9b897673f 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -30,7 +30,7 @@ jobs: matrix: include: - package_extension: rpm - image: packaging-plugins-alma8 + image: packaging-plugins-java-alma8 distrib: el8 # - package_extension: rpm # image: packaging-plugins-alma9 From eee97b5a89029f37fff531bd3553063f0a9defec Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 15:56:56 +0200 Subject: [PATCH 08/40] add alma8 java packaging image entry to docker builder matrix --- .github/workflows/docker-builder-packaging-plugins.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-builder-packaging-plugins.yml b/.github/workflows/docker-builder-packaging-plugins.yml index ed27cbf655..5b4c358614 100644 --- a/.github/workflows/docker-builder-packaging-plugins.yml +++ b/.github/workflows/docker-builder-packaging-plugins.yml @@ -28,6 +28,9 @@ jobs: - runner: ubuntu-22.04 dockerfile: packaging-plugins-alma9 image: packaging-plugins-alma9 + - runner: ubuntu-22.04 + dockerfile: packaging-plugins-java-alma8 + image: packaging-plugins-java-alma8 - runner: ubuntu-22.04 dockerfile: packaging-plugins-bullseye image: packaging-plugins-bullseye From 6081de54a4ceb56767b37766e1056fe4f9e17622 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 16:01:46 +0200 Subject: [PATCH 09/40] removed old doc as it is now outdated --- as400/doc/.project | 11 --- .../en/exploitation/configurationCentreon.rst | 90 ------------------ as400/doc/en/exploitation/index.rst | 14 --- as400/doc/en/exploitation/indicator.rst | 32 ------- .../indicators/allJobHaveNoMsgW.rst | 59 ------------ .../allJobHaveNoMsgWInSubSystem.rst | 61 ------------ .../en/exploitation/indicators/asp1Usage.rst | 55 ----------- .../indicators/backupJobExist.rst | 51 ---------- .../en/exploitation/indicators/cpuUsage.rst | 56 ----------- .../en/exploitation/indicators/diskState.rst | 51 ---------- .../en/exploitation/indicators/diskUsage.rst | 57 ----------- .../indicators/diskUsageRepartition.rst | 56 ----------- .../indicators/executeCommand.rst | 62 ------------ .../en/exploitation/indicators/jobExist.rst | 56 ----------- .../exploitation/indicators/jobHasNoMsgw.rst | 56 ----------- .../indicators/jobQueueStatus.rst | 55 ----------- .../indicators/jobQueueWaitJobCount.rst | 60 ------------ .../indicators/messageQueueSize.rst | 62 ------------ .../indicators/messageQueueSizeFiltered.rst | 67 ------------- .../indicators/newMessageInMessageQueue.rst | 74 --------------- .../en/exploitation/indicators/pageFault.rst | 57 ----------- .../indicators/specificJobInSubSystem.rst | 82 ---------------- .../specificJobRunningInSubSystem.rst | 68 -------------- .../indicators/subSystemExist.rst | 55 ----------- .../indicators/workWithProblem.rst | 50 ---------- as400/doc/en/exploitation/mode.rst | 69 -------------- as400/doc/en/installation/prerequisites.rst | 64 ------------- as400/doc/en/installation/rpm.rst | 21 ----- as400/doc/en/installation/tarball.rst | 41 -------- as400/doc/en/upgrade/rpm.rst | 20 ---- .../fr/exploitation/configurationCentreon.rst | 94 ------------------- as400/doc/fr/exploitation/index.rst | 14 --- as400/doc/fr/exploitation/indicator.rst | 32 ------- .../indicators/allJobHaveNoMsgW.rst | 59 ------------ .../allJobHaveNoMsgWInSubSystem.rst | 61 ------------ .../fr/exploitation/indicators/asp1Usage.rst | 55 ----------- .../indicators/backupJobExist.rst | 53 ----------- .../fr/exploitation/indicators/cpuUsage.rst | 55 ----------- .../fr/exploitation/indicators/diskState.rst | 51 ---------- .../fr/exploitation/indicators/diskUsage.rst | 57 ----------- .../indicators/diskUsageRepartition.rst | 56 ----------- .../indicators/executeCommand.rst | 62 ------------ .../fr/exploitation/indicators/jobExist.rst | 56 ----------- .../exploitation/indicators/jobHasNoMsgw.rst | 56 ----------- .../indicators/jobQueueStatus.rst | 55 ----------- .../indicators/jobQueueWaitJobCount.rst | 60 ------------ .../indicators/messageQueueSize.rst | 62 ------------ .../indicators/messageQueueSizeFiltered.rst | 67 ------------- .../indicators/newMessageInMessageQueue.rst | 74 --------------- .../fr/exploitation/indicators/pageFault.rst | 57 ----------- .../indicators/specificJobInSubSystem.rst | 83 ---------------- .../specificJobRunningInSubSystem.rst | 68 -------------- .../indicators/subSystemExist.rst | 55 ----------- .../indicators/workWithProblem.rst | 50 ---------- as400/doc/fr/exploitation/mode.rst | 69 -------------- as400/doc/fr/installation/prerequisites.rst | 67 ------------- as400/doc/fr/installation/rpm.rst | 21 ----- as400/doc/fr/installation/tarball.rst | 41 -------- as400/doc/fr/upgrade/rpm.rst | 20 ---- 59 files changed, 3222 deletions(-) delete mode 100644 as400/doc/.project delete mode 100644 as400/doc/en/exploitation/configurationCentreon.rst delete mode 100644 as400/doc/en/exploitation/index.rst delete mode 100644 as400/doc/en/exploitation/indicator.rst delete mode 100644 as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst delete mode 100644 as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst delete mode 100644 as400/doc/en/exploitation/indicators/asp1Usage.rst delete mode 100644 as400/doc/en/exploitation/indicators/backupJobExist.rst delete mode 100644 as400/doc/en/exploitation/indicators/cpuUsage.rst delete mode 100644 as400/doc/en/exploitation/indicators/diskState.rst delete mode 100644 as400/doc/en/exploitation/indicators/diskUsage.rst delete mode 100644 as400/doc/en/exploitation/indicators/diskUsageRepartition.rst delete mode 100644 as400/doc/en/exploitation/indicators/executeCommand.rst delete mode 100644 as400/doc/en/exploitation/indicators/jobExist.rst delete mode 100644 as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst delete mode 100644 as400/doc/en/exploitation/indicators/jobQueueStatus.rst delete mode 100644 as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst delete mode 100644 as400/doc/en/exploitation/indicators/messageQueueSize.rst delete mode 100644 as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst delete mode 100644 as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst delete mode 100644 as400/doc/en/exploitation/indicators/pageFault.rst delete mode 100644 as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst delete mode 100644 as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst delete mode 100644 as400/doc/en/exploitation/indicators/subSystemExist.rst delete mode 100644 as400/doc/en/exploitation/indicators/workWithProblem.rst delete mode 100644 as400/doc/en/exploitation/mode.rst delete mode 100644 as400/doc/en/installation/prerequisites.rst delete mode 100644 as400/doc/en/installation/rpm.rst delete mode 100644 as400/doc/en/installation/tarball.rst delete mode 100644 as400/doc/en/upgrade/rpm.rst delete mode 100644 as400/doc/fr/exploitation/configurationCentreon.rst delete mode 100644 as400/doc/fr/exploitation/index.rst delete mode 100644 as400/doc/fr/exploitation/indicator.rst delete mode 100644 as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst delete mode 100644 as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst delete mode 100644 as400/doc/fr/exploitation/indicators/asp1Usage.rst delete mode 100644 as400/doc/fr/exploitation/indicators/backupJobExist.rst delete mode 100644 as400/doc/fr/exploitation/indicators/cpuUsage.rst delete mode 100644 as400/doc/fr/exploitation/indicators/diskState.rst delete mode 100644 as400/doc/fr/exploitation/indicators/diskUsage.rst delete mode 100644 as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst delete mode 100644 as400/doc/fr/exploitation/indicators/executeCommand.rst delete mode 100644 as400/doc/fr/exploitation/indicators/jobExist.rst delete mode 100644 as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst delete mode 100644 as400/doc/fr/exploitation/indicators/jobQueueStatus.rst delete mode 100644 as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst delete mode 100644 as400/doc/fr/exploitation/indicators/messageQueueSize.rst delete mode 100644 as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst delete mode 100644 as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst delete mode 100644 as400/doc/fr/exploitation/indicators/pageFault.rst delete mode 100644 as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst delete mode 100644 as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst delete mode 100644 as400/doc/fr/exploitation/indicators/subSystemExist.rst delete mode 100644 as400/doc/fr/exploitation/indicators/workWithProblem.rst delete mode 100644 as400/doc/fr/exploitation/mode.rst delete mode 100644 as400/doc/fr/installation/prerequisites.rst delete mode 100644 as400/doc/fr/installation/rpm.rst delete mode 100644 as400/doc/fr/installation/tarball.rst delete mode 100644 as400/doc/fr/upgrade/rpm.rst diff --git a/as400/doc/.project b/as400/doc/.project deleted file mode 100644 index f7597a8ab5..0000000000 --- a/as400/doc/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - doc - - - - - - - - diff --git a/as400/doc/en/exploitation/configurationCentreon.rst b/as400/doc/en/exploitation/configurationCentreon.rst deleted file mode 100644 index d006b58fe3..0000000000 --- a/as400/doc/en/exploitation/configurationCentreon.rst +++ /dev/null @@ -1,90 +0,0 @@ -.. _configurationCentreon: - -###################### -Centreon configuration -###################### - -Template configuration in Centreon are on necessary when using the tarball installation. -To fully exploit Centreon-Connector-AS400, it is recommanded to perform a series of actions. - -Create a generic check command -============================== - -Go to the « Configuration → Commande » menu and create a " check_as400_generic " command. - -Insert the command: - -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| $USER1$/check_centreon_as400_generic \-\-connector "$_HOSTDAEMONHOST$:$_HOSTDAEMONPORT$" \-\-host "$HOSTADDRESS$" \-\-user "$_HOSTAS400USER$" \-\-password "$_HOSTAS400PASSWORD$" \-\-check "$_SERVICECHECK$" \-\-args "$_SERVICEARGS$" | -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -This command has a series of macros used at different level of host templates , hosts, service templates, services. - -Macro prefixed with HOST are retrieved from the host definition (or host template). -Macros prefixed with SERVICE are retrieved from the service definition. (or service template) . - -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| Macro name | Macro value | Resource where the macro must be defined (recommanded) | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| DAEMONHOST | IP or hostname of the server running the daemon AS/400 | Lowest level AS/400 host template | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| DAEMONPORT | Daemon port | Lowest level AS/400 host template | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| AS400USER | AS/400 user name | AS/400 Host | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| AS400PASSWORD | AS/400 password | AS/400 Host | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| CHECK | Check command | Service or AS/400 model service of the highest level | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ -| ARGS | Check command arguments | Service or AS/400 model service of the highest level | -+---------------+--------------------------------------------------------+--------------------------------------------------------+ - -Create a generic host template -============================== - -Go to the menu « Configuration → Hosts → Templates » and create an host template « as400 ». -This model will be the lowest level host template for all AS/400 hosts. Other higher level host template can be created . -Configure all the fields as shown in Centreon documentation. - -Define the following macros : - -+------------+-----------------------+ -| Macro name | Macro value | -+------------+-----------------------+ -| DAEMONHOST | Exemple : 10.30.10.30 | -+------------+-----------------------+ -| DAEMONPORT | Exemple : 8091 | -+------------+-----------------------+ - -Create an as400 host -==================== - -Go to the " Configuration → Hosts " menu and create an host based on the host template "as400" generic (or a higher-level host template based on the template "as400" generic) . - -Define the following macros: - -+---------------+-----------------------+ -| Macro name | Macro value | -+---------------+-----------------------+ -| AS400USER | Exemple : USER123 | -+---------------+-----------------------+ -| AS400PASSWORD | Exemple : PASSWORD123 | -+---------------+-----------------------+ - - -Create a service template or service -==================================== - -Go « Configuration → Services » or « Template », and create a service or service template - -Define the following maccro - -+------------+--------------------+ -| Macro name | Macro value | -+------------+--------------------+ -| CHECK | Exemple : cpuUsage | -+------------+--------------------+ -| ARGS | Exemple : 80!90 | -+------------+--------------------+ - -The various commands and arguments are explained in the " List of indicators " diff --git a/as400/doc/en/exploitation/index.rst b/as400/doc/en/exploitation/index.rst deleted file mode 100644 index 981101ea93..0000000000 --- a/as400/doc/en/exploitation/index.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. _exploitation: - -############ -Exploitation -############ - -.. toctree:: - :glob: - - mode - configurationCentreon - indicator - - \ No newline at end of file diff --git a/as400/doc/en/exploitation/indicator.rst b/as400/doc/en/exploitation/indicator.rst deleted file mode 100644 index 84d9c5daad..0000000000 --- a/as400/doc/en/exploitation/indicator.rst +++ /dev/null @@ -1,32 +0,0 @@ -.. _indicator: - -############## -Indicator list -############## - -Depending of the used API, user rights on AS/400 may vary. -They are specified in each control. - -.. toctree:: - - indicators/cpuUsage - indicators/asp1Usage - indicators/diskState - indicators/diskUsage - indicators/diskUsageRepartition - indicators/subSystemExist - indicators/pageFault - indicators/jobExist - indicators/jobHasNoMsgw - indicators/allJobHaveNoMsgW - indicators/allJobHaveNoMsgWInSubSystem - indicators/backupJobExist - indicators/jobQueueStatus - indicators/jobQueueWaitJobCount - indicators/specificJobInSubSystem - indicators/specificJobRunningInSubSystem - indicators/messageQueueSize - indicators/messageQueueSizeFiltered - indicators/newMessageInMessageQueue - indicators/executeCommand - indicators/workWithProblem diff --git a/as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst b/as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst deleted file mode 100644 index 61808f2197..0000000000 --- a/as400/doc/en/exploitation/indicators/allJobHaveNoMsgW.rst +++ /dev/null @@ -1,59 +0,0 @@ -.. _allJobHaveNoMsgW: - -********************************************************************** -Check the amount of jobs with a message wait (MSGW) (allJobHaveNoMsgW) -********************************************************************** - -Description -^^^^^^^^^^^ - -+--------------------+------------------------------------------------------------------------------------------------+ -| Description | Control all jobs , the as400 , and check that they are not waiting for a message ( MSGW ) | -+--------------------+------------------------------------------------------------------------------------------------+ -| Operation | OK if the number of job waiting for a message is less or equal to the warning count | -| | WARNING if the number of job waiting for a message is less than the critical count | -| | CRITICAL if the number of job waiting for a message is equal or greater to the critical count | -+--------------------+------------------------------------------------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+------------------------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+-------------------------------+-----------------+-----------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+-------------------------------+-----------------+-----------------------------+---------+ -| allJobHaveNoMsgW | 1 | Arguments order | Description | Exemple | -+------------------+-------------------------------+-----------------+-----------------------------+---------+ -| | | Argument 1 | Warning threshold (amount) | 1 | -+------------------+-------------------------------+-----------------+-----------------------------+---------+ -| | | Argument 2 | Critical threshold (amount) | 2 | -+------------------+-------------------------------+-----------------+-----------------------------+---------+ -| Metrics returned | totalJob=1234 jobMSGW=1 | | | | -+------------------+-------------------------------+-----------------+-----------------------------+---------+ -| Output returned | Job name waiting for messages | | | | -+------------------+-------------------------------+-----------------+-----------------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+------------------------------+-------------------------------+-----------------------------+ -| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | -+------------------------------+-------------------------------+-----------------------------+ -| 1 (theoretic) | 77 o | 2,3 o | -+------------------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+------------------+ -| Macro name | Macro value | -+------------+------------------+ -| CHECK | allJobHaveNoMsgW | -+------------+------------------+ -| ARGS | 1!2 | -+------------+------------------+ diff --git a/as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst b/as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst deleted file mode 100644 index 340cb60555..0000000000 --- a/as400/doc/en/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. _allJobHaveNoMsgWInSubSystem: - -*********************************************************************************************************** -Check the amount of jobs with a message wait (MSGW) in a specific file system (allJobHaveNoMsgWInSubSystem) -*********************************************************************************************************** - -Description -^^^^^^^^^^^ - -+--------------------+--------------------------------------------------------------------------------------------------------+ -| Description | Control all jobs in a specific file system, and check that they are not waiting for a message ( MSGW ) | -+--------------------+--------------------------------------------------------------------------------------------------------+ -| Operation | OK if the number of job waiting for a message is less or equal to the warning count | -| | WARNING if the number of job waiting for a message is less than the critical count | -| | CRITICAL if the number of job waiting for a message is equal or greater to the critical count | -+--------------------+--------------------------------------------------------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+--------------------------------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+--------------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| allJobHaveNoMsgWInSubSystem | 1 | Arguments order | Description | Exemple | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| | | Argument 1 | SubSystem name | QBASE | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| | | Argument 2 | Seuil Warning (quantité) | 1 | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| | | Argument 3 | Seuil Critical (quantité) | 2 | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| Metrics returned | totalJob=1234 jobMSGW=1 | | | | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ -| Output returned | Job name waiting for messages | | | | -+-----------------------------+-------------------------------+-----------------+---------------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+------------------------------+-------------------------------+-----------------------------+ -| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | -+------------------------------+-------------------------------+-----------------------------+ -| 1 (theoretic) | 77 o | 2,3 o | -+------------------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------------------+ -| Macro name | Macro value | -+------------+-----------------------------+ -| CHECK | allJobHaveNoMsgWInSubSystem | -+------------+-----------------------------+ -| ARGS | QBASE!1!2 | -+------------+-----------------------------+ diff --git a/as400/doc/en/exploitation/indicators/asp1Usage.rst b/as400/doc/en/exploitation/indicators/asp1Usage.rst deleted file mode 100644 index 3c37f60093..0000000000 --- a/as400/doc/en/exploitation/indicators/asp1Usage.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _asp1Usage: - -**************************************** -Check the usage rate of ASP1 (asp1Usage) -**************************************** - -Description -^^^^^^^^^^^ - -+--------------------+--------------------------------------------------------+ -| Description | Contrôle le taux d'occupation de l'ASP1. | -+--------------------+--------------------------------------------------------+ -| Operation | Ok if the usage rate is below warning threshold | -| | Warning if the usage rate is above warning threshold | -| | Critical if the usage rate is above critical threshold | -+--------------------+--------------------------------------------------------+ -| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | -+--------------------+--------------------------------------------------------+ -| Required authority | *USE | -+--------------------+--------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+------------------------+---------+ -| asp1Usage | | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+------------------------+---------+ -| | | Argument 1 | Warning threshold (%) | 80 | -+------------------+---------------------+-----------------+------------------------+---------+ -| | | Argument 2 | Critical threshold (%) | 90 | -+------------------+---------------------+-----------------+------------------------+---------+ -| Metrics returned | usage=xx% | | | | -+------------------+---------------------+-----------------+------------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 1,5 ko | 1.1 ko | -+---------------------------------+-------------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | asp1Usage | -+------------+-------------+ -| ARGS | 80!90 | -+------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/backupJobExist.rst b/as400/doc/en/exploitation/indicators/backupJobExist.rst deleted file mode 100644 index 3123cac5c7..0000000000 --- a/as400/doc/en/exploitation/indicators/backupJobExist.rst +++ /dev/null @@ -1,51 +0,0 @@ -.. _backupJobExist: - -******************************************** -Existence of the backup job (backupJobExist) -******************************************** - -Description -^^^^^^^^^^^ - -+--------------------+-----------------------------------------------------------------------------------+ -| Description | Control the existence of the backup job RBT_DDMMYY . Does not control it's status | -+--------------------+-----------------------------------------------------------------------------------+ -| Operation | Ok if job exist | -| | Critical if the job does not exist. | -| | DDMMYY is the day of the check eecution. Date is the date from as400 server | -+--------------------+-----------------------------------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+-----------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+-----------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+-------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+-------------+---------+ -| backupJobExist | | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+-------------+---------+ -| | | Argument 1 | X | X | -+------------------+---------------------+-----------------+-------------+---------+ -| Metrics returned | | | | | -+------------------+---------------------+-----------------+-------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------+ -| Macro name | Macro value | -+------------+----------------+ -| CHECK | backupJobExist | -+------------+----------------+ diff --git a/as400/doc/en/exploitation/indicators/cpuUsage.rst b/as400/doc/en/exploitation/indicators/cpuUsage.rst deleted file mode 100644 index efd2ac1c78..0000000000 --- a/as400/doc/en/exploitation/indicators/cpuUsage.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _cpuUsage: - -********* -CPU usage -********* - -Description -^^^^^^^^^^^ - -+--------------------+-----------------------------------------------------------+-+ -| Description | Controls the time rate AS/400 CPU was used | | -+--------------------+-----------------------------------------------------------+-+ -| Operation | Ok if the CPU time rate is below warning threshold | | -| | Warning if the cpu time rate goes above warning threshold | | -| | Critical if the cpu time goes above critical threshold | | -| | Can exceed 100% on uncapped partition | | -+--------------------+-----------------------------------------------------------+-+ -| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | | -+--------------------+-----------------------------------------------------------+-+ -| Required authority | *USE | | -+--------------------+-----------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+------------------------+---------+ -| cpuUsage | 2 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+------------------------+---------+ -| | | Argument 1 | Warning threshold (%) | 80 | -+------------------+---------------------+-----------------+------------------------+---------+ -| | | Argument 2 | Critical threshold (%) | 90 | -+------------------+---------------------+-----------------+------------------------+---------+ -| Metrics returned | usage=xx% | | | | -+------------------+---------------------+-----------------+------------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------+---------------------------------+ -| Download (as400 vers connector) | Download (as400 vers connector) | -+---------------------------------+---------------------------------+ -| 1,7 ko | 1.5 ko | -+---------------------------------+---------------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | cpuUsage | -+------------+-------------+ -| ARGS | 80!90 | -+------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/diskState.rst b/as400/doc/en/exploitation/indicators/diskState.rst deleted file mode 100644 index a98f60dc35..0000000000 --- a/as400/doc/en/exploitation/indicators/diskState.rst +++ /dev/null @@ -1,51 +0,0 @@ -.. _diskState: - -************************************************************ -Check the operating status of all physical disks (diskState) -************************************************************ - -Description -^^^^^^^^^^^ - -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Description | Check the operating status of all physical disks | -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Operation | A physical disk may take several state : no control, active, failed, hardware failure, rebuild, not ready, protected, busy, not operational, unknown state (13 états au total). | -| | Ok if all disks are active | -| | Critical if at least 1 disk is in a different state than active | -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Used API | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+--------------------------+-----------------+-------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+--------------------------+-----------------+-------------+---------+ -| diskState | 0 | Arguments order | Description | Exemple | -+------------------+--------------------------+-----------------+-------------+---------+ -| | | X | X | X | -+------------------+--------------------------+-----------------+-------------+---------+ -| Metrics returned | totaldisk=x activedisk=x | | | | -+------------------+--------------------------+-----------------+-------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 4,1 ko | 4,3 ko | -+---------------------------------+-------------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | diskState | -+------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/diskUsage.rst b/as400/doc/en/exploitation/indicators/diskUsage.rst deleted file mode 100644 index ca342a17e9..0000000000 --- a/as400/doc/en/exploitation/indicators/diskUsage.rst +++ /dev/null @@ -1,57 +0,0 @@ -.. _diskUsage: - -*********************************************** -Check usage rate of a physical disk (Diskusage) -*********************************************** - -Description -^^^^^^^^^^^ - -+--------------------+-------------------------------------------------------------------+-+ -| Description | Check usage rate of a physical disk | | -+--------------------+-------------------------------------------------------------------+-+ -| Operation | Ok if usage is below the warning threshold. | | -| | Warning si le taux d'occupation est au dessus du seuil warning. | | -| | Critical si le taux d'occupation est au dessus du seuil critique. | | -+--------------------+-------------------------------------------------------------------+-+ -| Used API | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | | -+--------------------+-------------------------------------------------------------------+-+ -| Required authority | *USE | | -+--------------------+-------------------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ -| diskUsage | 3 | Arguments order | Description | Exemple | -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ -| | | Argument 1 | Disk name | DD003 | -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ -| | | Argument 2 | Warning threshold (%) | 80 | -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ -| | | Argument 3 | Critical threshold (%) | 90 | -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ -| Metrics returned | totalSpace=123456B usedSpace=12345B systemSpace=1234B | | | | -+------------------+-------------------------------------------------------+-----------------+------------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+-------------------------------+-----------------------------+ -| Download (as400 to connector) | Upload (connector to as400) | -+-------------------------------+-----------------------------+ -| 700 o | 700 o | -+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | diskUsage | -+------------+-------------+ -| ARGS | DD003!80!90 | -+------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/diskUsageRepartition.rst b/as400/doc/en/exploitation/indicators/diskUsageRepartition.rst deleted file mode 100644 index dbdb218fa1..0000000000 --- a/as400/doc/en/exploitation/indicators/diskUsageRepartition.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _diskUsageRepartition: - -************************************************************* -Check the gap usage rate between the different physical disks -************************************************************* - -Description -^^^^^^^^^^^ - -+--------------------+---------------------------------------------------------------------------------------+-+ -| Description | Check the gap usage rate between the different physical disks. | | -+--------------------+---------------------------------------------------------------------------------------+-+ -| Operation | Calculate the difference between the minimum and maximum usage of all physical disks. | | -| | Ok if the difference is below the warning threshold. | | -| | Warning if the difference is above the warning threshold. | | -| | Critical if the difference is above the critical threshold. | | -+--------------------+---------------------------------------------------------------------------------------+-+ -| Used API | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | | -+--------------------+---------------------------------------------------------------------------------------+-+ -| Required authority | *USE | | -+--------------------+---------------------------------------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+----------------------+---------------------+-----------------+-----------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+----------------------+---------------------+-----------------+-----------------------+---------+ -| diskUsageRepartition | 2 | Arguments order | Description | Exemple | -+----------------------+---------------------+-----------------+-----------------------+---------+ -| | | Argument 1 | Warning threshold (%) | 0.5 | -+----------------------+---------------------+-----------------+-----------------------+---------+ -| | | Argument 2 | Warning threshold (%) | 2 | -+----------------------+---------------------+-----------------+-----------------------+---------+ -| Metrics returned | gap=xx% | | | | -+----------------------+---------------------+-----------------+-----------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+-------------------------------+-----------------------------+ -| Download (as400 to connector) | Upload (connector to as400) | -+-------------------------------+-----------------------------+ -| 750 o | 750 o | -+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------------+ -| Macro name | Macro value | -+------------+----------------------+ -| CHECK | diskUsageRepartition | -+------------+----------------------+ -| ARGS | 0.5!2 | -+------------+----------------------+ diff --git a/as400/doc/en/exploitation/indicators/executeCommand.rst b/as400/doc/en/exploitation/indicators/executeCommand.rst deleted file mode 100644 index 86e8a34b83..0000000000 --- a/as400/doc/en/exploitation/indicators/executeCommand.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. _executeCommand: - -************************** -Execute a command on as400 -************************** - -Description -^^^^^^^^^^^ - -+--------------------+--------------------------------------------------------+-+ -| Description | Execute a command on as400 | | -+--------------------+--------------------------------------------------------+-+ -| Operation | Ok if the comamnd is successful | | -| | Critical if the command does not execute successfully. | | -+--------------------+--------------------------------------------------------+-+ -| Used API | | | -+--------------------+--------------------------------------------------------+-+ -| Required authority | | | -+--------------------+--------------------------------------------------------+-+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+--------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+--------------+---------+ -| executeCommand | 1 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+--------------+---------+ -| | | Argument 1 | Command name | TEST | -+------------------+---------------------+-----------------+--------------+---------+ -| Metrics returned | None | | | | -+------------------+---------------------+-----------------+--------------+---------+ -| Output | Command return | | | | -+------------------+---------------------+-----------------+--------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+-------------------------------+-----------------------------+ -| Download (as400 to connector) | Upload (connector to as400) | -+-------------------------------+-----------------------------+ -| variable | 800 o | -+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------+ -| Macro name | Macro value | -+------------+----------------+ -| CHECK | executeCommand | -+------------+----------------+ -| ARGS | TEST | -+------------+----------------+ - -Note: The output will only be available if messages have been generated by the executed command. - -Generating a message from an AS/400 CL program: - -+----------------------------------------------------------------------------------------------------------+ -| SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) \+ MSGDTA('Ceci est un message') \+ TOPGMQ(*EXT) MSGTYPE(*STATUS) | -+----------------------------------------------------------------------------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/jobExist.rst b/as400/doc/en/exploitation/indicators/jobExist.rst deleted file mode 100644 index 1eee6bec31..0000000000 --- a/as400/doc/en/exploitation/indicators/jobExist.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _jobExist: - -******************************************************************* -Check the existence of a job. Does not control its state (jobExist) -******************************************************************* - -Description -^^^^^^^^^^^ - -+--------------------+----------------------------------------------------------+ -| Description | Check the existence of a job. Does not control its state | -+--------------------+----------------------------------------------------------+ -| Operation | Ok if the job exist | -| | Critical if the job doesn't exist | -+--------------------+----------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+----------------------------------------------------------+ -| Required authority | *USE | -+--------------------+----------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+----------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+----------------+---------+ -| jobExist | 1 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+----------------+---------+ -| | | Argument 1 | Job name | QCTL | -+------------------+---------------------+-----------------+----------------+---------+ -| | | Argument 2 | Subsystem name | QBASE | -+------------------+---------------------+-----------------+----------------+---------+ -| Metrics returned | | | | | -+------------------+---------------------+-----------------+----------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------+-------------------------------+-----------------------------+ -| Job count on server | Download (as400 to connector) | Upload (connector to as400) | -+---------------------+-------------------------------+-----------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | jobExist | -+------------+-------------+ -| ARGS | QCTL !QBASE | -+------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst b/as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst deleted file mode 100644 index 8686b582c3..0000000000 --- a/as400/doc/en/exploitation/indicators/jobHasNoMsgw.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _jobHasNoMsgw: - -************************************************************************* -Check the existence of a job. Check if the job has no MSGW (jobHasNoMsgw) -************************************************************************* - -Description -^^^^^^^^^^^ - -+--------------------+--------------------------------------------------------------------------+ -| Description | Check the existence of a job. Check if the job has no MSGW | -+--------------------+--------------------------------------------------------------------------+ -| Fonctionnement | Ok if the job exist | -| | Critical if the job doesn't exist, or the job has a message wait (MSGW) | -+--------------------+--------------------------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+--------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+--------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+----------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+----------------+---------+ -| jobHasNoMsgw | 1 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+----------------+---------+ -| | | Argument 1 | Job name | QCTL | -+------------------+---------------------+-----------------+----------------+---------+ -| | | Argument 2 | Subsystem name | QBASE | -+------------------+---------------------+-----------------+----------------+---------+ -| Metrics returned | | | | | -+------------------+---------------------+-----------------+----------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------+-------------------------------+-----------------------------+ -| Job count on server | Download (as400 to connector) | Upload (connector to as400) | -+---------------------+-------------------------------+-----------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------+-------------------------------+-----------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+--------------+ -| Macro name | Macro value | -+------------+--------------+ -| CHECK | jobHasNoMsgw | -+------------+--------------+ -| ARGS | QCTL!QBASE | -+------------+--------------+ diff --git a/as400/doc/en/exploitation/indicators/jobQueueStatus.rst b/as400/doc/en/exploitation/indicators/jobQueueStatus.rst deleted file mode 100644 index dc78c5e2b3..0000000000 --- a/as400/doc/en/exploitation/indicators/jobQueueStatus.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _jobQueueStatus: - -************************************************************* -Check the existence and status of a jobQueue (jobQueueStatus) -************************************************************* - -Description -^^^^^^^^^^^ - -+--------------------+------------------------------------------------------------------------------------------------------------------+ -| Description | Check the existence and status of a jobQueue | -+--------------------+------------------------------------------------------------------------------------------------------------------+ -| Operation | A jobQueue can have status RELEASED or HELD. | -| | OK if the jobQueue is in RELEASED state | -| | Critical if the jobQueue is in HELD status or doesn't exist | -+--------------------+------------------------------------------------------------------------------------------------------------------+ -| Used API | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | -+--------------------+------------------------------------------------------------------------------------------------------------------+ -| Required authority | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue* JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | -+--------------------+------------------------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+---------------+-----------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+---------------+-----------+ -| jobQueueStatus | 2 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+---------------+-----------+ -| | | Argument 1 | JobQueue name | QSYSNOMAX | -+------------------+---------------------+-----------------+---------------+-----------+ -| | | Argument 2 | Library name | QSYS | -+------------------+---------------------+-----------------+---------------+-----------+ -| Metrics returned | X | | | | -+------------------+---------------------+-----------------+---------------+-----------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 1,7 ko | 1,9 ko | -+---------------------------------+-------------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------+ -| Macro name | Macro value | -+------------+----------------+ -| CHECK | jobQueueStatus | -+------------+----------------+ -| ARGS | QSYSNOMAX!QSYS | -+------------+----------------+ diff --git a/as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst b/as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst deleted file mode 100644 index 8d02ea5a20..0000000000 --- a/as400/doc/en/exploitation/indicators/jobQueueWaitJobCount.rst +++ /dev/null @@ -1,60 +0,0 @@ -.. _jobQueueWaitJobCount: - -********************************************************************************************* -Check amount of job waiting in a jobQueue disregarding jobs priorities (jobQueueWaitJobCount) -********************************************************************************************* - -Description -^^^^^^^^^^^ - -+------------------+-----------------------------------------------------------------------------------------------------------------+-+ -| Description | Check amount of job waiting in a jobQueue disregarding jobs priorities | | -+------------------+-----------------------------------------------------------------------------------------------------------------+-+ -| Fonctionnement | The jobs in a jobs queue can be ACTIVE, HELD, ou SCHEDULED. | | -| | Ok if the job count in HELD state is below the warning threshold. | | -| | Warning if the job count in HELD state is above the warning threshold. | | -| | Critical if job count in HELD state is above the critical threshold. | | -+------------------+-----------------------------------------------------------------------------------------------------------------+-+ -| API utilisée | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | | -+------------------+-----------------------------------------------------------------------------------------------------------------+-+ -| Autorité requise | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue*JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | | -+------------------+-----------------------------------------------------------------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| Command name | Number of arguments | Arguments | | | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| jobQueueWaitJobCount | 4 | Arguments order | Description | Exemple | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| | | Argument 1 | JobQueue name | QSYSNOMAX | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| | | Argument 2 | Library name | QSYS | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| | | Argument 3 | Warning threshold (amount) | 1 | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| | | Argument 4 | Critical threshold (amount) | 2 | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ -| Metrics returned | activeJob=44 heldJobOnQueue=0 scheduledJobOnQueue=0 | | | | -+----------------------+-----------------------------------------------------+-----------------+-----------------------------+-----------+ - -Network usage -^^^^^^^^^^^^^ - -+-------------------------------+-----------------------------+ -| Download (as400 to connector) | Upload (connector to as400) | -+-------------------------------+-----------------------------+ -| 750 o | 800 o | -+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------------+ -| Macro name | Macro value | -+------------+----------------------+ -| CHECK | jobQueueWaitJobCount | -+------------+----------------------+ -| ARGS | QSYSNOMAX!QSYS!1!2 | -+------------+----------------------+ diff --git a/as400/doc/en/exploitation/indicators/messageQueueSize.rst b/as400/doc/en/exploitation/indicators/messageQueueSize.rst deleted file mode 100644 index 8ae73fc4b2..0000000000 --- a/as400/doc/en/exploitation/indicators/messageQueueSize.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. _messageQueueSize: - -*************************************************** -Check the size of a MessageQueue (messageQueueSize) -*************************************************** - -Description -^^^^^^^^^^^ - -+--------------------+-------------------------------------------------------------------------------------+-+ -| Description | Check the size of a MessageQueue | | -+--------------------+-------------------------------------------------------------------------------------+-+ -| Operation | Retrieves all messages whose severity is greater or equal to minimum severity level | | -| | Ok if the number of messages is below the warning threshold. | | -| | Warning message if the number is above the warning threshold. | | -| | Critical if the message number is above the critical threshold. | | -+--------------------+-------------------------------------------------------------------------------------+-+ -| Used API | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | -+--------------------+-------------------------------------------------------------------------------------+-+ -| Required authority | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | | -+--------------------+-------------------------------------------------------------------------------------+-+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| messageQueueSize | 4 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 1 | MessageQueue name | /QSYS.LIB/QSYSOPR.MSGQ | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 2 | Minimum severity level | 40 | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 3 | Warning threshold (amount) | 2000 | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 4 | Critical threshold (amount) | 2500 | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ -| Metrics returned | count=1234 | | | | -+------------------+---------------------+-----------------+-----------------------------+------------------------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------------+-------------------------------+-----------------------------+ -| Amount of message in the messageQueue | Download (as400 to connector) | Upload (connector to as400) | -+---------------------------------------+-------------------------------+-----------------------------+ -| 1 (théorique) | 2,26 ko | 66 o | -+---------------------------------------+-------------------------------+-----------------------------+ -| 5000 | 11 mo | 325 ko | -+---------------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------------------------------+ -| Macro name | Macro value | -+------------+-------------------------------------+ -| CHECK | messageQueueSize | -+------------+-------------------------------------+ -| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!40!2000!2500 | -+------------+-------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst b/as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst deleted file mode 100644 index 1dfe692fb0..0000000000 --- a/as400/doc/en/exploitation/indicators/messageQueueSizeFiltered.rst +++ /dev/null @@ -1,67 +0,0 @@ -.. _messageQueueSizeFiltered: - -******************************************************************************************************************* -Check to count message in messageQueue (MSGQ) according to their severity and message ID (messageQueueSizeFiltered) -******************************************************************************************************************* - -Description -^^^^^^^^^^^ - -+--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ -| Description | Count amount of messages in messageQueue (MSGQ) according to their severity and message ID (messageQueueSizeFiltered) | | -+--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ -| Operation | Retrieves all messages whose severity is between min and max severity level, and whose message ID match the regex | | -| | Ok if the number of messages is below the warning threshold. | | -| | Warning message if the number is above the warning threshold. | | -| | Critical if the message number is above the critical threshold. | | -+--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ -| Used API | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | -+--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ -| Required authority | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | | -+--------------------+-----------------------------------------------------------------------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| Command name | Number of arguments | Arguments | | | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| messageQueueSizeFiltered | 6 | Arguments order | Description | Exemple | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 1 | messageQueue name | /QSYS.LIB/QSYSOPR.MSGQ | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 2 | Regex filtering message ID | ^CP.*$ | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 3 | Minimal severity level | 60 | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 4 | Maximal severity level | 80 | -| | | | Maximal severity exluded | | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 5 | Warning threshold (amount) | 1 | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 6 | Critical threshold (amount) | 2 | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ -| Metrics returned | count=1234 | | | | -+--------------------------+---------------------+-----------------+-----------------------------+------------------------+ - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------------+-------------------------------+-----------------------------+ -| Amount of message in the messageQueue | Download (as400 to connector) | Upload (connector to as400) | -+---------------------------------------+-------------------------------+-----------------------------+ -| 1 (théorique) | 2,26 ko | 66 o | -+---------------------------------------+-------------------------------+-----------------------------+ -| 5000 | 11 mo | 325 ko | -+---------------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------------------------------+ -| Macro name | Macro value | -+------------+-----------------------------------------+ -| CHECK | messageQueueSize | -+------------+-----------------------------------------+ -| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | -+------------+-----------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst b/as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst deleted file mode 100644 index f284b92d73..0000000000 --- a/as400/doc/en/exploitation/indicators/newMessageInMessageQueue.rst +++ /dev/null @@ -1,74 +0,0 @@ -.. _newMessageInMessageQueue: - -**************************************************************************************************************************************** -Check to count the amount of new messages in a messageQueue (MSGQ) according to their severity and message ID (newMessageInMessageQueue) -**************************************************************************************************************************************** - -Description -^^^^^^^^^^^ - -+--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ -| Description | Count amount of new messages in a messageQueue (MSGQ) according to their severity and message ID. Display the new logs in output | | -+--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ -| Operation | Retrieves all messages and store them in a light database. Return the new messages matching criteria in the output. | | -| | Ok if the number of new messages is below the warning threshold. | | -| | Warning if the number of new messages is above the warning threshold. | | -| | Critical if the number of new messages is above the critical threshold. | | -+--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ -| Used API | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | -+--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ -| Required authority | *USE on the messageQueue, *EXECUTE one the messageQueue library | | -+--------------------+----------------------------------------------------------------------------------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| Command name | Number of arguments | Arguments | | | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| newMessageInMessageQueue | 6 | Arguments order | Description | Exemple | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 1 | messageQueue name | /QSYS.LIB/QSYSOPR.MSGQ | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 2 | Regex filtering message ID | ^CP.*$ | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 3 | Minimal severity level | 60 | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 4 | Maximal severity level | 80 | -| | | | Maximal severity exluded | | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 5 | Warning threshold (amount) | 1 | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| | | Argument 6 | Critical threshold (amount) | 2 | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ -| Metrics returned | criteriaMessage=1 newMessage=3 | | | | -+--------------------------+--------------------------------+-----------------+-----------------------------+------------------------+ - -Local database configuration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The location of the local database can be configured in the file /etc/centreon-connector-as400/config.properties. -Variable is : pathMsgQDB. -/!\\ Take care with the others options ! - -Network usage -^^^^^^^^^^^^^ - -+---------------------------------------+-------------------------------+-----------------------------+ -| Amount of message in the messageQueue | Download (as400 to connector) | Upload (connector to as400) | -+---------------------------------------+-------------------------------+-----------------------------+ -| 1 (théorique) | 2,26 ko | 66 o | -+---------------------------------------+-------------------------------+-----------------------------+ -| 5000 | 11 mo | 325 ko | -+---------------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------------------------------+ -| Macro name | Macro value | -+------------+-----------------------------------------+ -| CHECK | newMessageInMessageQueue | -+------------+-----------------------------------------+ -| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | -+------------+-----------------------------------------+ diff --git a/as400/doc/en/exploitation/indicators/pageFault.rst b/as400/doc/en/exploitation/indicators/pageFault.rst deleted file mode 100644 index 752f2846f0..0000000000 --- a/as400/doc/en/exploitation/indicators/pageFault.rst +++ /dev/null @@ -1,57 +0,0 @@ -.. _pageFault: - -**************************************** -Check the rate of page fault (pagefault) -**************************************** - -Description -^^^^^^^^^^^ - -+--------------------+----------------------------------------------------------------------------------------------+-+ -| Description | Check the rate of page fault | | -+--------------------+----------------------------------------------------------------------------------------------+-+ -| Operation | Get the page rate per second, and the page fault rate per second, database and non-database. | | -| | Calculate the rate of page fault relative to the page. | | -| | Ok if this rate is below the warning threshold. | | -| | Warning if this rate is above the warning threshold. | | -| | Critical if this rate is above the critical threshold. | | -+--------------------+----------------------------------------------------------------------------------------------+-+ -| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | | -+--------------------+----------------------------------------------------------------------------------------------+-+ -| Required authority | *USE | | -+--------------------+----------------------------------------------------------------------------------------------+-+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+----------------------------------------------+-----------------+------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+----------------------------------------------+-----------------+------------------------+---------+ -| pageFault | 2 | Arguments order | Description | Exemple | -+------------------+----------------------------------------------+-----------------+------------------------+---------+ -| | | Argument 1 | Warning threshold (%) | 50 | -+------------------+----------------------------------------------+-----------------+------------------------+---------+ -| | | Argument 2 | Critical threshold (%) | 70 | -+------------------+----------------------------------------------+-----------------+------------------------+---------+ -| Metrics returned | dbPageFaultRatio=10% nonDbPageFaultRatio=20% | | | | -+------------------+----------------------------------------------+-----------------+------------------------+---------+ - -Network usage -^^^^^^^^^^^^^ - -+-------------------------------+-----------------------------+ -| Download (as400 to connector) | Upload (connector to as400) | -+-------------------------------+-----------------------------+ -| 15 ko | 12 ko | -+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | pageFault | -+------------+-------------+ -| ARGS | 50!70 | -+------------+-------------+ diff --git a/as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst b/as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst deleted file mode 100644 index e158c05336..0000000000 --- a/as400/doc/en/exploitation/indicators/specificJobInSubSystem.rst +++ /dev/null @@ -1,82 +0,0 @@ -.. _allJobHaveNoMsgWInSubSystem: - -********************************************************* -Check amount of job in a subsystem with a specific status -********************************************************* - -Description -^^^^^^^^^^^ - -+--------------------+-------------------------------------------------------------------------------------------------+ -| Description | Check amount of job in a subsystem with a specific status | -+--------------------+-------------------------------------------------------------------------------------------------+ -| Operation | OK si le nombre de job en attente de message est inférieur ou égal au warning count | -| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | -| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | -+--------------------+-------------------------------------------------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+-------------------------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+-------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| Command name | Number of arguments | Arguments | | | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| specificJobInSubSystem | 8 | arguments order | Description | Exemple | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 1 | Job pattern (regex) | ^JOBC.*$ | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 2 | SubSystem | QBASE | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 3 | Status | *ANY | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 4 | StatusActive | ANY | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 5 | Warning minimal threshold (amount) | 2 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 6 | Warning maximal threshold (amount) | 5 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 7 | Critical minimal threshold (amount) | 1 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 8 | Critical maximal threshold (amount) | 10 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| Metrics returned | foundJob=123 statusMatchingJob=1 | | | | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| Output returned | Amount of job found matching pattern and status | | | | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ - -All Status and StatusActive can be found here : -http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qusrjobi.htm - -Centreon-Connector-AS400 add 1 status (*ANY) and 1 statusActive (ANY), to match all existing status. - -Status can have value: *ANY, *OUTQ, *ACTIVE, *JOBQ -StatusActive can have value: BSCA, BSCW, CMNA, CMNW, CMTW ... (see IBM documentation) - - - - -Network usage -^^^^^^^^^^^^^ - -+------------------------------+-------------------------------+-----------------------------+ -| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | -+------------------------------+-------------------------------+-----------------------------+ -| 1 (theoretic) | 77 o | 2,3 o | -+------------------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+------------------------+ -| Macro name | Macro value | -+------------+------------------------+ -| CHECK | specificJobInSubSystem | -+------------+------------------------+ -| ARGS | QBASE!1!2 | -+------------+------------------------+ diff --git a/as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst b/as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst deleted file mode 100644 index 4571928be0..0000000000 --- a/as400/doc/en/exploitation/indicators/specificJobRunningInSubSystem.rst +++ /dev/null @@ -1,68 +0,0 @@ -.. _allJobHaveNoMsgWInSubSystem: - -*********************************************************************** -Controle le nombre de job running (RUN) dans un sous systeme spécifique -*********************************************************************** - -Description -^^^^^^^^^^^ - -+------------------+-------------------------------------------------------------------------------------------------+ -| Description | Controle l'ensemble des jobs d'un sous systeme en état running | -+------------------+-------------------------------------------------------------------------------------------------+ -| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | -| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | -| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | -+------------------+-------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+-------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ -String jobPattern, String subSystem, int warningMin, int warningMax, int criticalMin, int criticalMax - -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| specificJobRunningInSubSystem | 6 | Ordre des arguments | Description | Exemple | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 1 | Job pattern (regex) | ^JOBC.*$ | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 2 | Sous system | QBASE | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 3 | Seuil Warning minimal (quantité) | 2 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 4 | Seuil Warning maximal (quantité) | 5 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 5 | Seuil Critical minimal (quantité) | 1 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 6 | Seuil Critical maximal (quantité) | 10 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| Métriques renvoyées | totalJob=123 jobMSGW=1 | | | | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| Output renvoyé | Le nom des jobs en attente de message | | | | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ - -Network usage -^^^^^^^^^^^^^ - -+------------------------------+-------------------------------+-----------------------------+ -| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | -+------------------------------+-------------------------------+-----------------------------+ -| 1 (theoretic) | 77 o | 2,3 o | -+------------------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------------------+ -| Macro name | Macro value | -+------------+-----------------------------+ -| CHECK | allJobHaveNoMsgWInSubSystem | -+------------+-----------------------------+ -| ARGS | QBASE!1!2 | -+------------+-----------------------------+ diff --git a/as400/doc/en/exploitation/indicators/subSystemExist.rst b/as400/doc/en/exploitation/indicators/subSystemExist.rst deleted file mode 100644 index 7e61402623..0000000000 --- a/as400/doc/en/exploitation/indicators/subSystemExist.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _subSystemExist: - -**************************************************** -Check the existence of a sub system (subSystemExist) -**************************************************** - -Description -^^^^^^^^^^^ - -+--------------------+---------------------------------------------------------------------------------------------------------+ -| Description | Check the existence of a sub system | -+--------------------+---------------------------------------------------------------------------------------------------------+ -| Fonctionnement | A subsystem may take status: *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, or *STARTING. | -| | Ok if the subsystem is in state *ACTIVE. | -| | Critical if the subsystem is in an other status than * ACTIVE or that the subsystem has not been found. | -+--------------------+---------------------------------------------------------------------------------------------------------+ -| Used API | QWCRSSTS, format SSTS0100 & SSTS0200 | -+--------------------+---------------------------------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+---------------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------+-----------------+----------------+----------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------+-----------------+----------------+----------+ -| subSystemExist | 1 | Arguments order | Description | Exemple | -+------------------+---------------------+-----------------+----------------+----------+ -| | | Argument 1 | Subsystem name | QBATCH | -+------------------+---------------------+-----------------+----------------+----------+ -| | | Argument 2 | Library name | QSYS.LIB | -+------------------+---------------------+-----------------+----------------+----------+ -| Metrics returned | X | | | | -+------------------+---------------------+-----------------+----------------+----------+ - -Network usage -^^^^^^^^^^^^^ - -+-------------------------------+-----------------------------+ -| Download (as400 to connector) | Upload (connector to as400) | -+-------------------------------+-----------------------------+ -| 5,5 ko | 2,1 ko | -+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+------------------+ -| Macro name | Macro value | -+------------+------------------+ -| CHECK | subSystemExist | -+------------+------------------+ -| ARGS | QBATCH !QSYS.LIB | -+------------+------------------+ diff --git a/as400/doc/en/exploitation/indicators/workWithProblem.rst b/as400/doc/en/exploitation/indicators/workWithProblem.rst deleted file mode 100644 index aa5e03bbaf..0000000000 --- a/as400/doc/en/exploitation/indicators/workWithProblem.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. _workWithProblem: - -************************************************************* -Get the number of problems detected by the system or the user -************************************************************* - -Description -^^^^^^^^^^^ - -+------------------+----------------------------------------------------------------------------+ -| Description | Get the number of problems detected by the system or the user | -+------------------+----------------------------------------------------------------------------+ -| Fonctionnement | OK if the number of problems is lower or equal to the warning count | -| | WARNING if the number or problems is lower to the critical count | -| | CRITICAL if the number of problem is higher or equal to the critical count | -+------------------+----------------------------------------------------------------------------+ -| API utilisée | | -+------------------+----------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+----------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ - -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| Command name | Number of arguments | Arguments | | | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| allJobHaveNoMsgW | n * 2 + 1 | Argument's order | Description | Example | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| | | Argument 1 | Types of problems wanted | 1 | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| | | Argument 2 | Warning Threashold | 2 | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| | Repeat threashold for each type of problem wanted | Argument 3 | Critical Threashold | 2 | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| Sent metric | open=1;;;2;4 ready=0;;2;3 | | | | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ -| Sent output | OK: There are 1 OPENED / 0 READY statys problems | | | | -+------------------+---------------------------------------------------+------------------+--------------------------+---------+ - -Configuration example -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------+ -| Macro name | Macro value | -+------------+-----------------+ -| CHECK | workWithProblem | -+------------+-----------------+ -| ARGS | 1!2 | -+------------+-----------------+ diff --git a/as400/doc/en/exploitation/mode.rst b/as400/doc/en/exploitation/mode.rst deleted file mode 100644 index 63ce9a0f94..0000000000 --- a/as400/doc/en/exploitation/mode.rst +++ /dev/null @@ -1,69 +0,0 @@ -.. _mode: - -############## -Operating mode -############## - -Centreon-Connector-AS400 can run in daemon mode or command line. -It's also packaged with check plugin, connecting to the daemon, and responsible to transmitt the results to engine/nagios. - -Command line -============ - -With command line, a java virtual machine is started each time. This mode should be used only for testing purposes, toi avoid high CPU / memory consomption:: - - +-------------------------------------------------------------------------------------------------------------+ - | java -jar connector-as400-1.x.x.jar -I -H %HOST% --login %LOGIN% --password %PASSWORD% -C %CHECK% -A %ARGS% | - +-------------------------------------------------------------------------------------------------------------+ - -Enter the different arguments: - -+-----------+---------------------------------------+-------------+ -| Attribute | Description | Exemple | -+===========+=======================================+=============+ -| HOST | IP address or host name of the AS/400 | 10.30.10.30 | -+-----------+---------------------------------------+-------------+ -| LOGIN | AS/400 user name | USER123 | -+-----------+---------------------------------------+-------------+ -| PASSWORD | AS/400 password | PASSWORD123 | -+-----------+---------------------------------------+-------------+ -| CHECK | Check command | cpuUsage | -+-----------+---------------------------------------+-------------+ -| ARGS | Check command arguments | 80!90 | -+-----------+---------------------------------------+-------------+ - -Note: The command arguments are separated by " ! " . - -Daemon -====== - -The daemon mode permit to launch the same commands than from command line without having to restart a java virtual machine at each use. -The daemon listens on a port, waiting for query. -A check plugin ( check_centreon_as400_generic ) is available to connect to the daemon and return a result to the Nagios format. -Check plugin arguments are similar to the java program. However, it is necessary to specify the address and port of the daemon:: - - +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | check_centreon_as400_generic \-\-connector %DAEMONHOST%:%DAEMONPORT% \-\-host %HOST% \-\-user %USER% \-\-password %PASSWORD% \-\-check %CHECK% \-\-args %ARGS% | - +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -Enter the different arguments: - -+------------+--------------------------------------------------------+-------------+ -| Attribut | Description | Exemple | -+============+========================================================+=============+ -| DAEMONHOST | IP address or host name of the server executing daemon | 10.30.10.20 | -+------------+--------------------------------------------------------+-------------+ -| DAEMONPORT | Daemon port | 8091 | -+------------+--------------------------------------------------------+-------------+ -| HOST | IP address or host name of the AS/400 | 10.30.10.30 | -+------------+--------------------------------------------------------+-------------+ -| LOGIN | AS/400 user name | USER123 | -+------------+--------------------------------------------------------+-------------+ -| PASSWORD | AS/400 password | PASSWORD123 | -+------------+--------------------------------------------------------+-------------+ -| CHECK | Check command | cpuUsage | -+------------+--------------------------------------------------------+-------------+ -| ARGS | Check command arguments | 80!90 | -+------------+--------------------------------------------------------+-------------+ - -Note: The command arguments are separated by " ! " . diff --git a/as400/doc/en/installation/prerequisites.rst b/as400/doc/en/installation/prerequisites.rst deleted file mode 100644 index 8859bbce32..0000000000 --- a/as400/doc/en/installation/prerequisites.rst +++ /dev/null @@ -1,64 +0,0 @@ -.. _rpm: - -############# -Prerequisites -############# - -+----------+--------------+-+ -| Software | Minimum | | -+----------+--------------+-+ -| Centreon | 2.2.x | | -+----------+--------------+-+ -| Nagios | 3.x | | -+----------+--------------+-+ -| Java | JRE 6 Oracle | | -+----------+--------------+-+ -| AS/400 | V4R5\+ | | -+----------+--------------+-+ - -Hardware recommendations -************************ - -It is necessary to evaluate material resources before installing Centreon-Connector-AS400 on a server. - -- ** ** RAM: 512 MB ​​minimum (may increase significantly with the number of control). - -   - Count 2 GB for 2500 services with a 10 minute interval between each control. - -- ** CPU **: prerequisite identical to the collection server - -List of used ports -****************** - -+-----------+-----------+--------------------------+----------------+ -| Source | Target | Port | Can be changed | -+-----------+-----------+--------------------------+----------------+ -| Plugin | Connector | Custom | Yes | -+-----------+-----------+--------------------------+----------------+ - -List of ports between the connector and the AS400 -------------------------------------------------- - -+----------+------+ -| Standard | SSL | -+----------+------+ -| 446 | 448 | -+----------+------+ -| 449 | | -+----------+------+ -| 8470 | 9470 | -+----------+------+ -| 8471 | 9471 | -+----------+------+ -| 8472 | 9472 | -+----------+------+ -| 8473 | 9473 | -+----------+------+ -| 8474 | 9474 | -+----------+------+ -| 8475 | 9475 | -+----------+------+ -| 8476 | 9476 | -+----------+------+ - -A detailed list of the ports used by the AS400 can be found `on this page `_. diff --git a/as400/doc/en/installation/rpm.rst b/as400/doc/en/installation/rpm.rst deleted file mode 100644 index 08a3c853e4..0000000000 --- a/as400/doc/en/installation/rpm.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. _rpm: - -############################# -Installing from package (RPM) -############################# - -Prerequisites -************* - -A recent installation of CES with centreon-plugin-pack. - -Installation -************ - -Run the command:: - - $ yum install centreon-connector-as400-server ces-plugins-Operatingsystems-As400 ces-pack-Operatingsystems-As400 - -Then start the daemon:: - - $ /etc/init.d/centreon-connector-as400 start \ No newline at end of file diff --git a/as400/doc/en/installation/tarball.rst b/as400/doc/en/installation/tarball.rst deleted file mode 100644 index 6e7fbef7fa..0000000000 --- a/as400/doc/en/installation/tarball.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. _tarball: - -################################ -Installing from tarball (tar.gz) -################################ - -Tarball installation is not recommended - -Prerequisites -************* - -To build Centreon-Connector-AS400 check plugin, you will need the following external dependencies: - -a C++ compilation environment. -CMake (>= 2.8), a cross-platform build system. -the Qt (>= 4.7.4) framework with QtCore, and QtXml modules. -GnuTLS (>= 2.0), a secure communications library. - -Installing daemon -***************** - -Unzip tarball:: - - $ cd /tmp/ && tar xvzf centreon-connector-as400-server-1.x.x.tar.gz - - Start the installation:: - - $ /tmp/centreon-connector-as400-server-1.x.x/install.sh - -Installing check plugin -*********************** - -Check plugin must be compiled:: - - $ cd /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/ - $ cmake && make - -Then copy the as400 check plugin to the nagios libexec folder :: - - $ cp /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/as400_generic/check_centreon_as400 %nagios%/libexec/ - diff --git a/as400/doc/en/upgrade/rpm.rst b/as400/doc/en/upgrade/rpm.rst deleted file mode 100644 index c2d6a5dcf7..0000000000 --- a/as400/doc/en/upgrade/rpm.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. _rpm: - -############################ -Upgrading from package (RPM) -############################ - -Upgrade -******* - -Stop the connector service:: - - $ /etc/init.d/centreon-connector-as400 stop - -Upgrade the rpm:: - - $ yum update centreon-connector-as400-server ces-plugins-Operatingsystems-As400 - -Restart the connector service:: - - $ /etc/init.d/centreon-connector-as400 start diff --git a/as400/doc/fr/exploitation/configurationCentreon.rst b/as400/doc/fr/exploitation/configurationCentreon.rst deleted file mode 100644 index 98725344a2..0000000000 --- a/as400/doc/fr/exploitation/configurationCentreon.rst +++ /dev/null @@ -1,94 +0,0 @@ -.. _configurationCentreon: - -###################### -Configuration Centreon -###################### - -La configuration des templates Centreon n'est nécéssaire que lors de l'installation par tarball. -Afin d'exploiter pleinement Centreon-Connector-AS400, il est recommandé d'effectuer une série d'action préalablement. - - -Création d'une commande de check générique -========================================== - -Aller dans le menu « Configuration → Commande » et créer une commande « check_as400_generic ». - -Insérer la commande :  - -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| $USER1$/check_centreon_as400_generic \-\-connector "$_HOSTDAEMONHOST$:$_HOSTDAEMONPORT$" \-\-host "$HOSTADDRESS$" \-\-user "$_HOSTAS400USER$" \-\-password "$_HOSTAS400PASSWORD$" \-\-check "$_SERVICECHECK$" \-\-args "$_SERVICEARGS$" | -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -Cette commande comporte une série de macros utilisées à différents niveau des modèles d'hôtes, hôtes, modèles de services, services. - -Les macro précédé de HOST sont récupérés au niveau de la définition de l'hôte (ou le modèle d'hôte). Les macros précédé de SERVICE sont récupérés u niveau de la définition du service. (ou le modèle de service). - -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| Macro name | Macro value | Ressource ou la macro doit être défini (recommandé) | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| HOSTDAEMONHOST | IP ou nom d'hôte du serveur exécutant le daemon AS/400 | Modèle d'hôte AS/400 de plus bas niveau | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| HOSTDAEMONPORT | Port du daemon | Modèle d'hôte AS/400 de plus bas niveau | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| HOSTAS400USER | Nom d'utilisateur AS/400 | Hôte AS/400 | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| HOSTAS400PASSWORD | Mot de passe AS/400 | Hôte AS/400 | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| SERVICECHECK | Commande de check | Service ou modèle de service AS/400 de plus haut niveau | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ -| SERVICEARGS | Arguments de la commande de check | Service ou modèle de service AS/400 de plus haut niveau | -+-------------------+--------------------------------------------------------+---------------------------------------------------------+ - -Création d'un modele d'hote AS400 générique -=========================================== - -Aller dans le menu « Configuration → Hosts → Templates » et créer un modèle d'hôte « as400 ». Ce modèle d'hôte sera le modèle de plus bas niveau pour tous les hôtes AS/400. D'autres modèle de plus haut niveau pourront être créé. Configurer l'ensemble des champs comme indiqué dans la documentation Centreon. - -Définir les macros suivante :  - -+------------+-----------------------+ -| Macro name | Macro value | -+------------+-----------------------+ -| DAEMONHOST | Exemple : 10.30.10.30 | -+------------+-----------------------+ -| DAEMONPORT | Exemple : 8091 | -+------------+-----------------------+ - -**None** - - -Création d'un hôte AS400 -======================== - -Aller dans le menu « Configuration → Hosts » et créer un hôte basé sur le modèle « as400 » générique (ou un modèle de plus haut niveau basé sur le modèle « as400 » générique ). - -Définir les macros suivante :  - -+---------------+-----------------------+ -| Macro name | Macro value | -+---------------+-----------------------+ -| AS400USER | Exemple : USER123 | -+---------------+-----------------------+ -| AS400PASSWORD | Exemple : PASSWORD123 | -+---------------+-----------------------+ - - - -Création d'un modele de service AS400 -===================================== - -Aller dans le menu « Configuration → Services » ou « Template », et créer un service et ou modèle de service. - -Définir les macros suivante :  - -+------------+--------------------+ -| Macro name | Macro value | -+------------+--------------------+ -| CHECK | Exemple : cpuUsage | -+------------+--------------------+ -| ARGS | Exemple : 80!90 | -+------------+--------------------+ - -Les différentes commandes et arguments sont expliqués dans la partie "Liste des indicateurs" - - diff --git a/as400/doc/fr/exploitation/index.rst b/as400/doc/fr/exploitation/index.rst deleted file mode 100644 index 981101ea93..0000000000 --- a/as400/doc/fr/exploitation/index.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. _exploitation: - -############ -Exploitation -############ - -.. toctree:: - :glob: - - mode - configurationCentreon - indicator - - \ No newline at end of file diff --git a/as400/doc/fr/exploitation/indicator.rst b/as400/doc/fr/exploitation/indicator.rst deleted file mode 100644 index 447f1c1144..0000000000 --- a/as400/doc/fr/exploitation/indicator.rst +++ /dev/null @@ -1,32 +0,0 @@ -.. _indicator: - -##################### -Liste des indicateurs -##################### - -Selon les API utilisés, les droits des utilisateurs AS/400 peuvent varier. -Ils sont précisés dans chaque contrôle. - -.. toctree:: - - indicators/cpuUsage - indicators/asp1Usage - indicators/diskState - indicators/diskUsage - indicators/diskUsageRepartition - indicators/subSystemExist - indicators/pageFault - indicators/jobExist - indicators/jobHasNoMsgw - indicators/allJobHaveNoMsgW - indicators/allJobHaveNoMsgWInSubSystem - indicators/backupJobExist - indicators/jobQueueStatus - indicators/jobQueueWaitJobCount - indicators/specificJobInSubSystem - indicators/specificJobRunningInSubSystem - indicators/messageQueueSize - indicators/messageQueueSizeFiltered - indicators/newMessageInMessageQueue - indicators/executeCommand - indicators/workWithProblem diff --git a/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst b/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst deleted file mode 100644 index a1e7e9e533..0000000000 --- a/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgW.rst +++ /dev/null @@ -1,59 +0,0 @@ -.. _allJobHaveNoMsgW: - -****************************************************** -Controle le nombre de job en attente de message (MSGW) -****************************************************** - -Description -^^^^^^^^^^^ - -+------------------+------------------------------------------------------------------------------------------------------+ -| Description | Controle l'ensemble des jobs, de l'as400, et vérifie qu'ils ne sont pas en attente de message (MSGW) | -+------------------+------------------------------------------------------------------------------------------------------+ -| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | -| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | -| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | -+------------------+------------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ -| allJobHaveNoMsgW | 1 | Ordre des arguments | Description | Exemple | -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 1 | Seuil Warning (quantité) | 1 | -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 2 | Seuil Critical (quantité) | 2 | -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ -| Métriques renvoyées | totalJob=1234 jobMSGW=1 | | | | -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ -| Output renvoyé | Le nom des jobs en attente de message | | | | -+---------------------+---------------------------------------+---------------------+---------------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+------------------+ -| Macro name | Macro value | -+------------+------------------+ -| CHECK | allJobHaveNoMsgW | -+------------+------------------+ -| ARGS | 1!2 | -+------------+------------------+ diff --git a/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst b/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst deleted file mode 100644 index e40a3a60e5..0000000000 --- a/as400/doc/fr/exploitation/indicators/allJobHaveNoMsgWInSubSystem.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. _allJobHaveNoMsgWInSubSystem: - -************************************************************************************* -Controle le nombre de job en attente de message (MSGW) dans un sous system spécifique -************************************************************************************* - -Description -^^^^^^^^^^^ - -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| Description | Controle l'ensemble des jobs dans un sous system spécifique, et vérifie qu'ils ne sont pas en attente de message (MSGW) | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | -| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | -| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| allJobHaveNoMsgWInSubSystem | 1 | Ordre des arguments | Description | Exemple | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 1 | Sous system | QBASE | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 2 | Seuil Warning (quantité) | 1 | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 3 | Seuil Critical (quantité) | 2 | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| Métriques renvoyées | totalJob=123 jobMSGW=1 | | | | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ -| Output renvoyé | Le nom des jobs en attente de message | | | | -+-----------------------------+---------------------------------------+---------------------+---------------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------------------+ -| Macro name | Macro value | -+------------+-----------------------------+ -| CHECK | allJobHaveNoMsgWInSubSystem | -+------------+-----------------------------+ -| ARGS | QBASE!1!2 | -+------------+-----------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/asp1Usage.rst b/as400/doc/fr/exploitation/indicators/asp1Usage.rst deleted file mode 100644 index dd763861ab..0000000000 --- a/as400/doc/fr/exploitation/indicators/asp1Usage.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _asp1Usage: - -*************************** -Taux d'occupation de l'ASP1 -*************************** - -Description -^^^^^^^^^^^ - -+------------------+---------------------------------------------------------------------+ -| Description | Contrôle le taux d'occupation de l'ASP1. | -+------------------+---------------------------------------------------------------------+ -| Fonctionnement | Ok si le taux d'occupation est en dessous du seuil warning. | -| | Warning si le taux d'occupation passe au dessus du seuil warning. | -| | Critique si le taux d'occupation passe au dessus du seuil critique. | -+------------------+---------------------------------------------------------------------+ -| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | -+------------------+---------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+---------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+--------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+--------------------+---------+ -| asp1Usage | | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+--------------------+---------+ -| | | Argument 1 | Seuil warning (%) | 80 | -+---------------------+-------------------+---------------------+--------------------+---------+ -| | | Argument 2 | Seuil critique (%) | 90 | -+---------------------+-------------------+---------------------+--------------------+---------+ -| Métriques renvoyées | usage=xx% | | | | -+---------------------+-------------------+---------------------+--------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 1,5 ko | 1.1 ko | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | asp1Usage | -+------------+-------------+ -| ARGS | 80!90 | -+------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/backupJobExist.rst b/as400/doc/fr/exploitation/indicators/backupJobExist.rst deleted file mode 100644 index a58f7a3451..0000000000 --- a/as400/doc/fr/exploitation/indicators/backupJobExist.rst +++ /dev/null @@ -1,53 +0,0 @@ -.. _backupJobExist: - -************************** -Existence du job de backup -************************** - -Description -^^^^^^^^^^^ - -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| Description | Contrôle l’existence du job de backup RBT_DDMMYY. Ne contrôle pas son état. | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Ok si le job existe. | -| | Critical si le job n'existe pas. | -| | DDMMYY correspond au jour au moment de l’exécution du check. La date utilisé est celle du serveur hébergeant le daemon. | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-------------------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+-------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+-------------+---------+ -| backupJobExist | | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+-------------+---------+ -| | | Argument 1 | X | X | -+---------------------+-------------------+---------------------+-------------+---------+ -| Métriques renvoyées | | | | | -+---------------------+-------------------+---------------------+-------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------+ -| Macro name | Macro value | -+------------+----------------+ -| CHECK | backupJobExist | -+------------+----------------+ diff --git a/as400/doc/fr/exploitation/indicators/cpuUsage.rst b/as400/doc/fr/exploitation/indicators/cpuUsage.rst deleted file mode 100644 index 0c2c66419c..0000000000 --- a/as400/doc/fr/exploitation/indicators/cpuUsage.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _cpuUsage: - -*** -CPU -*** - -Description -^^^^^^^^^^^ - -+------------------+--------------------------------------------------------------------------------------------------------------------------------------+ -| Description | Contrôle le temps pendant lequel les CPU de l'AS/400 étaient utilisés. | -+------------------+--------------------------------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Ok si le temps cpu est en dessous du seuil warning. | -| | Warning si le temps cpu passe au dessus du seuil warning. | -| | Critique si le temps cpu passe au dessus du seuil critique.Il peut dépasser 100% sur les partitions non bridés (uncapped partition). | -+------------------+--------------------------------------------------------------------------------------------------------------------------------------+ -| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | -+------------------+--------------------------------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+--------------------------------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+--------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+--------------------+---------+ -| cpuUsage | 2 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+--------------------+---------+ -| | | Argument 1 | Seuil warning (%) | 80 | -+---------------------+-------------------+---------------------+--------------------+---------+ -| | | Argument 2 | Seuil critique (%) | 90 | -+---------------------+-------------------+---------------------+--------------------+---------+ -| Métriques renvoyées | usage=xx% | | | | -+---------------------+-------------------+---------------------+--------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+---------------------------------+ -| Download (as400 vers connector) | Download (as400 vers connector) | -+---------------------------------+---------------------------------+ -| 1,7 ko | 1.5 ko | -+---------------------------------+---------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | cpuUsage | -+------------+-------------+ -| ARGS | 80!90 | -+------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/diskState.rst b/as400/doc/fr/exploitation/indicators/diskState.rst deleted file mode 100644 index 430c2e7a69..0000000000 --- a/as400/doc/fr/exploitation/indicators/diskState.rst +++ /dev/null @@ -1,51 +0,0 @@ -.. _diskState: - -******************************************** -Etat de fonctionnement des disques physiques -******************************************** - -Description -^^^^^^^^^^^ - -+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Description | Contrôle l'état de fonctionnement de l'ensemble des disques physiques | -+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Un disque physique peut prendre plusieurs état : no control, active, failed, hardware failure, rebuild, not ready, protected, busy, not operational, unknown state (13 états au total). | -| | Ok si tous les disques sont actifs (active) | -| | Critique si au moins un disque est dans un état différent de actif. | -+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| API utilisée | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | -+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+--------------------------+---------------------+-------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+--------------------------+---------------------+-------------+---------+ -| diskState | 0 | Ordre des arguments | Description | Exemple | -+---------------------+--------------------------+---------------------+-------------+---------+ -| | | X | X | X | -+---------------------+--------------------------+---------------------+-------------+---------+ -| Métriques renvoyées | totaldisk=x activedisk=x | | | | -+---------------------+--------------------------+---------------------+-------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 4,1 ko | 4,3 ko | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | diskState | -+------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/diskUsage.rst b/as400/doc/fr/exploitation/indicators/diskUsage.rst deleted file mode 100644 index 950a3f5c58..0000000000 --- a/as400/doc/fr/exploitation/indicators/diskUsage.rst +++ /dev/null @@ -1,57 +0,0 @@ -.. _diskUsage: - -************************************** -Taux d'occupation d'un disque physique -************************************** - -Description -^^^^^^^^^^^ - -+------------------+-------------------------------------------------------------------+ -| Description | Contrôle le taux d'occupation d'un disque physique. | -+------------------+-------------------------------------------------------------------+ -| Fonctionnement | Ok si le taux d'occupation est en dessous du seuil warning. | -| | Warning si le taux d'occupation est au dessus du seuil warning. | -| | Critical si le taux d'occupation est au dessus du seuil critique. | -+------------------+-------------------------------------------------------------------+ -| API utilisée | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | -+------------------+-------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ -| diskUsage | 3 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ -| | | Argument 1 | Nom du disque | DD003 | -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ -| | | Argument 2 | Seuil warning (%) | 80 | -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ -| | | Argument 3 | Seuil critique (%) | 90 | -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ -| Métriques renvoyées | totalSpace=123456B usedSpace=12345B systemSpace=1234B | | | | -+---------------------+-------------------------------------------------------+---------------------+--------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 700 o | 700 o | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | diskUsage | -+------------+-------------+ -| ARGS | DD003!80!90 | -+------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst b/as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst deleted file mode 100644 index edf065db86..0000000000 --- a/as400/doc/fr/exploitation/indicators/diskUsageRepartition.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _diskUsageRepartition: - -************************************************* -Ecart des taux d'occupation des disques physiques -************************************************* - -Description -^^^^^^^^^^^ - -+------------------+----------------------------------------------------------------------------------------------------+ -| Description | Compare les taux d'utilisation des différents disques physiques. | -+------------------+----------------------------------------------------------------------------------------------------+ -| Fonctionnement | Calcul l'écart entre le taux d'utilisation minimal et maximal de l'ensemble des disques physiques. | -| | Ok si l’écart est en dessous du seuil warning. | -| | Warning si l’écart est au dessus du seuil warning. | -| | Critical si l’écart est au dessus du seuil critique. | -+------------------+----------------------------------------------------------------------------------------------------+ -| API utilisée | QYASPOL, format YASP0300, QGYGTLE, QGYCLST | -+------------------+----------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+----------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+----------------------+-------------------+---------------------+--------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+----------------------+-------------------+---------------------+--------------------+---------+ -| diskUsageRepartition | 2 | Ordre des arguments | Description | Exemple | -+----------------------+-------------------+---------------------+--------------------+---------+ -| | | Argument 1 | Seuil warning (%) | 0.5 | -+----------------------+-------------------+---------------------+--------------------+---------+ -| | | Argument 2 | Seuil critique (%) | 2 | -+----------------------+-------------------+---------------------+--------------------+---------+ -| Métriques renvoyées | gap=xx% | | | | -+----------------------+-------------------+---------------------+--------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 750 o | 750 o | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------------+ -| Macro name | Macro value | -+------------+----------------------+ -| CHECK | diskUsageRepartition | -+------------+----------------------+ -| ARGS | 0.5!2 | -+------------+----------------------+ diff --git a/as400/doc/fr/exploitation/indicators/executeCommand.rst b/as400/doc/fr/exploitation/indicators/executeCommand.rst deleted file mode 100644 index 023e04d7d1..0000000000 --- a/as400/doc/fr/exploitation/indicators/executeCommand.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. _executeCommand: - -*********************************** -Execution d'une commande spécifique -*********************************** - -Description -^^^^^^^^^^^ - -+------------------+-----------------------------------------------------------+ -| Description | Permet l'execution d'une commande spécifique | -+------------------+-----------------------------------------------------------+ -| Fonctionnement | Ok si la commande s'est déroulée avec succès. | -| | Critical si la commande ne s'est pas déroulé avec succes. | -+------------------+-----------------------------------------------------------+ -| API utilisée | | -+------------------+-----------------------------------------------------------+ -| Autorité requise | | -+------------------+-----------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+--------------------------+---------------------+--------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+--------------------------+---------------------+--------------------+---------+ -| executeCommand | 1 | Ordre des arguments | Description | Exemple | -+---------------------+--------------------------+---------------------+--------------------+---------+ -| | | Argument 1 | Nom de la commande | TEST | -+---------------------+--------------------------+---------------------+--------------------+---------+ -| Métriques renvoyées | | | | | -+---------------------+--------------------------+---------------------+--------------------+---------+ -| Output | Le retour de la commande | | | | -+---------------------+--------------------------+---------------------+--------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| variable | 800 o | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------+ -| Macro name | Macro value | -+------------+----------------+ -| CHECK | executeCommand | -+------------+----------------+ -| ARGS | TEST | -+------------+----------------+ - -Note : Un output sera disponible uniquement si des messages ont été généré par la commande exécutée. - -Génération d'un message depuis un programme AS/400 CL : - -+----------------------------------------------------------------------------------------------------------+ -| SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) \+ MSGDTA('Ceci est un message') \+ TOPGMQ(*EXT) MSGTYPE(*STATUS) | -+----------------------------------------------------------------------------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobExist.rst b/as400/doc/fr/exploitation/indicators/jobExist.rst deleted file mode 100644 index 58bc02969c..0000000000 --- a/as400/doc/fr/exploitation/indicators/jobExist.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _jobExist: - -****************** -Existence d'un job -****************** - -Description -^^^^^^^^^^^ - -+------------------+----------------------------------------------------------+ -| Description | Contrôle l’existence d'un job. Ne contrôle pas son état. | -+------------------+----------------------------------------------------------+ -| Fonctionnement | Ok si le job existe. | -| | Critical si le job n'existe pas. | -+------------------+----------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+----------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+----------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+---------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+---------------------+---------+ -| jobExist | 1 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+---------------------+---------+ -| | | Argument 1 | Nom du job | QCTL | -+---------------------+-------------------+---------------------+---------------------+---------+ -| | | Argument 2 | Nom du sous systeme | QBASE | -+---------------------+-------------------+---------------------+---------------------+---------+ -| Métriques renvoyées | | | | | -+---------------------+-------------------+---------------------+---------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | jobExist | -+------------+-------------+ -| ARGS | QCTL !QBASE | -+------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst b/as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst deleted file mode 100644 index abe579e349..0000000000 --- a/as400/doc/fr/exploitation/indicators/jobHasNoMsgw.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _jobHasNoMsgw: - -************************************************************************ -Controle l'existance d'un job et son statut en attente de message (MSGW) -************************************************************************ - -Description -^^^^^^^^^^^ - -+------------------+---------------------------------------------------------------------+ -| Description | Contrôle l’existence d'un job. Contrôle que le job n'a pas de MSGW. | -+------------------+---------------------------------------------------------------------+ -| Fonctionnement | Ok si le job existe. | -| | Critical si le job n'existe pas, ou que le job a un MSGW. | -+------------------+---------------------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+---------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+---------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+---------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+---------------------+---------+ -| jobHasNoMsgw | 1 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+---------------------+---------+ -| | | Argument 1 | Nom du job | QCTL | -+---------------------+-------------------+---------------------+---------------------+---------+ -| | | Argument 2 | Nom du sous systeme | QBASE | -+---------------------+-------------------+---------------------+---------------------+---------+ -| Métriques renvoyées | | | | | -+---------------------+-------------------+---------------------+---------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+--------------+ -| Macro name | Macro value | -+------------+--------------+ -| CHECK | jobHasNoMsgw | -+------------+--------------+ -| ARGS | QCTL !QBASE | -+------------+--------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobQueueStatus.rst b/as400/doc/fr/exploitation/indicators/jobQueueStatus.rst deleted file mode 100644 index 70d65908a2..0000000000 --- a/as400/doc/fr/exploitation/indicators/jobQueueStatus.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _jobQueueStatus: - -************************** -Etat d'une jobQueue (JOBQ) -************************** - -Description -^^^^^^^^^^^ - -+------------------+------------------------------------------------------------------------------------------------------------------+ -| Description | Contrôle l’existence et l'état d'une jobQueue. | -+------------------+------------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Une jobQueue peut avoir l’état RELEASED ou HELD. | -| | OK si la jobqueue est en état RELEASED. | -| | Critical si la jobqueue est en état HELD ou n'existe pas. | -+------------------+------------------------------------------------------------------------------------------------------------------+ -| API utilisée | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | -+------------------+------------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue* JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | -+------------------+------------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+---------------------+-----------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+---------------------+-----------+ -| jobQueueStatus | 2 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+---------------------+-----------+ -| | | Argument 1 | Nom de la JobQueue | QSYSNOMAX | -+---------------------+-------------------+---------------------+---------------------+-----------+ -| | | Argument 2 | Nom de la librairie | QSYS | -+---------------------+-------------------+---------------------+---------------------+-----------+ -| Métriques renvoyées | X | | | | -+---------------------+-------------------+---------------------+---------------------+-----------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 1,7 ko | 1,9 ko | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------+ -| Macro name | Macro value | -+------------+----------------+ -| CHECK | jobQueueStatus | -+------------+----------------+ -| ARGS | QSYSNOMAX!QSYS | -+------------+----------------+ diff --git a/as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst b/as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst deleted file mode 100644 index c24eafb2c5..0000000000 --- a/as400/doc/fr/exploitation/indicators/jobQueueWaitJobCount.rst +++ /dev/null @@ -1,60 +0,0 @@ -.. _jobQueueWaitJobCount: - -************************************************** -Nombre de jobs en attente dans une jobqueue (JOBQ) -************************************************** - -Description -^^^^^^^^^^^ - -+------------------+-----------------------------------------------------------------------------------------------------------------+ -| Description | Contrôle le nombre de job en attente dans une jobQueue sans tenir compte des priorités des jobs. | -+------------------+-----------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Les jobs dans une jobqueue peuvent avoir plusieurs états :ACTIVE, HELD, ou SCHEDULED. | -| | Ok si le nombre de job en état HELD est inférieur au seuil warning. | -| | Warning si le nombre de job en état HELD est au dessus du seuil warning. | -| | Critical si le nombre de job en état HELD est au dessus du seuil critical. | -+------------------+-----------------------------------------------------------------------------------------------------------------+ -| API utilisée | QSPRJOBQ, format JOBQ0100 & JOBQ0200 | -+------------------+-----------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE, *EXECUTE sur la jobQueue Library, *READ sur la jobQueue*JOBCTL sur les JobQueue contrôlé par OPRCTL(*YES) | -+------------------+-----------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| jobQueueWaitJobCount | 4 | Ordre des arguments | Description | Exemple | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| | | Argument 1 | Nom de la JobQueue | QSYSNOMAX | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| | | Argument 2 | Nom de la librairie | QSYS | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| | | Argument 3 | Seuil warning (quantité) | 1 | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| | | Argument 4 | Seuil critique (quantité) | 2 | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ -| Métriques renvoyées | activeJob=44 heldJobOnQueue=0 scheduledJobOnQueue=0 | | | | -+----------------------+-----------------------------------------------------+---------------------+---------------------------+-----------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 750 o | 800 o | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+----------------------+ -| Macro name | Macro value | -+------------+----------------------+ -| CHECK | jobQueueWaitJobCount | -+------------+----------------------+ -| ARGS | QSYSNOMAX!QSYS!1!2 | -+------------+----------------------+ diff --git a/as400/doc/fr/exploitation/indicators/messageQueueSize.rst b/as400/doc/fr/exploitation/indicators/messageQueueSize.rst deleted file mode 100644 index 91ddbfb32c..0000000000 --- a/as400/doc/fr/exploitation/indicators/messageQueueSize.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. _messageQueueSize: - -*********************************************** -Nombre de message dans une message queue (MSGQ) -*********************************************** - -Description -^^^^^^^^^^^ - -+------------------+------------------------------------------------------------------------------------------------------+ -| Description | Contrôle la taille de la messageQueue. | -+------------------+------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Récupère tous les message dont la sévérité est supérieur ou égale à celle défini dans les arguments. | -| | Ok si le nombre de message est en dessous du seuil warning. | -| | Warning si le nombre de message est au dessus du seuil warning. | -| | Critical si le nombre de message est au dessus du seuil critical. | -+------------------+------------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | -+------------------+------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | -+------------------+------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| messageQueueSize | 4 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 1 | Nom de la messageQueue | /QSYS.LIB/QSYSOPR.MSGQ | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 2 | Niveau de sévérité minimum pour comptabiliser le message | 40 | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 3 | Seuil warning (quantité) | 2000 | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 4 | Seuil critique (quantité) | 2500 | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ -| Métriques renvoyées | count=1234 | | | | -+---------------------+-------------------+---------------------+----------------------------------------------------------+------------------------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+-------------------------------------------------+---------------------------------+-------------------------------+ -| Nombre de message présent dans la message queue | Download (as400 vers connector) | Upload (connector vers as400) | -+-------------------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 2,26 ko | 66 o | -+-------------------------------------------------+---------------------------------+-------------------------------+ -| 5000 | 11 mo | 325 ko | -+-------------------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------------------------------+ -| Macro name | Macro value | -+------------+-------------------------------------+ -| CHECK | messageQueueSize | -+------------+-------------------------------------+ -| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!40!2000!2500 | -+------------+-------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst b/as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst deleted file mode 100644 index 55e34ae342..0000000000 --- a/as400/doc/fr/exploitation/indicators/messageQueueSizeFiltered.rst +++ /dev/null @@ -1,67 +0,0 @@ -.. _messageQueueSizeFiltered: - -************************************************************************* -Nombre de message dans une message queue (MSGQ) filtré par ID et severité -************************************************************************* - -Description -^^^^^^^^^^^ - -+------------------+------------------------------------------------------------------------------------------------------+ -| Description | Controle le nombre de message dans une message queue en filtrant par ID et sevérité | -+------------------+------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Récupère tous les message dont la sévérité est supérieur ou égale à celle défini dans les arguments. | -| | Ok si le nombre de message est en dessous du seuil warning. | -| | Warning si le nombre de message est au dessus du seuil warning. | -| | Critical si le nombre de message est au dessus du seuil critical. | -+------------------+------------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | -+------------------+------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | -+------------------+------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| Nom de la commande | Nombre d'arguments | Arguments | | | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| messageQueueSizeFiltered | 6 | Ordre des arguments | Description | Exemple | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 1 | Nom de la messageQueue | /QSYS.LIB/QSYSOPR.MSGQ | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 2 | Regex filtrant sur l'ID du message | ^CP.*$ | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 3 | Niveau de sévérité minimum pour comptabiliser le message | 60 | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 4 | Niveau de sévérité maximum pour comptabiliser le message | 80 | -| | | | Sévérité maximum exclue | | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 5 | Seuil warning (quantité) | 1 | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| | | Argument 6 | Seuil critique (quantité) | 2 | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ -| Métriques renvoyées | count=1234 | | | | -+--------------------------+--------------------+---------------------+----------------------------------------------------------+------------------------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+-------------------------------------------------+---------------------------------+-------------------------------+ -| Nombre de message présent dans la message queue | Download (as400 vers connector) | Upload (connector vers as400) | -+-------------------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 2,26 ko | 66 o | -+-------------------------------------------------+---------------------------------+-------------------------------+ -| 5000 | 11 mo | 325 ko | -+-------------------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+-----------------+-----------------------------------------+ -| Nom de la macro | Valeur de la macro | -+-----------------+-----------------------------------------+ -| CHECK | messageQueueSize | -+-----------------+-----------------------------------------+ -| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | -+-----------------+-----------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst b/as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst deleted file mode 100644 index 6308eccaeb..0000000000 --- a/as400/doc/fr/exploitation/indicators/newMessageInMessageQueue.rst +++ /dev/null @@ -1,74 +0,0 @@ -.. _newMessageInMessageQueue: - -********************************************************************************** -Nombre de nouveau messages dans une message queue (MSGQ) filtré par ID et severité -********************************************************************************** - -Description -^^^^^^^^^^^ - -+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ -| Description | Controle le nombre de nouveaux messages dans une message queue en filtrant par ID et sevérité | | -+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ -| Fonctionnement | Récupère tous les message et les stocks dans une base de donnée légère. Compte le nombre de nouveaus messages dont la sévérité est supérieur ou égale à celle défini dans les arguments. | | -| | Ok si le nombre de nouveau message est en dessous du seuil warning. | | -| | Warning si le nombre de nouveau message est au dessus du seuil warning. | | -| | Critical si le nombre de nouveau message est au dessus du seuil critical. | | -+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ -| API utilisée | QGYOLMSG format LSTM0100, QGYGTLE, QGYCLST | | -+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ -| Autorité requise | *USE sur la messageQueue, *EXECUTE sur la messageQueue library | | -+------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| Nom de la commande | Nombre d'arguments | Arguments | | | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| newMessageInMessageQueue | 6 | Arguments order | Description | Exemple | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| | | Argument 1 | Nom de la messageQueue | /QSYS.LIB/QSYSOPR.MSGQ | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| | | Argument 2 | Regex filtrant sur l'ID du message | ^CP.*$ | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| | | Argument 3 | Niveau de sévérité minimum pour comptabiliser le message | 60 | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| | | Argument 4 | Niveau de sévérité maximum pour comptabiliser le message | 80 | -| | | | Sévérité maximum non inclu | | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| | | Argument 5 | Seuil warning (quantité) | 1 | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| | | Argument 6 | Seuil critique (quantité) | 2 | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ -| Métriques renvoyées | criteriaMessage=1 newMessage=3 | | | | -+--------------------------+--------------------------------+-----------------+----------------------------------------------------------+------------------------+ - -Base de donnée locale -^^^^^^^^^^^^^^^^^^^^^ - -L'emplacement de la base de donnée locale peut etre configuré dans le fichier : /etc/centreon-connector-as400/config.properties. -La variable est : pathMsgQDB. -/!\\ Attention aux autres options dont les modifications peuvent avoir des impacts importants sur le fonctionnement du connecteur. - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+-------------------------------------------------+---------------------------------+-------------------------------+ -| Nombre de message présent dans la message queue | Download (as400 vers connector) | Upload (connector vers as400) | -+-------------------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 2,26 ko | 66 o | -+-------------------------------------------------+---------------------------------+-------------------------------+ -| 5000 | 11 mo | 325 ko | -+-------------------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+-----------------+-----------------------------------------+ -| Nom de la macro | Valeur de la macro | -+-----------------+-----------------------------------------+ -| CHECK | newMessageInMessageQueue | -+-----------------+-----------------------------------------+ -| ARGS | /QSYS.LIB/QSYSOPR.MSGQ!^CP.*$!60!80!1!2 | -+-----------------+-----------------------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/pageFault.rst b/as400/doc/fr/exploitation/indicators/pageFault.rst deleted file mode 100644 index c177e8dfff..0000000000 --- a/as400/doc/fr/exploitation/indicators/pageFault.rst +++ /dev/null @@ -1,57 +0,0 @@ -.. _pageFault: - -***************** -Taux de pageFault -***************** - -Description -^^^^^^^^^^^ - -+------------------+-------------------------------------------------------------------------------------------------------+ -| Description | Contrôle le taux de page fault. | -+------------------+-------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Récupère le taux de page par seconde, et le taux de page fault par seconde, database et non database. | -| | Calcul le pourcentage de page fault par rapport au page. | -| | Ok si ce pourcentage est en dessous du seuil warning. | -| | Warning si ce pourcentage est au dessus du seuil warning. | -| | Critical si ce pourcentage est au dessus du seuil critical. | -+------------------+-------------------------------------------------------------------------------------------------------+ -| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | -+------------------+-------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+----------------------------------------------+---------------------+--------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+----------------------------------------------+---------------------+--------------------+---------+ -| pageFault | 2 | Ordre des arguments | Description | Exemple | -+---------------------+----------------------------------------------+---------------------+--------------------+---------+ -| | | Argument 1 | Seuil warning (%) | 50 | -+---------------------+----------------------------------------------+---------------------+--------------------+---------+ -| | | Argument 2 | Seuil critique (%) | 70 | -+---------------------+----------------------------------------------+---------------------+--------------------+---------+ -| Métriques renvoyées | dbPageFaultRatio=10% nonDbPageFaultRatio=20% | | | | -+---------------------+----------------------------------------------+---------------------+--------------------+---------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 15 ko | 12 ko | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-------------+ -| Macro name | Macro value | -+------------+-------------+ -| CHECK | pageFault | -+------------+-------------+ -| ARGS | 50!70 | -+------------+-------------+ diff --git a/as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst b/as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst deleted file mode 100644 index 9c80501946..0000000000 --- a/as400/doc/fr/exploitation/indicators/specificJobInSubSystem.rst +++ /dev/null @@ -1,83 +0,0 @@ -.. _allJobHaveNoMsgWInSubSystem: - -************************************************************************ -Controle le nombre de job dans un sous systeme avec un status specifique -************************************************************************ - -Description -^^^^^^^^^^^ - -+--------------------+-------------------------------------------------------------------------------------------------+ -| Description | Check amount of job in a subsystem with a specific status | -+--------------------+-------------------------------------------------------------------------------------------------+ -| Operation | OK si le nombre de job en attente de message est inférieur ou égal au warning count | -| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | -| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | -+--------------------+-------------------------------------------------------------------------------------------------+ -| Used API | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+--------------------+-------------------------------------------------------------------------------------------------+ -| Required authority | *USE | -+--------------------+-------------------------------------------------------------------------------------------------+ - -Command argument -^^^^^^^^^^^^^^^^ -String jobPattern, String subSystem, int warningMin, int warningMax, int criticalMin, int criticalMax - -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| Command name | Number of arguments | Arguments | | | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| specificJobInSubSystem | 8 | arguments order | Description | Exemple | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 1 | Job pattern (regex) | ^JOBC.\*$| -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 2 | SubSystem | QBASE | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 3 | Status | \*ANY | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 4 | StatusActive | ANY | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 5 | Warning minimal threshold (amount) | 2 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 6 | Warning maximal threshold (amount) | 5 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 7 | Critical minimal threshold (amount) | 1 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| | | Argument 8 | Critical maximal threshold (amount) | 10 | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| Metrics returned | foundJob\=123 statusMatchingJob\=1 | | | | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ -| Output returned | Amount of job found matching pattern and status | | | | -+------------------------+-------------------------------------------------+-----------------+-------------------------------------+----------+ - -All Status and StatusActive can be found here : -http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qusrjobi.htm - -Centreon-Connector-AS400 add 1 status (*ANY) and 1 statusActive (ANY), to match all existing status. - -Status can have value: *ANY, *OUTQ, *ACTIVE, *JOBQ -StatusActive can have value: BSCA, BSCW, CMNA, CMNW, CMTW ... (see IBM documentation) - - - - -Network usage -^^^^^^^^^^^^^ - -+------------------------------+-------------------------------+-----------------------------+ -| Amount of jobs on the server | Download (as400 to connector) | Upload (connector to as400) | -+------------------------------+-------------------------------+-----------------------------+ -| 1 (theoretic) | 77 o | 2,3 o | -+------------------------------+-------------------------------+-----------------------------+ -| 10000 | 750 ko | 23 ko | -+------------------------------+-------------------------------+-----------------------------+ - -Configuration exemple -^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------------------+ -| Macro name | Macro value | -+------------+-----------------------------+ -| CHECK | allJobHaveNoMsgWInSubSystem | -+------------+-----------------------------+ -| ARGS | QBASE!1!2 | -+------------+-----------------------------+ diff --git a/as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst b/as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst deleted file mode 100644 index 4d0ed2d01c..0000000000 --- a/as400/doc/fr/exploitation/indicators/specificJobRunningInSubSystem.rst +++ /dev/null @@ -1,68 +0,0 @@ -.. _allJobHaveNoMsgWInSubSystem: - -*********************************************************************** -Controle le nombre de job running (RUN) dans un sous systeme spécifique -*********************************************************************** - -Description -^^^^^^^^^^^ - -+------------------+-------------------------------------------------------------------------------------------------+ -| Description | Controle l'ensemble des jobs d'un sous systeme en état running | -+------------------+-------------------------------------------------------------------------------------------------+ -| Fonctionnement | OK si le nombre de job en attente de message est inférieur ou égal au warning count | -| | WARNING si le nombre de job en attente de message est inferieur au "critical count » | -| | CRITICAL si le nombre de job en attente de message est superieur ou égal au « critical count ». | -+------------------+-------------------------------------------------------------------------------------------------+ -| API utilisée | QGYOLJOB format OLJB0200, QGYGTLE, QGYCLST | -+------------------+-------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+-------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ -String jobPattern, String subSystem, int warningMin, int warningMax, int criticalMin, int criticalMax - -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| specificJobRunningInSubSystem | 6 | Ordre des arguments | Description | Exemple | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 1 | Job pattern (regex) | ^JOBC.*$ | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 2 | Sous system | QBASE | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 3 | Seuil Warning minimal (quantité) | 2 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 4 | Seuil Warning maximal (quantité) | 5 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 5 | Seuil Critical minimal (quantité) | 1 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| | | Argument 6 | Seuil Critical maximal (quantité) | 10 | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| Métriques renvoyées | totalJob=123 jobMSGW=1 | | | | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ -| Output renvoyé | Le nom des jobs en attente de message | | | | -+-------------------------------+---------------------------------------+---------------------+-----------------------------------+----------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------------+---------------------------------+-------------------------------+ -| Nombre de jobs présent sur le serveur | Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------------+---------------------------------+-------------------------------+ -| 1 (théorique) | 77 o | 2,3 o | -+---------------------------------------+---------------------------------+-------------------------------+ -| 10000 | 750 ko | 23 ko | -+---------------------------------------+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+------------------+ -| Macro name | Macro value | -+------------+------------------+ -| CHECK | allJobHaveNoMsgW | -+------------+------------------+ -| ARGS | QBASE!1!2 | -+------------+------------------+ diff --git a/as400/doc/fr/exploitation/indicators/subSystemExist.rst b/as400/doc/fr/exploitation/indicators/subSystemExist.rst deleted file mode 100644 index 98f3b39bef..0000000000 --- a/as400/doc/fr/exploitation/indicators/subSystemExist.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. _subSystemExist: - -********************************** -Existance d'un sous systeme (SBSD) -********************************** - -Description -^^^^^^^^^^^ - -+------------------+------------------------------------------------------------------------------------------------------------+ -| Description | Contrôle la présence et l'état d'un sous système | -+------------------+------------------------------------------------------------------------------------------------------------+ -| Fonctionnement | Un sous système peut prendre les états *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, et *STARTING. | -| | Ok si le sous système est en état *ACTIVE. | -| | Critical si le sous système est dans un autre état que *ACTIVE, ou que le sous système n'a pas été trouvé. | -+------------------+------------------------------------------------------------------------------------------------------------+ -| API utilisée | QWCRSSTS, format SSTS0100 & SSTS0200 | -+------------------+------------------------------------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+------------------------------------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------+---------------------+---------------------+----------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------+---------------------+---------------------+----------+ -| subSystemExist | 1 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------+---------------------+---------------------+----------+ -| | | Argument 1 | Nom du sous système | QBATCH | -+---------------------+-------------------+---------------------+---------------------+----------+ -| | | Argument 2 | Nom de la librairie | QSYS.LIB | -+---------------------+-------------------+---------------------+---------------------+----------+ -| Métriques renvoyées | X | | | | -+---------------------+-------------------+---------------------+---------------------+----------+ - -Consommation réseau -^^^^^^^^^^^^^^^^^^^ - -+---------------------------------+-------------------------------+ -| Download (as400 vers connector) | Upload (connector vers as400) | -+---------------------------------+-------------------------------+ -| 5,5 ko | 2,1 ko | -+---------------------------------+-------------------------------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+------------------+ -| Macro name | Macro value | -+------------+------------------+ -| CHECK | subSystemExist | -+------------+------------------+ -| ARGS | QBATCH !QSYS.LIB | -+------------+------------------+ diff --git a/as400/doc/fr/exploitation/indicators/workWithProblem.rst b/as400/doc/fr/exploitation/indicators/workWithProblem.rst deleted file mode 100644 index 9a73c935f2..0000000000 --- a/as400/doc/fr/exploitation/indicators/workWithProblem.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. _workWithProblem: - -************************************************************************ -Retourne le nombre de problèmes détectés par le système ou l'utilisateur -************************************************************************ - -Description -^^^^^^^^^^^ - -+------------------+---------------------------------------------------------------------------------+ -| Description | Retourne le nombre de problèmes détectés par le système ou l'utilisateur | -+------------------+---------------------------------------------------------------------------------+ -| Fonctionnement | OK si le nombre de problèmes inférieur ou égal au warning count | -| | WARNING si le nombre de problèmes est inferieur au "critical count » | -| | CRITICAL si le nombre de problèmes est superieur ou égal au « critical count ». | -+------------------+---------------------------------------------------------------------------------+ -| API utilisée | | -+------------------+---------------------------------------------------------------------------------+ -| Autorité requise | *USE | -+------------------+---------------------------------------------------------------------------------+ - -Arguments de la commande -^^^^^^^^^^^^^^^^^^^^^^^^ - -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| Nom de la commande | Nombre d'argument | Arguments | | | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| allJobHaveNoMsgW | n * 2 + 1 | Ordre des arguments | Description | Exemple | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 1 | Types de problèmes voulus | 1 | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| | | Argument 2 | Seuil Critical (quantité) | 2 | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| | Répéter les seuils pour chaque type de problème voulu | Argument 3 | Seuil Critical (quantité) | 2 | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| Métriques renvoyées | open=1;;;2;4 ready=0;;2;3 | | | | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ -| Output renvoyé | OK: There are 1 OPENED / 0 READY statys problems | | | | -+---------------------+-------------------------------------------------------+---------------------+---------------------------+---------+ - -Exemple de configuration -^^^^^^^^^^^^^^^^^^^^^^^^ - -+------------+-----------------+ -| Macro name | Macro value | -+------------+-----------------+ -| CHECK | workWithProblem | -+------------+-----------------+ -| ARGS | 1!2 | -+------------+-----------------+ diff --git a/as400/doc/fr/exploitation/mode.rst b/as400/doc/fr/exploitation/mode.rst deleted file mode 100644 index a19ff7fba6..0000000000 --- a/as400/doc/fr/exploitation/mode.rst +++ /dev/null @@ -1,69 +0,0 @@ -.. _mode: - -###################### -Mode de fonctionnement -###################### - -Centreon-Connector-AS400 peut fonctionner en mode daemon ou en ligne de commande. -Il est complété par un plugin Nagios de contrôle, se connectant au daemon, et chargé de transmettre les résultats à Nagios. - -Ligne de commande -================= - -En ligne de commande, une machine virtuelle java est démarrée à chaque exécution. Ce mode ne doit être utilisé qu'à des fins de tests, afin d'éviter une forte consommation CPU/mémoire:: - - +-------------------------------------------------------------------------------------------------------------+ - | java -jar connector-as400-1.x.x.jar -I -H %HOST% --login %LOGIN% --password %PASSWORD% -C %CHECK% -A %ARGS% | - +-------------------------------------------------------------------------------------------------------------+ - -Saisir les differents arguments : - -+----------+-----------------------------------------+-------------+ -| Attribut | Description | Exemple | -+==========+=========================================+=============+ -| HOST | L'adresse IP ou le nom de l'hôte AS/400 | 10.30.10.30 | -+----------+-----------------------------------------+-------------+ -| LOGIN | Le nom d'utilisateur AS/400 | USER123 | -+----------+-----------------------------------------+-------------+ -| PASSWORD | Le mot de passe AS/400 | PASSWORD123 | -+----------+-----------------------------------------+-------------+ -| CHECK | La commande de check | cpuUsage | -+----------+-----------------------------------------+-------------+ -| ARGS | Les arguments de la commande | 80!90 | -+----------+-----------------------------------------+-------------+ - -Note : les arguments de la commande sont séparés par des « ! ». - -Daemon -====== - -Le mode daemon permet de lancer les mêmes commandes qu'en ligne de commande sans devoir redémarrer une machine virtuelle java à chaque utilisation. -Le daemon écoute sur un port, en attente de requête. -Un plugin de contrôle (check_centreon_as400_generic) est disponible pour se connecter au daemon, et renvoyer un résultat au format Nagios. -Les arguments du plugin sont similaires à ceux du programme java. Il est cependant nécessaire de préciser l'adresse et le port du daemon:: - - +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | check_centreon_as400_generic \-\-connector %DAEMONHOST%:%DAEMONPORT% \-\-host %HOST% \-\-user %USER% \-\-password %PASSWORD% \-\-check %CHECK% \-\-args %ARGS% | - +----------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -Saisir les differents arguments : - -+------------+------------------------------------------------------+-------------+ -| Attribut | Description | Exemple | -+------------+------------------------------------------------------+-------------+ -| DAEMONHOST | L'adresse IP ou le nom de l'hôte exécutant le daemon | 10.30.10.20 | -+------------+------------------------------------------------------+-------------+ -| DAEMONPORT | Le port du daemon | 8091 | -+------------+------------------------------------------------------+-------------+ -| HOST | L'adresse IP ou le nom de l'hôte AS/400 | 10.30.10.30 | -+------------+------------------------------------------------------+-------------+ -| LOGIN | Le nom d'utilisateur AS/400 | USER123 | -+------------+------------------------------------------------------+-------------+ -| PASSWORD | Le mot de passe AS/400 | PASSWORD123 | -+------------+------------------------------------------------------+-------------+ -| CHECK | La commande de check | cpuUsage | -+------------+------------------------------------------------------+-------------+ -| ARGS | Les arguments de la commande | 80!90 | -+------------+------------------------------------------------------+-------------+ - -Note : les arguments de la commande sont séparés par des « ! ». diff --git a/as400/doc/fr/installation/prerequisites.rst b/as400/doc/fr/installation/prerequisites.rst deleted file mode 100644 index e0763bfc1a..0000000000 --- a/as400/doc/fr/installation/prerequisites.rst +++ /dev/null @@ -1,67 +0,0 @@ -.. _rpm: - -########## -Pré-requis -########## - -+-----------+-----------------+ -| Logiciels | Version minimum | -+-----------+-----------------+ -| Centreon | 2.2.x | -+-----------+-----------------+ -| Nagios | 3.x | -+-----------+-----------------+ -| Java | JRE 6 Oracle | -+-----------+-----------------+ -| AS/400 | V4R5\+ | -+-----------+-----------------+ - -Préconisations matérielles -************************** - -Il est nécessaire d'évaluer les ressources matérielles nécessaires avant d'installer Centreon-Connector-AS400 sur un serveur. - -- **mémoire vive** : 512 Mo minimum (Peut sensiblement augmenter en fonction du nombre de contrôle). - - - Compter 2 Go pour 2500 services avec un intervalle de 10 minutes entre chaque contrôle. - -- **CPU** : même pré-requis que pour le serveur de collecte - - -List des ports utilisés -*********************** - -+-----------+-------------+--------------------------+------------------+ -| Source | Destination | Port | Peut être changé | -+-----------+-------------+--------------------------+------------------+ -| Plugin | Connector | Non défini | Oui | -+-----------+-------------+--------------------------+------------------+ - - -Liste des ports entre le connecteur et l'AS400 ----------------------------------------------- - -+----------+------+ -| Standard | SSL | -+----------+------+ -| 446 | 448 | -+----------+------+ -| 449 | | -+----------+------+ -| 8470 | 9470 | -+----------+------+ -| 8471 | 9471 | -+----------+------+ -| 8472 | 9472 | -+----------+------+ -| 8473 | 9473 | -+----------+------+ -| 8474 | 9474 | -+----------+------+ -| 8475 | 9475 | -+----------+------+ -| 8476 | 9476 | -+----------+------+ - - -Une liste complète des ports utilisés par l'AS400 peut être trouvée `sur cette page `_. diff --git a/as400/doc/fr/installation/rpm.rst b/as400/doc/fr/installation/rpm.rst deleted file mode 100644 index e07d03fb2f..0000000000 --- a/as400/doc/fr/installation/rpm.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. _rpm: - -############################# -Installation du package (RPM) -############################# - -Pré-Requis -********** - -Une installation recente de CES avec centreon-plugin-pack. - -Installation -************ - -Lancez la commande:: - - $ yum install centreon-connector-as400-server ces-plugins-Operatingsystems-As400 ces-pack-Operatingsystems-As400 - -Puis démarrez le daemon:: - - $ /etc/init.d/centreon-connector-as400 start \ No newline at end of file diff --git a/as400/doc/fr/installation/tarball.rst b/as400/doc/fr/installation/tarball.rst deleted file mode 100644 index 62391ba3d6..0000000000 --- a/as400/doc/fr/installation/tarball.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. _tarball: - -####################################### -Installation depuis le tarball (tar.gz) -####################################### - -L'installation par tarball est déconseillé. - -Pré-Requis -********** - -To build Centreon-Connector-AS400 check plugin, you will need the following external dependencies: - -a C++ compilation environment. -CMake (>= 2.8), a cross-platform build system. -the Qt (>= 4.7.4) framework with QtCore, and QtXml modules. -GnuTLS (>= 2.0), a secure communications library. - -Installation du daemon -********************** - -Décompresser l'archive:: - - $ cd /tmp/ && tar xvzf centreon-connector-as400-server-1.x.x.tar.gz - - Lancez l'instalation:: - - $ /tmp/centreon-connector-as400-server-1.x.x/install.sh - -Installation des sondes -*********************** - -Les sondes doivent etre compilées:: - - $ cd /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/ - $ cmake && make - -Copiez ensuite la sonde as400 vers le dossier libexec nagios:: - - $ cp /tmp/centreon-connector-as400-server-1.x.x/connector.plugins/as400_generic/check_centreon_as400 %nagios%/libexec/ - diff --git a/as400/doc/fr/upgrade/rpm.rst b/as400/doc/fr/upgrade/rpm.rst deleted file mode 100644 index 5ecdc59b51..0000000000 --- a/as400/doc/fr/upgrade/rpm.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. _rpm: - -###################################### -Mise à jour à partir des package (RPM) -###################################### - -Mise à jour -*********** - -Arrêter service du connecteur:: - - $ /etc/init.d/centreon-connector-as400 stop - -Mettre à jour les rpm:: - - $ yum update centreon-connector-as400-server ces-plugins-Operatingsystems-As400 - -Redémarrer le service du connecteur:: - - $ /etc/init.d/centreon-connector-as400 start From 8e7231875502c93da51e0010fca4e47cffe75fb3 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 16:05:41 +0200 Subject: [PATCH 10/40] removed java_home in dockerfile --- .../docker/packaging/Dockerfile.packaging-plugins-java-alma8 | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index bd62995373..6b801c3de7 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -20,6 +20,4 @@ dnf clean all EOF -ENV JAVA_HOME=$(java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | tr -s ' ' | cut -d ' ' -f 4) - WORKDIR /src \ No newline at end of file From 7e3a866a1ff6784e0dfdff242c4631b26837eabd Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 16:16:58 +0200 Subject: [PATCH 11/40] update pom.xml path in packaging --- .../docker/packaging/Dockerfile.packaging-plugins-java-alma8 | 2 +- .github/workflows/as400.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index 6b801c3de7..e5c40abb65 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -8,7 +8,7 @@ dnf install -y \ maven-3.5.4 \ git \ wget \ - zstd \ + zstd echo '[goreleaser] name=GoReleaser diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index f9b897673f..a8f442d384 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -76,7 +76,7 @@ jobs: run: export JAVA_HOME=$( java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | tr -s ' ' | cut -d ' ' -f 4) - name: Build JAR using maven - run: mvn clean install -f connector.as400/pom.xml + run: mvn clean install -f as400/connector.as400/pom.xml - name: Package uses: ./.github/actions/package-nfpm From 7338fe20e76390a4982c114f240ff360fdd9f29b Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 16:32:19 +0200 Subject: [PATCH 12/40] add path debug to packaging --- .github/workflows/as400.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index a8f442d384..9cdc136491 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -78,6 +78,9 @@ jobs: - name: Build JAR using maven run: mvn clean install -f as400/connector.as400/pom.xml + - name: Remove me after debug + run: find / -name "centreon-as400-2.0.2-jar-with-dependencies.jar" + - name: Package uses: ./.github/actions/package-nfpm with: From c77598a53452218ade6ee1ca500d2a7ee77dcfc6 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 16:41:48 +0200 Subject: [PATCH 13/40] fix --- .github/workflows/as400.yml | 2 +- as400/packaging/centreon-as400-daemon.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 9cdc136491..478ca94ba5 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -79,7 +79,7 @@ jobs: run: mvn clean install -f as400/connector.as400/pom.xml - name: Remove me after debug - run: find / -name "centreon-as400-2.0.2-jar-with-dependencies.jar" + run: find / -name "centreon-as400*.jar" - name: Package uses: ./.github/actions/package-nfpm diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index e7497fcd7a..19ad191d02 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -14,7 +14,7 @@ homepage: "https://www.centreon.com" license: "Apache-2.0" contents: - - src: "../centreon-plugins/as400/connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE + - src: "../as400/connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE dst: "/usr/share/centreon-as400/bin/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE scripts: From 5a852e6eaf05d95b4ba3a2c3b6cd63a57d21fb81 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 16:48:55 +0200 Subject: [PATCH 14/40] fix path --- as400/packaging/centreon-as400-daemon.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index 19ad191d02..f5d457ebfc 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -14,7 +14,7 @@ homepage: "https://www.centreon.com" license: "Apache-2.0" contents: - - src: "../as400/connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE + - src: "../connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE dst: "/usr/share/centreon-as400/bin/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE scripts: From 6d43e9b8b178cec3da823442b4ebb1a34627cad8 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 17:50:53 +0200 Subject: [PATCH 15/40] add install files and dirs --- as400/packaging/centreon-as400-daemon.yaml | 37 +++++++++++++++++-- .../centreon-as400-daemon-postinstall.sh | 1 + .../centreon-as400-daemon-preinstall.sh | 1 + .../centreon-as400-daemon-preremove.sh | 1 + 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 as400/packaging/scripts/centreon-as400-daemon-postinstall.sh create mode 100644 as400/packaging/scripts/centreon-as400-daemon-preinstall.sh create mode 100644 as400/packaging/scripts/centreon-as400-daemon-preremove.sh diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index f5d457ebfc..5d643ac132 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -16,11 +16,42 @@ license: "Apache-2.0" contents: - src: "../connector.as400/target/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE dst: "/usr/share/centreon-as400/bin/centreon-as400-2.0.2-jar-with-dependencies.jar" # VARIABLE VERSION REQUIRED HERE + file_info: + mode: 0755 + owner: "centreon-as400" + group: "centreon-as400" + + - src: "../connector.as400.install/init-script/centreon-as400.service" + dst: "/lib/systemd/system/centreon-as400.service" + file_info: + mode: 0644 + + - src: "../connector.as400.install/init-script/centreon-as400-sysconfig" + dst: "/etc/sysconfig/centreon-as400-sysconfig" + file_info: + mode: 0644 + + - src: "../connector.as400.install/etc/config.properties" + dst: "/etc/centreon-as400/config.properties" + file_info: + mode: 0644 + + - src: "../connector.as400.install/etc/log4j2.xml" + dst: "/etc/centreon-as400/log4j2.xml" + file_info: + mode: 0644 + + - dst: "/var/log/centreon-as400/" + type: dir + file_info: + mode: 0755 + owner: centreon-as400 + group: centreon-as400 scripts: - preinstall: ./scripts/centreon-bi-engine-preinstall.sh - postinstall: ./scripts/centreon-bi-engine-postinstall.sh - preremove: ./scripts/centreon-bi-engine-preremove.sh + preinstall: ./scripts/centreon-as400-daemon-preinstall.sh + postinstall: ./scripts/centreon-as400-daemon-postinstall.sh + preremove: ./scripts/centreon-as400-daemon-preremove.sh overrides: rpm: diff --git a/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh b/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh new file mode 100644 index 0000000000..96b4b06ad4 --- /dev/null +++ b/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh @@ -0,0 +1 @@ +#!/bin/sh \ No newline at end of file diff --git a/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh b/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh new file mode 100644 index 0000000000..96b4b06ad4 --- /dev/null +++ b/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh @@ -0,0 +1 @@ +#!/bin/sh \ No newline at end of file diff --git a/as400/packaging/scripts/centreon-as400-daemon-preremove.sh b/as400/packaging/scripts/centreon-as400-daemon-preremove.sh new file mode 100644 index 0000000000..96b4b06ad4 --- /dev/null +++ b/as400/packaging/scripts/centreon-as400-daemon-preremove.sh @@ -0,0 +1 @@ +#!/bin/sh \ No newline at end of file From 77ee74c9bd577cc743978e0bc2789b0bc2d487a5 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 17:58:57 +0200 Subject: [PATCH 16/40] update install files and dirs --- as400/packaging/centreon-as400-daemon.yaml | 2 +- .../packaging/scripts/centreon-as400-daemon-postinstall.sh | 6 +++++- as400/packaging/scripts/centreon-as400-daemon-preinstall.sh | 5 ++++- as400/packaging/scripts/centreon-as400-daemon-preremove.sh | 5 ++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index 5d643ac132..e5a3f4e9cf 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -41,7 +41,7 @@ contents: file_info: mode: 0644 - - dst: "/var/log/centreon-as400/" + - dst: "/var/log/centreon-as400" type: dir file_info: mode: 0755 diff --git a/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh b/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh index 96b4b06ad4..e5d5829623 100644 --- a/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh +++ b/as400/packaging/scripts/centreon-as400-daemon-postinstall.sh @@ -1 +1,5 @@ -#!/bin/sh \ No newline at end of file +#!/bin/sh + +# Start as400-daemon function + +# Handle actions diff --git a/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh b/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh index 96b4b06ad4..8e9f5106aa 100644 --- a/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh +++ b/as400/packaging/scripts/centreon-as400-daemon-preinstall.sh @@ -1 +1,4 @@ -#!/bin/sh \ No newline at end of file +#!/bin/sh + +echo "Creating centreon-as400 user ..." +useradd -m -r centreon-as400 2> /dev/null ||: \ No newline at end of file diff --git a/as400/packaging/scripts/centreon-as400-daemon-preremove.sh b/as400/packaging/scripts/centreon-as400-daemon-preremove.sh index 96b4b06ad4..b615952916 100644 --- a/as400/packaging/scripts/centreon-as400-daemon-preremove.sh +++ b/as400/packaging/scripts/centreon-as400-daemon-preremove.sh @@ -1 +1,4 @@ -#!/bin/sh \ No newline at end of file +#!/bin/sh + +# Stop as400-daemon +systemctl stop centreon-as400 \ No newline at end of file From 53185576465a3ccaa3dfc8cbd345d58420c6055a Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 18:21:41 +0200 Subject: [PATCH 17/40] add alma9 packaging dockerfile --- .../Dockerfile.packaging-plugins-java-alma9 | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 index e69de29bb2..ef0cfb41ee 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 @@ -0,0 +1,29 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:9 + +RUN bash -e < Date: Wed, 4 Sep 2024 18:22:34 +0200 Subject: [PATCH 18/40] enable alma9 packaging in workflow --- .github/workflows/as400.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 478ca94ba5..3acd2a02e6 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -32,9 +32,9 @@ jobs: - package_extension: rpm image: packaging-plugins-java-alma8 distrib: el8 - # - package_extension: rpm - # image: packaging-plugins-alma9 - # distrib: el9 + - package_extension: rpm + image: packaging-plugins-alma9 + distrib: el9 # - package_extension: deb # image: packaging-plugins-bullseye # distrib: bullseye From 1e1653a1e26ce71d8b2e8f80f7684f9e1696bd89 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 18:23:27 +0200 Subject: [PATCH 19/40] add alma9 java packaging image entry to docker builder matrix --- .github/workflows/docker-builder-packaging-plugins.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-builder-packaging-plugins.yml b/.github/workflows/docker-builder-packaging-plugins.yml index 5b4c358614..66bf557098 100644 --- a/.github/workflows/docker-builder-packaging-plugins.yml +++ b/.github/workflows/docker-builder-packaging-plugins.yml @@ -31,6 +31,9 @@ jobs: - runner: ubuntu-22.04 dockerfile: packaging-plugins-java-alma8 image: packaging-plugins-java-alma8 + - runner: ubuntu-22.04 + dockerfile: packaging-plugins-java-alma9 + image: packaging-plugins-java-alma9 - runner: ubuntu-22.04 dockerfile: packaging-plugins-bullseye image: packaging-plugins-bullseye From dc352546c077f2d666b5abd72666368d5c3dbba8 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 4 Sep 2024 18:37:13 +0200 Subject: [PATCH 20/40] fix alma9 java packaging image name in package job matrix --- .github/workflows/as400.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 3acd2a02e6..45c7536a54 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -33,7 +33,7 @@ jobs: image: packaging-plugins-java-alma8 distrib: el8 - package_extension: rpm - image: packaging-plugins-alma9 + image: packaging-plugins-java-alma9 distrib: el9 # - package_extension: deb # image: packaging-plugins-bullseye From a69f9198eaac231ea06bbd0fb1039a706c11f292 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 5 Sep 2024 15:48:06 +0200 Subject: [PATCH 21/40] update deb dependency for default-jre --- as400/packaging/centreon-as400-daemon.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/as400/packaging/centreon-as400-daemon.yaml b/as400/packaging/centreon-as400-daemon.yaml index e5a3f4e9cf..2d0c819877 100644 --- a/as400/packaging/centreon-as400-daemon.yaml +++ b/as400/packaging/centreon-as400-daemon.yaml @@ -59,7 +59,7 @@ overrides: - java-1.8.0-openjdk deb: depends: - - java-1.8.0-openjdk + - default-jre rpm: summary: Centreon AS 400 Plugin daemon From 88d5fc97fde2daec4b8aa9eb6b0f11681bbf9164 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 5 Sep 2024 16:08:56 +0200 Subject: [PATCH 22/40] add packaging dockerfiles for debian --- ...Dockerfile.packaging-plugins-java-bookworm | 22 +++++++++++++++++++ ...Dockerfile.packaging-plugins-java-bullseye | 22 +++++++++++++++++++ .../docker-builder-packaging-plugins.yml | 6 +++++ 3 files changed, 50 insertions(+) create mode 100644 .github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm create mode 100644 .github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm new file mode 100644 index 0000000000..46ea293929 --- /dev/null +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm @@ -0,0 +1,22 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bookworm + +RUN bash -e < Date: Thu, 5 Sep 2024 16:27:13 +0200 Subject: [PATCH 23/40] update debian java packaging dockerfiles --- .../packaging/Dockerfile.packaging-plugins-java-bookworm | 2 +- .../packaging/Dockerfile.packaging-plugins-java-bullseye | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm index 46ea293929..1c8c2581bc 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm @@ -9,7 +9,7 @@ apt-get install -y \ ca-certificates \ git \ zstd \ - maven-3.8.7 \ + maven=3.8.7-1 \ openjdk-17-jdk echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye index db1c89d74d..c9aa522ecd 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye @@ -9,8 +9,8 @@ apt-get install -y \ ca-certificates \ git \ zstd \ - maven-3.6.3 \ - openjdk-17-jdk + maven=3.6.3-5 \ + openjdk-11-jdk echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list From ed5b3e1a769e328062117501c42fc1925560d419 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 5 Sep 2024 16:58:17 +0200 Subject: [PATCH 24/40] enable deb packaging in workflow --- .github/workflows/as400.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 45c7536a54..7bd6cbbc06 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -35,13 +35,13 @@ jobs: - package_extension: rpm image: packaging-plugins-java-alma9 distrib: el9 - # - package_extension: deb - # image: packaging-plugins-bullseye - # distrib: bullseye - # - package_extension: deb - # image: packaging-plugins-bookworm - # distrib: bookworm - # - package_extension: deb + - package_extension: deb + image: packaging-plugins-bullseye + distrib: bullseye + - package_extension: deb + image: packaging-plugins-bookworm + distrib: bookworm + - package_extension: deb # image: packaging-plugins-jammy # distrib: jammy From 568bad2649ca2fd7e74900981081701782be1b37 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 5 Sep 2024 17:09:38 +0200 Subject: [PATCH 25/40] add workdir to debian packaging dockerfile --- .../packaging/Dockerfile.packaging-plugins-java-bookworm | 4 +++- .../packaging/Dockerfile.packaging-plugins-java-bullseye | 4 +++- .github/workflows/as400.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm index 1c8c2581bc..4c48ae04a0 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bookworm @@ -19,4 +19,6 @@ apt-get install -y nfpm apt-get clean all -EOF \ No newline at end of file +EOF + +WORKDIR /src \ No newline at end of file diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye index c9aa522ecd..2ecab5517d 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye @@ -19,4 +19,6 @@ apt-get install -y nfpm apt-get clean all -EOF \ No newline at end of file +EOF + +WORKDIR /src \ No newline at end of file diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 7bd6cbbc06..c88e38a277 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -41,7 +41,7 @@ jobs: - package_extension: deb image: packaging-plugins-bookworm distrib: bookworm - - package_extension: deb + # - package_extension: deb # image: packaging-plugins-jammy # distrib: jammy From c536225a69b1fd71017a6dadadadfd3615da6e37 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 5 Sep 2024 17:28:39 +0200 Subject: [PATCH 26/40] update as400 package matrix --- .github/workflows/as400.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index c88e38a277..3853f8b714 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -36,10 +36,10 @@ jobs: image: packaging-plugins-java-alma9 distrib: el9 - package_extension: deb - image: packaging-plugins-bullseye + image: packaging-plugins-java-bullseye distrib: bullseye - package_extension: deb - image: packaging-plugins-bookworm + image: packaging-plugins-java-bookworm distrib: bookworm # - package_extension: deb # image: packaging-plugins-jammy From e0552d7936374fbaf1ae319762d4f8013b12c101 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Thu, 5 Sep 2024 17:52:01 +0200 Subject: [PATCH 27/40] fix docker builder matrix --- .github/workflows/docker-builder-packaging-plugins.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-builder-packaging-plugins.yml b/.github/workflows/docker-builder-packaging-plugins.yml index bc973207b3..b8a195ed0a 100644 --- a/.github/workflows/docker-builder-packaging-plugins.yml +++ b/.github/workflows/docker-builder-packaging-plugins.yml @@ -47,8 +47,8 @@ jobs: dockerfile: packaging-plugins-java-bullseye image: packaging-plugins-java-bullseye - runner: ubuntu-22.04 - dockerfile: packaging-plugins-java-bullseye - image: packaging-plugins-java-bullseye + dockerfile: packaging-plugins-java-bookworm + image: packaging-plugins-java-bookworm - runner: ubuntu-22.04 dockerfile: packaging-plugins-jammy image: packaging-plugins-jammy From 2138ac51c4d24d287dd9e65f230ade48066681e8 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Mon, 9 Sep 2024 17:32:41 +0200 Subject: [PATCH 28/40] use java 17 on all os --- .../docker/packaging/Dockerfile.packaging-plugins-java-alma8 | 3 ++- .../docker/packaging/Dockerfile.packaging-plugins-java-alma9 | 3 ++- .../packaging/Dockerfile.packaging-plugins-java-bullseye | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index e5c40abb65..29482e9657 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -8,7 +8,8 @@ dnf install -y \ maven-3.5.4 \ git \ wget \ - zstd + zstd \ + https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm echo '[goreleaser] name=GoReleaser diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 index ef0cfb41ee..a7fd37e5c5 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 @@ -8,7 +8,8 @@ dnf install -y \ java-1.8.0-openjdk-devel \ git \ wget \ - zstd + zstd \ + https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm cd /usr/local/src wget https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye index 2ecab5517d..2678be01e7 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-bullseye @@ -10,7 +10,7 @@ apt-get install -y \ git \ zstd \ maven=3.6.3-5 \ - openjdk-11-jdk + openjdk-17-jdk echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list From f2a0e17a1bb634b7804fdee8524b3a7b2be13163 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Mon, 9 Sep 2024 17:36:01 +0200 Subject: [PATCH 29/40] update as400 pom.xml plugins and java version --- as400/connector.as400/pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/as400/connector.as400/pom.xml b/as400/connector.as400/pom.xml index e1c7ddaf6d..9b4af16195 100644 --- a/as400/connector.as400/pom.xml +++ b/as400/connector.as400/pom.xml @@ -11,7 +11,7 @@ UTF-8 4.0.5.RELEASE - 1.8 + 17 2.17.1 jacoco @@ -71,10 +71,10 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.13.0 - 1.8 - 1.8 + 17 + 17 @@ -115,7 +115,7 @@ org.jacoco jacoco-maven-plugin - 0.8.2 + 0.8.12 @@ -204,8 +204,8 @@ org.mockito - mockito-all - 1.9.5 + mockito-core + 5.13.0 test From a88efb537602401a25a522ff903dac08af2f1c10 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Mon, 9 Sep 2024 17:42:13 +0200 Subject: [PATCH 30/40] up alma8 to maven 3.6.3 --- .../docker/packaging/Dockerfile.packaging-plugins-java-alma8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index 29482e9657..0c32d79d05 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -5,7 +5,7 @@ FROM ${REGISTRY_URL}/almalinux:8 RUN bash -e < Date: Mon, 9 Sep 2024 17:54:44 +0200 Subject: [PATCH 31/40] update alma8 container --- .../packaging/Dockerfile.packaging-plugins-java-alma8 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 index 0c32d79d05..96be158b18 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma8 @@ -5,12 +5,17 @@ FROM ${REGISTRY_URL}/almalinux:8 RUN bash -e < Date: Tue, 10 Sep 2024 16:07:03 +0200 Subject: [PATCH 32/40] add mvn version output --- .github/workflows/as400.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 3853f8b714..d4db2e2406 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -76,7 +76,7 @@ jobs: run: export JAVA_HOME=$( java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | tr -s ' ' | cut -d ' ' -f 4) - name: Build JAR using maven - run: mvn clean install -f as400/connector.as400/pom.xml + run: mvn -version && mvn clean install -f as400/connector.as400/pom.xml - name: Remove me after debug run: find / -name "centreon-as400*.jar" From 01bca92c1edbd52f608b93bdb071fbd69250619c Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 11 Sep 2024 09:21:32 +0200 Subject: [PATCH 33/40] enable delivery and force use of java 17 ffor packaging --- .../Dockerfile.packaging-plugins-java-alma9 | 1 - .github/workflows/as400.yml | 86 +++++++++---------- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 index a7fd37e5c5..35a48e6bf0 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-alma9 @@ -5,7 +5,6 @@ FROM ${REGISTRY_URL}/almalinux:9 RUN bash -e < Date: Wed, 11 Sep 2024 09:28:03 +0200 Subject: [PATCH 34/40] force stability to unstable --- .github/workflows/get-environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-environment.yml b/.github/workflows/get-environment.yml index 3ae9be4aec..1f177751c4 100644 --- a/.github/workflows/get-environment.yml +++ b/.github/workflows/get-environment.yml @@ -36,7 +36,7 @@ jobs: fi case "$BRANCHNAME" in - develop) + develop | MON-34611-add-plugin-as400-build-and-packaging) STABILITY="unstable" ;; release* | hotfix*) From 9bf9d428141094cc3598c2046ec3f6fd36bae060 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 11 Sep 2024 09:36:27 +0200 Subject: [PATCH 35/40] add missing cache --- .github/workflows/as400.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 631865fdc2..80f95c49b9 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -97,6 +97,12 @@ jobs: rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }} stability: ${{ needs.get-environment.outputs.stability }} + - name: Save to cache + uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 + with: + path: ./*.${{ matrix.package_extension }} + key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }} + deliver-rpm: needs: [get-environment, package] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} From 9063a0ee49ee811cdd85c1b8f00ea16a63b798e2 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Wed, 11 Sep 2024 09:43:06 +0200 Subject: [PATCH 36/40] update module_name for delivery --- .github/workflows/as400.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 80f95c49b9..185babd3d1 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -119,7 +119,7 @@ jobs: - name: Delivery uses: ./.github/actions/rpm-delivery with: - module_name: nrpe + module_name: as400 distrib: ${{ matrix.distrib }} cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }} stability: ${{ needs.get-environment.outputs.stability }} @@ -141,7 +141,7 @@ jobs: - name: Delivery uses: ./.github/actions/deb-delivery with: - module_name: nrpe + module_name: as400 distrib: ${{ matrix.distrib }} cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }} stability: ${{ needs.get-environment.outputs.stability }} From c026589441491590dd33d34cc57edc5ea31d2321 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Tue, 17 Sep 2024 15:37:32 +0200 Subject: [PATCH 37/40] add dockerfile and packaging on jammy --- .../Dockerfile.packaging-plugins-java-jammy | 30 +++++++++++++++++++ .github/workflows/as400.yml | 6 ++-- .../docker-builder-packaging-plugins.yml | 3 ++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/docker/packaging/Dockerfile.packaging-plugins-java-jammy diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-java-jammy b/.github/docker/packaging/Dockerfile.packaging-plugins-java-jammy new file mode 100644 index 0000000000..7fd177179f --- /dev/null +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-java-jammy @@ -0,0 +1,30 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/ubuntu:jammy + +RUN bash -e < Date: Tue, 17 Sep 2024 15:39:12 +0200 Subject: [PATCH 38/40] add jammy to packaging matrix --- .github/workflows/as400.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index f2688f18dd..2ee1132e4a 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -44,6 +44,10 @@ jobs: - package_extension: deb image: packaging-plugins-jammy distrib: jammy + - package_extension: deb + image: packaging-plugins-java-jammy + distrib: jammy + container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }} From 3adbb6456d7f95735aba2fac9dea33bea62e1d70 Mon Sep 17 00:00:00 2001 From: tuntoja Date: Tue, 17 Sep 2024 15:49:26 +0200 Subject: [PATCH 39/40] fix packaging matrix --- .github/workflows/as400.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/as400.yml b/.github/workflows/as400.yml index 2ee1132e4a..004ee377da 100644 --- a/.github/workflows/as400.yml +++ b/.github/workflows/as400.yml @@ -41,9 +41,6 @@ jobs: - package_extension: deb image: packaging-plugins-java-bookworm distrib: bookworm - - package_extension: deb - image: packaging-plugins-jammy - distrib: jammy - package_extension: deb image: packaging-plugins-java-jammy distrib: jammy From 330da2dc5cdef9ac3a2f9f1bcc6f101f1c07a354 Mon Sep 17 00:00:00 2001 From: tuntoja <58987095+tuntoja@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:25:04 +0200 Subject: [PATCH 40/40] Update .github/workflows/get-environment.yml --- .github/workflows/get-environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-environment.yml b/.github/workflows/get-environment.yml index 1f177751c4..3ae9be4aec 100644 --- a/.github/workflows/get-environment.yml +++ b/.github/workflows/get-environment.yml @@ -36,7 +36,7 @@ jobs: fi case "$BRANCHNAME" in - develop | MON-34611-add-plugin-as400-build-and-packaging) + develop) STABILITY="unstable" ;; release* | hotfix*)