2018-03-22 20:15:24 +01:00
|
|
|
---
|
2018-06-14 17:14:31 +02:00
|
|
|
|
2018-03-22 20:15:24 +01:00
|
|
|
- name: Is nrpe present ?
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.stat:
|
2018-03-22 20:15:24 +01:00
|
|
|
path: /etc/nagios/nrpe.d/evolix.cfg
|
|
|
|
register: nrpe_evolix_config
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Install dependencies
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.apt:
|
2023-01-06 09:54:51 +01:00
|
|
|
name:
|
2022-09-01 15:32:56 +02:00
|
|
|
- libcache-memcached-perl
|
|
|
|
- libmemcached11
|
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include_role:
|
2022-09-01 15:32:56 +02:00
|
|
|
name: evolix/remount-usr
|
2018-03-22 20:15:24 +01:00
|
|
|
|
|
|
|
- name: Copy Nagios check for memcached
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2018-03-22 20:15:24 +01:00
|
|
|
src: check_memcached.pl
|
|
|
|
dest: /usr/local/lib/nagios/plugins/
|
|
|
|
mode: "0755"
|
|
|
|
|
2022-09-01 15:32:56 +02:00
|
|
|
- name: install check_memcached_instances
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2022-09-01 15:32:56 +02:00
|
|
|
src: check_memcached_instances.sh
|
|
|
|
dest: /usr/local/lib/nagios/plugins/check_memcached_instances
|
2023-06-28 13:22:59 +02:00
|
|
|
force: true
|
2022-09-01 15:32:56 +02:00
|
|
|
mode: "0755"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2018-08-09 17:25:50 +02:00
|
|
|
|
2022-09-01 15:32:56 +02:00
|
|
|
- name: Add NRPE check (single instance)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2018-03-22 20:15:24 +01:00
|
|
|
name: /etc/nagios/nrpe.d/evolix.cfg
|
|
|
|
regexp: '^command\[check_memcached\]='
|
2018-06-14 17:14:31 +02:00
|
|
|
line: 'command[check_memcached]=/usr/local/lib/nagios/plugins/check_memcached.pl -H 127.0.0.1 -p {{ memcached_port }}'
|
2018-03-22 20:15:24 +01:00
|
|
|
notify: restart nagios-nrpe-server
|
2024-03-11 10:54:36 +01:00
|
|
|
when: memcached_instance_name | length == 0
|
2022-09-01 15:32:56 +02:00
|
|
|
|
|
|
|
- name: Add NRPE check (multi instance)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2022-09-01 15:32:56 +02:00
|
|
|
name: /etc/nagios/nrpe.d/evolix.cfg
|
|
|
|
regexp: '^command\[check_memcached\]='
|
|
|
|
line: 'command[check_memcached]=/usr/local/lib/nagios/plugins/check_memcached_instances'
|
|
|
|
notify: restart nagios-nrpe-server
|
2024-03-11 10:54:36 +01:00
|
|
|
when: memcached_instance_name | length > 0
|
2018-03-22 20:15:24 +01:00
|
|
|
|
|
|
|
when: nrpe_evolix_config.stat.exists
|