From 66f5ae27c9e90a09ad744a5ae0f0fc6c375a6d7a Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 23 Dec 2016 20:05:56 +0100 Subject: [PATCH] Store Nagios custom plugins in /etc by default --- nagios-nrpe/defaults/main.yml | 1 + nagios-nrpe/tasks/main.yml | 21 +++++++++++---------- nagios-nrpe/templates/evolix.cfg.j2 | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/nagios-nrpe/defaults/main.yml b/nagios-nrpe/defaults/main.yml index 4ad1e504..dac40309 100644 --- a/nagios-nrpe/defaults/main.yml +++ b/nagios-nrpe/defaults/main.yml @@ -5,3 +5,4 @@ nagios_nrpe_ldap_passwd: LDAP_PASSWD nagios_nrpe_pgsql_passwd: PGSQL_PASSWD nagios_nrpe_mysql_passwd: MYSQL_PASSWD nagios_nrpe_amavis_from: "foobar@{{ ansible_domain }}" +nagios_plugins_directory: "/etc/nagios/plugins" diff --git a/nagios-nrpe/tasks/main.yml b/nagios-nrpe/tasks/main.yml index 08ded3c8..dbe910b4 100644 --- a/nagios-nrpe/tasks/main.yml +++ b/nagios-nrpe/tasks/main.yml @@ -17,7 +17,7 @@ dest: /etc/nagios/nrpe.d/evolix.cfg notify: restart nagios-nrpe-server -- name: Nagios config is secured +- name: Nagios config is secure file: dest: /etc/nagios/ mode: 0750 @@ -27,18 +27,19 @@ # TODO deal with /usr mounted as read-only -- name: Nagios plugins are installed - copy: - src: plugins/ - dest: /usr/local/lib/nagios/plugins/ - mode: 0755 - notify: restart nagios-nrpe-server - -- name: Nagios lib is secured +- name: Nagios plugins directory is secure file: - dest: /usr/local/lib/nagios/ + dest: "{{ nagios_plugins_directory }}/" mode: 0755 group: nagios recurse: yes state: directory notify: restart nagios-nrpe-server + +- name: Nagios plugins are installed + copy: + src: plugins/ + dest: "{{ nagios_plugins_directory }}/" + group: nagios + mode: 0755 + notify: restart nagios-nrpe-server diff --git a/nagios-nrpe/templates/evolix.cfg.j2 b/nagios-nrpe/templates/evolix.cfg.j2 index f60ed56b..54fe37c1 100644 --- a/nagios-nrpe/templates/evolix.cfg.j2 +++ b/nagios-nrpe/templates/evolix.cfg.j2 @@ -47,17 +47,17 @@ command[check_ssl]=/usr/lib/nagios/plugins/check_http -f follow -I 127.0.0.1 -S command[check_elasticsearch]=/usr/lib/nagios/plugins/check_http -H localhost -u /_cluster/health -p 9200 -r '"status":"red",' --invert-regex # Local checks (not packaged) -command[check_mem]=/usr/local/lib/nagios/plugins/check_mem -f -C -w 20 -c 10 -command[check_amavis]=/usr/local/lib/nagios/plugins/check_amavis --server 127.0.0.1 --from {{ nagios_nrpe_amavis_from }} --to postmaster@localhost --port 10024 -command[check_spamd]=/usr/local/lib/nagios/plugins/check_spamd -H 127.0.0.1 -command[check_nfsclient]=sudo -u www-data /usr/local/lib/nagios/plugins/check_nfsclient -command[check_evobackup]=/usr/local/lib/nagios/plugins/check_evobackup -command[check_process]=/usr/local/lib/nagios/plugins/check_process -command[check_drbd]=/usr/local/lib/nagios/plugins/check_drbd -d All -c StandAlone -command[check_mongodb_connect]=/usr/local/lib/nagios/plugins/check_mongodb -H localhost -P27017 -A connect -command[check_glusterfs]=/usr/local/lib/nagios/plugins/check_glusterfs -v all -n 0 -command[check_supervisord_status]=/usr/local/lib/nagios/plugins/check_supervisord +command[check_mem]={{ nagios_plugins_directory }}/check_mem -f -C -w 20 -c 10 +command[check_amavis]={{ nagios_plugins_directory }}/check_amavis --server 127.0.0.1 --from {{ nagios_nrpe_amavis_from }} --to postmaster@localhost --port 10024 +command[check_spamd]={{ nagios_plugins_directory }}/check_spamd -H 127.0.0.1 +command[check_nfsclient]=sudo -u www-data {{ nagios_plugins_directory }}/check_nfsclient +command[check_evobackup]={{ nagios_plugins_directory }}/check_evobackup +command[check_process]={{ nagios_plugins_directory }}/check_process +command[check_drbd]={{ nagios_plugins_directory }}/check_drbd -d All -c StandAlone +command[check_mongodb_connect]={{ nagios_plugins_directory }}/check_mongodb -H localhost -P27017 -A connect +command[check_glusterfs]={{ nagios_plugins_directory }}/check_glusterfs -v all -n 0 +command[check_supervisord_status]={{ nagios_plugins_directory }}/check_supervisord # Check HTTP "many". Use this to check many websites (http, https, ports, sockets and SSL certificates). # Beware! All checks must not take more than 10s! -#command[check_https]=/usr/local/lib/nagios/plugins/check_http_many +#command[check_https]={{ nagios_plugins_directory }}/check_http_many