Monit http-based API
This is old, I know, but monit has a basic API, found at:
http://SERVER_IP:2812/_status?format=xml
There also appears to be a JSON format as well (change format to json from XML). You can parse the XML for everything you need (I've done it in python easily). However, I can't seem to find any documentation on this, so you have to discover what you can.
Some of the m/monit documentation details some of the monit codes, so you should get some help from there.
You can also check out monittr https://github.com/karmi/monittr.
That is a ruby implementation of monitoring multiple monit instances.
Related videos on Youtube
giosakti
Updated on September 18, 2022Comments
-
giosakti over 1 year
I'm just wondering whether monit has an API, which we could poll-regularly (perhaps something that is http-based) ?
It would be very useful to create an integrated monitoring solution across multiple servers. Or perhaps there is no other option other than m/monit?
-
Greg Petersen over 11 yearsWhat is your final purpose? How about this mmonit.com/wiki/MMonit/HTTP-API?
-
giosakti over 11 yearsI'm looking for open-source alternatives other than m/monit..
-
dunxd over 11 yearsYou really need to give a bit more detail about what exactly you want to monitor and how, since there are a LOT of server monitoring tools out there besides Monit. If you have looked over a few of these and none of them meet your needs then you must be doing something unusual, and need to say so.
-
iMil about 8 yearsFWIW, I know this thread is old but as I didn't find any satisfactory answer to this question myself I wrote this imil.net/blog/2016/03/16/Fetch-monit-status-in-JSON HTH
-
-
timurb over 8 yearsHow did you get JSON format? I'm running latest official build 5.16 and it looks like there only plaintext status and XML status are available and no JSON.
-
deranjer over 8 yearsHmm, it works on my version (5.9) with this url: SERVERIP:2812/_status?format=json I assume it may have been removed in the later versions?
-
deranjer over 8 yearsUpdate: I've checked all my hosts, and the latest monit version I have running is 5.14, and JSON works on that.
-
timurb over 8 yearsCould you be running custom patched version? Or are you referring to M/Monit? I've found a ticket in Monit bugtracker with such feature request but it's dated back to only few months ago and is unresolved: bitbucket.org/tildeslash/monit/issues/240/…
-
deranjer over 8 yearsThe monit version running on my openmediavault server might be patched, but my debian/ubuntu monit's are running direct from the default repos. Also, not referring to M/Monit.
-
Kenny Rasschaert almost 7 yearsThe link you posted is to the API documentation of M/Monit, the commercial SaaS that makes use of Monit, the open source watchdog software. (I agree that the naming is confusing). The OP wanted an API to interact with Monit, specifically to build an alternative to M/Monit.