Delegate the nagios and nrpe handlers
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
parent
ceaee68d45
commit
ac6245ddde
3 changed files with 15 additions and 8 deletions
9
roles/rabbit/queue/handlers/main.yml
Normal file
9
roles/rabbit/queue/handlers/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
- name: restart nagios on noc
|
||||||
|
shell: nagios -v /etc/nagios/nagios.cfg && systemctl restart nagios
|
||||||
|
delegate_to: "{{ nagios_server }}"
|
||||||
|
|
||||||
|
- name: restart nrpe on rabbitmq
|
||||||
|
service:
|
||||||
|
name: nrpe
|
||||||
|
state: restarted
|
||||||
|
delegate_to: "{{ rabbitmq_server }}"
|
|
@ -21,7 +21,8 @@
|
||||||
# The values are numbers. Generate an alert in Nagios if
|
# The values are numbers. Generate an alert in Nagios if
|
||||||
# the number of messages go above these values.
|
# the number of messages go above these values.
|
||||||
|
|
||||||
- assert:
|
- name: Validate parameters
|
||||||
|
assert:
|
||||||
that:
|
that:
|
||||||
- "queue_name.startswith(username)"
|
- "queue_name.startswith(username)"
|
||||||
fail_msg: "Your queue name must be prefixed with your username"
|
fail_msg: "Your queue name must be prefixed with your username"
|
||||||
|
@ -74,10 +75,7 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify:
|
notify: restart nrpe on rabbitmq
|
||||||
- restart nrpe
|
|
||||||
tags:
|
|
||||||
- nagios_client
|
|
||||||
|
|
||||||
- name: Monitor the {{ queue_name }} queue in Nagios
|
- name: Monitor the {{ queue_name }} queue in Nagios
|
||||||
when: thresholds and env == "production"
|
when: thresholds and env == "production"
|
||||||
|
@ -85,4 +83,4 @@
|
||||||
template:
|
template:
|
||||||
src: nagios.cfg.j2
|
src: nagios.cfg.j2
|
||||||
dest: /etc/nagios/services/rabbitmq-queue-{{ queue_name }}.cfg
|
dest: /etc/nagios/services/rabbitmq-queue-{{ queue_name }}.cfg
|
||||||
notify: restart nagios
|
notify: restart nagios on noc
|
Loading…
Add table
Add a link
Reference in a new issue