Computer Monitor Setup Example

This example shows how to use the Computer Monitor in the following scenario:

Configure the Trigger

First you must set up the computer monitor trigger. Your web application has a page called "webtest.asp" that returns the text "Result: Application OK" if everything is working properly.

Therefore, the Computer Monitor will be set to request this page, and trigger if the response returned by the server does not match this text.

You want the trigger to test every 5 minutes, and you need to check these additional options:

Show screen example Type your expanding text here.
 

Configure the Notification Task

This job will have a single step: a Notification Task to send your notification message.

You will use a script to determine the subject, text, and severity of the message.

Show screen example

Conditions

The step will use a Script Condition. The script will serve two purposes:

'first, determine whether the job is being triggered because the server has failed
'or because it has been restored. The Action parameter tells us this
if Parameters("Action")="ConnectionFailed" then		
	
	'the job has been triggered because the server or connection failed
	
	'set the message text to be used. Build a notification message that includes the status code and the error message
	'assign this message to the NotificationMessage parameter, which the Notification Task uses as its message text
		Parameters("NotificationMessage")="Connection Status: " & Parameters("ConnectionStatusCode") & vbcrlf & _
						  "Error Message: " & Parameters("ResponseText") 
						  
						
	'now figure out how many times a failure has been detected since the last successful response. 
	'We only want to send messages for the first and second failure.
	'The FailureCount parameter tells us this
	if Parameters("FailureCount")=1 then		'first failure
	
		'set the subject to be used for the notification message
		Parameters("NotificationSubject")="Server XXX failed (first notice)"
		
		'set the severity for the message
		Parameters("MessageSeverity")=7	
		'set the Result to True to indicate that the condition is satisfied, so step will be run			
		Result=true							  
		
	elseif Parameters("FailureCount")=2 then	'second failure
	
		'set the subject to be used for the notification message
		Parameters("NotificationSubject")="Server XXX failed (second notice)"
		'set the severity for the message
		Parameters("MessageSeverity")=9		'override the severity set for the task
		
		'set the result to True to indicate that the condition is satisfied, so step will be run
		Result=true							  
	else 						'subsequent failure
		'After we've already sent 2 messages, we don't want to send any more until the connection is restored.
		'Set the Result to False, which indicates that the condition is not met. This will cause
		'the step to be skipped (notification will not be sent).
		Result=False	
	end if
	
else	
	'the job is being triggered because the server or connection has been 
	'restored after a previously-reported failure
	
	'set the message subject and text to be used:
		Parameters("NotificationSubject")="Server restored"
		Parameters("NotificationMessage")="Connection Status: " & Parameters("ConnectionStatusCode") & vbcrlf & _
						  "Response: " & Parameters("ResponseText") 
	Result=true	'set the result to True to indicate that the condition is satisfied, so step will be run						  
	'we want to send this message to the same people who received the most recent failure notification,
	'so we need to set the severity to match the severity of the most recent message.
	'the FailureCount will tell us how many failures were detected since the last success; based
	'on that we know which severity to use.
	
	'if the count is 1, we know we only sent a severity 7 message before.
	'if the count is >1, we know we sent a severity 9 message before.
	if Parameters("FailureCount")=1 then		
		Parameters("MessageSeverity")=7		
	else
		Parameters("MessageSeverity")=9		
	end if
	
end if

Recipients

The Recipients for your task should be users or groups that are configured to notify the correct people based on the message severity. For example, you may set up your web server administrator so that she is notified by e-mail for all notifications, and by pager for notifications with a severity of 9. Then, if you include her as a recipient for this task, she will receive an e-mail warning if the server is unreachable, and another alert by pager if the server is still unreachable 5 minutes later.