The HTTP-API may be updated in the future.

M/Monit 4.4.0

  • Login (/z_security_check):
    • The session gets a new id when the login succeeds, and the login response sets it in the zsessionid cookie. Use that cookie from then on; the one you logged in with is no longer valid. With curl, use -c as well as -b on the login request, see the cURL example.
    • A failed login, a wrong password or a wrong two-factor code, is answered with HTTP 401 instead of 200, and the “x-auth” response header was dropped.
  • CSRF protection:
    • M/Monit decides from the Sec-Fetch-Site and Origin headers that browsers send, and answers a request other than GET, HEAD or OPTIONS from another origin, the login included, with HTTP 403. Programs send neither header and need no CSRF token. The CSRFToken header or parameter and the z_csrf_protection login parameter are ignored, and /api/2/session/get no longer returns a CSRFToken. See Authentication.
  • POST requests:
    • A POST without a body is accepted, so curl -X POST works without -d '', which older releases need.
    • M/Monit reads a body of type application/x-www-form-urlencoded (what curl -d sends), multipart/form-data, application/json, text/xml or application/xml, and answers a body of any other type, or one without a Content-Type, with HTTP 415.
  • /api/2/session/put, /api/2/session/delete and /api/2/session/invalidate:
    • POST only; a GET is answered with HTTP 404.
  • /api/2/reports/events/dismiss:
    • POST only; a GET is answered with HTTP 404.
  • /api/2/admin/users/get:
    • response:
      • A new attribute “enable2fa” was added. The attribute is true if two phase authentication is enabled.
  • /api/2/admin/hosts/list: Added support for filtering, pagination and sorting.
    • request:
      • new optional arguments: hostpattern, hostgroupid, led (filtering), results, startindex (pagination), sort and dir (sorting).
    • response:
      • output enhanced with following attributes: pageSize, recordsReturned, startIndex, sort, dir
      • the totalRecords attribute counts the hosts which match the filter
  • /api/2/admin/hosts/delete:
    • request:
      • hosts can be deleted by a filter: the hostpattern, hostgroupid and led arguments select the hosts
      • a request without id, inactive or a filter argument is answered with HTTP 400 instead of 500
  • /api/2/admin/hosts/test:
    • request:
      • Added new attribute “id” which sets the M/Monit hostid to be tested. M/Monit will use the host’s settings to perform the test.
      • Dropped the “ipaddr”, “port”, “ssl”, “monituser”, “monitpassword” attributes.
  • /api/2/admin/hosts/get:
    • response:
      • The “monitpassword” attribute no longer returns the plaintext Monit password: it is ........ if the host has one, otherwise empty.
      • New attributes “reportlimit” and “maxreportlimit” which specifies how long M/Monit waits for a status update from the host before reporting it as down, and the longest it waits, in seconds. The wait is poll times skew, at most one hour, or for Monit before 6.0.0 two poll cycles if that is longer.
  • /api/2/admin/hosts/update:
    • request:
      • If the skew gives the host the same reportlimit as the default skew, the host gets the default skew and follows changes to it, as it did for a skew equal to the default.

M/Monit 4.2.0

  • /api/2/admin/users/list:
    • response:
      • A new attribute “unsafepassword” was added. The attribute is true, if password audit is enabled and some user has unsafe password.
  • /api/2/status/hosts/get:
    • request:
      • New attributes for led and servicepattern filtering
    • response:
      • New attributes for pagination and sorting (layout in line with /api/2/status/hosts/list)

