Add ansible example
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mark Nellemann 2023-02-09 16:21:29 +01:00
parent 43d3e9babf
commit fb94b9e563
2 changed files with 40 additions and 1 deletions

View file

@ -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 >/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 >/dev/null 2>&1 &"
when: result.stdout == ""

View file

@ -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;