From 422b13fd86c9d4aff721f9fe1a3d3cf1b0224bc4 Mon Sep 17 00:00:00 2001
From: Kevin Carter <kevin.carter@rackspace.com>
Date: Fri, 11 May 2018 14:03:23 -0500
Subject: [PATCH] update heartbeat vars to check response

Several API services use 300 to indicate it's up, this change add the
ability to check for that.

Change-Id: Ic85f6cff3bc225b29ae0e3e8fbd19eceece00441
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
---
 elk_metrics_6x/templates/heartbeat.yml.j2 | 3 +++
 elk_metrics_6x/vars/variables.yml         | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/elk_metrics_6x/templates/heartbeat.yml.j2 b/elk_metrics_6x/templates/heartbeat.yml.j2
index f3840670..12875eb1 100644
--- a/elk_metrics_6x/templates/heartbeat.yml.j2
+++ b/elk_metrics_6x/templates/heartbeat.yml.j2
@@ -217,6 +217,8 @@ heartbeat.monitors:
     #body:
 
   # Expected response settings
+{%         if item.check_response is defined %}
+  check.response: {{ item.check_response }}
   #check.response:
     # Expected status code. If not configured or set to 0 any status code not
     # being 404 is accepted.
@@ -227,6 +229,7 @@ heartbeat.monitors:
 
     # Required response contents.
     #body:
+{%         endif %}
 {%       endif %}
 {%     endif %}
 {%   endif %}
diff --git a/elk_metrics_6x/vars/variables.yml b/elk_metrics_6x/vars/variables.yml
index de4f75cf..f4bfd8d0 100644
--- a/elk_metrics_6x/vars/variables.yml
+++ b/elk_metrics_6x/vars/variables.yml
@@ -89,6 +89,8 @@ heartbeat_services:
     type: http
     method: HEAD
     path: "/"
+    check_response:
+      status: 300
   - group: "{{ groups['heat_api'] | default([]) }}"
     name: heat api
     ports:
@@ -96,6 +98,8 @@ heartbeat_services:
     type: http
     method: HEAD
     path: "/"
+    check_response:
+      status: 300
   - group: "{{ groups['keystone_all'] | default([]) }}"
     name: keystone api
     ports:
@@ -104,6 +108,8 @@ heartbeat_services:
     type: http
     method: HEAD
     path: "/"
+    check_response:
+      status: 300
   - group: "{{ groups['neutron_server'] | default([]) }}"
     name: neutron server
     ports:
@@ -146,6 +152,8 @@ heartbeat_services:
     type: http
     method: HEAD
     path: "/"
+    check_response:
+      status: 300
   - group: "{{ groups['horizon_all'] | default([]) }}"
     name: horizon
     ports: