From 1c0157dd68f65f29a8216b9eb64c08033d431127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 2 Nov 2020 18:04:12 +0100 Subject: [PATCH] Add megaraid probe management --- CHANGELOG.md | 1 + README.md | 18 +++++++++++++ defaults/main.yml | 8 ++++++ tasks/main.yml | 25 +++++++++++++++++++ .../etc/xymon/clientlaunch.d/megaraid.cfg.j2 | 9 +++++++ 5 files changed, 61 insertions(+) create mode 100644 templates/etc/xymon/clientlaunch.d/megaraid.cfg.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c29394..4600cb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v1.5.2 ### Enhancements +* Add megaraid probe management. * Add net probe management. * Add configuration file for `net` script (/etc/xymon/net.yaml) and possibility to set your own template. Check [net documentation](net plugin doc). diff --git a/README.md b/README.md index 43075de..d7b53b8 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,22 @@ processes with upgraded libraries. * **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. +#### Net + +Require hobbit-plugins > 20200525. + +Variables for the Megaraid plugin from hobbit-plugins. The plugin check +hardware raid status with Megacli tools [from hwraid.le-vert](url hwraid). +You will need to install `megaclisas-status` by your own to get this plugin +running correctly. Please take a look to the [Readme](megaraid plugin doc) of +the project for more informations. + +* **xymon_cli__plug_megaraid_state** : The state of plugin `megaraid` [default : `false`]. +* **xymon_cli__plug_megaraid_package** : The packages to install to provide `megaraid` plugin [default : `[ 'libipc-run-perl' ]`]. +* **xymon_cli__plug_megaraid_path** : Configuration file for the `megaraid` plugin [default : `/etc/xymon/clientlaunch.d/megaraid.cfg`]. +* **xymon_cli__plug_megaraid_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/megaraid.cfg.j2`]. +* **xymon_cli__plug_megaraid_interval** : Time between each run of the `megaraid` plugin [default : `5m`]. + #### Mq Variables for the Mq plugin from hobbit-plugins. The plugin check Postfix's @@ -259,6 +275,8 @@ Jérémy Gardais [wtfpl website]: http://www.wtfpl.net/about/ [ipr website]: https://ipr.univ-rennes1.fr/ +[url hwraid]: https://hwraid.le-vert.net/wiki/DebianPackages +[megaraid plugin doc]: https://salsa.debian.org/debian/hobbit-plugins#megaraid-check-state-of-lsi-megaraid-sas-controllers [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 diff --git a/defaults/main.yml b/defaults/main.yml index 87a106c..d83883d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -98,6 +98,14 @@ xymon_plug_libs_group_whitelist: {} xymon_plug_libs_host_whitelist: {} # ]]] +## Plugin Megaraid [[[ +xymon_cli__plug_megaraid_state: false +xymon_cli__plug_megaraid_package: [ 'libipc-run-perl' ] +xymon_cli__plug_megaraid_path: '/etc/xymon/clientlaunch.d/megaraid.cfg' +xymon_cli__plug_megaraid_tpl: 'etc/xymon/clientlaunch.d/megaraid.cfg.j2' +xymon_cli__plug_megaraid_interval: '5m' +# +## ]]] ## Plugin mq [[[ xymon_plug_mq_state: true xymon_plug_mq_package: ['libtimedate-perl'] diff --git a/tasks/main.yml b/tasks/main.yml index 0b4df47..55f48e3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -147,6 +147,31 @@ xymon_plug_manage|bool) notify: restart xymon-client service +# Manage megaraid plugin [[[1 +- name: PLUGIN megaraid packages + package: + name: '{{ item }}' + state: 'present' + with_items: + - '{{ xymon_cli__plug_megaraid_package | to_nice_json }}' + register: megaraid_plug_result + until: megaraid_plug_result is success + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool and + xymon_cli__plug_megaraid_state|bool) + notify: restart xymon-client service + +- name: PLUGIN megaraid + template: + src: '{{ xymon_cli__plug_megaraid_tpl }}' + dest: '{{ xymon_cli__plug_megaraid_path }}' + owner: root + group: root + mode: 0644 + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool) + notify: restart xymon-client service + # Manage mq plugin [[[1 - name: PLUGIN mq packages package: diff --git a/templates/etc/xymon/clientlaunch.d/megaraid.cfg.j2 b/templates/etc/xymon/clientlaunch.d/megaraid.cfg.j2 new file mode 100644 index 0000000..4af3a47 --- /dev/null +++ b/templates/etc/xymon/clientlaunch.d/megaraid.cfg.j2 @@ -0,0 +1,9 @@ +# Requires megaclisas-status package from https://hwraid.le-vert.net/wiki/DebianPackages +[megaraid] + # {{ ansible_managed }} + ## From ipr-cnrs.xymon role + {{ '#DISABLED' if xymon_cli__plug_megaraid_state else 'DISABLED' }} + ENVFILE /etc/xymon/xymonclient.cfg + CMD /usr/bin/xynagios --test=megaraid -- sudo megaclisas-status --nagios + LOGFILE /var/log/xymon/xymonclient.log + INTERVAL 5m