From 91e6822ee7efef0e59da6bd3beaf8bf96d907e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 8 Feb 2018 17:28:49 +0100 Subject: [PATCH] Add whitelist settings for `libs` plugin. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow to set some processes that won't be monitored by the `libs` plugin and set some default ones (sssd,…). --- CHANGELOG.md | 3 ++- README.md | 3 +++ defaults/main.yml | 23 ++++++++++++++++++++++- tasks/main.yml | 11 +++++++++++ templates/etc/xymon/libs.local.yaml.j2 | 15 +++++++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 templates/etc/xymon/libs.local.yaml.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 71f1e75..97d7a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ -## v1.X +## v1.1 ## Enhancements * Add possibility to install `mq` dependancies. * Add possibility to install `libs` dependancies. +* Add whitelist settings for `libs` plugin. ## v1.0.1 diff --git a/README.md b/README.md index 2cfbac0..f7a27b0 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,9 @@ Manage Xymon (client) installation and configuration. * **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`]. * **xymon_plug_libs_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/libs.cfg.j2`]. +* **xymon_plug_libs_default_whitelist** : Default 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. ### OS Specific Variables diff --git a/defaults/main.yml b/defaults/main.yml index c4167c3..f4e172d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,13 +20,34 @@ xymon_cli_service_enabled: true # server xymon_srv_list: "monitoring.{{ ansible_domain }}" -# plugins +# plugins {{{ xymon_plug_manage: true + +## mq {{{ xymon_plug_mq_state: true xymon_plug_mq_package: [ 'libtimedate-perl' ] xymon_plug_mq_path: '/etc/xymon/clientlaunch.d/mq.cfg' xymon_plug_mq_tpl: 'etc/xymon/clientlaunch.d/mq.cfg.j2' +## }}} + +# libs {{{ xymon_plug_libs_state: true xymon_plug_libs_package: [ 'binutils', 'lsof', 'libyaml-tiny-perl', 'libsort-naturally-perl' ] xymon_plug_libs_path: '/etc/xymon/clientlaunch.d/libs.cfg' xymon_plug_libs_tpl: 'etc/xymon/clientlaunch.d/libs.cfg.j2' + +xymon_plug_libs_default_whitelist: + /lib/systemd/systemd: + - '.*' + /usr/lib/x86_64-linux-gnu/sssd/sssd_be: + - '.*' + /usr/sbin/sssd: + - '.*' + /sbin/multipathd: + - '.*' +xymon_plug_libs_group_whitelist: {} +xymon_plug_libs_host_whitelist: {} + +## }}} +# +# }}} diff --git a/tasks/main.yml b/tasks/main.yml index c0f28f9..b92576d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -81,4 +81,15 @@ mode: 0644 when: xymon_plug_manage notify: restart xymon-client service + +- name: PLUGIN libs whitelist + template: + src: 'etc/xymon/libs.local.yaml.j2' + dest: '/etc/xymon/libs.local.yaml' + owner: root + group: root + mode: 0644 + when: xymon_plug_manage + notify: restart xymon-client service + # }}} diff --git a/templates/etc/xymon/libs.local.yaml.j2 b/templates/etc/xymon/libs.local.yaml.j2 new file mode 100644 index 0000000..6f42ce9 --- /dev/null +++ b/templates/etc/xymon/libs.local.yaml.j2 @@ -0,0 +1,15 @@ +# {{ ansible_managed }} +{% set inputmerged = xymon_plug_libs_default_whitelist.copy() %} +{% set _ = inputmerged.update(xymon_plug_libs_group_whitelist) %} +{% set _ = inputmerged.update(xymon_plug_libs_host_whitelist) %} +--- +whitelist: +{% for group, rules in inputmerged|dictsort %} + {{ group }}: +{% if not rules %} +# (none) +{% endif %} +{% for rule in rules %} + - '{{ rule }}' +{% endfor %} +{% endfor %}