Set checks timeout (defaults to 5 minutes)
Also allow setting flap thresholds.
And trivial fix on check_glusterfs.
diff --git a/sensu/files/check.json b/sensu/files/check.json
index 5f0efee..91b6a12 100644
--- a/sensu/files/check.json
+++ b/sensu/files/check.json
@@ -44,6 +44,13 @@
{%- if check.occurrences is defined %}
"occurrences": {{ check.occurrences }},
{%- endif %}
+ {%- if check.get('timeout', 300) %}
+ "timeout": {{ check.get('timeout', 300) }},
+ {%- endif %}
+ {%₋ if check.low_flap_threshold is defined %}
+ "low_flap_threshold": {{ check.low_flap_threshold }},
+ "high_flap_threshold": {{ check.high_flap_threshold }},
+ {%- endif %}
"interval": {{ check.interval }}
}
}
diff --git a/sensu/files/checks/check_glusterfs b/sensu/files/checks/check_glusterfs
index 53734ea..3a12adc 100755
--- a/sensu/files/checks/check_glusterfs
+++ b/sensu/files/checks/check_glusterfs
@@ -44,10 +44,11 @@
ret=1
tries=3
while [ $ret -ne 0 ] || [ $tries -ne 0 ]; do
- out=$(timeout -s9 10 sudo gluster volume status ${VOLUME} detail 2>&1)
+ out=$(timeout -s9 5 sudo gluster volume status ${VOLUME} detail 2>&1)
ret=$?
- [ $ret -ne 0 ] && sleep 1
+ [ $ret -eq 0 ] && break
tries=$[ $tries - 1 ]
+ sleep 1
done
if [ $ret -ne 0 ]; then