Files
MaxScale/Documentation/REST-API/Resources-Monitor.md
Markus Makela 59e615eb3c Create initial REST API documentation
The Resources document lists all currently known resources and will be converted
to a list of separate resource documents once the individual resource documents
are done. The Headers and Response Codes document contains a list of request and
response headers and the HTTP return codes. This is a work in progress and will
be expanded upon.

Added initial versions of the filter, monitor, session and user resource
documents. These provide information about various parts of MaxScale and
allow interaction.

All PATCH operations expect a JSON Patch type document in the request
body. Examples modified accordingly.

Add MaxScale resource document which describes the resources that give the
global configuration options and show statistics.

The resources that link to other resources provide values as a list of
relative links. This reduces the amount of sent data when the client
doesn't require all parts of the resource.

Since the updating is not yet implement, it should be stated that the update API
will most likely be modified at some point.

The module resource is similar to `maxadmin show modules` and the log
resource contains status information about logs. The log resource also has
an "action" resource at `/maxscale/logs/flush` which flushes logs to disk
and rotates them.

Added start and stop entry points for services and monitors. Also added
missing service parameters to the list of parameters that can be updated.

The documentation lists listeners as a sub-resource of the
service. This allows the listeners of a particular service to be queried.
2016-11-07 14:20:44 +02:00

3.5 KiB

Monitor Resource

A monitor resource represents a monitor inside MaxScale that monitors one or more servers.

Resource Operations

Get a monitor

Get a single monitor. The :name in the URI must be a valid monitor name with all whitespace replaced with hyphens. The monitor names are case-insensitive.

GET /monitors/:name

Response

Status: 200 OK

{
    "name": "MySQL Monitor",
    "module": "mysqlmon",
    "state": "started",
    "monitor_interval": 2500,
    "connect_timeout": 5,
    "read_timeout": 2,
    "write_timeout": 3,
    "servers": [
        "/servers/db-serv-1",
        "/servers/db-serv-2",
        "/servers/db-serv-3"
    ]
}

Supported Request Parameter

  • fields

Get all monitors

Get all monitors.

GET /monitors

Response

Status: 200 OK

[
    {
        "name": "MySQL Monitor",
        "module": "mysqlmon",
        "state": "started",
        "monitor_interval": 2500,
        "connect_timeout": 5,
        "read_timeout": 2,
        "write_timeout": 3,
        "servers": [
            "/servers/db-serv-1",
            "/servers/db-serv-2",
            "/servers/db-serv-3"
        ]
    },
    {
        "name": "Galera Monitor",
        "module": "galeramon",
        "state": "started",
        "monitor_interval": 5000,
        "connect_timeout": 10,
        "read_timeout": 5,
        "write_timeout": 5,
        "servers": [
            "/servers/db-galera-1",
            "/servers/db-galera-2",
            "/servers/db-galera-3"
        ]
    }
]

Supported Request Parameter

  • fields
  • range

Stop a monitor

Stops a started monitor.

PUT /monitor/:name/stop

Response

Status: 204 No Content

Start a monitor

Starts a stopped monitor.

PUT /monitor/:name/start

Response

Status: 204 No Content

Update a monitor

Note: The update mechanisms described here are provisional and most likely will change in the future. This description is only for design purposes and does not yet work.

Partially update a monitor. The :name in the URI must map to a monitor name and the request body must be a valid JSON Patch document which is applied to the resource.

PATCH /monitor/:name

Modifiable Fields

The following values can be modified with the PATCH method.

Field Type Description
servers string array Servers monitored by this monitor
monitor_interval number Monitoring interval in milliseconds
connect_timeout number Connection timeout in seconds
read_timeout number Read timeout in seconds
write_timeout number Write timeout in seconds
[
    { "op": "remove", "path": "/servers/0" },
    { "op": "replace", "path": "/monitor_interval", "value": 2000 },
    { "op": "replace", "path": "/connect_timeout", "value": 2 },
    { "op": "replace", "path": "/read_timeout", "value": 2 },
    { "op": "replace", "path": "/write_timeout", "value": 2 }
]

Response

Response contains the modified resource.

Status: 200 OK

{
    "name": "MySQL Monitor",
    "module": "mysqlmon",
    "servers": [
        "/servers/db-serv-2",
        "/servers/db-serv-3"
    ],
    "state": "started",
    "monitor_interval": 2000,
    "connect_timeout": 2,
    "read_timeout": 2,
    "write_timeout": 2
}