| Version 4.1 User's Guide |
|
| Example Scenarios | Previous | Next Contents |
HTTP Sentry Example
Configuring an HTTP Sentry with Notifier
This example will demonstrate how to monitor a typical Web server, and receive an alphanumeric page whenever the server fails.Defining the Sentry
First, you need to select a specific page to verify. In general, it is best to select a page or file that is not very long, to minimize any potential performance penalty. Testing a typical HTML page of a few K Bytes should have virtually no performance impact, so make sure you do not choose a page or file that is exceedingly large and performance should never be an issue.
Another consideration in choosing a page to monitor is how the page is generated. The simplest test of a Web server is to access a normal HTML page, stored on the server's file system, which is served without the intervention of CGI applications or add-on processes. However, to verify that a particular CGI is functioning properly, you may want to select a URL that causes a page to be generated by the CGI. Database applications, "Server Side Include" handlers, text search and retrieval engines, and other processes performed by add-ons can be verified simply by using the appropriate URL.
Once you have selected the page to test, use a standard Web browser to open the corresponding URL. This will not only verify that the URL is correct, but will make it easy to select a "Verify Phrase" for the page. Use the "View Source..." option in your browser to view the HTML source of the document, and pick out a phrase that occurs in the page. Choose a phrase that is unique to the page, so that incorrect error messages or other content-related problems can be identified by PageSentry. The phrase can be a few characters or a few words, and it is generally best to pick something that is unique but not too long.
Next, launch PageSentry and open a new HTTP Sentry (using the "New Sentry" option of the "Sentries" menu). Enter a name for your Sentry, keeping in mind that this is the name that will be displayed in the Status Window and should allow you to easily recognize the Sentry in logs and error reports. Next, enter the name of the log file into which PageSentry will save a record of it's activity. If you do not need a log for the Sentry tests, simply leave this field blank. Also, select a frequency interval that you would like the Sentry to perform its test. There are several factors that you may want to consider in setting the test frequency. See the Montoring Strategies section of this guide for more details. For now, set the frequency to "5 Minutes". You can always change this later if you feel that you need to increase or decrease this time period.
"HTTP (Web)" is chosen by default from the Sentry Type pull-down menu, so leave the Sentry Type setting as it is. In the "Check URL" field, enter the full URL of the page you wish to check, usually in the form "http://www.yourcom.com/page.html". The URL should be entered exactly as it was entered into the browser earlier. Next, enter the verify phrase you chose above in the "Verify Phrase" field.
If user validation is required to access the page, enter the correct username and password. Again, the username and password should be entered exactly as they were in the validation dialog box displayed by the Web browser when you accessed the page. For pages that are not password protected, simply leave these fields blank.
Defining the Notifier
To receive an alphanumeric page when the Web server fails, you will be defining a PageNow! Notifier for this Sentry. Leaving the Sentry window open, select "New Notifier" from the "Notifiers" menu. Enter a name for the new Notifier, again remembering to choose a name that will be easily recognizable. Next, click the "Send 'Back Up' Notices" checkbox, which will cause the Notifier to send a second page as soon as the server has returned to service after failures. If you want the Sentry to repeatedly send failure notices for as long as the server is down, click the "Persistent Notices" box.
This type of Sentry requires that you have PageNow! running on the same machine as PageSentry. For more information on PageNow!, visit the MarkSpace Web site at http://www.markspace.com/. Also, you must put either the PageNow! application, or an alias to it, in the same folder as PageSentry.
Open PageNow! and configure a "Subscriber", as detailed in the PageNow! documentation. The specific configuration settings do not matter, but be sure to select a subscriber name that is easy to remember and recognize. Send a couple of test messages directly from PageNow! to verify that your configuration is correct and that messages can be sent and received correctly.
Back in PageSentry, select "PageNow!" from the Notifier Type pull-down, and enter the Subscriber Name as it has been configured in the PageNow! application.
Next, click the "Message" button. Here, you can enter the text you would like to receive on the pager when the server reports an error. Use normal text and the defined "tokens" to configure the page you receive to fit your pager or preference. When the message text is set, click the "OK" button to close the window.
To test the Notifier, click the "Run it" button. You may see PageNow! processing the message in the background. When the page arrives, check it to see if you would like to make any changes to your configuration. When finished, click "OK" to close and save the Notifier. Next, return to the Edit Sentry dialog box and you will see the new Notifier in the "Defined Notifiers" list. Select this Notifier and click "Add" so that the pager Notifier will be used to send messages when the Sentry detects a failure.
Testing the Sentry
Click on "Execute Test" in the Edit Sentry dialog box. This will cause your Sentry to check the Web server page for the verify phrase you entered. If the test passes, you have correctly configured your Sentry. Click "OK" to close and save the Sentry, and notice that the Sentry has been added to the Sentry list in the Status Window.
This example will demonstrate how to monitor an AppleShare File server. When the server fails, an e-mail message will be sent, followed by an automatic restart should the server not return to service within a set time period.Defining the Sentry
To test AppleShare servers, PageSentry will log on to the server (if necessary), save a file, wait 2 seconds, read and verify the file, and then delete it. This process will require that PageSentry have full read/write/delete access to the server being tested. The first task in creating an AppleShare Sentry, then, is to either create an account on your AppleShare server for PageSentry to use, or to verify that an existing user account can be used (probably your own).
Next, you must determine the determine the directory you will use on the file server to conduct the test. This is the folder in which PageSentry will create the temporary file. Mount the file server, and choose a folder in which the test can be performed. It is best to select a folder which is not purged on a regular basis, or in which other users might interfere with the Sentry's test. Also, it is best not to select a folder that is commonly left open on user desktops, since the periodic creation of a temporary file might be confusing.
Launch PageSentry and open a new Sentry (from the "Sentries" menu, select "New Sentry"). Enter a name for your Sentry, choosing a name that will be easy to recognize on the Status Window, in log entries, etc. Also, enter a log file name, if the AppleShare Sentry's activities need to be tracked. As with all Sentry types, select a frequency interval that you would like the Sentry to perform its test. Keep in mind that you are using CPU resources on both the PageSentry machine and the AppleShare server, and that the AppleShare test involves slightly more overhead than most other Sentries. For now, set a frequency period of 5 minutes.
Select "AppleShare" from the Sentry Type pull-down menu. This will cause the "Test Setup" fields below to change to those applicable for an AppleShare test. Enter the correct username and password that will be used to log on to the AppleShare server. Remember that it is extremely imporatant that the username and password PageSentry uses to access the server permit full read/write/delete access.
Now, click on "Set Volume/Folder", and use the "Standard File Dialog" to select the AppleShare volume and folder that you wish to use for the Sentry. Again, selecting the correct volume to test the server in question is essential, but choosing a specific folder is entirely up to you.
Defining the Notifiers
When the AppleShare server fails, the first action this Sentry will take is to send an E-mail notification. Leaving the Sentry window open, select "New Notifier" from the Setup menu and begin by entering a name for the new Notifier that will be easy to recognize. In this example, it will be important for a follow up e-mail message to be sent when the server is back up (since it may be automatically restarted without your intervention), so click on the "Send 'Back Up' Notices" checkbox.
Enter your e-mail address and SMTP server name under "User Address" and "Mail Server", respectively. If you are not sure of the name of your mail server, check your e-mail package configuration. The mail server name is often, but not always, the second part of your e-mail address, which follows the '@' (at sign) symbol.
You also need to specify where you would like the warning message to come from. Specifying a good "Mail From" address allows you to do two things. First, you can use the From address as an easy to recognize "flag" that the mail message is coming from PageSentry. For example, a From address of "PAGESENTRY@yourorg.com" will make PageSentry warnings easy to spot in your mailbox. The other important use for the From address is to ensure that the mail message is received. If your mail account or server has failed for some reason, then mail servers will return the mail with an error to the sender. This allows you to enter a friend or co-worker's e-mail address and have the mail message "bounce" to them if for some reason the message can not be delivered to you.
After filling out the e-mail addresses and the server name, click on the "Message" button. Enter appropriate text for both the message body as well as the "Subject" for the message you will receive. Use "tokens" to represent pieces of information detailing the specific problem being reported. When you are done entering the message, click "OK".
To test the Notifier, click the "Run it" button, then open your standard mail package and check your incoming mail. When the e-mail message arrives, check it to see if you would like to make any changes to your configuration. Back in PageSentry, click "OK" to close and save the Notifier.
When the Sentry detects a server failure, you will be sent an e-mail message immediately, but there will be times when you simply can not get to the server or you are not at your desk to receive the e-mail warning. In these cases, you can tell PageSentry to wait 20 minutes and restart the server even if you are not there to do it manually. To do this, you will be using a PowerKey Pro intelligent power strip.
The first step in configuring PageSentry to control the PowerKey Pro is to install and set up the PowerKey Pro hardware and software. Remember that the Powerkey Pro ADB (Apple Desktop Bus) adapter must be plugged into the ADB connector of the PageSentry machine, and the PowerKey software must be installed on the PageSentry machine as well. The server(s) that will be tested and restarted are then plugged into the outlets of the PowerKey Pro.
Follow the instructions given in the PowerKey User's Guide for installation. We strongly recommend that you test your PowerKey using a lamp or some other standard electrical device. For example, plug a lamp into outlet 1 of your PowerKey Pro power strip and verify that you can turn it on and off from within the PowerKey Editor software.
Once the PowerKey Pro is installed and functioning, you can configure a new Notifier in PageSentry. Select "New Notifier" from the Notifiers menu to create another Notifier. Enter a name for the new Notifier, again selecting an easy to recognize name like "Restart Server 1". It is best not to select "Persistent Notices" for a PowerKey Notifier, as the server may take longer to restart than the PageSentry tests allow. In this case, "Persistent Notices" would cause the server to be repeatedly restarted, causing a never-ending reboot cycle.
Next, use the "Delay After Initial Failure" to make PageSentry wait before restarting the server. Set the delay to "20" and choose "Minutes" from the pop-up menu provided. When the server fails, PageSentry will send the e-mail message immediately using the Notifier we defined earlier. When the 20 minute delay completes without the server returning to service, the restart Notifier we are creating now will take action.
In the "Notification" section, choose "PowerKey Pro" as the "Notifier Type", and then select the outlet number that the server to be restarted is plugged into. If you are not sure of the outlet number, look at the PowerKey unit itself. The outlet numbers are labeled, making it easy to see which server is plugged into which outlet. If you have more than 1 PowerKey unit plugged into the PageSentry machine, enter the name of the unit that the server is plugged into. PowerKey units are named in the PowerKey Editor software, so if you can not rememeber the unit name(s), open the PowerKey Editor and check. If you have only 1 PowerKey unit, you can simply leave the PowerKey Unit name blank.
To test the Notifier, click the "Run it" button. Again, you may want to test the Notifier with a lamp or another simple electric appliance, rather than a real server. When finished, a dialog will tell you that the test is complete, so click "OK". Note that PageSentry will report errors communicating with the PowerKey software, but if PageSentry successfully sends the events that control the PowerKey, no errors will be reported. If PageSentry reports that no errors occurred, but the unit doesn't shut off, wait, and turn back on, then see the PowerKey software and documentation for troubleshooting information.
When the Notifier is functioning correctly, click the "OK" button to close and save the Notifier.
If the AppleShare Sentry window has been closed for some reason, re-open it by double-clicking it's name in the Sentry list of the Status Window. In the Sentry Edit window, notice that both the e-mail and PowerKey Notifiers now appear in the "Defined Notifiers" list. Select one of the Notifiers and click "Add", then select the other and click "Add" again. This will cause the AppleShare Sentry to run both notifiers, at the appropriate times.
You can configure the TCP Stream Sentry to monitor a variety of servers, including news (NNTP), POP mail, and others. This example will demonstrate how to monitor a news server and send warning messages to an on-duty network administrator, plus send a delayed warning to the network manager.Using the TCP Stream Sentry to Monitor a News Server
Launch PageSentry and open a new TCP Stream Sentry (by selecting "New Sentry" from the "Sentries" menu). Enter a name for your Sentry, as always choosing an easy to recognize name for use in the Status Window and in failure notifications. Next, if you would like the Sentry's activity logged, enter the log file name. Also, select a frequency interval that you would like the Sentry to perform its test. You can always change this later if you feel that you need to increase or decrease this time.
Now, select "TCP Stream" from the Sentry Type pull-down menu. Enter the server address or domain name that you wish to check, which is usually in the form "news.yourcom.com". Since different TCP/IP servers work on different ports, the default port for the stream Sentry will almost certainly be incorrect. Check the configuration or documentation of the server you would like to test to find out what port the server is running on. To test a news server, enter "119", which is the default NNTP port.
Click "Execute Test" to try your Sentry. If your Sentry test succeeds, you will see a value filled in for the Checksum field. PageSentry will use this value to verify subsequent tests, insuring the server is working properly. If PageSentry is ever unable to open a connection with the server, or if the checksum is found to be incorrect, PageSentry will recognize the server failure. This effectively tests any TCP/IP server that responds to incoming connections with a stream of data.
Some common services and port numbers:
Finger 79 Kerberos 88 POP3 110 News (NNTP) 119 Network Time (NTP) 123 SNMP 161 Defining the Notifiers
In this example, PageSentry will send e-mail to multiple people at different times. The notifiers could just as easily send pages, restart the server, or trigger AppleScript applications.
First, configure three Notifiers, which will send e-mail to Bob, Mary, and Chris. Bob and Mary, in this example, are first line network administrators, and Chris is the network manager. Bob is on call Monday through Friday, 6 a.m. to 6 p.m., and all day Saturday. Mary is on call 6 p.m. to 6 a.m. during the week and on Sunday. Chris should receive an e-mail message any time of the day or day of the week, but only if the server is down for more than 30 minutes.
The basic configuration of the Notifiers to send mail to Bob and Mary are very similar, the only difference being their e-mail addresses. However, the schedules are also different, set by clicking and dragging through the appropriate areas on the schedule section at the bottom of the Notifier window. Red (highlighted) areas represent times in which each administrator is on duty, as the Notifier for Bob, shown below, demonstrates.
![]()
Figure 38: A Scheduled Notifier.Mary's Notifier will have a different name and e-mail address, and the schedule will be exactly opposite the one shown for Bob. When both Notifiers are added to the Stream Sentry, only one will trigger, depending on the time of day and day of week. This will make sure that whoever is on call at the time the server fails will be the one to receive the warning e-mail.
Note that if a server initially fails at, say 5:50 a.m., Mary will receive a warning e-mail message immediately. If the server does not return to service by 6:00 a.m., Bob will also receive a warning e-mail. Any failure, even if it isn't the initial failure, will trigger a Notifier when it occurs during the Notifier's scheduled period.
To complete the example, another Notifier can be created for Chris. In this case (as will the Notifiers in the previous examples), the entire schedule will be left highlighted (red). Chris' Notifier will also be set with a "Delay After Initial Failure" of 30 minutes.
Back on the Stream Sentry Editor window, be sure to add all 3 Notifiers to the "Notifiers to Execute" list. This will ensure that either Bob or Mary receives an immediate notice of the failed news server, and will send Chris a warning if Bob or Mary is unable to correct the problem in a timely manner.
The final example we'll give is also the most complicated. Let's look at the case where a single Macintosh server is providing both Web and E-Mail services, both of which experience occassional (once a month, or less) failures. An APC Intelligent Power Control Unit will be used for recycling server power in the event of a total machine failure, but we'll take less drastic measures as possible.The first step will be to create 3 Sentries, which we'll call "Main Web Server", "Main Mail Server", and "Ping Server Box". By now, you should be comfortable creating basic Sentries, and none of these will be complicated. The "Main Web Server" Sentry will test the top level home page of the Web server, "Main Mail Server" will test the E-Mail service, and "Ping Server Box" is assumed to be a simple Ping of the Macintosh running both services.
Several Notifiers will also be needed. One will restart the Web server application, while another will be setup to restart the e-mail server. A third Notifier will trigger the APC power restart. Finally, an e-mail Notifier will be created to let the system administrator know that a problem occured, even though the first 3 Notifiers will automatically handle the error. To start, here is how a Notifier to restart the WebStar Web server might look:
![]()
Figure 39: A Notifier to restart WebStar.To create the Notifier, enter the address of the server in the Machine Name field, press the Update button, and select the application (in this case, "WebStar 4.3") from the Process menu. The Signature is supplied automatically.
The e-mail restart Notifier will be nearly identical, and the same method will be used to create it. After entering the address of the server and clicking the Update button, however, the mail server application will be selected from the Process pop-up menu.
To create a Notifier to recycle power using the APC Masterswitch, we start by plugging the APC unit into the Ethernet LAN, configuring it's TCP/IP settings, and connecting to it using a Telnet client like NCSA Telnet. Once connected, we manually recycle the outlet via Telnet, keeping track of exactly what keystrokes are used to log-in, make menu selections, etc. Finally, the Telnet Notifier is created and the keystrokes are entered into the PageSentry Telnet Script window, as shown:
![]()
Figure 40: A Notifier to restart a server using the APC Masterswitch.To create this Notifier, the Notifier Type is set to Telnet, and the address of the APC Masterswitch (not the server being restarted) is entered as the Machine Name. The normal Telnet port, 23, is entered into the Port field, and then the Script Editor window is opened, as shown above.
When logging in to the Masterswitch via Telnet, a loging is required to begin. In the script, the username ("Bob") is supplied, followed by a return token ("<CR>") and a pause token ("<PAUSE>"). These were entered into the script by using the token buttons to the right, and tell PageSentry to send the username and a return character, then pause for a few seconds while the Masterswitch Telnet service continues. The password is then sent to complete the login.
The Masterswitch Telnet interface is menu driven, allowing the user to perform options by choosing numbered options. To restart an outlet, option 1 is selected on the main menu, and on the following sub-menu option 1 is choosen again. The user then specifies the outlet number to be restarted, confirms the action, and logs out. This is all reflected in the script, where PageSentry is told to enter "1" in response to the first menu, "1" again in response to the sub-menu, and then "3" to specify the outlet number. Next, the script confirms the action, sends the "Escape" character 3 times to back out of each successive menu, and finally chooses menu item 4 at the top level menu to log out. (The last line of the script, "4<CR><PAUSE>" is not shown.)
The last Notifier, which will send an e-mail to the system administrator, will not be covered here but is straightforward and very similar to previous examples. One important note... The mail server used in the Notifier should be a server other than the one being tested in the example, since if the mail server fails, the Notifier won't be able to send mail through it. Instead, choose a backup mail server or your ISP's mail server.
Next, a Group needs to be created so that when any one of the Sentries fails, all of the Sentries can be tested and the correct action taken. Create a new Group by selecting "Open Group - New Group..." from the "Setup" menu. In this case, we'll give the Group a name like "Primary Server" which will indicate that all Sentries that test the main server will be collected under this Group.
Two Notifiers will then be assigned to the Group, the APC Masterswitch Notifier and the E-Mail Notifier. When all 3 Sentries detect a failure, the Notifiers assigned to the Group will be triggered to restart the server using a power reset, and then mail will be sent letting the administrator know of the failure. When complete, the Group window will look something like this:
![]()
Figure 41: A Group, configured to restart the server, ready for Sentries to be added.With the Group complete, all that's left is a couple of small changes to each Sentry. The Web server test Sentry will be assigned to the Group using the Group pop-up menu, then the "Restart Web Server" and "E-Mail Bill" Notifier will be set to execute when the Sentry fails. If the Web server fails, but the Ping or E-Mail Sentries do not detect a problem, then these Notifiers will be run. In this case, the Web server will be gracefully restarted, and the e-mail notice will be sent. If all 3 Sentries do detect the error, then the Notifiers assigned to this specific Sentry will be ignored, in favor of the higher-level Notifiers assigned to the Group.
Similar changes will be made to the other Sentries. Both will be assigned to the Group, and specific Notifiers will be assigned so that a failure to only the e-mail server will trigger the Notifier that restarts just that application. In practice, it will be impossible for the Ping Sentry to detect a failure but have the other Sentries in the Group succeed in their tests. The Notifiers assigned to the Ping Sentry, therefore, aren't important since the Group Notifiers will always be triggered when the Ping fails.
| Copyright © 1995-2002 Maxum Development Corporation http://www.maxum.com/ Rev. 7/10/02 |
Previous | Next Contents |