Here's a short example for your review. It consists of just two files: "light.cfm" (which resides on the server being tested to see if the lights are on
The following code, light.cfm, is a form that calls itself. When you (or the CFHTTP tag from another server) submit a number in the input field, the form automatically adds one to the input and displays the result: proof that you're not looking at a static display.
It would be quick work to modify this code to update a database with the incremented value, read the value back from the database, and pass it back to the form. This would check the database and its connection to the server as well.
For this example, be sure not to leave any spaces after the word "value" in the input field; because, the remote tester is going to count positions from the beginning of this word when it looks for the new value of this field.
The returned value above should be 9; because, the page sends an 8 to the server being tested. You'll run your code from a remote server of course (after debugging). This example is triggered manually and provides visual feedback so you can see what has happened; you'll want to write your test to be triggered manually, dump its output to a file, and send a signal in some fashion to alert you when a consistent problem occurs. =Marty=
Test the Server
A perfect CFHTTP tag would understand javascript and would let you specify which submit button to trigger on which of multiple forms of the target URL. However, the existing CFHTTP tag isn't that smart. That's why it's a good idea to create a simple check page for your server instead of expecting CFHTTP to cope with the bells and whistles on the main page you've prepared for your human users.
<cfif isDefined("form.check")>
<cfset form.check=#form.check#+1>
<cfelse>
<cfset form.check=0>
</cfif>
If the machine is running, it will increment the number in the form field.<br>
<cfform name="light" action="light.cfm" method="post">
Check: <cfinput name="check" type="text" value="#form.check#">
<input name="doit" type="submit" value="Now">
</cfform>
Run the Test Remotely
There are two oddities which aren't clear from the examples I've seen. First, you don't send a value for the submit tag. (That's one of the reasons for picking a target page that doesn't have multiple submit tags.) Second, you do send a value for all other inputs, even those you don't care about. The CFHTTP tag uses CFHTTPPARAM tags to submit variables to the remote server almost as if the target page didn't exist. If your "post" from the CFHTTP tag leaves any input fields empty that are present on the remote form, the post will probably fail. Here's push.cfm
<!--- Point this URL at the system to be monitored --->
<cfhttp url="http://127.0.0.1/light.cfm"
method="post"
resolveurl="false">
<cfhttpparam type="formfield" name="check" value="8">
</cfhttp>
<html>
<head><title>view</title></head><body>
<h3>view</h3>
<cfoutput>
Status code is #cfhttp.statusCode#<br>
<hr>
Content is #htmlCodeFormat(cfhttp.fileContent)#<br>
</cfoutput>
<cfif findnocase("value",cfhttp.fileContent)>
<cfset point=findnocase("value",cfhttp.fileContent)>
<cfset saw=mid("#cfhttp.fileContent#",point+7,1)>
<cfelse>
<cfset saw="0">
</cfif>
<cfoutput>
returned value is #saw#
</cfoutput>
</body>
</html>