diff --git a/CHANGELOG.md b/CHANGELOG.md index 54bc9ee..21c207a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Enhancements * 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). ## v1.5.1 @@ -90,3 +92,4 @@ * 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 diff --git a/README.md b/README.md index 721c986..c9219d6 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,12 @@ informations. * **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 diff --git a/defaults/main.yml b/defaults/main.yml index 729d25f..2da4853 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -111,6 +111,9 @@ xymon_cli__plug_net_package: [ 'ethtool', 'iproute2', 'libfile-slurp-perl', 'lib 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 @@ -118,6 +121,7 @@ xymon_cli__plug_netstats_package: [ 'libfile-which-perl', 'libfile-slurp-perl', 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 SGE [[[ ### From https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/xymon/plugins/client/ext/sge.sh diff --git a/tasks/main.yml b/tasks/main.yml index 94202b0..7621d28 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -197,6 +197,17 @@ xymon_plug_manage|bool) notify: restart xymon-client service +- name: PLUGIN net config template + 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_plug_manage|bool) + notify: restart xymon-client service + # Manage netstats plugin [[[1 - name: PLUGIN netstats packages package: diff --git a/templates/etc/xymon/net.yaml.j2 b/templates/etc/xymon/net.yaml.j2 new file mode 100644 index 0000000..81de716 --- /dev/null +++ b/templates/etc/xymon/net.yaml.j2 @@ -0,0 +1,39 @@ +# {{ ansible_managed }} +## 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