Http health check monitor

Health Mon

Hein Pragt Http health monitor As a technical application manager I face the problem of having a complex application with many servers and lots of api services, and sometimes one or more of the many http servers or rest api’s fails. There is excellent tooling to monitor an application farm but a lot of companies do not invest in this kind of health check maintenance tooling especially not in de development area. Giving the fact that a lot of technical maintenance is done by the devops team and they also don’t have the health check tooling to monitor the servers. I am a programmer so decided to build a small portable dotnet program that could generate a real time status view of all the http(s) services in an application suite. It is a simple http server that will run on any chosen port (default 8080) and it reads a simple xml file with a list of url’s it has to poll and what result status code is expected. When the expected status code is returned it will show a green bar and when the status is different it will show a red bar with the server name and the http error code. The program is a simple x64 DotNet 4.6 console application that you can run from the command line, or at server startup, from a scheduled task.

It expects a settings.xml file and a style.css file in the same directory, the xml file contains a list of all the url’s the program has to poll. It looks like this:

    <name>Server one VM00345:8080</name> 
    <name>Server one VM00347:8081</name> 
    <name>Server two VM00385:80</name> 

To give users a chance to change the layout or colors of the healt monitor screen, an external css file is provided, it will be read at startup. It only contains the basics, but if you f.i. use short names you could change the width of the blocks (entry) so more blocks can be displayed on a singe screen. It looks like this:

.ok { background-color: lightgreen; } 
.error { background-color: red; } 
.entry { width: 320px; padding-left: 8px; padding-right: 8px; margin-left: 4px; border: 1px solid gray; float: left; } 
.header { font-size: 1.5 em; padding-bottom: 4px; margin-bottom: 4px; } 
.timestamp { font-size: 0.6em; } 
.groupend { clear: both; } 
.groupbar { width: 99%; color: #ffffff; background-color: gray; margin-top: 6px; }

Since version 1.09 there is a config.xml file where some configuration settings are stored in simple name value format. The commandline port will still overide the config.xml setting.

   <setting> <name>Port</name> <value>8080</value> </setting> 
   <setting> <name>TimeoutMs</name> <value>2200</value> </setting> 
   <setting> <name>Title</name> <value>Development</value> </setting> 

Every time you send a GET request to this health check monitor program the internal http server will poll all he url’s and generate the html status screen. It will not poll until the next GET request, the date time stamp of the last request is in the top of the screen. This http health check program is KISS (keep it simple stupid) and does what it has to do and nothing more. Its portable and does not need installation and it runs anywhere you put it. It only needs the dotnet 3.1 (or higher) installed. The program is closed source, freeware and without any warranty whatsoever. But I use it myself and I think it’s simple, stable and safe. Any recommendations for improvement are welcome.

Download the zip file of the https health monitor program and unpack it in a (logical) folder on your disk drive, I use a folder named portapps in the root folder of my C drive. Run the http health check monitor program by hand (the argument can be a different port number), double click it for the default port and it will start a console application. As long as this console applicatio is running the http server is alive. In the console window it will log all the things it does, including more details on the response codes. Start you browser and type: http//localhost:8080 and the status screen will be displayed in you browser. The timeout on every request is 1.5 seconds, so if a lot of servers are down, the response screen will take a while to load. If you open the port number in the firewall, the http server can also be used on another (client) computer.


Version 1.09 – Feb 2021 – new features.

Here you can download the zip file with the lates version 1.09 of the HmPHealtheMonitor.exe portable Windows ™ health check monitor program. The executable file is digital signed with my codesigning certificate. Read the intructions to use above.


Release notes

  • 1.03
    • Initial release
  • 1.04
    • Add timeout of 1.5 sec.
    • Now listening on any IP
  • 1.05
    • Added support for old and invalid TSL/SSL versions.
  • 1.06
    • Added explicit GET methode.
    • Improved error handling.
  • 1.07
    • Improved TSL/SSL handling.
  • 1.08
    • Fixed bug in 404 errorhandling.
  • 1.09
    • Added configurable timeout value for each call.
    • Added a configurable title for the header.
    • Added a config.xml file.

Known issues

  • The windows defender program will sometimes block this program, just right click the exe file and click run anyway.
  • The Avast virusscanner sometimes gives an alarm, I double ckhecked, it is a false positive.

How to install the Health monitor as a service in Windows ™

When you want this health check monitor to run at a Windows server at startup, one way is installing it as a server and set the startup mode to automatic. This also gives the opportunity to run it under another account. There is a nice open source wrapper that can run ANY windows executable (but also runnable jar (Java) programs) under windows as a service. You can find the binary distribution (but also the source code if you need it) at Github, it is the WINSW project for dotnet version 4 with the name: WinSW.NET4.exe, Jus Google it and download it from Github. This is a short manual for this purpose, you can also use it for other programs.

  • Copy the file to the directory containing the executable.
  • Rename the file WinSW.NET4.exe to HmpHealthSrc.exe.
  • Create a xml file with the (same) name HmpHealthSrc.xml.
  • Edit this file and change the content to this:
  <!-- ID of the service. It should be unique across the Windows system-->
  <!-- Display name of the service --> 
  <name>HmpHealth WinSW</name> 
  <!-- Service description --> 
  <description>HmpHealth on port 8080</description> 
  <!-- Path to the executable, which should be started -->
  <arguments> </arguments> 
  • To change the port, just put it in arguments.
  • Open a CMD shell and go to the HealtMonitor directory.
  • Type: HmpHealthSrc install to install the service.
  • Open the service manager and check i fit is set to autimatic and start the service.
  • Check, using the browser if the Health Monitor is running.

WINSW commands:

  • ‘install’ – install the service to Windows Service Controller
  • ‘uninstall’ – uninstall the service
  • ‘start’ – start the service (must be installed before)
  • ‘stop’ – stop the service
  • ‘restart’ – restart the service
  • ‘restart!’ – self-restart (can be called from child processes)
  • ‘status’ – check the current status of the service
  • ‘test’ – check if the service can be started and then stopped
  • ‘testwait’ – starts the service and waits until a key is pressed then stops the service
  • ‘version’ – print the version info
  • ‘help’ – print the help info (aliases: -h,–help,-?,/?)

More pages on application software

Leave a Reply

Your email address will not be published. Required fields are marked *