From d3e82b5566a6528b1ac2b4332734d28d21106aae Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Fri, 24 Apr 2020 18:14:42 +0200
Subject: [PATCH] ansible-roles/nextcloud#12 Add OCS monitoring for NextCloud
 instances

---
 templates/httpcheck.conf | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/templates/httpcheck.conf b/templates/httpcheck.conf
index 9a7f494..d53f3fb 100644
--- a/templates/httpcheck.conf
+++ b/templates/httpcheck.conf
@@ -154,4 +154,13 @@ redirect: no
     header: {{ site.uptime.header|to_json }}
 {% endif %}
 {% endif %}
+{% if site.ocs is defined %}
+
+{{ site.domain|to_uuid }}:
+    name: NextCloud OCS {{ site.id }}
+    url: {{ site.protocol|default('https') }}://{{ site.domain }}/ocs/v2.php/apps/serverinfo/api/v1/info?format=json
+    header:
+      Authorization: Basic {{ (site.ocs.username + ':' + site.ocs.password) | b64encode }}
+    regex: {{ '"status":"ok"'|regex_escape() }}
+{% endif %}
 {% endfor %}
-- 
GitLab