Website Monitor

<!--- 
I wrote this when I had to monitor several websites. I actually didn't have access to them so I couldn't create the simple ok.html page, but
I grabbed the first 10 characters and if they did not equal the error page then it gave the green light, but if there was a problem it gave the blinking red light.

The META tag refreshes, and therefore re-executes the script as often as you have it set. The number 60 means 60 seconds.

You could easily build in logging (as in keeping a log, not cutting down trees), and automatic email alerts. My final script was wicked complicated, 
but this is the basis of it.

For this to work you really only have to change the META tag url which is really just the URL of this page.
Then change the CFHTTP URL to what ever you are monitoring.

From there just make any little modifications you want and go crazy with it.
--->




<HTML>
     <HEAD>
        <TITLE>
           
CFHTTP Example
        </TITLE>
      <META http-equiv=
"refresh" content="60;URL=http://www.this-page's-url.com">
    </HEAD>

    <BODY>

    <!--- CFHTTP grabs everything on a page --->

    <CFHTTP
        URL =
"http://www.yesicanusechopsticks.com/testcfm/ok.htm"
        resolveurl =
"Yes"
        throwonerror =
"Yes"
    >
    </CFHTTP>


    <!--- Create a table using Frontpage or whatever --->
    <center>
    <table border="0" width="50%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
        <tr>
            <td width=
"11%" align="center" bgcolor="#000000"><b><font color="#FFFFFF" face="Book Antiqua">Site</font></b></td>
            <td width=
"21%" align="center" bgcolor="#000000"><b><font color="#FFFFFF" face="Book Antiqua">Status</font></b></td>
            <td width=
"24%" align="center" bgcolor="#000000"><b><font color="#FFFFFF" face="Book Antiqua">Last
Poll</font></b></td>
        </tr>


        <!--- After the first row of TR you can put your dynamic info. The first row will be your headers --->
        <!--- Whatever cfhttp grabs will be stored in the variable cfhttp.filecontent --->
        <!--- Here it grabs one page with only three characters on the page, ok. --->

        <cfif cfhttp.filecontent NEQ "ok.">

        <!--- If it cannot grab the page or grabs something other than those three characters then it executes this first cfif --->

        <tr>
            <td width=
"11%"><font face="Bookman Old Style" size="4">Site Name</font></td>
            <td width=
"21%" align="center"><font size="7"><span style="background-color: #FF0000">ALERT</span></font></td>
            <td width=
"24%" align="center"></td>
        </tr>


        <!--- Otherwise (if it did grab it) it executes the efelse --->

    <cfelse>

        <tr>
            <td width=
"11%"><font face="Bookman Old Style" size="4">Site Name</font></td>
            <td width=
"21%" align="center"><font size="7"><span style="background-color: #00FF00">ok</span></font></td>
            <td width=
"24%" align="center"><CFOUTPUT>#TimeFormat(now(),'HH:mm:ss')#</CFOUTPUT></td>
        </tr>


    </cfif>
</table>
<!--- End the CFIF and end the Table --->
<!--- This script can be easily modified to check multiple sites and pages--->


</BODY>
</HTML>



All ColdFusion Tutorials By Author: Rhino
  • Auto Event Emailer
    Queries the database everyday and sends an email automatically when certain events happen.
    Author: Rhino
    Views: 16,706
    Posted Date: Friday, December 13, 2002
  • Column View Output
    Ever wanted your data to be output in a column view such as mailing labels are? Use this code and change only a few lines and your data will be output in a table with 3 columns and as many rows as you have data. A great alternative to the standard row based view. Very easy to modify.
    Author: Rhino
    Views: 8,949
    Posted Date: Wednesday, February 25, 2004
  • Count Down
    Easy CFM file that counts down from a distant date to the present. Can show how many days, months, or years.
    Author: Rhino
    Views: 13,911
    Posted Date: Friday, December 13, 2002
  • Enter-Update same form
    I hate creating duplicate forms where one is for entry and an identical one is for udpating. This code lets you use one form for both purposes.
    Author: Rhino
    Views: 11,416
    Posted Date: Wednesday, April 7, 2004
  • Form processor with individual link email
    This tutorial shows how to process a form and generate a random string that is put on the end of a link. When the user clicks the link it goes to their personal page.
    Author: Rhino
    Views: 11,571
    Posted Date: Wednesday, March 31, 2004
  • Form with 2 Submit Buttons
    An easy way to have a form with 2 or more submit buttons where each one does a different thing. One can count a rows in a DB, then next can actually submit the query. Possibilities are limitless.
    Author: Rhino
    Views: 16,028
    Posted Date: Monday, October 9, 2006
  • IP checker
    Checks to see where the user came from and then decides where to send them.
    Author: Rhino
    Views: 14,768
    Posted Date: Friday, December 13, 2002
  • Use checkboxes on update pages
    Do you have an update page and want to use checkboxes on the page? This tutorial will go over the two steps needed.
    Author: Rhino
    Views: 10,982
    Posted Date: Wednesday, March 31, 2004
  • User Authenication - ADMIN area
    This script provides a simple admin area for the login script written by Pablon on this site. You can list, add, change pass, and delete users.
    Author: Rhino
    Views: 13,392
    Posted Date: Monday, March 29, 2004
  • Website Monitor
    Do you have a website that you'd like to monitor but would rather not pay outrageous fees to some company? This simple script will monitor uptime for you website. It is the barebones version and can be easily modified into something highly useful.
    Author: Rhino
    Views: 13,758
    Posted Date: Wednesday, March 24, 2004