How to monitor (almost) anything with Monitis M3 – My very personal use case

free-website-monitoringWelcome M3

Among the many hats I wear, I also wear a DevOps/SysAdmin hat in Lacoon Security. (upd. Lacoon Security was acquired by Check Point Solutions)
When I was invited to custom tailor the monitoring solution for Lacoon Security, I didn’t even hesitate and recommended to use Monitis and M3.
Partly because I wrote M3 but mainly because I think it is a really good solution.
Lacoon Security implements a security service for mobile devices, based on the cloud.
Lacoon’s monitoring needs were rather complex, however, nothing Monitis & M3 could not achieve. Here is the proof.

System monitoring

Even though Monitis offers an agent for internal monitoring, such as CPU, memory, disk – M3 can offer just the same.
It was a matter of minutes to understand the needs and custom tailor the right monitors, used from this directory.
Together with system monitoring, bandwidth monitoring was a need too. Bandwidth monitoring can be found here.
System and bandwidth monitoring were tailored in no time.

Service monitoring

I honestly admit, a proper monitor for services was not implemented, however I’ve found that implementing a M3 configuration for service monitoring was a matter of 20 seconds, here it is:

 <monitor name="%HOSTNAME% httpd Monitor"> <exectemplate>/sbin/service 
 httpd status</exectemplate>
 <metric name="httpd Status"> <type>boolean</type> <uom>n/a</uom> 
 <regex>.* is running</regex> </metric> </monitor> 

Adding a notification for that was more than too easy. Monitis is excelling at creating notifications. Anywhere I go I get either a SMS or email, telling me what is going on with Lacoon’s systems.

VPN monitors

Among the services Lacoon offers, there are also several VPN interfaces such as OpenVPN, PPTP, XL2TP and more.
Even though M3 could not connect to a remote VPN interface, the idea of writing a script which will connect and then report the results was not too complex, the integration with M3 looked like this:

 <monitor name="SOME_HOST PPTP Monitor"> <exectemplate>/usr/local/sbin/ 
connect SOME_HOST MonitorUser MonitorUser</exectemplate> <metric name="PPTP up"> <type>
boolean</type> <uom>n/a</uom> <regex>^VPN OK$</regex> </metric> 
<metric name="PPTP Error" additional="true"> <type>string</type> 
<uom>n/a</uom> <regex>Error: (.*)</regex> </metric> </monitor> 

As soon as the script was developed, it was again a matter of minutes until data started loading to the Monitis dashboard.
Not only that, with the use of “additional data” on Monitis, we could also easily troubleshoot the problem – if there was one. VPNs are not very simple, when connectivity fails – the reasons for that can be many and intricate.
Getting the notification when something doesn’t work is the “real deal”, however understanding why is just as invaluable.
I generally believe in simple monitors – does it work? – Yes / No. However when complex things are entering the equation, the ‘why’ is just as important – that’s the “additional data”.

And even more monitors

I can go on and on about the monitors Lacoon is using, among them are also snort, squid, django etc.
All of these monitors were implemented with ease. In no time I could build Lacoon the dashboard they’ve always wanted, including notifications, when things break.
There are many more monitors to be implemented at Lacoon, however, having a tool such as M3 I’ll be more than ready with anything thrown at me. Be it DB queries, port monitoring, JSON parsing – bring it on!
I’m encouraging any of you to implement useful monitors, set notifications and improve your overall system uptime by doing that.
Here is a snippet of Lacoon’s comprehensive dashboard:


We can monitor anything. Yes.
I proved it to myself, being on the user side of M3 and not the developer side.
As a developer I will always try to prove you that “everything works” whereas as the user you will try to prove me that “nothing works”.
I got the user’s hat this time and was surprised to find out actually that “most things work” – and that’s pretty good!
Some things did not work, I agree, they were quickly fixed though. In the next article I will outline the last changes to M3 – and there were a few.
I hope you enjoyed this reading and keep on giving me feedback!

With M3 and Monitis anything can be monitored. Follow us on github and twitter.