Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
    
What is your final purpose? How about this mmonit.com/wiki/MMonit/HTTP-API? – quanta Sep 26 '12 at 7:20
1  
I'm looking for open-source alternatives other than m/monit.. – giosakti Sep 26 '12 at 10:43
    
You 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. – dunxd Oct 5 '12 at 23:20

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.

share|improve this answer
    
How 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. – timurb Feb 20 at 11:21
    
Hmm, 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 Feb 20 at 17:17
    
Update: I've checked all my hosts, and the latest monit version I have running is 5.14, and JSON works on that. – deranjer Feb 20 at 17:25
    
Could 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/… – timurb Feb 22 at 19:04
    
The 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. – deranjer Feb 23 at 1:09

FWIW, I know this thread is old but as I didn't find any satisfactory answer to this question myself I wrote this https://imil.net/blog/2016/03/16/Fetch-monit-status-in-JSON/

HTH

share|improve this answer
    
Link-only answers are considered to be sub-par on SF. Please provide content here and then link elsewhere for more details if necessary. – EEAA Mar 16 at 20:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.