Blob Blame History Raw
From d828c825c58f2da4b4edd6548c5fd254842a0add Mon Sep 17 00:00:00 2001
From: David Vossel <dvossel@redhat.com>
Date: Wed, 29 Apr 2015 11:15:18 -0500
Subject: [PATCH 4/6] nginx agent support

---
 heartbeat/nginx | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/heartbeat/nginx b/heartbeat/nginx
index 65fd8f2..fadc545 100755
--- a/heartbeat/nginx
+++ b/heartbeat/nginx
@@ -31,7 +31,7 @@
 #  OCF_RESKEY_status10regex
 #  OCF_RESKEY_status10url
 #  OCF_RESKEY_client
-#  OCF_RESKEY_testurl
+#  OCF_RESKEY_test20url
 #  OCF_RESKEY_test20regex
 #  OCF_RESKEY_test20conffile
 #  OCF_RESKEY_test20name
@@ -416,7 +416,7 @@ start_nginx() {
     return $OCF_SUCCESS
   fi
   if 
-    ocf_run $NGINXD -t -c $CONFIGFILE
+    ocf_run $NGINXD $OPTIONS -t -c $CONFIGFILE
   then
     : Configuration file $CONFIGFILE looks OK
   else
@@ -442,7 +442,7 @@ start_nginx() {
       [ $ec -eq $OCF_NOT_RUNNING ]
     then
       tries=`expr $tries + 1`
-      ocf_log info "Waiting for $NGINXD -c $CONFIGFILE to come up (try $tries)"
+      ocf_log info "Waiting for $NGINXD $OPTIONS -c $CONFIGFILE to come up (try $tries)"
       true
     else
       false
@@ -727,25 +727,25 @@ For example, you can set this paramter to "wget" if you prefer that to curl.
 <content type="string" />
 </parameter>
 
-<parameter name="testurl">
+<parameter name="test20url">
 <longdesc lang="en">
 URL to test. If it does not start with "http", then it's
 considered to be relative to the document root address.
 </longdesc>
-<shortdesc lang="en">Level 10 monitor url</shortdesc>
+<shortdesc lang="en">Level 20 monitor url</shortdesc>
 <content type="string" />
 </parameter>
 
 <parameter name="test20regex">
 <longdesc lang="en">
-Regular expression to match in the output of testurl.
+Regular expression to match in the output of test20url.
 Case insensitive.
 </longdesc>
 <shortdesc lang="en">Level 20 monitor regular expression</shortdesc>
 <content type="string" />
 </parameter>
 
-<parameter name="testconffile">
+<parameter name="test20conffile">
 <longdesc lang="en">
 A file which contains a more complex test configuration. Could be useful if
 you have to check more than one web application or in case sensitive
@@ -785,14 +785,11 @@ Extra options to apply when starting nginx.
 </parameters>
 
 <actions>
-<action name="start"   timeout="40s" />
+<action name="start"   timeout="60s" />
 <action name="stop"    timeout="60s" />
 <action name="reload"  timeout="40s" />
 <action name="status"  timeout="30s" />
-<action name="monitor" timeout="30s" depth="0" interval="10s" />
-<action name="monitor" timeout="30s" depth="10" interval="30s" />
-<action name="monitor" timeout="45s" depth="20" />
-<action name="monitor" timeout="60s" depth="30" />
+<action name="monitor" timeout="30s" depth="0" interval="20s" />
 <action name="meta-data"  timeout="5" />
 <action name="validate-all"  timeout="5" />
 </actions>
@@ -838,11 +835,11 @@ validate_all_nginx() {
     exit $OCF_ERR_CONFIGURED
   fi
   if
-    ocf_run $NGINXD -t -c $CONFIGFILE
+    ocf_run $NGINXD $OPTIONS -t -c $CONFIGFILE
   then
     : Cool $NGINXD likes $CONFIGFILE
   else
-    ocf_log err "$NGINXD -t -c $CONFIGFILE reported a configuration error."
+    ocf_log err "$NGINXD $OPTIONS -t -c $CONFIGFILE reported a configuration error."
     return $OCF_ERR_CONFIGURED
   fi
   return $OCF_SUCCESS
@@ -859,7 +856,7 @@ then
   OPTIONS="$OCF_RESKEY_options"
   CLIENT=${OCF_RESKEY_client}
   TESTREGEX=${OCF_RESKEY_status10regex:-'Reading: [0-9]+ Writing: [0-9]+ Waiting: [0-9]+'}
-  TESTURL="$OCF_RESKEY_status10url"
+  TESTURL="$OCF_RESKEY_test20url"
   TESTREGEX20=${OCF_RESKEY_test20regex}
   TESTCONFFILE="$OCF_RESKEY_test20conffile"
   TESTNAME="$OCF_RESKEY_test20name"
-- 
1.8.4.2