Skip to main content

Raymii.org Raymii.org Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

What's coming in the next version of Leaf Node Monitoring?

Published: 14-07-2022 | Author: Remy van Elst | Text only version of this article


❗ This post is over two years old. It may no longer be up to date. Opinions may have changed.


Leaf Node Monitoring is my own open source (GPLv3), paid, network monitoring program for Windows, Linux & Android. Written in C++ & Qt 5. Perfect to run on your desktop and monitor your servers. Simple setup, auto-detects running services, runs checks concurrently, open port scanning and alerting. I've recently released the first version, and this post goes over the features that will come in the next release.

I did not do any active promotion for the first release, only added a link to my sponsor message block on this site. That's a bit of text linking to different ways to sponsor me, which I include on almost all articles on this site. This article does not include that block, but if you want to check out Leaf Node Monitoring, please click here. Although, without that active promotion, sales have been way above expectation, which I'm surprised by and also happy about. I also received quite some positive feedback, thanks to all of you who wrote in.

Now, on to the new features planned for v2022.02.

External Process checks

One of the big new features in the next release will be external processes as monitor checks. Here is a screenshot of two external checks on Android:

external process checks

You might notice that they're orange, which means warning status. You might also notice the visual changes, rounded corners and other small tweaks. External processes are simple checks that are successful (OK) when the exit code is 0 and critical otherwise. In this case, they're warning because some errors, like a nonexistent binary, do not trigger critical (since, no exit code is not the same as exit code > 0).

External processes allow you to have many more checks. For testing the functionality, I use the checks from Nagios / Icinga, monitoring plugins, which extend the functionality of Leaf Node Monitoring by a huge amount. I will still continue to implement new checks in native C++, both for speed and cross-platform functionality, but this feature will help in all the cases where there are no checks yet. These monitoring plugins will not be shipped with Leaf Node Monitoring, it's just the example I'm using.

Retry attempts

retry attempts

The next new feature is retry attempts. For all checks currently, like the TCP port or HTTP check I'm implementing an automated retry. Currently 4 times, but I might make that configurable in the future. If a check fails, it will be retried with the same parameters. No back-off timer or pause in between yet. I've been running LeafNodeMonitoring myself and have noticed some notifications which were flaky tests, with the automated retries I hope to have less of those.

Unit tests

The last new thing is that I've begun to add unit tests. For most of my private projects I don't do unit tests since they're not worth the time/effort. At work they're required and we have automated checks that reject merge requests when there is not enough coverage. Unit tests are not user facing, but they do help in delivering better software. With the growing amount of checks and logic, I am now of the opinion that Leaf Node Monitoring benefits from tests. Since I'm used to write code that can be tested (small methods, decoupled, dependency injected, etc), it does not require any refactoring, I'm noticing most of the code is already testable just fine.

Here is an example test that checks if the new external process code fires off the correct signals and returns the correct result when it receives an exit code of 0:

TEST_F(ExternalProcessCheckTest, exitCodeZeroShouldGiveOkayResult)
{
    //arrange
    QString fullPath = "/bin/bash";
    QStringList arguments;
    arguments << "-c 'exit 0'";
    epck = new ExternalProcessCheck(*target, fullPath, arguments, timeout);
    QSignalSpy signalSpy_checkResultChanged(epck, &ExternalProcessCheck::checkResultChanged);

    //act
    emit epck->startCheck();
    signalSpy_checkResultChanged.wait(1000);

    //assert
    EXPECT_EQ(epck->checkResult(), MonitorEnums::CheckResult::Ok);
    EXPECT_EQ(signalSpy_checkResultChanged.count(), 1);
}

The constructor and destructor of this test suite handle the deletion of the pointers and further cleanup, so don't worry about the naked new.

It's always hard to test external programs like this, as is testing time-related stuff (without a lot of stubs/mocks). I'm using the googletest framework since I'm used to it. It requires a bit of shoehorning to make it works with Qt but once your project is setup correctly it's a breeze to use. I had to convert the one project to three projects (a library, an application and a test-app) using SUBDIRS in qmake and linking to the library in the main application. Not rocket science, but I imagine it can be hard to do if you don't know what to look for.

Code coverage is now up to 57% so that's a great start.

That's all for this post, I'm not sure when the next version is going to be released, but it will be a free update for all of you who purchased it. If you have any feature requests, issues or want to let me know something, don't hesitate to contact me.

More on selling GPL software?

I did a series of articles on figuring out how to sell GPL software. Leaf Node Monitoring is an open source application, but it's paid as well. The parts are here:

This article is cross-posted on the Leaf Node Monitoring site.

Tags: android , blog , business , c++ , gpl , leaf-node-monitoring , qt