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,9 +21,10 @@
|
|||
# The values are numbers. Generate an alert in Nagios if
|
||||
# the number of messages go above these values.
|
||||
|
||||
- assert:
|
||||
- name: Validate parameters
|
||||
assert:
|
||||
that:
|
||||
- "queue_name.startswith(username)"
|
||||
- "queue_name.startswith(username)"
|
||||
fail_msg: "Your queue name must be prefixed with your username"
|
||||
|
||||
# See https://www.rabbitmq.com/access-control.html#permissions for details on
|
||||
|
@ -74,10 +75,7 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify:
|
||||
- restart nrpe
|
||||
tags:
|
||||
- nagios_client
|
||||
notify: restart nrpe on rabbitmq
|
||||
|
||||
- name: Monitor the {{ queue_name }} queue in Nagios
|
||||
when: thresholds and env == "production"
|
||||
|
@ -85,4 +83,4 @@
|
|||
template:
|
||||
src: nagios.cfg.j2
|
||||
dest: /etc/nagios/services/rabbitmq-queue-{{ queue_name }}.cfg
|
||||
notify: restart nagios
|
||||
notify: restart nagios on noc
|
|
@ -1 +1 @@
|
|||
command[check_rabbitmq_queue_{{ vhost.replace("/", "") }}_{{ queue_name }}]=/usr/lib64/nagios/plugins-rabbitmq/check_rabbitmq_queue --extra-opts=common@/etc/nrpe.d/rabbitmq_args.ini --vhost {{ vhost }} --queue {{ queue_name }} {% if thresholds.warning %}-w {{ thresholds.warning }}{% endif %}{% if thresholds.critical %}-c {{ thresholds.critical }}{% endif %}
|
||||
command[check_rabbitmq_queue_{{ vhost.replace("/", "") }}_{{ queue_name }}]=/usr/lib64/nagios/plugins-rabbitmq/check_rabbitmq_queue --extra-opts=common@/etc/nrpe.d/rabbitmq_args.ini --vhost {{ vhost }} --queue {{ queue_name }} {% if thresholds.warning %}-w {{ thresholds.warning }}{% endif %} {% if thresholds.critical %}-c {{ thresholds.critical }}{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue