From fb94b9e5635542c64c5af0f8f9bdd4620e77f565 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Thu, 9 Feb 2023 16:21:29 +0100 Subject: [PATCH] Add ansible example --- doc/ansible/setup-client.yml | 40 +++++++++++++++++++ .../plugins/base/BaseFilesystemExtension.java | 1 - 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 doc/ansible/setup-client.yml diff --git a/doc/ansible/setup-client.yml b/doc/ansible/setup-client.yml new file mode 100644 index 0000000..58d1adb --- /dev/null +++ b/doc/ansible/setup-client.yml @@ -0,0 +1,40 @@ +--- +# +# Example ansible playbook for installation of jload on AIX. +# +# ansible-playbook -i target-host-or-ip, -k -u root --extra-vars "sysmon_url=http://169.50.182.146:80/metrics" setup-client.yml +# + +- name: "Install sysmon client and plugins on CentOS/RHEL" + hosts: all + gather_facts: no + tasks: + - name: Sysmon | Install java runtime + yum: + name: java-11-openjdk-headless + state: present + - name: Sysmon | Install sysmon-client RPM package + yum: + name: https://git.data.coop/api/packages/nellemann/generic/sysmon/v1.1.2/sysmon-client-1.1.2-1.noarch.rpm + disable_gpg_check: true + state: present + - name: Sysmon | Install sysmon-plugins RPM package + yum: + name: https://git.data.coop/api/packages/nellemann/generic/sysmon/v1.1.2/sysmon-plugins-1.1.2-1.noarch.rpm + disable_gpg_check: true + state: present + - name: Sysmon | Setup service to start from cron at boot + ansible.builtin.cron: + name: "sysmon-client" + special_time: reboot + job: "/opt/sysmon/client/bin/client -s {{ sysmon_url }} /dev/null 2>&1 &" + - name: Sysmon | Check if sysmon-client is running + shell: "ps -ef | grep 'sysmon-client' | grep -v 'grep'" + register: result + failed_when: result.rc not in [ 0, 1 ] + - name: Debug running_processes + debug: + var: result.stdout + - name: Sysmon | Start sysmon-client service if not running + shell: "nohup /opt/sysmon/client/bin/client -s {{ sysmon_url }} /dev/null 2>&1 &" + when: result.stdout == "" diff --git a/plugins/base/src/main/java/sysmon/plugins/base/BaseFilesystemExtension.java b/plugins/base/src/main/java/sysmon/plugins/base/BaseFilesystemExtension.java index 57c842e..bbfe1ac 100644 --- a/plugins/base/src/main/java/sysmon/plugins/base/BaseFilesystemExtension.java +++ b/plugins/base/src/main/java/sysmon/plugins/base/BaseFilesystemExtension.java @@ -4,7 +4,6 @@ import org.pf4j.Extension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import oshi.SystemInfo; -import oshi.hardware.HardwareAbstractionLayer; import oshi.software.os.OSFileStore; import sysmon.shared.Measurement; import sysmon.shared.MetricExtension;