From dacdd47d9f88987ab08b24bff7f03d311a620246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 29 Oct 2020 17:52:19 +0100 Subject: [PATCH] Add net probe management --- CHANGELOG.md | 5 ++++ README.md | 13 ++++++++++ defaults/main.yml | 7 ++++++ tasks/main.yml | 25 +++++++++++++++++++ templates/etc/xymon/clientlaunch.d/net.cfg.j2 | 8 ++++++ 5 files changed, 58 insertions(+) create mode 100644 templates/etc/xymon/clientlaunch.d/net.cfg.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index f0e06b4..54bc9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v1.X.Y + +### Enhancements +* Add net probe management. + ## v1.5.1 ### Enhancements diff --git a/README.md b/README.md index a958cb8..721c986 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,18 @@ mail queue. * **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`]. +#### Net + +Variables for the Net plugin from hobbit-plugins. The plugin check network +interface states. Check the [Readme](net plugin doc) of the project for more +informations. + +* **xymon_cli__plug_net_state** : The state of plugin `net` [default : `false`]. +* **xymon_cli__plug_net_package** : The packages to install to provide `net` plugin [default : `[ 'ethtool', 'iproute2', 'libfile-slurp-perl', 'libfile-which-perl', 'libipc-run-perl', 'libyaml-tiny-perl' ]`]. +* **xymon_cli__plug_net_path** : Configuration file for the `net` plugin [default : `/etc/xymon/clientlaunch.d/net.cfg`]. +* **xymon_cli__plug_net_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/net.cfg.j2`]. +* **xymon_cli__plug_net_interval** : Time between each run of the `net` plugin [default : `5m`]. + #### Netstats Variables for the Net/Netstats plugin from hobbit-plugins. The plugin check @@ -240,6 +252,7 @@ Jérémy Gardais [wtfpl website]: http://www.wtfpl.net/about/ [ipr website]: https://ipr.univ-rennes1.fr/ +[net plugin doc]: https://salsa.debian.org/debian/hobbit-plugins#net-check-network-interface-states [sge plugin source]: https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/sge.sh [smartoverall plugin source]: https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/smartoverall [smart plugin source]: https://github.com/skazi0/xymon-plugins diff --git a/defaults/main.yml b/defaults/main.yml index 648aded..729d25f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -105,6 +105,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 net [[[ +xymon_cli__plug_net_state: false +xymon_cli__plug_net_package: [ 'ethtool', 'iproute2', 'libfile-slurp-perl', 'libfile-which-perl', 'libipc-run-perl', 'libyaml-tiny-perl' ] +xymon_cli__plug_net_path: '/etc/xymon/clientlaunch.d/net.cfg' +xymon_cli__plug_net_tpl: 'etc/xymon/clientlaunch.d/net.cfg.j2' +xymon_cli__plug_net_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' ] diff --git a/tasks/main.yml b/tasks/main.yml index b9bec2a..94202b0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -172,6 +172,31 @@ xymon_plug_manage|bool) notify: restart xymon-client service +# Manage net plugin [[[1 +- name: PLUGIN net packages + package: + name: '{{ item }}' + state: 'present' + with_items: + - '{{ xymon_cli__plug_net_package | to_nice_json }}' + register: net_plug_result + until: net_plug_result is success + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool and + xymon_cli__plug_net_state|bool) + notify: restart xymon-client service + +- name: PLUGIN net + template: + src: '{{ xymon_cli__plug_net_tpl }}' + dest: '{{ xymon_cli__plug_net_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: diff --git a/templates/etc/xymon/clientlaunch.d/net.cfg.j2 b/templates/etc/xymon/clientlaunch.d/net.cfg.j2 new file mode 100644 index 0000000..fa6f2cf --- /dev/null +++ b/templates/etc/xymon/clientlaunch.d/net.cfg.j2 @@ -0,0 +1,8 @@ +[net] + # {{ ansible_managed }} + ## From ipr-cnrs.xymon role + {{ '#DISABLED' if xymon_cli__plug_net_state else 'DISABLED' }} + ENVFILE /etc/xymon/xymonclient.cfg + CMD $XYMONCLIENTHOME/ext/net + LOGFILE /var/log/xymon/xymonclient.log + INTERVAL {{ xymon_cli__plug_net_interval }}