HmPHealthMonitor.exe - http health monitor program

Hein Pragt Http health monitorAs 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 maintenance tooling especially not in de development area. Giving the fact that a lot of technical maintenance is done by the develops team and they also don't have the 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 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:


<servers>
  <server>
   <group>Dev</group>
   <name>Server one VM00345:8080</name>
   <url>http://www.system1.com:8080/health</url>
   <valid>200</valid>
  </server>
	
  <server>
   <group>Test</group>
   <name>Server one VM00347:8081</name>
   <url>http://www.sever11.com:8081/api</url>
   <valid>401</valid>
  </server>
	
  <server>
   <group>Test</group>
   <name>Server two VM00385:80</name>
   <url>http://www.apigate.com/test</url>
   <valid>200</valid>
  </server>
</servers>

To give users a chance to change the layout or colors, 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.


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

Every time you send a GET request to this 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 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 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 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. Th 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.

Versions

Version 1.09 - Feb 2021 - new features.

download program zip file Here you can download the zip file with the lates version 1.09 of the HmPHealtheMonitor.exe portable Windows (tm) program. The executable file is digital signed with my heinpragt.com code signing certificate. Read the intructions to use above.

Release notes

Known issues

How to install the Health monitor as a service in Windows (tm)

When you want this health 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.

<service>
<!-- ID of the service. It should be unique across the Windows system-->
<id>HmpHealth</id>
<!-- 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 -->
<executable>E:\HealthMonitor\HmPHealthMonitor.exe</executable>
<arguments> </arguments>
</service>

WINSW commands:

Last update: 11-12-2020

Disclaimer: All pages on this Web site are copyrighted by Hein Pragt, unless otherwise noted. I strive for accuracy but cannot be held responsible for any errors in the content. For questions about the content of this site or persmission to copy you can contact me at: (email: mail@heinpragt.com). Heinpragt.com is registered under KvK number: 73839426.