Learn to inspect MaxScale's runtime state using the JSON report from maxctrl. Use jq to query servers services and monitors for detailed debugging and analysis.
The output of the maxctrl create report command produces a JSON payload that contains the current state of MaxScale. This includes the runtime configuration and the status all objects in MaxScale.
The maxctrl create report command was added in MaxScale 2.5.20.
The report can be created with:
After the command completes, the data is in maxctrl-report.json.
The file in which the output is stored is the only argument to this command. Recent versions of maxctrl pipe the output to the standard output if no filename is given. This can be useful for environments where copying files may be difficult (e.g. docker).
jqThe easiest way to inspect the JSON output is to use the jq program:
It is usually available as a package in most operating systems.
This can be combined with the object field access to list the fields of sub-objects. The following lists the keys in the first server object.
Change the RW-Split-Router to the name of the service you're looking for.
Change the MariaDB-Monitor to the name of the monitor you're looking for.
Change the DB-1 to the name of the server you're looking for.
Change DB-1 to the name of the server you're looking for.
This page is licensed: CC BY-SA / Gnu FDL
maxctrl create report maxctrl-report.jsonjq '.servers.data[].id' < maxctrl-report.jsonjq '.services.data[].id' < maxctrl-report.jsonjq '.monitors.data[].id' < maxctrl-report.jsonjq '.listeners.data[].id' < maxctrl-report.jsonjq '.filters.data[].id' < maxctrl-report.jsonjq 'keys' < maxctrl-report.jsonjq '.servers.data[0]|keys' < maxctrl-report.jsonjq '.services.data|map(select(.id == "RW-Split-Router"))' < maxctrl-report.jsonjq '.monitors.data|map(select(.id == "MariaDB-Monitor"))' < maxctrl-report.jsonjq '.servers.data|map(select(.id == "DB-1"))' < maxctrl-report.jsonjq '.servers.data|map(select(.id == "DB-1"))|.[].relationships.monitors.data' < maxctrl-report.jsonjq '[.threads.data[].attributes.stats.query_classifier_cache.size]|add' < maxctrl-report.json