XML API can't filter on service groups

Issue #387 closed
Kenny Rasschaert created an issue

As a result of issue #202, we can ask for the status for members of a specific service group since Monit 5.14.

I'd like to be able to do the same from the API.

e.g.

curl --user admin:monit -s -X GET 'Accept: application/xml' 'http://localhost:2812/_status?format=xml&level=full&group=www'

As it is now, the group parameter is ignored.

With tcpdump I can observe that &group=www does have the desired effect for format=text, which is what the monit cli tool sends to the back-end when running monit -g www status

Curiously, the same command line tool does not communicate the group to the back-end for the start action.

When running monit -g www start, I can see individual start commands being sent to the HTTP back-end, instead of passing a single start command with the name of the group.

Similarly, monit -g nosuchgroup start replies with "Group 'nosuchgroup' not found", without sending a single request to the HTTP back-end.

I'm puzzled as to how the cli tool knows the members of a group.

Comments (2)

  1. Tildeslash repo owner

    The XML interface is to be replaced with JSON, we don't plan to extend this API at this point.

    The start/stop/restart commands implementation was refactored already, so when you (re)start a group, it sends single command instead of one per command (the group is still expanded on client side to individual service names).

  2. Kenny Rasschaert reporter

    Thanks for the swift reply!

    Until the JSON API lands, I'll cope by parsing the output of ?format=text&group=www to get a list of service group members.

    I'll be watching issue #240 with bated breath :)

  3. Log in to comment