From d46011763fb7600d9f8f38dc8d96574216fe1283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 24 May 2019 09:49:54 +0200 Subject: [PATCH] Add netstats plugin managment --- CHANGELOG.md | 1 + README.md | 15 ++-- defaults/main.yml | 7 ++ tasks/main.yml | 73 +++++++++++++------ .../etc/xymon/clientlaunch.d/netstats.cfg.j2 | 6 ++ 5 files changed, 73 insertions(+), 29 deletions(-) create mode 100644 templates/etc/xymon/clientlaunch.d/netstats.cfg.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cc21c2..b52e154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Enhancements * Add variables to manage plugin interval. +* Add netstats plugin managment. ## v1.3.3 diff --git a/README.md b/README.md index 828dfd1..2e21830 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,6 @@ Manage Xymon (client) installation and configuration. * **xymon_cli__plug_ipmi_path** : Configuration file for the `ipmi` plugin [default : `/etc/xymon/clientlaunch.d/ipmi.cfg`]. * **xymon_cli__plug_ipmi_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/ipmi.cfg.j2`]. * **xymon_cli__plug_ipmi_interval** : Time between each run of the `ipmi` plugin [default : `5m`]. -* **xymon_plug_mq_state** : The state of plugin `mq` [default : `true`]. -* **xymon_plug_mq_package** : The packages to install to provide `mq` plugin [default : `[ 'libtimedate-perl' ]`]. -* **xymon_plug_mq_path** : Configuration file for the `mq` plugin [default : `/etc/xymon/clientlaunch.d/mq.cfg`]. -* **xymon_plug_mq_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/mq.cfg.j2`]. -* **xymon_plug_mq_interval** : Time between each run of the `mq` plugin [default : `5m`]. * **xymon_plug_libs_state** : The state of plugin `libs` [default : `true`]. * **xymon_plug_libs_package** : The packages to install to provide `libs` plugin [default : `[ 'binutils', 'lsof', 'libyaml-tiny-perl', 'libsort-naturally-perl' ]`]. * **xymon_plug_libs_path** : Configuration file for the `libs` plugin [default : `/etc/xymon/clientlaunch.d/libs.cfg`]. @@ -55,6 +50,16 @@ Manage Xymon (client) installation and configuration. * **xymon_plug_libs_whitelist** : All hosts whitelist of processes that should not be monitored with `libs` plugin. * **xymon_plug_libs_group_whitelist** : Group whitelist of processes that should not be monitored with `libs` plugin. * **xymon_plug_libs_host_whitelist** : Host whitelist of processes that should not be monitored with `libs` plugin. +* **xymon_plug_mq_state** : The state of plugin `mq` [default : `true`]. +* **xymon_plug_mq_package** : The packages to install to provide `mq` plugin [default : `[ 'libtimedate-perl' ]`]. +* **xymon_plug_mq_path** : Configuration file for the `mq` plugin [default : `/etc/xymon/clientlaunch.d/mq.cfg`]. +* **xymon_plug_mq_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/mq.cfg.j2`]. +* **xymon_plug_mq_interval** : Time between each run of the `mq` plugin [default : `5m`]. +* **xymon_cli__plug_netstats_state** : The state of plugin `netstats` [default : `false`]. +* **xymon_cli__plug_netstats_state** : The packages to install to provide `netstats` plugin [default : `[ 'libfile-which-perl', 'libfile-slurp-perl', 'libipc-run-perl', 'libyaml-tiny-perl', 'iproute2', 'ethtool' ]`]. +* **xymon_cli__plug_netstats_path** : Configuration file for the `netstats` plugin [default : `/etc/xymon/clientlaunch.d/netstats.cfg`]. +* **xymon_cli__plug_netstats_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/netstats.cfg.j2`]. +* **xymon_cli__plug_netstats_interval** : Time between each run of the `netstats` plugin [default : `5m`]. * **xymon_cli__plug_zfs_state** : The state of plugin `zfs` [default : `false`]. * **xymon_cli__plug_zfs_script_path** : Path to the ZFS script [default : `/usr/lib/xymon/client/ext/zfs`]. * **xymon_cli__plug_zfs_script_tpl** : Template used to generate the previous script [default : `usr/lib/xymon/client/ext/zfs.j2`]. diff --git a/defaults/main.yml b/defaults/main.yml index 9c7afe2..a4fbe71 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -99,6 +99,13 @@ xymon_plug_mq_path: '/etc/xymon/clientlaunch.d/mq.cfg' xymon_plug_mq_tpl: 'etc/xymon/clientlaunch.d/mq.cfg.j2' xymon_plug_mq_interval: '5m' ## ]]] +## Plugin netstats [[[ +xymon_cli__plug_netstats_state: false +xymon_cli__plug_netstats_package: [ 'libfile-which-perl', 'libfile-slurp-perl', 'libipc-run-perl', 'libyaml-tiny-perl', 'iproute2', 'ethtool' ] +xymon_cli__plug_netstats_path: '/etc/xymon/clientlaunch.d/netstats.cfg' +xymon_cli__plug_netstats_tpl: 'etc/xymon/clientlaunch.d/netstats.cfg.j2' +xymon_cli__plug_netstats_interval: '5m' +## ]]] ## Plugin zfs [[[ xymon_cli__plug_zfs_state: false xymon_cli__plug_zfs_script_path: '/usr/lib/xymon/client/ext/zfs' diff --git a/tasks/main.yml b/tasks/main.yml index 5808b06..20dbd6e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -85,30 +85,6 @@ xymon_plug_manage|bool) notify: restart xymon-client service -# Manage mq plugin [[[1 -- name: PLUGIN mq packages - package: - name: '{{ item }}' - state: '{{ "present" if xymon_plug_mq_state else "absent" }}' - with_items: - - '{{ xymon_plug_mq_package | to_nice_json }}' - register: mq_plug_result - until: mq_plug_result is success - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - -- name: PLUGIN mq - template: - src: '{{ xymon_plug_mq_tpl }}' - dest: '{{ xymon_plug_mq_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - # Manage ipmi plugin [[[1 - name: PLUGIN ipmi packages package: @@ -168,6 +144,55 @@ xymon_plug_manage|bool) notify: restart xymon-client service +# Manage mq plugin [[[1 +- name: PLUGIN mq packages + package: + name: '{{ item }}' + state: '{{ "present" if xymon_plug_mq_state else "absent" }}' + with_items: + - '{{ xymon_plug_mq_package | to_nice_json }}' + register: mq_plug_result + until: mq_plug_result is success + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) + notify: restart xymon-client service + +- name: PLUGIN mq + template: + src: '{{ xymon_plug_mq_tpl }}' + dest: '{{ xymon_plug_mq_path }}' + owner: root + group: root + mode: 0644 + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) + notify: restart xymon-client service + +# Manage netstats plugin [[[1 +- name: PLUGIN netstats packages + package: + name: '{{ item }}' + state: 'present' + with_items: + - '{{ xymon_cli__plug_netstats_package | to_nice_json }}' + register: netstats_plug_result + until: netstats_plug_result is success + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool and + xymon_cli__plug_netstats_state|bool) + notify: restart xymon-client service + +- name: PLUGIN netstats config + template: + src: '{{ xymon_cli__plug_netstats_tpl }}' + dest: '{{ xymon_cli__plug_netstats_path }}' + owner: root + group: root + mode: 0644 + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) + notify: restart xymon-client service + # Manage zfs plugin [[[1 - name: PLUGIN zfs config file template: diff --git a/templates/etc/xymon/clientlaunch.d/netstats.cfg.j2 b/templates/etc/xymon/clientlaunch.d/netstats.cfg.j2 new file mode 100644 index 0000000..c14c3ae --- /dev/null +++ b/templates/etc/xymon/clientlaunch.d/netstats.cfg.j2 @@ -0,0 +1,6 @@ +[netstats] + {{ '#DISABLED' if xymon_cli__plug_netstats_state else 'DISABLED' }} + ENVFILE /etc/xymon/xymonclient.cfg + CMD $XYMONCLIENTHOME/ext/netstats + LOGFILE /var/log/xymon/xymonclient.log + INTERVAL {{ xymon_cli__plug_netstats_interval }}