From c9cba944c89cfb9b650571441bda05282e2a1bf2 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 15 Jul 2016 19:14:10 +0000 Subject: switch osbs-api monitoring to nrpe in nagios instead of check_website Signed-off-by: Adam Miller --- roles/nagios/client/files/scripts/check_osbs_api.py | 14 ++++++++++++++ roles/nagios/client/tasks/main.yml | 5 +++-- roles/nagios/client/templates/check_osbs.cfg.j2 | 1 + roles/nagios/server/files/nagios/services/osbs.cfg | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100755 roles/nagios/client/files/scripts/check_osbs_api.py 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 } -- cgit