M/Monit 4.0.0

  • the /api/1 was deprecated and renamed to /api/2, due to major changes. See the changes bellow to migrate the API from v1 to v2.
  • /api/2/status/hosts/list: The API was enhanced with support for pagination
    • request:
      • a new optional argument: hostpattern.
      • allows for multiple hostgroupid arguments (originally only one hostgroupid was supported)
      • allows for multiple led arguments (originally only one led was supported)
    • response: output enhanced with following attributes:
      • pageSize
      • recordsReturned
      • startIndex
      • sort
      • dir
  • /api/2/status/hosts/get:
    • response:
      • is_user_admin attribute dropped
      • serviceactions attribute added
      • added new statistics types (35-78) to records.host.services[].statistics[]: 35=ProgramOutput 36=NetState 37=NetSpeed 38=NetDuplex 39=NetBytesIn 40=NetBytesInTotal 41=NetPacketsIn 42=NetPacketsInTotal 43=NetErrorsIn 44=NetErrorsInTotal 45=NetBytesOut 46=NetBytesOutTotal 47=NetPacketsOut 48=NetPacketsOutTotal 49=NetErrorsOut 50=NetErrorsOutTotal 51=Downtime 52=Threads 53=FilesystemType 54=FilesystemReadBytes 55=FilesystemReadBytesTotal 56=FilesystemReadOperations 57=FilesystemReadOperationsTotal 58=FilesystemWriteBytes 59=FilesystemWriteBytesTotal 60=FilesystemWriteOperations 61=FilesystemWriteOperationsTotal 62=FilesystemServiceTimeRead 63=FilesystemServiceTimeWrite 64=FilesystemServiceTimeWait 65=FilesystemServiceTimeRun 66=FilesystemServiceTime 67=ProcessReadBytes 68=ProcessReadBytesTotal 69=ProcessReadOperations 70=ProcessReadOperationsTotal 71=ProcessWriteBytes 72=ProcessWriteBytesTotal 73=ProcessWriteOperations 74=ProcessWriteOperationsTotal 75=CertificateValidDays 76=TimestampAccess 77=TimestampChange 78=TimestampModify
  • /api/2/status/hosts/summary:
    • request:
      • a new optional argument: hostid
      • a new optional argument: hostgroupid
  • /api/2/admin/hosts/test: allows to use the GET method in addition to POST
  • /api/2/admin/hosts/list:
    • response:
      • add the inactive attribute
  • /api/2/admin/hosts/get:
    • response:
      • add the defaultskew attribute
  • /api/2/admin/users/list:
    • response:
      • add the user id attribute (immutable numeric id)
      • add the avatar attribute (user image)
  • /api/2/admin/users/get:
    • request:
      • the uname string argument was replaced with numeric id argument
    • response:
      • add the user id attribute (immutable numeric id)
      • the admin attribute was replaced with roles array
  • /api/2/admin/users/create:
    • request:
      • dropped the admin option
      • added roleid attribute (can be used multiple times)
      • added the optional image attribute
  • /api/2/admin/users/update:
    • request:
      • added the user id attribute (required)
      • dropped the oldpassword attribute
      • dropped the admin attribute
      • added roleid attribute (can be used multiple times)
      • added the optional image attribute
  • /api/2/admin/users/delete:
    • request:
      • replaced the uname attribute with the id attribute
  • /api/2/map/id/operator: added
  • /api/2/map/name/operator: added
  • /api/2/map/id/permission: added
  • /api/2/map/name/permission: added
  • /api/2/admin/roles/list added
  • /api/2/admin/roles/create added
  • /api/2/admin/roles/update added
  • /api/2/admin/roles/delete added
  • /api/2/admin/roles/adduser added
  • /api/2/admin/roles/updateactive added
  • /api/1/map/id/servicename: dropped

M/Monit 3.7.4

  • Prefix: All API paths are now prefixed with /api/1. Old paths are deprecated, but will continue to work

M/Monit 3.6

  • Map: The /map/service API output format for typeid attribute has changed from value to array of values. Originally if the same service name was used on multiple hosts for different service type, multiple entries were displayed, e.g.: {“id”:“1”,“name”:“myservice”,“typeid”:“4”}, {“id”:“1”,“name”:“myservice”,“typeid”:“5”} The new output format lists all service types using one entry: {“id”:“1”,“name”:“myservice”,“typeid”:[“4”,“5”]}
  • Status: Added the “onreboot” value.

M/Monit 3.5

  • Admin host: add inactivity based delete support.

M/Monit 3.3

  • Events: Date values are provided as a UNIX timestamp in the GMT timezone rather than as a date-string in the M/Monit’s server local timezone.
  • CSRF-protection: This version of M/Monit includes CSRF-protection as described in the Authentication page. To simplify HTTP-API usage, we provide a way to turn-off CSRF-protection at login, as demonstrated in the examples.
  • Map: New resource mapping API

M/Monit 3.2.1

  • Status: added statusid and heartbeat attributes for /status/hosts/get method

M/Monit 3.2

  • Uptime: optional datefrom and dateto arguments added

M/Monit 3.1

  • Admin host: keepname added

M/Monit 3.0

  • Initial release