Simple Site Monitor
Simple console application that makes web requests to the configured URLs, validating that they work correctly. Run on a schedule (e.g., Windows scheduled task) for a simple website monitoring solution.
I wanted to monitor the availability of various websites that I develop and/or host. Searching the Internet yielded a lot of nice pay options and some limited functionality free options. I figured I'd create my own basic monitor and just run it as a scheduled task on my Windows desktop at home. Been running it for years now and it's worked perfectly, giving me the simple monitoring that I needed.
The search for expected text uses regular expression matching because it was quick and simple. I acknowledge that using regular expressions to parse HTML is generally not advisable, but due to the simplicity of the implementation here, it works just fine. Read up here on why you shouldn't use regular expressions to parse HTML, using an XML parser instead.
- Website Monitor
- Configure as many URLs to monitor as you like
- Checks for an HTTP status 200 response
- Also can check for the existence of expected text in the HTML returned in the response
- Email Notifications
- Configure your SMTP credentials and send email alerts when a URL monitor fails
- Includes details on the failure, i.e., HTTP status code, if expected text wasn't found, etc.
How to Use
- Build the solution
- Take a copy of SimpleSiteMonitor.exe and SimpleSiteMonitor.exe.config from the build output and place them in a location from where you want the application to run
- Open SimpleSiteMonitor.exe.config in a text editor
- Configure the URLs to monitor:
- Create entries in the appSettings node:
<!--add key="uniqueName" value="http://yourUrlHere.com,text to look for in HTML"/-->
<add key="google" value="http://www.google.com,I'm feeling lucky"/>
- Set the SMTP values for sending email in the applicationSettings node:
<setting name="SmtpServer" serializeAs="String">
<setting name="SmtpPort" serializeAs="String">
<setting name="FromAddress" serializeAs="String">
<setting name="ToAddress" serializeAs="String">
<setting name="Password" serializeAs="String">
- Create a Windows scheduled task to execute *SimpleSiteMonitor.exe" on the schedule of your choosing