Monit http-based API

7,656

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:
7,656

Related videos on Youtube

giosakti
Author by

giosakti

Updated on September 18, 2022

Comments

  • giosakti
    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
      Greg Petersen over 11 years
      What is your final purpose? How about this mmonit.com/wiki/MMonit/HTTP-API?
    • giosakti
      giosakti over 11 years
      I'm looking for open-source alternatives other than m/monit..
    • dunxd
      dunxd over 11 years
      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.
    • iMil
      iMil about 8 years
      FWIW, 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
    timurb over 8 years
    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.
  • deranjer
    deranjer over 8 years
    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
    deranjer over 8 years
    Update: I've checked all my hosts, and the latest monit version I have running is 5.14, and JSON works on that.
  • timurb
    timurb over 8 years
    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/…
  • deranjer
    deranjer over 8 years
    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.
  • Kenny Rasschaert
    Kenny Rasschaert almost 7 years
    The 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.