While searching for a simple monitoring für my root servers, I’m stumbled over a python-based software called Simplemonitor. Other alternatives, like Nagios, or forks like Incinga etc., were a bit too much for my needs.
What is SimpleMonitor?
SimpleMonitor is a Python script which monitors hosts and network connectivity. It is designed to be quick and easy to set up and lacks complex features that can make things like Nagios, OpenNMS and Zenoss overkill for a small business or home network. Remote monitor instances can send their results back to a central location.
My requirements were simple:
- Ping monitoring
- TCP monitoring
- HTTP monitoring
- Service monitoring
- Disk space monitoring
Monitoring is nothing without alerting, so I was pretty happy that Simplemonitor is able to send messages into a Slack channel! But it can also send e-mails, SMS, or it can write into a log file. To get a full feature overview, visit the Simplemonitor website.
The project is hosted on GitHub. If you are familiar with Python, you can contribute to the project, or you can add features as you need.
Installation & configuration
The installation is pretty simple: Just fetch the ZIP or the tarball from the project website, and extract it.
The configuration is split into two files:
The naming is a bit confusing. The monitor.ini contains the basic monitoring configuration, like the interval for the checks, the alerting and reporting settings. The monitors.ini contains the configuration of the service checks. That’s confusing, that confused me, and so I changed the name of the monitors.ini to services.ini.
[monitor] interval=60 monitors=services.ini
The services.ini (monitors.ini) contains the service checks. This is a short example of a ping, a service check, a port check, and a disk space check.
[ping-host1] type=host host=host1.tld.de tolerance=3 [svc-postfix-host1] type=rc runon=host1.tld.de service=postfix [port-postfix-host1] type=tcp host=host1.tld.de port=25 [diskspace] type=diskspace partition=/ limit=4096M
The alerting is configured in the monitor.ini. I’m using only the Slack notification. All you need is a web hook and the corresponding web hook URL.
[slack] type=slack channel=#monitoring limit=1 url=https://hooks.slack.com/services/afjnsdifnsdfnsdf
In case of a service fail, or service recovery, a notification is sent to the configured Slack channel.
To start Simplemonitor, just start the monitor.py. It expects the monitor.ini in the same directory.
[email protected] /opt/simplemonitor # python2 monitor.py -v SimpleMonitor v1.7 --> Loading main config from monitor.ini --> Loading monitor config from services.ini Adding host monitor ping-host2 Adding rc monitor svc-postfix-host1 Adding rc monitor svc-nginx-host1 Adding rc monitor svc-mysql-host1 Adding rc monitor svc-fail2ban-host1 Adding rc monitor svc-postgrey-host1 Adding rc monitor svc-phpfpm-host1 Adding rc monitor svc-named-host1 Adding diskspace monitor diskspace --> Loaded 9 monitors. Adding logfile logger logfile Adding slack alerter slack --> Starting... (loop runs every 60s) Hit ^C to stop php_fpm is running as pid 33937. Passed: svc-phpfpm-host1 named is running as pid 566. Passed: svc-named-host1 fail2ban is running as pid 41306. Passed: svc-fail2ban-host1 Passed: diskspace postgrey is running as pid 649. Passed: svc-postgrey-host1 mysql is running as pid 23726. Passed: svc-mysql-host1 Passed: ping-host2 postfix is running as pid 53332. Passed: svc-postfix-host1 nginx is running as pid 52736. Passed: svc-nginx-host1
I really like the simplicity of Simplemonitor. Download, extract, configure, run, done. That’s what I’ve searched for. It is still under development, but you should not expect that it will gain much complexity. Even if features will be added, it should be a simple monitoring.
- Why you should change your KRBTGT password prior disabling RC4 - July 28, 2022
- Use app-only authentication with the Microsoft Graph PowerShell SDK - July 22, 2022
- Getting started with the Microsoft Graph PowerShell SDK - July 21, 2022