Class WebMonitorSite

This class contains all the settings relevant for monitoring a site, handling an error and notifying a recipient.

The key methods of the class are CheckSite and CheckSiteAsync which are high level methods that perform all the tasks associated with a single site check. These methods call lower level methods like AccessSiteHttp, SendEmail, Log which are the actual worker methods.

Async operation is supported via CheckSiteAsync and the OnMessage event which runs on a separate newly created thread. OnMessage events are fired as requests are started and finished with error information embedded.

System.Object
  Westwind.WebMonitor.Components.WebMonitorSite

public class WebMonitorSite : object

Class Members


MemberDescription
Constructor Constructor initiallizes this instance
OnMessage The OnMessage Event fires on various occasions during the request process. When a request is started and when it completes. The event provides references to the Site a message and a Event Id that describes which kind of event is being fired.
Error Error flag that is true if an operation fails.
ErrorMsg Error Message that was set when the last request failed.
SiteId Identifier for this site in GUID string format.
AccessSiteHttp Low level method that goes out and accesses a URL based on the internal URL propoerty settings. Request checks for timeout, response code and the actual content compared to the SearchFor property value.
public bool AccessSiteHttp();
CheckSite High level method that performs an entire site check, notifies the recipients on errors and takes the action specified.
public bool CheckSite();
CheckSiteAsync This method performs the same functionality as CheckSite does, but does so Asynchronously. It fires a new thread and then calls CheckSite from this new thread.
public void CheckSiteAsync();
Clone
public WebMonitorSite Clone();
RaiseOnMessage Raises a message event on this site. You can use this to fire special events to the front end layer of the application. Normally this method is called only internally.
public void RaiseOnMessage( string Message,
EventMessageId lnMsgId );
RequiresChecking Queries the current site and sees if it has to be run. Based on the values contained in the NextCheck, LastCheck, CheckFrequency and Active properties.
public bool RequiresChecking();
RunProcess Executes a process when the site is down
public bool RunProcess( int lnFailures );
SendEmail Sends an email using the oConfig and internal mail settings.
public bool SendEmail( string lcHeader,
string Message );
SetConfig Assigns the Config member on the WebMonitorSite object. The config object is used to specify default HTTP and system settings.
public void SetConfig( WebMonitorConfig Config );
SetDefaultValuesFromConfig Assigns the default values that are stored in the main configuration. This method is called when a new entry is created with default values.
public bool SetDefaultValuesFromConfig();
SetError Sets the Error and ErrorMsg flags.
public void SetError( string lcErrorMsg );

public void SetError();

StopThread Handles shutting down the currently executing thread of this instance when running CheckSiteAsync.
public void StopThread();
Active Determines whether the site is active and checked for in the RequiresChecking() check whether this request needs to be run.
AsyncResult The result value from an Async request check
BackUpMessage Message assigned to email if a failed server comes back up.
CheckFrequency Timeout in seconds for the site to wait for completion of the request. If exceeded an alert is sent.
EmailAddress Email Address used to send alert messages.
EmailFrom Email address used as the return address when error emails are sent.
FailureMessage Message assigned to email if a failure occurs. If not set defaults to the Site Url.
LastCheck DateTime of the last request that was run.
LastRequestTime Contains the time it took to run the last HTTP request.
LastResponseText Contains the HTTP response from the last request. Typically this will be HTML.
NextCheck DateTime of when the next check should occur.
Password HTTP Password to access this HTTP request.
PostContentType The content type for the data posted.
PostData Any raw POST data to send to the server
ProcessToRun Contains an external process to fire when the request fails.
ProcessToRun2 Contains an external process to fire when the request fails.
SearchFor String the HTTP content is searched for on a site check. If the string is not found the request fails. If this string is empty no search matching is performed.
SiteCheckStarted Time and Date that a site check was started.
SiteName Descriptive Name of this Web Monitor Site
Tag General purpose field you can use to attach some information to the request. Not used internally but can be used to pass generic info to a handler
Timeout Timeout in seconds for the site to wait for completion of the request. If exceeded an alert is sent.
Url The Url to hit for a given site check. Should be in format: http://site.com:port/page.ext
Username Username for authentication if required.

Requirements

Namespace: Westwind.WebMonitor.Components
Assembly: wwwebmonitor.dll


Last Updated: 4/22/2005 | Send Topic Feedback