It’s been quite a while since I posted the latest update of the Warden project designed for monitoring the resources in general. After a lot of back-end coding and refactoring, the time has come to finally focus on the new web interface implementation. And this is where the things start to become interesting (I promise).





In case you’re not familiar what Warden is about, please take a look either at its landing page or at the repository where you can find a detailed documentation. In simple words, it’s an open source & cross-platform library written in C# that lets you create custom monitoring applications. Since it’s built on top of the .NET Core you can run it actually anywhere. It does provide a lot of integrations with external services and a set of handful methods and hooks (callbacks) that you can make use of e.g. when something goes wrong.

//Sample Warden code to monitor Web and MongoDB + send email notifications via SendGrid. var configuration = WardenConfiguration .Create() .AddWebWatcher("http://my-website.com") .AddMongoDbWatcher("mongodb://localhost:27017", "MyDatabase", cfg => { cfg.WithQuery("Users", "{\"name\": \"admin\"}") .EnsureThat(users => users.Any(user => user.role == "admin")); }) .IntegrateWithSendGrid("api-key", "noreply@system.com", cfg => { cfg.WithDefaultSubject("Monitoring status") .WithDefaultReceivers("admin@system.com"); }) .SetHooks(hooks => { hooks.OnIterationCompleted(iteration => OnIterationCompleted(iteration)) .OnError(exception => Logger.Error(exception)); }) .Build(); var warden = WardenInstance.Create(configuration); await warden.StartAsync(); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 //Sample Warden code to monitor Web and MongoDB + send email notifications via SendGrid. var configuration = WardenConfiguration . Create ( ) . AddWebWatcher ( "http://my-website.com" ) . AddMongoDbWatcher ( "mongodb://localhost:27017" , "MyDatabase" , cfg = > { cfg . WithQuery ( "Users" , "{\"name\": \"admin\"}" ) . EnsureThat ( users = > users . Any ( user = > user . role == "admin" ) ) ; } ) . IntegrateWithSendGrid ( "api-key" , "noreply@system.com" , cfg = > { cfg . WithDefaultSubject ( "Monitoring status" ) . WithDefaultReceivers ( "admin@system.com" ) ; } ) . SetHooks ( hooks = > { hooks . OnIterationCompleted ( iteration = > OnIterationCompleted ( iteration ) ) . OnError ( exception = > Logger . Error ( exception ) ) ; } ) . Build ( ) ; var warden = WardenInstance . Create ( configuration ) ; await warden . StartAsync ( ) ;

I’ve started developing this project 9 months ago and I’m still the main contributor, however, there were some nice pull requests and issues reported already. Moreover, I managed to convince a few friends of mine to help me develop a new version of the Warden, so I’m not alone anymore while carrying this “burden”.

So what’s all the fuss about the web interface? Isn’t it just a simple library for programmers? Indeed, it’s a not a complex library, yet you can actually do something with the data that you get during monitoring the particular resources. By doing, I mean visualize or browse the historical logs. Which is why I made a first version of the web application a long time ago available under the panel.getwarden.net and also as a part of the main repository. It was a proof of concept that this library could be used for something else like displaying in real time what’s going on with your system or infrastructure.

After a few months, once I started diving into the world of microservices and CQRS I decided to start working on the new version of the web interface and the whole back-end.

If you take a look at the warden-stack you will notice that there are many repositories – most of them are services designed for the specific tasks, and there’s the API which acts a gateway to the whole system. Everything is also available under the Docker Hub. Apologies for the lack of documentation but this services are still being heavily developed, but once they’re ready for the preview or alpha release, the documentation will be in place.

Now, let me introduce a first 2 screenshots (prototypes) of the new web application:

The dashboard should be as clean as possible, however, it has to provide the most important information about the resources being monitored by the watchers. If you want to more know what’s going on with the particular resource, you can click on a selected watcher and dive into its details – plain and simple. Of course, you will be able to browse historical data and so on – that’s the first important part.

The second important part of the new web interface will be so called configurator. In order to be able to see what’s happening in real-time, you need to have your monitoring application running somewhere and pushing out the data to the API. But what if you don’t want to write such application on your own? Maybe you’re not a programmer, or you just want to have something running up very quickly. Imagine the following scenario – you will be able to use a graphical configurator (with some inputs and other form elements of course) where you could specify what would like to monitor, define the callbacks if something goes wrong (for example send me a message if there’s an error or execute given code if the check has completed).

To achieve such goal I did create Spawn (ever played Quake or other FPS game where you would respawn once dead?) It’s also a proof of concept (but a working one) and what it does under the hood is translating the JSON configuration file to the C# code which creates the instance of the Warden just like you would do by writing C# code. Please take a look at the following article if you would like to know more about Spawn project.

Before I finish this post I’d like to thank Bartosz (one of the authors of Akka.NET) that I had a pleasure to meet a few days ago in Warsaw during WG.NET group event where I gave a talk about the Warden. He opened a very interesting issue about using RX in the Warden library. Unfortunately, I have a very small amount of free time (especially now), to redesign the core library, yet one day I’d like to give it a try. Or maybe one of you would like to help? Feel free to submit a PR and I’ll be more than grateful!

