[PATCH] Add a nagios check for each rabbitmq server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit eae92f73e95 installed the nagios scripts[0] that are packaged for
epel7-infra on the RabbitMQ hosts. This is an attempt to use them with
nagios. I don't know anything about nagios though, so I have no idea if
this is even close to right, or if it works.

[0] https://github.com/nagios-plugins-rabbitmq/nagios-plugins-rabbitmq

Signed-off-by: Jeremy Cline <jcline@xxxxxxxxxx>

---
 roles/nagios_client/tasks/main.yml            | 15 +++++++++++++
 .../templates/check_rabbitmq_server.cfg.j2    |  1 +
 roles/nagios_server/tasks/main.yml            | 22 +++++++++++++++++++
 .../nrpe/check_rabbitmq_server.cfg.j2         |  1 +
 4 files changed, 39 insertions(+)
 create mode 100644 roles/nagios_client/templates/check_rabbitmq_server.cfg.j2
 create mode 100644 roles/nagios_server/templates/nrpe/check_rabbitmq_server.cfg.j2

diff --git a/roles/nagios_client/tasks/main.yml b/roles/nagios_client/tasks/main.yml
index 0259a43ca..65a60a7c3 100644
--- a/roles/nagios_client/tasks/main.yml
+++ b/roles/nagios_client/tasks/main.yml
@@ -233,6 +233,21 @@
   tags:
   - nagios_client
 
+- name: install nrpe checks for the RabbitMQ cluster
+  template:
+    src: "{{ item }}.j2"
+    dest: "/etc/nrpe.d/{{ item }}"
+    owner: root
+    group: root
+    mode: 0600
+  with_items:
+    - check_rabbitmq_server.cfg
+  when: inventory_hostname.startswith('rabbitmq')
+  notify:
+  - restart nrpe
+  tags:
+  - nagios_client
+
 - name: nrpe service start
   service: name=nrpe state=started enabled=true
   tags:
diff --git a/roles/nagios_client/templates/check_rabbitmq_server.cfg.j2 b/roles/nagios_client/templates/check_rabbitmq_server.cfg.j2
new file mode 100644
index 000000000..498a8757e
--- /dev/null
+++ b/roles/nagios_client/templates/check_rabbitmq_server.cfg.j2
@@ -0,0 +1 @@
+command[check_nrpe_check_rabbitmq_server]=exec /usr/lib64/nagios/plugins-rabbitmq/check_rabbitmq_server -H localhost --password "{{ (env == 'production')|ternary(rabbitmq_monitoring_password_production, rabbitmq_monitoring_password_staging) }}" --user nagios-monitoring
diff --git a/roles/nagios_server/tasks/main.yml b/roles/nagios_server/tasks/main.yml
index 2d6d50c31..f61584ed6 100644
--- a/roles/nagios_server/tasks/main.yml
+++ b/roles/nagios_server/tasks/main.yml
@@ -110,6 +110,28 @@
   - config
   - nagios_server
 
+- name: Ensure the nrpe.d directory exists for nrpe configs
+  file:
+    dest: /etc/nrpe.d
+    state: directory
+  tags:
+  - nagios_server
+
+- name: Add nrpe configurations to /etc/nrpe.d
+  template:
+    src: "/nrpe/{{ item }}.j2"
+    dest: "/etc/nrpe.d/{{ item }}"
+    owner: root
+    group: root
+    mode: 0600
+  with_items:
+    - check_rabbitmq_server.cfg
+  notify:
+  - restart nrpe
+  tags:
+  - config
+  - nagios_server
+
 ## Copy over the nagios configs
 - name: Copy /etc/nagios/conf.d/*cfg files
   copy: src=nagios/configs/{{ item }} dest=/etc/nagios/conf.d/{{ item }}
diff --git a/roles/nagios_server/templates/nrpe/check_rabbitmq_server.cfg.j2 b/roles/nagios_server/templates/nrpe/check_rabbitmq_server.cfg.j2
new file mode 100644
index 000000000..498a8757e
--- /dev/null
+++ b/roles/nagios_server/templates/nrpe/check_rabbitmq_server.cfg.j2
@@ -0,0 +1 @@
+command[check_nrpe_check_rabbitmq_server]=exec /usr/lib64/nagios/plugins-rabbitmq/check_rabbitmq_server -H localhost --password "{{ (env == 'production')|ternary(rabbitmq_monitoring_password_production, rabbitmq_monitoring_password_staging) }}" --user nagios-monitoring
-- 
2.21.0
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux