Compare commits

..

No commits in common. "master" and "v1.3.1" have entirely different histories.

30 changed files with 216 additions and 1587 deletions

View File

@ -1,102 +1,3 @@
## v2.3.0
### Enhancements
* Add variable/template to fix **kern**'s probe related message on Ubuntu
(`Can't check kernel version!`)
* See : https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725/comments/35
## v2.2.0
### Enhancements
* Use **comment** filter for ansible_managed, to allow multi-lines.
* Update SSSD path for libs white list.
## v2.1.0
### Enhancements
* Add new kern probe management.
* Update dependencies for libs probe after hobbit-plugins 20230301 upgrade
### Removed
* Remove hddtemp dependency. Package is no longer available in Debian Bookworm
and replaced by **drivetemp** kernel module (working since Debian Bullseye).
## v2.0.3
### Fix
* Use flatten to manage packages list.
* Prefix module with "ansible.builtin.".
### Enhancements
* Works with Debian Bullseye
## v2.0.2
### Fix
* Prefix **net** probe command with **sudo** (required for some interfaces).
## v2.0.1
### Fix
* Correct the path for ZFS probe.
## v2.0.0
### Enhancements
* All vars now starts with "xymon_cli__" for more readability.
No backward compatibility with old variable naming! Update your configuration!
* Add megaraid probe management.
* Add net probe management.
* Add ntpq 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).
* Remove unecessary netstats dependencies (due to a previous misunderstanding)
between `net` and `netstats` probes. `netstats` only
reads /proc/net/{netstat,snmp} files.
* Combine packages vars of all enabled plugins to install them in _one_ task.
* Combine clientlaunch files for plugins to manage them in _one_ dedicated task.
* Split base package list in order to allow installation of `xymon-client` without
"hobbit-plugins".
* Add extra var for Nvidia support with temp plugin.
## v1.5.1
### Enhancements
* Add temp probe configuration.
* Add example to enable probes for hardware hosts.
## v1.5.0
### Enhancements
* Possibility to define URLs in order to get the latest version of SMART's scripts.
* Add sge plugin from https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/sge.sh
## v1.4.0
### Enhancements
* Add variables to manage plugin interval.
* Add netstats plugin managment.
* Add smart plugin from https://github.com/skazi0/xymon-plugins
* Add smartoverall plugin from https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/smartoverall
* Add description for plugins.
### Fix
* Don't remove any plugin dependencies cause some plugins might have the same.
Plugin dependencies will only be installed if the plugin is wanted.
* Add missing plugin dependencies.
See [version 20180711][20180711 hobbit-plugins debian changelog]
for libs dependencies for example.
## v1.3.3
### Enhancements
* Use to_nice_json to manage packages list.
## v1.3.2
### Enhancements
* Fix E405 Remote package tasks should have a retry.
## v1.3.1
### Fix
@ -144,6 +45,3 @@
* Manage `xymon-client` service.
* Add possibility to set the value of CLIENTHOSTNAME `xymon-client` value.
* Allow to set Xymon servers list for `xymon-client` config.
[20180711 hobbit-plugins debian changelog]: https://salsa.debian.org/debian/hobbit-plugins/blob/debian-20180711/debian/changelog
[net plugin doc]: https://salsa.debian.org/debian/hobbit-plugins#net-check-network-interface-states

266
README.md
View File

@ -2,7 +2,6 @@
1. [Overview](#overview)
2. [Role Variables](#role-variables)
* [Plugins Specific Variables](#plugins-variables)
* [OS Specific Variables](#os-specific-variables)
3. [Example Playbook](#example-playbook)
4. [Configuration](#configuration)
@ -17,238 +16,48 @@ Manage Xymon (client) installation and configuration.
## Role Variables
* **xymon_cli__manage**: If `xymon-client` should be managed with this role [default: `true`].
* **xymon_cli__pkg_state**: State of new `xymon-client` package(s) [default: `present`].
* **xymon_cli__default_conf_path**: Configuration file for `xymon-client` [default: `/etc/default/xymon-client`].
* **xymon_cli__default_conf_tpl**: Template used to generate the previous config file [default: `etc/default/xymon-client.j2`].
* **xymon_cli__hostname**: Allow to override default value of CLIENTHOSTNAME var [default: `{{ ansible_fqdn }}`].
* **xymon_cli__user_groups**: List of 'xymon' user's groups [default: `xymon`].
* **xymon_cli__service_manage**: If `xymon-client` service should be managed with this role [default: `true`].
* **xymon_cli__service_name**: `xymon-client` service name [default: `xymon-client`].
* **xymon_cli__service_enabled**: Set `xymon-client` service available at startup [default: `true`].
* **xymon_cli__srv_list**: The list of Xymon servers (you must give an hostname, IP,… reachable from any clients) [defaults: `monitoring.{{ ansible_domain }}`].
* **xymon_cli__plug_manage**: If this role should manage plugins configuration [default: `true`].
### Plugins Variables
* **xymon_cli__plug_combined_packages**: Combine all packages vars related to plugins (only enabled plugins).
* **xymon_cli__plug_combined_clientlaunch**: Combine clientlaunch files for all plugins.
#### APT
Variables for the APT plugin from hobbit-plugins. The plugin check for
outstanding updates.
* **xymon_cli__plug_apt_state**: The state of plugin `apt` [default: `true`].
* **xymon_cli__plug_apt_package**: The packages to install to provide `apt` plugin [default: `[ 'libtimedate-perl' ]`].
* **xymon_cli__plug_apt_path**: Configuration file for the `apt` plugin [default: `/etc/xymon/clientlaunch.d/apt.cfg`].
* **xymon_cli__plug_apt_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/apt.cfg.j2`].
* **xymon_cli__plug_apt_interval**: Time between each run of the `apt` plugin [default: `5m`].
* **xymon_cli__plug_apt_default_whitelist**: Default list of allowed packages not installed from repositories [default: `[]`].
* **xymon_cli__plug_apt_whitelist**: All hosts list of allowed packages not installed from repositories [default: `[]`].
* **xymon_cli__plug_apt_group_whitelist**: Group list of allowed packages not installed from repositories [default: `[]`].
* **xymon_cli__plug_apt_host_whitelist**: Host list of allowed packages not installed from repositories [default: `[]`].
#### IPMI
Variables for the IPMI plugin from hobbit-plugins. The plugin read IPMI
sensors and event log.
* **xymon_cli__plug_ipmi_state**: The state of plugin `ipmi` [default: `false`].
* **xymon_cli__plug_ipmi_state**: The packages to install to provide `ipmi` plugin [default: `[ 'ipmitool' ]`].
* **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`].
#### Kern
Variables for the kern plugin from hobbit-plugins. The plugin check for running
outdated running kernel and need for reboot.
* **xymon_cli__plug_kern_state**: The state of plugin `kern` [default: `true`].
* **xymon_cli__plug_kern_package**: The packages to install to provide `kern` plugin [default: `[ 'binutils', 'libfile-slurp-perl', 'libsort-naturally-perl' ]`].
* **xymon_cli__plug_kern_path**: Configuration file for the `kern` plugin [default: `/etc/xymon/clientlaunch.d/kern.cfg`].
* **xymon_cli__plug_kern_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/kern.cfg.j2`].
* **xymon_cli__plug_kern_interval**: Time between each run of the `kern` plugin [default: `5m`].
#### Libs
Variables for the Libs plugin from hobbit-plugins. The plugin check for running
processes with upgraded libraries.
* **xymon_cli__plug_libs_state**: The state of plugin `libs` [default: `true`].
* **xymon_cli__plug_libs_package**: The packages to install to provide `libs` plugin [default: `[ 'lsof', 'sudo', 'libyaml-tiny-perl' ]`].
* **xymon_cli__plug_libs_path**: Configuration file for the `libs` plugin [default: `/etc/xymon/clientlaunch.d/libs.cfg`].
* **xymon_cli__plug_libs_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/libs.cfg.j2`].
* **xymon_cli__plug_libs_interval**: Time between each run of the `libs` plugin [default: `5m`].
* **xymon_cli__plug_libs_default_whitelist**: Default whitelist of processes that should not be monitored with `libs` plugin.
* **xymon_cli__plug_libs_whitelist**: All hosts whitelist of processes that should not be monitored with `libs` plugin.
* **xymon_cli__plug_libs_group_whitelist**: Group whitelist of processes that should not be monitored with `libs` plugin.
* **xymon_cli__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
mail queue.
* **xymon_cli__plug_mq_state**: The state of plugin `mq` [default: `true`].
* **xymon_cli__plug_mq_package**: The packages to install to provide `mq` plugin [default: `[ 'libtimedate-perl' ]`].
* **xymon_cli__plug_mq_path**: Configuration file for the `mq` plugin [default: `/etc/xymon/clientlaunch.d/mq.cfg`].
* **xymon_cli__plug_mq_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/mq.cfg.j2`].
* **xymon_cli__plug_mq_interval**: Time between each run of the `mq` plugin [default: `5m`].
#### Net
Require hobbit-plugins > 20190129.
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`].
* **xymon_cli__plug_net_conf_path**: Configuration file for the `net` script (probe silently exit if not present) [default: `/etc/xymon/net.yaml`].
* **xymon_cli__plug_net_conf_tpl**: Template used to generate the previous config file [default: `etc/xymon/net.yaml.j2`].
You really should consider writing your own template for `net` script,
specific to your host(s) network configuration and override
**xymon_cli__plug_net_conf_tpl** variable.
#### Netstats
Variables for the Netstats plugin from hobbit-plugins. The plugin check
network interface states.
* **xymon_cli__plug_netstats_state**: The state of plugin `netstats` [default: `false`].
* **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`].
#### Ntpq
Variables for the Ntpq plugin from hobbit-plugins. The plugin check
the ntpd daemon synchronization status (needs manual ntp installation).
* **xymon_cli__plug_ntpq_state**: The state of plugin `ntpq` [default: `false`].
* **xymon_cli__plug_ntpq_path**: Configuration file for the `ntpq` plugin [default: `/etc/xymon/clientlaunch.d/ntpq.cfg`].
* **xymon_cli__plug_ntpq_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/ntpq.cfg.j2`].
* **xymon_cli__plug_ntpq_interval**: Time between each run of the `ntpq` plugin [default: `5m`].
#### SGE
Variables for sge plugin from [ipr-cnrs.scripts][sge plugin source].
The plugin check health status for SGE queues and display informations about
SGE jobs and host.
* **xymon_cli__plug_sge_state**: The state of plugin `sge` [default: `False`].
* **xymon_cli__plug_sge_script_path**: Path to the `sge` script [default: `'/usr/lib/xymon/client/ext/sge'`].
* **xymon_cli__plug_sge_script_tpl**: Template used to generate the previous script [default: `'usr/lib/xymon/client/ext/sge.j2'`].
* **xymon_cli__plug_sge_script_url**: Use a remote file to get the previous script instead of a template [default: `''`].
* **xymon_cli__plug_sge_path**: Configuration file for the `sge` plugin [default: `'/etc/xymon/clientlaunch.d/sge.cfg'`].
* **xymon_cli__plug_sge_tpl**: Template used to generate the previous config file [default: `'etc/xymon/clientlaunch.d/sge.cfg.j2'`].
* **xymon_cli__plug_sge_interval**: Time between each run of the `sge` plugin [default: `'10m'`]
#### Smartoverall
Variables for Smartoverall plugin from [ipr-cnrs.scripts][smartoverall plugin source].
The plugin will try to display health status of each disks (with SMART support)
but it can't check that a recent test was successfully done.
This plugin is mostly useful for disks unknown from smartmontools's database.
For more features, see the next Smart plugin.
* **xymon_cli__plug_smartoverall_state**: The state of plugin `smartoverall` [default: `False`].
* **xymon_cli__plug_smartoverall_package**: The packages to install to provide `smartoverall` plugin [default: `[ 'smartmontools' ]`].
* **xymon_cli__plug_smartoverall_script_path**: Path to the `smartoverall` script [default: `'/usr/lib/xymon/client/ext/smartoverall'`].
* **xymon_cli__plug_smartoverall_script_tpl**: Template used to generate the previous script [default: `'usr/lib/xymon/client/ext/smartoverall.j2'`].
* **xymon_cli__plug_smartoverall_script_url**: Use a remote file to get the previous script instead of a template [default: `''`].
* **xymon_cli__plug_smartoverall_path**: Configuration file for the `smartoverall` plugin [default: `'/etc/xymon/clientlaunch.d/smartoverall.cfg'`].
* **xymon_cli__plug_smartoverall_tpl**: Template used to generate the previous config file [default: `'etc/xymon/clientlaunch.d/smartoverall.cfg.j2'`].
* **xymon_cli__plug_smartoverall_interval**: Time between each run of the `smartoverall` plugin [default: `'10m'`]
#### Smart
Variables for Smart plugin from [skazi0 xymon-plugins][smart plugin source].
The plugin check health status for each disks, compare current values with the
one's recommended by the vendor and check a recent (<24h) test was done.
* **xymon_cli__plug_smart_state**: The state of plugin `smart` [default: `False`].
* **xymon_cli__plug_smart_package**: The packages to install to provide `smart` plugin [default: `[ 'smartmontools' ]`].
* **xymon_cli__plug_smart_script_path**: Path to the `smart` script [default: `'/usr/lib/xymon/client/ext/smart'`].
* **xymon_cli__plug_smart_script_tpl**: Template used to generate the previous script [default: `'usr/lib/xymon/client/ext/smart.j2'`].
* **xymon_cli__plug_smart_script_url**: Use a remote file to get the previous script instead of a template [default: `''`].
* **xymon_cli__plug_smart_path**: Configuration file for the `smart` plugin [default: `'/etc/xymon/clientlaunch.d/smart.cfg'`].
* **xymon_cli__plug_smart_tpl**: Template used to generate the previous config file [default: `'etc/xymon/clientlaunch.d/smart.cfg.j2'`].
* **xymon_cli__plug_smart_interval**: Time between each run of the `smart` plugin [default: `'10m'`]
#### Temp
Variables for the temp plugin from hobbit-plugins. Simple temperature monitor.
* **xymon_cli__plug_temp_state**: The state of plugin `temp` [default: `False`].
* **xymon_cli__plug_temp_package**: The packages to install to provide `temp` plugin [default: `[ 'libfile-which-perl', 'libyaml-tiny-perl', 'smartmontools', 'libxml-twig-perl' ]`].
* **xymon_cli__plug_temp_path**: Configuration file for the `temp` plugin [default: `'/etc/xymon/clientlaunch.d/temp.cfg'`].
* **xymon_cli__plug_temp_tpl**: Template used to generate the previous config file [default: `'etc/xymon/clientlaunch.d/temp.cfg.j2'`].
* **xymon_cli__plug_temp_interval**: Time between each run of the `temp` plugin [default: `'5m'`]
##### Nvidia support
The temp plugin can also checks NVidia GPU temperature. In order to get those
informations, you need to install `nvidia-smi` package by your own or define
**xymon_cli__plug_temp_extra_package** var:
``` yml
xymon_cli__plug_temp_extra_package: [ 'nvidia-smi' ]
```
#### ZFS
Variables for ZFS plugin from [Xymonton][zfs plugin source]. The plugin check
health (global and for pools), capacity and snapshot status.
* **xymon_cli_manage**: If `xymon-client` should be managed with this role [default: `true`].
* **xymon_cli_pkg_state**: State of new `xymon-client` package(s) [default: `present`].
* **xymon_cli_default_conf_path**: Configuration file for `xymon-client` [default: `/etc/default/xymon-client`].
* **xymon_cli_default_conf_tpl**: Template used to generate the previous config file [default: `etc/default/xymon-client.j2`].
* **xymon_cli_hostname**: Allow to override default value of CLIENTHOSTNAME var [default: `{{ ansible_fqdn }}`].
* **xymon_user_groups**: List of 'xymon' user's groups [default: `xymon`].
* **xymon_cli_service_manage**: If `xymon-client` service should be managed with this role [default: `true`].
* **xymon_cli_service_name**: `xymon-client` service name [default: `xymon-client`].
* **xymon_cli_service_enabled**: Set `xymon-client` service available at startup [default: `true`].
* **xymon_srv_list**: The list of Xymon servers (you must give an hostname, IP,… reachable from any clients) [defaults: `monitoring.{{ ansible_domain }}`].
* **xymon_plug_manage**: If this role should manage plugins configuration [default: `true`].
* **xymon_plug_apt_state**: The state of plugin `apt` [default: `true`].
* **xymon_plug_apt_package**: The packages to install to provide `apt` plugin [default: `[ 'libtimedate-perl' ]`].
* **xymon_plug_apt_path**: Configuration file for the `apt` plugin [default: `/etc/xymon/clientlaunch.d/apt.cfg`].
* **xymon_plug_apt_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/apt.cfg.j2`].
* **xymon_plug_apt_default_whitelist: Default list of allowed packages not installed from repositories [default: `[]`].
* **xymon_plug_apt_whitelist: All hosts list of allowed packages not installed from repositories [default: `[]`].
* **xymon_plug_apt_group_whitelist: Group list of allowed packages not installed from repositories [default: `[]`].
* **xymon_plug_apt_host_whitelist: Host list of allowed packages not installed from repositories [default: `[]`].
* **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_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`].
* **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_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_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`].
* **xymon_cli__plug_zfs_path**: Configuration file for the `zfs` plugin [default: `/etc/xymon/clientlaunch.d/zfs.cfg`].
* **xymon_cli__plug_zfs_tpl**: Template used to generate the previous config file [default: `etc/xymon/clientlaunch.d/zfs.cfg.j2`].
* **xymon_cli__plug_zfs_interval**: Time between each run of the `zfs` plugin [default: `5m`].
#### Automatically enable some probes
It can be useful to automatically enable some probes according to the type of
servers:
* Enable temp probe on hardware hosts (also useful for Smartoverall and Smart):
``` yml
xymon_cli__plug_temp_state: '{{ True
if (ansible_virtualization_role == "host")
else False }}'
```
### OS Specific Variables
Please see default value by Operating System file in [vars][vars directory] directory.
* **xymon_cli__pkg_list**: The list of packages to install to provide `xymon-client`.
* **xymon_cli__plug_pkg_list**: The list of packages to install to provide extra plugins to Xymon client.
* **xymon_cli_pkg_list**: The list of packages to install to provide `xymon-client`.
## Example Playbook
@ -271,7 +80,6 @@ This role will:
Some plugins and options can be managed with this role:
* apt: Check state of packages and repositories.
* kern: Check for outdated running kernel and need for reboot.
* libs: Check for running processes with upgraded libraries.
* mq: Check mail queue.
* zfs: Check ZFS pools status.
@ -296,15 +104,7 @@ Jérémy Gardais
[vars directory]: ./vars
[gogs to github hook]: https://stackoverflow.com/a/21998477
[xymon source]: https://git.ipr.univ-rennes.fr/cellinfo/ansible.xymon
[xymon source]: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.xymon
[xymon github]: https://github.com/ipr-cnrs/xymon
[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-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/sge.sh
[smartoverall plugin source]: https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/smartoverall
[smart plugin source]: https://github.com/skazi0/xymon-plugins
[zfs plugin source]: https://wiki.xymonton.org/doku.php/monitors:bb-zfs

View File

@ -7,12 +7,12 @@
# Packages and installation [[[
# -----------------------------
# .. envvar:: xymon_cli__manage [[[
# .. envvar:: xymon_cli_manage [[[
#
# If this role should manage the installation of Xymon client
xymon_cli__manage: true
xymon_cli_manage: true
# ]]]
# .. envvar:: xymon_cli__pkg_state [[[
# .. envvar:: xymon_cli_pkg_state [[[
#
# What is the desired state which this role's packages should be?
# Possible options:
@ -23,190 +23,76 @@ xymon_cli__manage: true
# ``absent``
# Ensure to remove the packages.
#
xymon_cli__pkg_state: 'present'
xymon_cli_pkg_state: 'present'
# ]]]
# ]]]
# Server configuration and service [[[
# ------------------------------------
## conf
xymon_cli__default_conf_path: '/etc/default/xymon-client'
xymon_cli__default_conf_tpl: 'etc/default/xymon-client.j2'
xymon_cli__hostname: "{{ ansible_fqdn }}"
xymon_cli__user_groups: 'xymon'
xymon_cli_default_conf_path: '/etc/default/xymon-client'
xymon_cli_default_conf_tpl: 'etc/default/xymon-client.j2'
xymon_cli_hostname: "{{ ansible_fqdn }}"
xymon_user_groups: 'xymon'
## service
xymon_cli__service_manage: true
xymon_cli__service_name: 'xymon-client'
xymon_cli__service_enabled: true
xymon_cli_service_manage: true
xymon_cli_service_name: 'xymon-client'
xymon_cli_service_enabled: true
# server
xymon_cli__srv_list: "monitoring.{{ ansible_domain }}"
xymon_srv_list: "monitoring.{{ ansible_domain }}"
# ]]]
# Plugins management [[[
# ----------------------
xymon_cli__plug_manage: true
xymon_plug_manage: true
## Plugin apt [[[
xymon_cli__plug_apt_state: true
xymon_cli__plug_apt_package: [ 'aptitude', 'dctrl-tools' ]
xymon_cli__plug_apt_path: '/etc/xymon/clientlaunch.d/apt.cfg'
xymon_cli__plug_apt_tpl: 'etc/xymon/clientlaunch.d/apt.cfg.j2'
xymon_cli__plug_apt_interval: '5m'
xymon_cli__plug_apt_default_whitelist: []
xymon_cli__plug_apt_whitelist: []
xymon_cli__plug_apt_group_whitelist: []
xymon_cli__plug_apt_host_whitelist: []
xymon_cli__plug_apt_combined_whitelist: '{{ xymon_cli__plug_apt_default_whitelist
+ xymon_cli__plug_apt_whitelist
+ xymon_cli__plug_apt_group_whitelist
+ xymon_cli__plug_apt_host_whitelist }}'
xymon_plug_apt_state: true
xymon_plug_apt_package: ['dctrl-tools']
xymon_plug_apt_path: '/etc/xymon/clientlaunch.d/apt.cfg'
xymon_plug_apt_tpl: 'etc/xymon/clientlaunch.d/apt.cfg.j2'
xymon_plug_apt_default_whitelist: []
xymon_plug_apt_whitelist: []
xymon_plug_apt_group_whitelist: []
xymon_plug_apt_host_whitelist: []
xymon_plug_apt_combined_whitelist: '{{ xymon_plug_apt_default_whitelist
+ xymon_plug_apt_whitelist
+ xymon_plug_apt_group_whitelist
+ xymon_plug_apt_host_whitelist }}'
## ]]]
## Plugin 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'
## ]]]
## Plugin ipmi [[[
xymon_cli__plug_ipmi_state: false
xymon_cli__plug_ipmi_package: ['ipmitool']
xymon_cli__plug_ipmi_path: '/etc/xymon/clientlaunch.d/ipmi.cfg'
xymon_cli__plug_ipmi_tpl: 'etc/xymon/clientlaunch.d/ipmi.cfg.j2'
xymon_cli__plug_ipmi_interval: '5m'
## ]]]
## Plugin kern [[[
xymon_cli__plug_kern_state: true
xymon_cli__plug_kern_package: [ 'binutils', 'libfile-slurp-perl', 'libsort-naturally-perl' ]
xymon_cli__plug_kern_path: '/etc/xymon/clientlaunch.d/kern.cfg'
xymon_cli__plug_kern_tpl: 'etc/xymon/clientlaunch.d/kern.cfg.j2'
xymon_cli__plug_kern_interval: '5m'
### Related to "Ubuntu - Can't check kernel version" warning message
### See : https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725/comments/35
xymon_cli__plug_kern_fix: '{{ True if (ansible_distribution == "Ubuntu")
else False }}'
xymon_cli__plug_kern_fix_path: '/etc/kernel/postinst.d/statoverride'
xymon_cli__plug_kern_fix_tpl: 'etc/kernel/postinst.d/statoverride.j2'
# ]]]
## Plugin libs [[[
xymon_cli__plug_libs_state: true
xymon_cli__plug_libs_package: [ 'lsof', 'sudo', 'libyaml-tiny-perl' ]
xymon_cli__plug_libs_path: '/etc/xymon/clientlaunch.d/libs.cfg'
xymon_cli__plug_libs_tpl: 'etc/xymon/clientlaunch.d/libs.cfg.j2'
xymon_cli__plug_libs_interval: '5m'
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_cli__plug_libs_default_whitelist:
xymon_plug_libs_default_whitelist:
/lib/systemd/systemd:
- '.*'
/usr/libexec/sssd/sssd_autofs:
- '.*'
/usr/libexec/sssd/sssd_be:
- '.*'
/usr/libexec/sssd/sssd_nss:
- '.*'
/usr/libexec/sssd/sssd_pac:
- '.*'
/usr/libexec/sssd/sssd_pam:
- '.*'
/usr/libexec/sssd/sssd_ssh:
- '.*'
/usr/libexec/sssd/sssd_sudo:
/usr/lib/x86_64-linux-gnu/sssd/sssd_be:
- '.*'
/usr/sbin/sssd:
- '.*'
/sbin/multipathd:
- '.*'
xymon_cli__plug_libs_whitelist: {}
xymon_cli__plug_libs_group_whitelist: {}
xymon_cli__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_cli__plug_mq_state: true
xymon_cli__plug_mq_package: ['libtimedate-perl']
xymon_cli__plug_mq_path: '/etc/xymon/clientlaunch.d/mq.cfg'
xymon_cli__plug_mq_tpl: 'etc/xymon/clientlaunch.d/mq.cfg.j2'
xymon_cli__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'
xymon_cli__plug_net_conf_path: '/etc/xymon/net.yaml'
xymon_cli__plug_net_conf_tpl: 'etc/xymon/net.yaml.j2'
## ]]]
## Plugin netstats [[[
xymon_cli__plug_netstats_state: false
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 ntpq [[[
xymon_cli__plug_ntpq_state: true
xymon_cli__plug_ntpq_path: '/etc/xymon/clientlaunch.d/ntpq.cfg'
xymon_cli__plug_ntpq_tpl: 'etc/xymon/clientlaunch.d/ntpq.cfg.j2'
xymon_cli__plug_ntpq_interval: '5m'
## ]]]
## Plugin SGE [[[
### From https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/sge.sh
xymon_cli__plug_sge_state: False
xymon_cli__plug_sge_script_path: '/usr/lib/xymon/client/ext/sge.sh'
xymon_cli__plug_sge_script_tpl: 'usr/lib/xymon/client/ext/sge.sh.j2'
xymon_cli__plug_sge_script_url: ''
xymon_cli__plug_sge_path: '/etc/xymon/clientlaunch.d/sge.cfg'
xymon_cli__plug_sge_tpl: 'etc/xymon/clientlaunch.d/sge.cfg.j2'
xymon_cli__plug_sge_interval: '5m'
# ]]]
## Plugin smartoverall [[[
### From https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/smartoverall
### And based on https://www.xymon.com/xymon-cgi/viewconf.sh?smart
### Mostly for disks unknown from smartmontools's database
xymon_cli__plug_smartoverall_state: False
xymon_cli__plug_smartoverall_package: [ 'smartmontools' ]
xymon_cli__plug_smartoverall_script_path: '/usr/lib/xymon/client/ext/smartoverall'
xymon_cli__plug_smartoverall_script_tpl: 'usr/lib/xymon/client/ext/smartoverall.j2'
xymon_cli__plug_smartoverall_script_url: ''
xymon_cli__plug_smartoverall_path: '/etc/xymon/clientlaunch.d/smartoverall.cfg'
xymon_cli__plug_smartoverall_tpl: 'etc/xymon/clientlaunch.d/smartoverall.cfg.j2'
xymon_cli__plug_smartoverall_interval: '10m'
# ]]]
## Plugin smart [[[
### From https://github.com/skazi0/xymon-plugins
xymon_cli__plug_smart_state: False
xymon_cli__plug_smart_package: [ 'smartmontools' ]
xymon_cli__plug_smart_script_path: '/usr/lib/xymon/client/ext/smart'
xymon_cli__plug_smart_script_tpl: 'usr/lib/xymon/client/ext/smart.j2'
xymon_cli__plug_smart_script_url: ''
xymon_cli__plug_smart_path: '/etc/xymon/clientlaunch.d/smart.cfg'
xymon_cli__plug_smart_tpl: 'etc/xymon/clientlaunch.d/smart.cfg.j2'
xymon_cli__plug_smart_interval: '10m'
# ]]]
## Plugin temp [[[
### Enable by default on hardware host
xymon_cli__plug_temp_state: False
xymon_cli__plug_temp_package: [ 'libfile-which-perl', 'libyaml-tiny-perl', 'smartmontools', 'libxml-twig-perl' ]
# Define xymon_cli__plug_temp_extra_package in your own inventory.
# See Nvidia support in README for more informations
#xymon_cli__plug_temp_extra_package: [ 'nvidia-smi' ]
xymon_cli__plug_temp_path: '/etc/xymon/clientlaunch.d/temp.cfg'
xymon_cli__plug_temp_tpl: 'etc/xymon/clientlaunch.d/temp.cfg.j2'
xymon_cli__plug_temp_interval: '5m'
xymon_plug_libs_whitelist: {}
xymon_plug_libs_group_whitelist: {}
xymon_plug_libs_host_whitelist: {}
# ]]]
## Plugin zfs [[[
@ -215,75 +101,6 @@ xymon_cli__plug_zfs_script_path: '/usr/lib/xymon/client/ext/zfs'
xymon_cli__plug_zfs_script_tpl: 'usr/lib/xymon/client/ext/zfs.j2'
xymon_cli__plug_zfs_path: '/etc/xymon/clientlaunch.d/zfs.cfg'
xymon_cli__plug_zfs_tpl: 'etc/xymon/clientlaunch.d/zfs.cfg.j2'
xymon_cli__plug_zfs_interval: '5m'
# ]]]
# .. envvar:: xymon_cli__plug_combined_packages [[[
#
# Combine all packages vars related to plugins (only enabled plugins).
#
xymon_cli__plug_combined_packages: '{{ ((xymon_cli__plug_pkg_list|d([]) if xymon_cli__plug_manage|bool else [])
+ (xymon_cli__plug_apt_package if xymon_cli__plug_apt_state|bool else [])
+ (xymon_cli__plug_ipmi_package if xymon_cli__plug_ipmi_state|bool else [])
+ (xymon_cli__plug_kern_package if xymon_cli__plug_kern_state|bool else [])
+ (xymon_cli__plug_libs_package if xymon_cli__plug_libs_state|bool else [])
+ (xymon_cli__plug_megaraid_package if xymon_cli__plug_megaraid_state|bool else [])
+ (xymon_cli__plug_mq_package if xymon_cli__plug_mq_state|bool else [])
+ (xymon_cli__plug_net_package if xymon_cli__plug_net_state|bool else [])
+ (xymon_cli__plug_smartoverall_package if xymon_cli__plug_smartoverall_state|bool else [])
+ (xymon_cli__plug_smart_package if xymon_cli__plug_smart_state|bool else [])
+ (xymon_cli__plug_temp_package if xymon_cli__plug_temp_state|bool else [])
+ (xymon_cli__plug_temp_extra_package|d([]) if xymon_cli__plug_temp_state|bool else []))
| sort | unique }}'
# ]]]
# .. envvar:: xymon_cli__plug_combined_clientlaunch [[[
#
# Combine clientlaunch files for all plugins
#
xymon_cli__plug_combined_clientlaunch:
- name: apt
path: '{{ xymon_cli__plug_apt_path }}'
template: '{{ xymon_cli__plug_apt_tpl }}'
- name: ipmi
path: '{{ xymon_cli__plug_ipmi_path }}'
template: '{{ xymon_cli__plug_ipmi_tpl }}'
- name: kern
path: '{{ xymon_cli__plug_kern_path }}'
template: '{{ xymon_cli__plug_kern_tpl }}'
- name: libs
path: '{{ xymon_cli__plug_libs_path }}'
template: '{{ xymon_cli__plug_libs_tpl }}'
- name: megaraid
path: '{{ xymon_cli__plug_megaraid_path }}'
template: '{{ xymon_cli__plug_megaraid_tpl }}'
- name: mq
path: '{{ xymon_cli__plug_mq_path }}'
template: '{{ xymon_cli__plug_mq_tpl }}'
- name: net
path: '{{ xymon_cli__plug_net_path }}'
template: '{{ xymon_cli__plug_net_tpl }}'
- name: netstats
path: '{{ xymon_cli__plug_netstats_path }}'
template: '{{ xymon_cli__plug_netstats_tpl }}'
- name: ntpq
path: '{{ xymon_cli__plug_ntpq_path }}'
template: '{{ xymon_cli__plug_ntpq_tpl }}'
- name: sge
path: '{{ xymon_cli__plug_sge_path }}'
template: '{{ xymon_cli__plug_sge_tpl }}'
- name: smartoverall
path: '{{ xymon_cli__plug_smartoverall_path }}'
template: '{{ xymon_cli__plug_smartoverall_tpl }}'
- name: smart
path: '{{ xymon_cli__plug_smart_path }}'
template: '{{ xymon_cli__plug_smart_tpl }}'
- name: temp
path: '{{ xymon_cli__plug_temp_path }}'
template: '{{ xymon_cli__plug_temp_tpl }}'
- name: zfs
path: '{{ xymon_cli__plug_zfs_path }}'
template: '{{ xymon_cli__plug_zfs_tpl }}'
# ]]]

View File

@ -1,5 +1,5 @@
---
# handlers file for ipr.ansible.xymon
- name: restart xymon-client service
service: name={{ xymon_cli__service_name }} state=restarted
when: xymon_cli__service_manage
service: name={{ xymon_cli_service_name }} state=restarted
when: xymon_cli_service_manage

View File

@ -7,13 +7,11 @@ galaxy_info:
description: "Manage Xymon configuration"
license: WTFPL
company: IPR
issue_tracker_url: https://git.ipr.univ-rennes.fr/cellinfo/ansible.xymon/issues
min_ansible_version: 2.7
issue_tracker_url: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.xymon/issues
min_ansible_version: 2.2
platforms:
- name: Debian
versions:
- buster
- bullseye
- stretch
galaxy_tags:
- system

View File

@ -4,7 +4,7 @@
# tasks file for ipr.ansible.xymon
- name: Load specific OS vars for xymon
ansible.builtin.include_vars: "{{ item }}"
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution|lower }}.yml"
@ -12,199 +12,171 @@
# Manage required client packages [[[1
- name: client package
ansible.builtin.package:
name: '{{ xymon_cli__pkg_list | flatten }}'
state: '{{ xymon_cli__pkg_state }}'
register: cli_result
until: cli_result is success
when: xymon_cli__manage|bool
package:
name: '{{ item }}'
state: '{{ xymon_cli_pkg_state }}'
with_items:
- '{{ xymon_cli_pkg_list }}'
when: xymon_cli_manage|bool
# Manage client configuration [[[1
- name: CONFIG xymon-client service
ansible.builtin.template:
src: '{{ xymon_cli__default_conf_tpl }}'
dest: '{{ xymon_cli__default_conf_path }}'
template:
src: '{{ xymon_cli_default_conf_tpl }}'
dest: '{{ xymon_cli_default_conf_path }}'
owner: root
group: root
mode: 0644
backup: true
when: xymon_cli__manage|bool
when: xymon_cli_manage|bool
notify: restart xymon-client service
- name: CONFIG xymon user's groups
ansible.builtin.user:
user:
name: xymon
groups: '{{ xymon_cli__user_groups }}'
groups: '{{ xymon_user_groups }}'
append: true
when: xymon_cli__manage|bool
when: xymon_cli_manage|bool
notify: restart xymon-client service
# Manage service [[[1
- name: SERVICE manage '{{ xymon_cli__service_name }}'
ansible.builtin.service:
name: '{{ xymon_cli__service_name }}'
- name: SERVICE manage '{{ xymon_cli_service_name }}'
service:
name: '{{ xymon_cli_service_name }}'
state: started
enabled: '{{ xymon_cli__service_enabled }}'
when: (xymon_cli__manage|bool and
xymon_cli__service_manage|bool)
enabled: '{{ xymon_cli_service_enabled }}'
when: (xymon_cli_manage|bool and
xymon_cli_service_manage|bool)
# Manage all plugins's packages [[[1
- name: PLUGINS package and dependencies
ansible.builtin.package:
name: '{{ xymon_cli__plug_combined_packages | flatten }}'
state: 'present'
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
register: combined_packages_plug_result
until: combined_packages_plug_result is success
# Manage apt plugin [[[1
- name: PLUGIN apt packages
package:
name: '{{ item }}'
state: '{{ "present" if xymon_plug_apt_state else "absent" }}'
with_items:
- '{{ xymon_plug_apt_package }}'
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
# Manage plugins clientlaunch files [[[1
- name: PLUGINS clientlaunch files
ansible.builtin.template:
src: '{{ item.template }}'
dest: '{{ item.path }}'
- name: PLUGIN apt
template:
src: '{{ xymon_plug_apt_tpl }}'
dest: '{{ xymon_plug_apt_path }}'
owner: root
group: root
mode: 0644
with_items:
- '{{ xymon_cli__plug_combined_clientlaunch }}'
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
# Manage apt plugin [[[1
- name: PLUGIN apt no_repo_accept whitelist
ansible.builtin.template:
template:
src: 'etc/xymon/apt_no_repo_accept.j2'
dest: '/etc/xymon/apt_no_repo_accept'
owner: root
group: root
mode: 0644
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
when: (xymon_cli_manage|bool and
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 }}'
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:
name: '{{ item }}'
state: '{{ "present" if xymon_cli__plug_ipmi_state else "absent" }}'
with_items:
- '{{ xymon_cli__plug_ipmi_package }}'
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN ipmi
template:
src: '{{ xymon_cli__plug_ipmi_tpl }}'
dest: '{{ xymon_cli__plug_ipmi_path }}'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
# Manage libs plugin [[[1
- name: PLUGIN libs packages
package:
name: '{{ item }}'
state: '{{ "present" if xymon_plug_libs_state else "absent" }}'
with_items:
- '{{ xymon_plug_libs_package }}'
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN libs
template:
src: '{{ xymon_plug_libs_tpl }}'
dest: '{{ xymon_plug_libs_path }}'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN libs whitelist
ansible.builtin.template:
template:
src: 'etc/xymon/libs.local.yaml.j2'
dest: '/etc/xymon/libs.local.yaml'
owner: root
group: root
mode: 0644
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
notify: restart xymon-client service
# Manage kern plugin [[[1
- name: PLUGIN kern workaround
ansible.builtin.template:
src: '{{ xymon_cli__plug_kern_fix_tpl }}'
dest: '{{ xymon_cli__plug_kern_fix_path }}'
owner: root
group: root
mode: 0754
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_kern_fix|bool)
notify: restart xymon-client service
# Manage net plugin [[[1
- name: PLUGIN net config template
ansible.builtin.template:
src: '{{ xymon_cli__plug_net_conf_tpl }}'
dest: '{{ xymon_cli__plug_net_conf_path }}'
owner: root
group: root
mode: 0644
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
notify: restart xymon-client service
# Manage sge plugin [[[1
- name: PLUGIN sge script file from template
ansible.builtin.template:
src: '{{ xymon_cli__plug_sge_script_tpl }}'
dest: '{{ xymon_cli__plug_sge_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_sge_script_url|length == 0 )
notify: restart xymon-client service
- name: PLUGIN sge script file from URL
ansible.builtin.get_url:
url: '{{ xymon_cli__plug_sge_script_url }}'
dest: '{{ xymon_cli__plug_sge_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_sge_script_url|length > 0 )
notify: restart xymon-client service
# Manage smartoverall plugin [[[1
- name: PLUGIN smartoverall script file from template
ansible.builtin.template:
src: '{{ xymon_cli__plug_smartoverall_script_tpl }}'
dest: '{{ xymon_cli__plug_smartoverall_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smartoverall_script_url|length == 0 )
notify: restart xymon-client service
- name: PLUGIN smartoverall script file from URL
ansible.builtin.get_url:
url: '{{ xymon_cli__plug_smartoverall_script_url }}'
dest: '{{ xymon_cli__plug_smartoverall_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smartoverall_script_url|length > 0 )
notify: restart xymon-client service
# Manage smart plugin [[[1
- name: PLUGIN smart script file from template
ansible.builtin.template:
src: '{{ xymon_cli__plug_smart_script_tpl }}'
dest: '{{ xymon_cli__plug_smart_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smart_script_url|length == 0 )
notify: restart xymon-client service
- name: PLUGIN smart script file from URL
ansible.builtin.get_url:
url: '{{ xymon_cli__plug_smart_script_url }}'
dest: '{{ xymon_cli__plug_smart_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smart_script_url|length > 0 )
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:
src: '{{ xymon_cli__plug_zfs_tpl }}'
dest: '{{ xymon_cli__plug_zfs_path }}'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN zfs script file
ansible.builtin.template:
template:
src: '{{ xymon_cli__plug_zfs_script_tpl }}'
dest: '{{ xymon_cli__plug_zfs_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service

View File

@ -1,6 +1,3 @@
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
# Configure the Xymon client settings.
# You MUST set the list of Xymon servers that this
@ -13,7 +10,7 @@
# or (multiple servers)
# XYMONSERVERS="10.0.0.1 192.168.1.1"
XYMONSERVERS="{{ xymon_cli__srv_list }}"
XYMONSERVERS="{{ xymon_srv_list }}"
# The defaults usually suffice for the rest of this file,
# but you can tweak the hostname that the client reports
@ -23,7 +20,7 @@ XYMONSERVERS="{{ xymon_cli__srv_list }}"
# CLIENTHOSTNAME=""
# CLIENTOS="rhel3"
CLIENTHOSTNAME="{{ xymon_cli__hostname }}"
CLIENTHOSTNAME="{{ xymon_cli_hostname }}"
# Optionally mount a tmpfs on /var/lib/xymon/tmp. On client systems this has
# the advantage that client reports will continue to work even if the /var

View File

@ -1,18 +0,0 @@
#!/bin/sh
{# Use | comment to manage multilines #}
# {{ ansible_managed | comment }}
# Ansible template : {{ template_path }}
#
# Allow to fix the warning :
# "Kernel image /boot/vmlinuz… unreadable. Can't check kernel version!"
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
# See comment #34 - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725/comments/34
set -e
version="$1"
if [ -z "$version" ]; then
exit 0
fi
exec dpkg-statoverride --force-statoverride-add --update --add root root 0644 "/boot/vmlinuz-${version}"

View File

@ -1,5 +1,4 @@
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{% for package in xymon_cli__plug_apt_combined_whitelist %}
# {{ ansible_managed }}
{% for package in xymon_plug_apt_combined_whitelist %}
{{ package }}
{% endfor %}

View File

@ -1,8 +1,6 @@
[apt]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_apt_state else 'DISABLED' }}
{{ '#DISABLED' if xymon_plug_apt_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/apt
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_apt_interval }}
INTERVAL 5m

View File

@ -1,8 +1,6 @@
[ipmi]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_ipmi_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD /usr/bin/sudo -E -u root $XYMONCLIENTHOME/ext/ipmi
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_ipmi_interval }}
INTERVAL 5m

View File

@ -1,8 +0,0 @@
[kern]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_kern_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/kern
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_kern_interval }}

View File

@ -1,8 +1,6 @@
[libs]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_libs_state else 'DISABLED' }}
{{ '#DISABLED' if xymon_plug_libs_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/libs
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_libs_interval }}
INTERVAL 5m

View File

@ -1,9 +0,0 @@
# Requires megaclisas-status package from https://hwraid.le-vert.net/wiki/DebianPackages
[megaraid]
# {{ ansible_managed | comment }}
## 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

View File

@ -1,8 +1,6 @@
[mq]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_mq_state else 'DISABLED' }}
{{ '#DISABLED' if xymon_plug_mq_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/mq
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_mq_interval }}
INTERVAL 5m

View File

@ -1,8 +0,0 @@
[net]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_net_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD /usr/bin/sudo -E -u root $XYMONCLIENTHOME/ext/net
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_net_interval }}

View File

@ -1,8 +0,0 @@
[netstats]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#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 }}

View File

@ -1,8 +0,0 @@
[ntpq]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_ntpq_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/ntpq
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_ntpq_interval }}

View File

@ -1,8 +0,0 @@
[sge]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_sge_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD {{ xymon_cli__plug_sge_script_path }}
LOGFILE /var/log/xymon/sge.log
INTERVAL {{ xymon_cli__plug_sge_interval }}

View File

@ -1,8 +0,0 @@
[smart]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_smart_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD /usr/bin/sudo -E -u root {{ xymon_cli__plug_smart_script_path }}
LOGFILE /var/log/xymon/smart.log
INTERVAL {{ xymon_cli__plug_smart_interval }}

View File

@ -1,8 +0,0 @@
[smartoverall]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_smartoverall_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD /usr/bin/sudo -E -u root {{ xymon_cli__plug_smartoverall_script_path }}
LOGFILE /var/log/xymon/smartoverall.log
INTERVAL {{ xymon_cli__plug_smartoverall_interval }}

View File

@ -1,8 +0,0 @@
[temp]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_temp_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/temp
LOGFILE /var/log/xymon/xymonclient.log
INTERVAL {{ xymon_cli__plug_temp_interval }}

View File

@ -1,8 +1,6 @@
[zfs]
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ '#DISABLED' if xymon_cli__plug_zfs_state else 'DISABLED' }}
ENVFILE /etc/xymon/xymonclient.cfg
CMD /usr/bin/sudo -E -u root $XYMONCLIENTHOME/ext/zfs
LOGFILE /var/log/xymon/zfs.log
INTERVAL {{ xymon_cli__plug_zfs_interval }}
INTERVAL 5m

View File

@ -1,9 +1,8 @@
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{% set inputmerged = xymon_cli__plug_libs_default_whitelist.copy() %}
{% set _ = inputmerged.update(xymon_cli__plug_libs_whitelist) %}
{% set _ = inputmerged.update(xymon_cli__plug_libs_group_whitelist) %}
{% set _ = inputmerged.update(xymon_cli__plug_libs_host_whitelist) %}
# {{ ansible_managed }}
{% set inputmerged = xymon_plug_libs_default_whitelist.copy() %}
{% set _ = inputmerged.update(xymon_plug_libs_whitelist) %}
{% set _ = inputmerged.update(xymon_plug_libs_group_whitelist) %}
{% set _ = inputmerged.update(xymon_plug_libs_host_whitelist) %}
---
whitelist:
{% for group, rules in inputmerged|dictsort %}

View File

@ -1,39 +0,0 @@
# {{ ansible_managed | comment }}
## From ipr-cnrs.xymon role
{{ ansible_hostname }}:
- {{ ansible_default_ipv4.interface }}
## This file is just here to allow the net probe, you juste enable,
## to send something.
## Check the README of hobbit-plugins project:
## https://salsa.debian.org/debian/hobbit-plugins#net-check-network-interface-states
## To get an overview of what can be done with this probe and how to get
## a working and more complete configuration file (check speed, mtu,…).
## You really should consider writing your own template and override
## `xymon_cli__plug_net_conf_tpl` variable.
## As the probe search for the hostname to get it's configuration, you can
## write one single configuration file with several hosts definition.
## And if you don't like template, you can simply put static informations ;)
## Example for "host1"
#host1:
# ### Ensure eno1 is up with a "Direct Attach Copper" (see ethtool) and
# ### with a speed of 10000Mb/s
# eno1:
# UP: red
# "Port: Direct Attach Copper": red
# "Speed: 10000Mb/s": red
# ### Ensure bond0 and vmbr0 are up
# bond0:
# UP: red
# vmbr0:
# UP: red
# ### Ensure vlan2 as MTU 9000
# vlan2:
# "mtu 9000": red
# ### Ensure eno3 is up with a speed of 1000Mb/s
# eno3:
# UP: red
# "1000Mb/s": red

View File

@ -1,252 +0,0 @@
#!/bin/sh
# {{ ansible_managed | comment }}
# From ipr-cnrs.xymon role
# https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/sge.sh
#
# SGE: Sun Grid Engine check - Xymon external script test
#
##### Purpose is to report back to a central server, all Sun
##### Grid Engine software faults.
#####
#
# version 0.4
#
# BIG BROTHER / XXXXXXXXXXXXXXXX status
#
# Written by Butch Deal <butchdeal@yahoo.com>
# Daniel Gomez <dgomez@tigr.org,daniel@ixplosive.com>
# Jérémy Gardais <jeremy.gardais@univ-rennes1.fr>
#
# v0.4 09/06/20 clean, correction,… for Xymon 4.3.28
# v0.3e 10/14/08 cut down on the number of qhost runs
# v0.3d 03/31/06 added alarm/suspend state identification
# v0.3c 03/01/06 propogated yellow state upon UNAVAILABLE queue intances
# v0.3b 01/31/06 fixed yellow warning queue status for ambigious config test
# v0.3a 01/31/06 added unknown queue status and ambigious config test
# v0.3 01/26/06 fixed status reporting and optimized job status
# v0.2 08/03/05 flag disabled queues as clear
# v0.1 07/28/05 authored
########################################
# NOTE
# The version v0.4 has only been tested with Xymon (server and client) 4.2.x.
#
# The color status with respects to queue status is arbitrary and should be
# reviewed for your particular environment.
#
# Tested on :
# Solaris & Linux
# Linux only (for v0.4)
########################################
########################################
# INSTALLATION
# step 1 - copy to Xymon client's ext dir
# step 2 - New clientlaunch.d/sge.cfg file
# step 3 - restart Xymon client
#
# NOTE - the TEST variable in the configuration section, this is the name used
# as the column header.
########################################
##################################
# CONFIGURE IT HERE
##################################
readonly PLUGIN_NAME=$(basename "${0}")
readonly TEST="sge"
readonly PLUGIN_RESULT="${XYMONTMP}/${MACHINEDOTS}.${TEST}.plugin_result"
readonly QSTAT=$(command -v qstat)
readonly QHOST=$(command -v qhost)
readonly QSELECT=$(command -v qselect)
export QSTAT QHOST QSELECT
# define colours for graphics
# Comment these out if using older BB versions
CLEAR_PIC="&clear"
RED_PIC="&red"
YELLOW_PIC="&yellow"
GREEN_PIC="&green"
UNKNOWN_PIC="&purple"
##################################
# Start of script
##################################
get_header()
{
echo ""
#echo "<FONT SIZE=+2><b>$1</b></FONT> ($2)<BR>"
echo "<FONT SIZE=+2><b>$1</b></FONT> <BR>"
# If you do not want the header in a bigger font use line below instead
#echo "<b>$1</b> ($2)"
# If you want the "Paul Luzzi" look uncomment this section and comment
# out the above sections:
#echo "<P><DIV ALIGN=\"CENTER\"><HR>"
#echo "<B>============== $1 ==============</B>"
#echo "<B>--- ($2) ---</B>"
#echo "<HR></DIV>"
#echo "<BLOCKQUOTE>"
}
get_header_small()
{
echo ""
#echo "<FONT SIZE=+2><b>$1</b></FONT> ($2)<BR>"
echo "<FONT SIZE=+1><b>$1</b></FONT> <BR>"
# If you do not want the header in a bigger font use line below instead
# echo "<b>$1</b> ($2)"
# If you want the "Paul Luzzi" look uncomment this section and comment
# out the above sections:
#echo "<P><DIV ALIGN=\"CENTER\"><HR>"
#echo "<B>============== $1 ==============</B>"
#echo "<B>--- ($2) ---</B>"
#echo "<HR></DIV>"
#echo "<BLOCKQUOTE>"
}
get_footer()
{
echo ""
# If you want the "Paul Luzzi" look uncomment this section and comment
# out the above sections:
#echo "</BLOCKQUOTE>"
}
#####
##### Get Status proc - used to get all responses
#####
get_status()
{
#####
##### Setup some variables for use later
#####
COLOR="green"
# Check defaults have been set
if [ "${QSTAT}" = "" ]; then
readonly QSTAT=$(command -v qstat)
echo ""
echo "$YELLOW_PIC QSTAT command is not defined in etc/bbsys.local - using default: ${QSTAT}"
fi
if [ "${QHOST}" = "" ]; then
readonly QHOST=$(command -v qhost)
echo ""
echo "$YELLOW_PIC QHOST command is not defined in etc/bbsys.local - using default: ${QHOST}"
fi
if [ "${QSELECT}" = "" ]; then
readonly QSELECT=$(command -v qselect)
echo ""
echo "$YELLOW_PIC QSELECT command is not defined in etc/bbsys.local - using default: ${QSELECT}"
fi
###
### Check the jobs
###
get_header "Jobs" "$QSTAT -l hostname=$MACHINEDOTS"
jobs=$(${QSTAT} -l hostname="${MACHINEDOTS}" -s r -u \*)
if [ -z "$jobs" ]; then
echo "No Running Jobs"
else
${QSTAT} -l hostname="${MACHINEDOTS}" -s r -u \*
fi
get_footer
###
### Check the host
###
get_header "Host" "$METAHS -i"
${QHOST} -h "${MACHINEDOTS}" | grep -v "global"
get_footer
###
### Identify queue memberships
###
#get_header "Queue Membership" "$QHOST -q"
#${QHOST} -h ${MACHINEDOTS} -q | tail +5
#get_footer
###
### Check queue instance states
###
queueTriggered=false;
# Queueset=$(${QHOST} -h ${MACHINEDOTS} -q | tail +5 | awk '{ print $1 }')
${QHOST} -h "${MACHINEDOTS}" -q | tail +5 > "${PLUGIN_RESULT}.QSTATE"
Queueset=$(< "${PLUGIN_RESULT}.QSTATE" awk '{ print $1 }')
for Qset in $Queueset; do
# qstate=$(${QHOST} -q -h "${MACHINEDOTS}" | tail +5 | grep " $Qset" | awk '{print $4}')
qstate=$(grep " $Qset" "${PLUGIN_RESULT}.QSTATE" | awk '{print $4}')
# Order determines more significant color status
if [ "$(echo "${qstate}" | grep -c d)" != "0" ]; then
COLOR="clear"
queueMsg=$(echo "$queueMsg<BR>$CLEAR_PIC $Qset@$HOST is DISABLED")
queueTriggered=true;
elif [ "$(echo "${qstate}" | grep -c E)" != "0" ]; then
COLOR="red"
queueMsg=$(echo "$queueMsg<BR>$RED_PIC $Qset@$HOST is in ERROR!")
queueTriggered=true;
elif [ "$(echo "${qstate}" | grep -c c)" != "0" ]; then
COLOR="yellow"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST has an ambigious configuration!")
queueTriggered=true;
elif [ "$(echo "${qstate}" | grep -c a)" != "0" ] || \
[ "$(echo "${qstate}" | grep -c A)" != "0" ]; then
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is in ALARM")
elif [ "$(echo "${qstate}" | grep -c s)" != "0" ] || \
[ "$(echo "${qstate}" | grep -c S)" != "0" ]; then
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is SUSPENDED")
elif [ "$(echo "${qstate}" | grep -c u)" != "0" ]; then
COLOR="yellow"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is UNAVAILABLE!")
queueTriggered=true;
elif [ "$qstate" = "" ]; then
queueMsg=$(echo "$queueMsg<BR>$GREEN_PIC $Qset@$HOST is OK")
else
queueMsg=$(echo "$queueMsg<BR>$UNKNOWN_PIC $Qset@$HOST is UNKNOWN")
queueTriggered=true;
fi
done
if [ -f "${PLUGIN_RESULT}.QSTATE" ]; then
rm -f -- "${PLUGIN_RESULT}.QSTATE"
fi
get_header "Queue Instance Status Report"
echo "$queueMsg"
get_footer
#####
##### Make sure to export COLOR so that it gets back to "central"
#####
export COLOR
#####
##### End of get_status proc
#####
}
#####
##### Main body
#####
get_status > "${PLUGIN_RESULT}"
# NOW USE THE XYMON COMMAND TO SEND THE DATA ACROSS
$XYMON "${XYMSRV}" "status ${MACHINE}.${TEST} ${COLOR} $($DATE) $(cat ${PLUGIN_RESULT})"
#For testing only
# echo $XYMON "${XYMSRV}" "status ${MACHINE}.${TEST} ${COLOR} $($DATE) $(cat ${PLUGIN_RESULT})" > /tmp/sgetmp
# Clean up our mess
# Checking for existence of each file since the whole test may be optional
# and may not actually run on every client
#
if [ -f "${PLUGIN_RESULT}" ]; then
rm -f -- "${PLUGIN_RESULT}"
fi
##############################################
# end of script
##############################################

View File

@ -1,203 +0,0 @@
#!/usr/bin/perl
# $Id: sensors 70 2011-11-25 09:21:18Z skazi $
# Author: Jacek Tomasiak <jacek.tomasiak@gmail.com>
# {{ ansible_managed | comment }}
# From ipr-cnrs.xymon role
# Thanks to Jacek Tomasiak skazi0
# https://github.com/skazi0/xymon-plugins/blob/master/client/ext/smart
use strict;
# add script's directory to module search path for Hobbit.pm on non-debian systems
use FindBin;
use lib $FindBin::Bin;
use Hobbit;
use Data::Dumper;
my $bb = new Hobbit('smart');
my $temp_disk_list = "$ENV{'XYMONTMP'}/$ENV{'MACHINEDOTS'}.smart.drivedb.list";
my @disks = ();
my %olderr = {};
my $CACHETIME = 10; # minutes
my $CACHEFILE = "$ENV{'XYMONTMP'}/$ENV{'MACHINEDOTS'}.smart.cache";
&load_config("$ENV{'XYMONTMP'}/logfetch.$ENV{'MACHINEDOTS'}.cfg");
my @disks_stat = stat($temp_disk_list);
my $disks_mtime = scalar @disks_stat ? $disks_stat[9] : 0;
#
# Regenerate disks list if the file is too old (600 minutes)
if (time() - $disks_mtime > 600)
{
unlink $temp_disk_list;
}
if (-e $temp_disk_list) {
# Should use the existing file
}
else {
# Create a file with the list of disks
system("ls -1 /dev/sd* | grep -vE '[0-9]' > $temp_disk_list") == 0
or die "system command to create $temp_disk_list failed: $?";
}
# fallback to disk detection if nothing defined in the config
unless (@disks) {
## Put temp_disk_list content to disks array
open(my $fh, '<:encoding(UTF-8)', $temp_disk_list)
or die "Could not open file '$temp_disk_list' $!";
while (my $row = <$fh>) {
chomp $row;
push(@disks, "$row");
}
}
my @stat = stat($CACHEFILE);
my $mtime = scalar @stat ? $stat[9] : 0;
# regenerate sensors cache if outdated
if (time() - $mtime > $CACHETIME * 60)
{
open(OUT, ">$CACHEFILE") or die "cannot open $CACHEFILE";
foreach my $name (@disks)
{
print OUT ('=' x 20) . " $name " . ('=' x 20) . "\n";
my @output = `sudo smartctl -AHi -l error -l selftest $name 2>&1` or die;
my $ncv = '';
my $newerr = 1;
my $ponhours = undef;
my $lasttest = undef;
foreach my $line (@output)
{
# skip header
next if ($line =~ /smartctl|Copyright|Home page|===/);
if ($line =~ /.*overall-health.*:\s*(.*)/)
{
my $lstatus = ($1 == 'PASSED') ? 'green' : 'red';
print OUT "&$lstatus $line";
}
elsif ($line =~ /^\s*(\d+)\s+(\S+)\s+\S+\s+(\d+)\s+(\d+)\s+(\d+)\s+\S+\s+\S+\s+\S+\s+(.*)$/)
{
my ($aname, $value, $worst, $thresh, $raw) = ($2, $3, $4, $5, $6);
my $lstatus = 'green';
if ($aname =~ /Current_Pending_Sector|Offline_Uncorrectable/ and int($raw) > 0)
{
$lstatus = 'yellow';
}
elsif ($aname =~ /Power_On_Hours/)
{
$ponhours = $raw;
}
print OUT "&$lstatus $line";
$ncv .= "$name-$aname-value : $value\n";
$ncv .= "$name-$aname-worst : $worst\n";
$ncv .= "$name-$aname-thresh : $thresh\n";
$ncv .= "$name-$aname-raw : $raw\n";
}
elsif ($line =~ /^\s*No Errors Logged\s*$/)
{
$newerr = 0;
print OUT "&green $line";
}
elsif ($line =~ /Error Count:\s*(\d+)/)
{
$newerr = $1 - $olderr{$name};
my $lstatus = $newerr > 0 ? 'red' : 'green';
print OUT "&$lstatus $line"
}
elsif ($line =~ /^\s*Error \d+ occurred/)
{
my $lstatus = $newerr > 0 ? 'red' : 'green';
print OUT "&$lstatus $line"
}
elsif ($line =~ /^\s*#\s*\d+\s+(Conveyance offline|Extended offline|Short offline|Extended captive)\s+(.*)\s+\d+%\s+(\d+)/)
{
my $status = $2;
my $lifetime = $3;
my $lstatus = 'red';
$lasttest = $lifetime if (!defined($lasttest));
$lstatus = 'yellow' if ($status =~ /Aborted by host|Interrupted \(host reset\)/);
$lstatus = 'green' if ($status =~ /Completed without error|Self-test routine in progress|Interrupted \(host reset\)/);
print OUT "&$lstatus $line";
}
else
{
print OUT " $line";
}
}
# test status footer
my $lasttestage = $ponhours % 65536 - $lasttest;
my $lasttestmsg = "$lasttestage hours ago";
my $lasttestcolor = 'green';
if (!defined($lasttest))
{
$lasttestcolor = 'yellow';
$lasttestmsg = 'no test performed';
}
elsif ($lasttestage > 24 * 7)
{
$lasttestcolor = 'red';
}
elsif ($lasttestage > 24 * 2)
{
$lasttestcolor = 'yellow';
}
print OUT "&$lasttestcolor Last Self-test: $lasttestmsg\n";
# hidden output for ncv
print OUT "<!--\n$ncv\n-->\n";
}
close OUT;
}
# send cached content
{
open IN, $CACHEFILE or die "cannot open $CACHEFILE";
while (my $line = <IN>)
{
if ($line =~ /^\s*&(\S+)/)
{
$bb->color_print($1, $line);
}
else
{
$bb->print($line);
}
}
close IN;
}
$bb->send;
sub load_config
{
my $path = shift;
open C, "<$path" or return;
# print "loading config from $path\n";
while (my $line = <C>)
{
next if ($line =~ /^\s*#/);
if ($line =~ /DISKS\s*=\s*['"](.*?)["']/)
{
@disks = split(/\s+/, $1);
}
if ($line =~ /SMARTOLDERROR\[([\w\/]+)\]\s+(\d+)/)
{
$olderr{$1} = $2;
}
if ($line =~ /SMARTCACHETIME=(\d+)/)
{
$CACHETIME = $1;
}
}
close C;
}

View File

@ -1,250 +0,0 @@
#!/bin/sh
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# {{ ansible_managed | comment }}
# From ipr-cnrs.xymon role
# Source:
# https://git.ipr.univ-rennes.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/smartoverall
# NOTE: Must be run as root, so you probably need to setup sudo for this.
# This script is mostly intend to be used with Xymon and rather for devices unknown to the smartmontools base.
# Based on xymon.com's script: https://www.xymon.com/xymon-cgi/viewconf.sh?smart
# The script will scan all devices compatible with SMART and for each disk, it will: [[[
# * try to guess the expected TYPE (even megaraid,…).
# * display health status.
# * set a "clear" state for incompatible device.
# * display last selftests.
# * set a "error" state if no selftest is recorded.
# * display basic informations.
# * recommend a more advanced SMART script if the disk is known of smartmontools's database (drivedb.h) or redirect to smartmontools's FAQ if not.
# ]]]
# Things the script CAN'T do: [[[
# * ensure a recent selftest was run.
# * compare current value with vendor's one (for failure prediction or error).
# * give detail about errors.
# * Take a look to this more advance script for such features: https://github.com/skazi0/xymon-plugins/blob/master/client/ext/smart
# ]]]
# Vars [[[
debug="1"
## Colors [[[
c_redb='\033[1;31m'
c_magentab='\033[1;35m'
c_reset='\033[0m'
## ]]]
plugin_name=$(basename "${0}")
plugin_result="${XYMONTMP}/${MACHINEDOTS}.smartoverall.plugin_result"
plugin_state="${XYMONTMP}/${MACHINEDOTS}.smartoverall.plugin_state"
device_list="${XYMONTMP}/${MACHINEDOTS}.smartoverall.dscan"
## List of devices known from the smartmontools base and compatible with test logging
## This file might be used by a more advanced script such as skazi0's one
drivedb_list="${XYMONTMP}/${MACHINEDOTS}.smart.drivedb.list"
# ]]]
# Functions
## Test if a disk really support SMART [[[
## Smartctl can give an health status even without a full support
## of SMART for some type (eg. scsi or megaraid).
## Exemple: SMART support is: Unavailable - device lacks SMART capability.
is_disk_support_smart() {
_disk="${1}"
_type="${2}"
_smarctl_support_result="${XYMONTMP}/${MACHINEDOTS}.smartoverall.support.$(basename "${_disk}")"
smart_support_msg=""
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: is_disk_support_smart func check if SMART is supported on: ${_disk}."
## Create or empty previous file
true > "${_smarctl_support_result}"
## Grep only "support" lines from disk's informations
smartctl -d "${_type}" -i -- "${_disk}" | grep -E "^SMART support is:" -- >> "${_smarctl_support_result}"
## If the file is not empty
if test -s "${_smarctl_support_result}"; then
## Parse all "support" lines
while IFS= read -r _LINE; do
if ! printf -- '%s' "${_LINE}" | grep -q -E -- "(Enabled|Available)"
then
smart_support_msg="${_LINE}"
fi
done < "${_smarctl_support_result}"
else
smart_support_msg="smartctl was not able to open ${_disk} DEVICE with ${_type} TYPE."
fi
if [ -z "${smart_support_msg}" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: is_disk_support_smart func SMART seems fully supported on: ${_disk} with ${_type} type."
else
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: is_disk_support_smart func SMART is not fully supported on: ${_disk} with ${_type} type. See smartctl informations:\n${smart_support_msg}"
fi
## Clean temp files
### As the Xymon's tmpdir is used to store log files, no need to delete them at
### the end of the script. They will be emptied at the beginning of the next run.
}
## ]]]
## Test the type of disk with smartctl [[[
## Cause the scanned one might not be the one to use
choose_correct_type() {
_disk="${1}"
_scanned_type="${2}"
_default_type="auto"
TYPE=""
SMART_SUPPORT_MSG=""
for test_type in "${_default_type}" "${_scanned_type}"; do
is_disk_support_smart "${_disk}" "${test_type}"
## If no message, the type is correct
if [ -z "${smart_support_msg}" ]; then
TYPE="${test_type}"
SMART_SUPPORT_MSG=""
return
else
SMART_SUPPORT_MSG="${smart_support_msg}"
fi
done
}
## ]]]
# Create or empty previous files
true > "${plugin_result}"
true > "${plugin_state}"
true > "${device_list}"
true > "${drivedb_list}"
# Get the list of all available devices
smartctl --scan >> "${device_list}"
# If the file is not empty
if test -s "${device_list}"; then
while IFS= read -r LINE; do
## Get device path
DISK=$(echo "${LINE}" | cut -d" " -f1)
## Try to determine the best type
SCANNED_TYPE=$(echo "${LINE}" | cut -d" " -f3)
choose_correct_type "${DISK}" "${SCANNED_TYPE}"
## If no correct type was found for this device
if [ -z "${TYPE}" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: SMART is not fully supported."
DRES=$(printf '%s' "SMART Health Status can't be determine because of:\n${SMART_SUPPORT_MSG}")
DCODE="2"
TYPE="unsupported"
### Still try to display informations about unsupported device (eg. RAID controller,…)
DID="unsupported-${DISK}"
DINFO=$(smartctl -i -d "${SCANNED_TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$" || printf '%s' "Can't get informations due to no SMART support.")
DDRIVEDB_MSG=""
DSELFTEST=""
else
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: SMART seems fully supported, proceed normally."
### Get SMART Health Status and return code
DRES=$(/usr/sbin/smartctl -H -d "${TYPE}" -n standby "${DISK}")
DCODE=$?
### Get disk's serial number and informations
DID=$(smartctl -i -d "${TYPE}" "${DISK}" | awk '/.erial .umber:/ { print $NF }')
DINFO=$(smartctl -i -d "${TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$")
## If the model of the disk is known from smartmontools database
if smartctl -d "${TYPE}" -P show "${DISK}" | grep -qi -- "drive found in"; then
DDRIVEDB_MSG="&green Device is known in smartmontools database. You might consider using a more advanced plugin such as:
https://github.com/skazi0/xymon-plugins/blob/master/client/ext/smart"
else
DDRIVEDB_MSG="&clear Device is unknown or not complete in smartmontools database. Please take a look to the FAQ:
https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
fi
DSELFTEST=$(smartctl -d "${TYPE}" -l selftest "${DISK}" | grep -v -E -- "^smartctl|^Copyright|^$")
## If no selftest have been recorded
if smartctl -d "${TYPE}" -l selftest "${DISK}" | grep -qi -- "No self-tests"; then
DSELFTEST_MSG="&red No self-tests recorded:"
DCODE="8"
## If the device doesn't support test logging
elif smartctl -d "${TYPE}" -l selftest "${DISK}" | grep -qEi -- "does not support.*logging"; then
DSELFTEST_MSG="&clear Test logging are not supported:"
else
DSELFTEST_MSG=""
### If the device is also known from smartmontools database
if printf -- '%s' "${DDRIVEDB_MSG}" | grep -q -E -- "green"
then
echo "${DISK}" >> "${drivedb_list}"
fi
fi
fi
## Test health status
DSTBY=$(( DCODE & 2 ))
DFAIL=$(( DCODE & 8 ))
DWARN=$(( DCODE & 32 ))
## According to health, give a weight to each color to easily get the page status
if test $DSTBY -ne 0
then
COLOR="4&clear"
elif test $DFAIL -ne 0
then
COLOR="1&red"
elif test $DWARN -ne 0
then
COLOR="2&yellow"
else
COLOR="3&green"
fi
## Avoid duplicate device
if ! grep -q "${DID}" "${plugin_result}"; then
## For summary
echo "${COLOR} $DISK ${TYPE}"
## For detailed informations
{
echo "${COLOR} $DISK ${TYPE}" | cut -c2-
echo ""
echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^==="
echo "${DDRIVEDB_MSG}"
echo "${DINFO}"
echo "${DSELFTEST_MSG}"
echo "${DSELFTEST}" | head -n6
echo "------------------------------------------------------------"
echo ""
echo ""
} >> "${plugin_result}"
fi
done < "${device_list}" >> "${plugin_state}"
# If the file is empty
else
echo "1&red Error while scanning devices with smartctl" >> "${plugin_state}"
fi
# Set the global color according to the highest alert
COLOR=$(< "${plugin_state}" awk '{print $1}' | sort | uniq | head -1 | cut -c3-)
# Send informations to Xymon server
$XYMON "${XYMSRV}" "status ${MACHINE}.${plugin_name} ${COLOR} SMART health check
$(< "${plugin_state}" cut -c2-)
==================== Detailed status ====================
$(cat "${plugin_result}")
"
# Clean temp files
## As the Xymon's tmpdir is used to store log files, no need to delete them at
## the end of the script. They will be emptied at the beginning of the next run.
exit 0

View File

@ -1,8 +1,4 @@
#!/bin/ksh
# {{ ansible_managed | comment }}
# From ipr-cnrs.xymon role
# Revision History:
# 1. Mike Rowell <Mike.Rowell@Rightmove.co.uk>, original
# 2. Uwe Kirbach <U.Kirbach@EnBW.com>
@ -122,6 +118,6 @@ then
fi
# What: Sent out the final bb message to hobbit server.
$XYMON $XYMONSRV $XYMONSERVERS "status $MACHINE.$TEST $DISPCOLOR `date` $FIRST_LINE $STRING"
echo "$XYMON $XYMONSRV $XYMONSERVERS --debug status $MACHINE.$TEST $DISPCOLOR `date` $FIRST_LINE $STRING" > /tmp/xymon_cli__zfs
echo "$XYMON $XYMONSRV $XYMONSERVERS --debug status $MACHINE.$TEST $DISPCOLOR `date` $FIRST_LINE $STRING" > /tmp/xymon_zfs
$XYMON $XYMONSRV $XYMONSERVERS "data $MACHINE.$TEST $DISPCOLOR $(echo; echo "$DATA" ;echo;echo)"

View File

@ -1,7 +1,5 @@
---
# vars file for Debian-based distros
xymon_cli__pkg_list:
xymon_cli_pkg_list:
- xymon-client
xymon_cli__plug_pkg_list:
- hobbit-plugins