- changed status to invalid
Monit HTTPD Documentation seems to be outdated
I was trying to understand the HTTP API so I could do some monit control in a Python script (I want to start stop and check status for example), I found the docs to be misleading:
https://mmonit.com/documentation/http-api/Methods/Status
An example snippet says this should work:
curl -b ~/.mmonit/cookie \
http://127.0.0.1:8080/status/hosts/list
In my case my server is using port 2812, but when I make a request I just get an error (there is no auth):
$ curl http://localhost:2812/status
<html><head><title>404 Not Found</title></head><body bgcolor=#FFFFFF><h2>Not Found</h2>There is no service by that name<p><hr><a href='http://mmonit.com/monit/'><font size=-1>monit 5.6</font></a></body></html>
I managed to find a python script which did (most) of what I wanted (monitor/unmonitor doesn't appear to work):
https://github.com/polymeris/python-monit
$ curl http://localhost:2812/_status
Works fine and returns the expected status output, but I don't see this documented anywhere
I checked the man file and I see notes on how to enable the HTTPD API, but I don't see any usage examples there. Is there anywhere I can go to get this information? I couldn't turn anything else up in my investigation.
Thanks
Comments (6)
-
repo owner -
Account Deactivated reporter Thanks, that explains the confusion, can you advise where to find the correct docs?
-
repo owner Monit does not have an official HTTP API yet. It has an internal HTTP API, which is accessible, but not documented other than in the source code. A proper JSON REST API is planned for the next major release of Monit sometime later this year.
-
repo owner There is no documentation of monit's http-api, the output is XML based, we plan to switch to JSON. You can find the details in the source code: https://bitbucket.org/tildeslash/monit/src/1bb7cbc91ddb8aaaef8303a91dd6262e835cc27c/src/http/cervlet.c?at=master&fileviewer=file-view-default https://bitbucket.org/tildeslash/monit/src/1bb7cbc91ddb8aaaef8303a91dd6262e835cc27c/src/http/xml.c?at=master&fileviewer=file-view-default
-
Account Deactivated reporter Thanks for the info
-
Is this document is released as per the above comment ?
A proper JSON REST API is planned for the next major release of Monit sometime later this year.
- Log in to comment
The HTTP-API is for M/Monit, which is optional Monit extension (independent application).
Monit has different API.