Use Scripting To Monitor Your Site
This article is about our proprietary scripting engine. If you're just looking for a simple and easy way to monitor your website, we have the perfect service for that, too. You can get alerts by phone call, SMS, XMPP and e-mail. Read about how it works or sign up for a free trial.
The Scripting Language
This is a simple script that checks the home page of Yahoo.com. First, the script checks to make sure that the domain name, www.yahoo.com, can be resolved to an IP address. Next, the script checks connectivity to the port that the HTTP server is listening on. Finally, the script initiates an HTTP protocol connection and gets the home page. If any one of these operations fails, the script generates an error. The following script is a slight variation that also shows some of the error handling available.
This script adds a little refinement to the first script. In this one, if the TCP connection fails, the script immediately jumps to the tcp_error label. There we store the error message that was generated away for later, and then try to ping the server; if the ping fails, we ignore its error message. Once the ping has completed we re-generate the original error so it will be reported back to our server. The nice thing about this script, is that once you have been notified that your site is down due to a TCP error, you can look at the check record through our Web site. If the ping command was successful you will know that your server is available on the Internet, but that the particular port is not.
Those first two scripts aren't too revolutionary, and are close to the one generated automagically when you create a standard HTTP site and don't select any of the optional features. Lets walk through the site a little.
This script expands on the last to fully check out the user experience on the My Yahoo! site. It checks the home page and makes sure the given keyword can be found on it ("2002 Yahoo" appears at the bottom of the page). Next the script sets some form variables and then calls the login page. This time instead of checking for the existence of a keyword, it checks to make sure that the word "Error" isn't found on the page. The script wraps up with a check of the amount of time it took to load the page. We keep track of any cookies sent by the server in response to HTTP requests. Those cookies are sent back to the server on any subsequent HTTP requests. This helps us replicate the activities a normal user would cause on your server.
The script shows another feature of our script-based agents, the ability to send a warning instead of always generating an error. Warnings result in alerts being sent out, but your site is not marked down. In this case, the contacts for this site are notified that the page isn't loading fast enough, but the site is not down and doesn't need to be marked as such.
Lets wrap up this brief look at the scripting language with a look at a fairly complicated script designed to fully test the functionality of an e-mail server.
Copyright © 2000-2013 Alertra, Inc. All rights reserved. Please read our privacy statement and our terms of service. [C]