summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Miller <admiller@redhat.com>2016-07-15 19:14:10 +0000
committerAdam Miller <admiller@redhat.com>2016-07-15 19:16:04 +0000
commitc9cba944c89cfb9b650571441bda05282e2a1bf2 (patch)
tree4a8a5d763d1375c3652c8b1dd05dd5a03867ed87
parent450acca7d6c84ba0e06e0b9f1933419d27ec0fbd (diff)
downloadansible-c9cba944c89cfb9b650571441bda05282e2a1bf2.tar.gz
ansible-c9cba944c89cfb9b650571441bda05282e2a1bf2.tar.xz
ansible-c9cba944c89cfb9b650571441bda05282e2a1bf2.zip
switch osbs-api monitoring to nrpe in nagios instead of check_website
Signed-off-by: Adam Miller <admiller@redhat.com>
-rwxr-xr-xroles/nagios/client/files/scripts/check_osbs_api.py14
-rw-r--r--roles/nagios/client/tasks/main.yml5
-rw-r--r--roles/nagios/client/templates/check_osbs.cfg.j21
-rw-r--r--roles/nagios/server/files/nagios/services/osbs.cfg2
4 files changed, 19 insertions, 3 deletions
diff --git a/roles/nagios/client/files/scripts/check_osbs_api.py b/roles/nagios/client/files/scripts/check_osbs_api.py
new file mode 100755
index 000000000..b836f007d
--- /dev/null
+++ b/roles/nagios/client/files/scripts/check_osbs_api.py
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import requests
+import sys
+
+r = requests.get("https://localhost:8443/", verify=False)
+
+if 'paths' in r.json().keys():
+ print "OK: OSBS API endpoint is responding with path data"
+ sys.exit(0)
+else:
+ print "CRITICAL: OSBS API not responding properly"
+ sys.exit(2)
+
diff --git a/roles/nagios/client/tasks/main.yml b/roles/nagios/client/tasks/main.yml
index 8bc441469..905a1fd00 100644
--- a/roles/nagios/client/tasks/main.yml
+++ b/roles/nagios/client/tasks/main.yml
@@ -57,13 +57,14 @@
- check_lock_file_age
- check_testcloud
- check_osbs_builds.py
+ - check_osbs_api.py
when: not inventory_hostname.startswith('noc')
tags:
- nagios/client
# create dirs
# puppet used to make /var/spool/nagios (owned by nagios.nagios) mode 750
-# and /usr/lib/nagios/plugins (owned by root) mode 755 - but we don't know WHY
+# and /usr/lib/nagios/plugins (owned by root) mode 755 - but we don't know WHY
# then stuff it with plugins from the plugins dir in the nagios module
# then we symlinked that to /usr/lib64/nagios/plugins
# it was a nightmare - don't do that - my ghost will haunt you if you do
@@ -181,7 +182,7 @@
- name: install nrpe checks for proxies
template: src={{ item }}.j2 dest=/etc/nrpe.d/{{ item }}
with_items:
- - check_happroxy_conns.cfg
+ - check_happroxy_conns.cfg
- check_varnish_proc.cfg
when: inventory_hostname.startswith('proxy')
notify:
diff --git a/roles/nagios/client/templates/check_osbs.cfg.j2 b/roles/nagios/client/templates/check_osbs.cfg.j2
index ba56709dc..1b427f381 100644
--- a/roles/nagios/client/templates/check_osbs.cfg.j2
+++ b/roles/nagios/client/templates/check_osbs.cfg.j2
@@ -1 +1,2 @@
command[check_osbs_builds]={{ libdir }}/nagios/plugins/check_osbs_builds.py
+command[check_osbs_api]={{ libdir }}/nagios/plugins/check_osbs_api.py
diff --git a/roles/nagios/server/files/nagios/services/osbs.cfg b/roles/nagios/server/files/nagios/services/osbs.cfg
index 8b034541a..ce8f68cb4 100644
--- a/roles/nagios/server/files/nagios/services/osbs.cfg
+++ b/roles/nagios/server/files/nagios/services/osbs.cfg
@@ -1,7 +1,7 @@
define service {
host_name osbs-master01
service_description Check OSBS API endpoint paths
- check_command check_website!osbs-master01.phx2.fedoraproject.org:8443!paths
+ check_command check_by_nrpe!check_osbs_api
max_check_attempts 5
use defaulttemplate
}