From 6303c7c2703dc578603b43f5d616b7ae40d9f7f4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Sun, 17 Feb 2019 13:49:13 +0100 Subject: [PATCH] Change a variable that was specific to our environment, and set a default. --- nagios/defaults/main.yml | 3 ++- nagios/tasks/dell-omsa.yml | 2 +- nagios/tasks/hardware-checks.yml | 2 +- nagios/tasks/nagios.yml | 6 +++--- nagios/tasks/postgresql-nagios.yml | 4 ++-- nagios/templates/check_library.sh.j2 | 2 +- nagios/templates/common-nrpe.cfg.j2 | 14 +++++++------- nagios/templates/nagios.sudoers.j2 | 2 +- nagios/templates/postgresql-nrpe.cfg.j2 | 2 +- 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/nagios/defaults/main.yml b/nagios/defaults/main.yml index ffa0e401..3d9a4d7b 100644 --- a/nagios/defaults/main.yml +++ b/nagios/defaults/main.yml @@ -4,10 +4,11 @@ monitoring_group_name: 'change_this_on_your_playbook' nagios_plugdir: /usr/lib/nagios/plugins nagios_plugins_dir: '{{ nagios_plugdir }}' +nagios_local_plugdir: '{{ nagios_plugins_dir }}/local' nagios_centos_plugins_dir: /usr/lib64/nagios/plugins nagios_common_lib: check_library.sh # Needed inside nrpe.cfg -# It is already defined in isti-global.yml +# #nagios_monitoring_server_ip: nagios_hw: False nagios_check_disk_w: 10 diff --git a/nagios/tasks/dell-omsa.yml b/nagios/tasks/dell-omsa.yml index c1cf1751..d7b2fcf3 100644 --- a/nagios/tasks/dell-omsa.yml +++ b/nagios/tasks/dell-omsa.yml @@ -83,7 +83,7 @@ tags: [ 'dell', 'nagios' ] - name: Install some standalone plugins - copy: src={{ item }} dest={{ nagios_isti_plugdir }}/{{ item }} owner=root group=nagios mode=0750 + copy: src={{ item }} dest={{ nagios_local_plugdir }}/{{ item }} owner=root group=nagios mode=0750 with_items: '{{ nagios_dell_standalone_checks }}' tags: [ 'dell', 'nagios' ] diff --git a/nagios/tasks/hardware-checks.yml b/nagios/tasks/hardware-checks.yml index 0f2b34e7..7182657e 100644 --- a/nagios/tasks/hardware-checks.yml +++ b/nagios/tasks/hardware-checks.yml @@ -1,7 +1,7 @@ --- # We do not use the check_linux_raid plugin anymore. Now the check_raid one is much better. - name: Install some plugins that check hardware parts - copy: src={{ item }} dest={{ nagios_isti_plugdir }}/{{ item }} owner=root group=nagios mode=0750 + copy: src={{ item }} dest={{ nagios_local_plugdir }}/{{ item }} owner=root group=nagios mode=0750 with_items: - check_smart tags: diff --git a/nagios/tasks/nagios.yml b/nagios/tasks/nagios.yml index e35c053e..448616e6 100644 --- a/nagios/tasks/nagios.yml +++ b/nagios/tasks/nagios.yml @@ -10,15 +10,15 @@ tags: [ 'nagios', 'nagios_plug_contrib' ] - name: Create the directory where our local plugins are installed - file: path={{ nagios_isti_plugdir }} state=directory + file: path={{ nagios_local_plugdir }} state=directory tags: nagios - name: Install the generic shell library used by some custom checks - template: src=check_library.sh.j2 dest={{ nagios_isti_plugdir }}/check_library.sh owner=root group=root mode=0644 + template: src=check_library.sh.j2 dest={{ nagios_local_plugdir }}/check_library.sh owner=root group=root mode=0644 tags: nagios - name: Install plugins that can be useful on all the installed servers - copy: src={{ item }} dest={{ nagios_isti_plugdir }}/{{ item }} owner=root group=nagios mode=0755 + copy: src={{ item }} dest={{ nagios_local_plugdir }}/{{ item }} owner=root group=nagios mode=0755 with_items: - check_system_pp - show_users diff --git a/nagios/tasks/postgresql-nagios.yml b/nagios/tasks/postgresql-nagios.yml index ef459fcc..91c5cb81 100644 --- a/nagios/tasks/postgresql-nagios.yml +++ b/nagios/tasks/postgresql-nagios.yml @@ -1,12 +1,12 @@ --- - name: Ensure that the isti local nagios plugins directory exists - file: dest={{ nagios_isti_plugdir }} owner=root group=root state=directory + file: dest={{ nagios_local_plugdir }} owner=root group=root state=directory tags: - nrpe - nagios - name: Install the postgresql backup nagios check - copy: src=check_postgresql_backup dest={{ nagios_isti_plugdir }}/check_postgresql_backup owner=root group=root mode=0555 + copy: src=check_postgresql_backup dest={{ nagios_local_plugdir }}/check_postgresql_backup owner=root group=root mode=0555 tags: - nrpe - nagios diff --git a/nagios/templates/check_library.sh.j2 b/nagios/templates/check_library.sh.j2 index 73919824..d1a23ad1 100644 --- a/nagios/templates/check_library.sh.j2 +++ b/nagios/templates/check_library.sh.j2 @@ -4,7 +4,7 @@ export NAGIOS_WARNING=1 export NAGIOS_CRITICAL=2 export NAGIOS_UNKNOWN=3 -ISTI_PLUGDIR={{ nagios_isti_plugdir }} +ISTI_PLUGDIR={{ nagios_local_plugdir }} COMMON_LIB={{ nagios_common_lib }} if [ -d {{ nagios_plugins_dir }} ] ; then diff --git a/nagios/templates/common-nrpe.cfg.j2 b/nagios/templates/common-nrpe.cfg.j2 index f9b244a6..f8282eb7 100644 --- a/nagios/templates/common-nrpe.cfg.j2 +++ b/nagios/templates/common-nrpe.cfg.j2 @@ -21,16 +21,16 @@ command[global_check_munin]={{ nagios_plugins_dir }}/check_procs -w 1:1 -c 1:1 - # Show number and username of the logged users {% if nagios_multiple_allowed_users %} -command[global_show_users]={{ nagios_isti_plugdir }}/show_users -a {% if nagios_multiple_users_allow_root %}root,{% endif %}{% for u in users_system_users %}{{ u.login }}{% if not loop.last %},{% endif %}{% endfor %} +command[global_show_users]={{ nagios_local_plugdir }}/show_users -a {% if nagios_multiple_users_allow_root %}root,{% endif %}{% for u in users_system_users %}{{ u.login }}{% if not loop.last %},{% endif %}{% endfor %} {% else %} -command[global_show_users]={{ nagios_isti_plugdir }}/show_users -a {{ nagios_allowed_users }} +command[global_show_users]={{ nagios_local_plugdir }}/show_users -a {{ nagios_allowed_users }} {% endif %} # Generic script that monitors the existance of a given processes list -command[global_check_system_pp]={{ nagios_isti_plugdir }}/check_system_pp +command[global_check_system_pp]={{ nagios_local_plugdir }}/check_system_pp # Linux RAID check -#command[global_check_linux_raid]={{ nagios_isti_plugdir }}/check_linux_raid +#command[global_check_linux_raid]={{ nagios_local_plugdir }}/check_linux_raid {% if nagios_soft_raid_mdstat is defined and nagios_soft_raid_mdstat %} command[global_check_linux_raid]={{ nagios_plugins_dir }}/check_raid -p mdstat {% else %} @@ -38,11 +38,11 @@ command[global_check_linux_raid]={{ nagios_plugins_dir }}/check_raid {% endif %} # Disks S.M.A.R.T. check -command[global_check_smart]={{ nagios_isti_plugdir }}/check_smart -d $ARG1$ -i $ARG2$ +command[global_check_smart]={{ nagios_local_plugdir }}/check_smart -d $ARG1$ -i $ARG2$ # Network interfaces -#command[global_net_interfaces]={{ nagios_isti_plugdir }}/check_netint.pl -K -f -e -command[global_net_interfaces]={{ nagios_isti_plugdir }}/check_netint.pl -K -f -e -D -S -n \(l\|eth\|p\|bond\) +#command[global_net_interfaces]={{ nagios_local_plugdir }}/check_netint.pl -K -f -e +command[global_net_interfaces]={{ nagios_local_plugdir }}/check_netint.pl -K -f -e -D -S -n \(l\|eth\|p\|bond\) # Restart ntp (via handler) command[global_restart_ntp]=/usr/bin/sudo /etc/init.d/ntp start diff --git a/nagios/templates/nagios.sudoers.j2 b/nagios/templates/nagios.sudoers.j2 index 65f8e8a2..f10f836c 100644 --- a/nagios/templates/nagios.sudoers.j2 +++ b/nagios/templates/nagios.sudoers.j2 @@ -1 +1 @@ -nagios ALL=(ALL) NOPASSWD: {{ nagios_plugins_dir }}/, {{ nagios_isti_plugdir }}/, {{ nagios_centos_plugins_dir }}/, /etc/init.d/, /usr/sbin/service, /sbin/service +nagios ALL=(ALL) NOPASSWD: {{ nagios_plugins_dir }}/, {{ nagios_local_plugdir }}/, {{ nagios_centos_plugins_dir }}/, /etc/init.d/, /usr/sbin/service, /sbin/service diff --git a/nagios/templates/postgresql-nrpe.cfg.j2 b/nagios/templates/postgresql-nrpe.cfg.j2 index 03623906..1074f1a7 100644 --- a/nagios/templates/postgresql-nrpe.cfg.j2 +++ b/nagios/templates/postgresql-nrpe.cfg.j2 @@ -1,5 +1,5 @@ # Check the status of the postgresql local dumps -command[{{ monitoring_group_name }}_check_postgresql_backup]={{ nagios_isti_plugdir }}/check_postgresql_backup +command[{{ monitoring_group_name }}_check_postgresql_backup]={{ nagios_local_plugdir }}/check_postgresql_backup command[{{ monitoring_group_name }}_check_postgresql_connection]=/usr/bin/sudo -u postgres /usr/bin/check_postgres_connection -db template1