From e01e4ee661dfb21b21940cc7193de020efd6ce9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 17 May 2017 08:48:44 +0300 Subject: [PATCH] Update Resources-MaxScale.md Updated the responses and added missing resources. --- Documentation/REST-API/Resources-MaxScale.md | 447 +++++++++++++++---- 1 file changed, 350 insertions(+), 97 deletions(-) diff --git a/Documentation/REST-API/Resources-MaxScale.md b/Documentation/REST-API/Resources-MaxScale.md index f2959c1d4..899ad86f3 100644 --- a/Documentation/REST-API/Resources-MaxScale.md +++ b/Documentation/REST-API/Resources-MaxScale.md @@ -16,32 +16,103 @@ GET /maxscale #### Response -``` -Status: 200 OK +`Status: 200 OK` +```javascript { - "config": "/etc/maxscale.cnf", - "cachedir": "/var/cache/maxscale/", - "datadir": "/var/lib/maxscale/" - "libdir": "/usr/lib64/maxscale/", - "piddir": "/var/run/maxscale/", - "execdir": "/usr/bin/", - "languagedir": "/var/lib/maxscale/", - "user": "maxscale", - "threads": 4, - "version": "2.1.0", - "commit": "12e7f17eb361e353f7ac413b8b4274badb41b559" - "started": "Wed, 31 Aug 2016 23:29:26 +0300" + "links": { + "self": "http://localhost:8989/v1/maxscale/" + }, + "data": { + "attributes": { + "parameters": { + "libdir": "/usr/lib64/maxscale", + "datadir": "/var/lib/maxscale", + "process_datadir": "/var/lib/maxscale/data16218", + "cachedir": "/var/cache/maxscale", + "configdir": "/etc", + "config_persistdir": "/var/lib/maxscale/maxscale.cnf.d", + "module_configdir": "/etc/maxscale.modules.d", + "piddir": "/var/run/maxscale", + "logdir": "/var/log/maxscale", + "langdir": "/var/lib/maxscale", + "execdir": "/usr/bin", + "connector_plugindir": "/var/lib/plugin", + "threads": 4, + "auth_connect_timeout": 3, + "auth_read_timeout": 1, + "auth_write_timeout": 2, + "skip_permission_checks": false, + "syslog": true, + "maxlog": true, + "log_to_shm": false, + "query_classifier": "" + }, + "version": "2.1.3", + "commit": "a32aa6c16236d2d8830e1286ea3aa4dba19174ec", + "started_at": "Wed, 17 May 2017 05:33:46 GMT", + "uptime": 19 + }, + "id": "maxscale", + "type": "maxscale" + } } ``` #### Supported Request Parameter -- `fields` +- `pretty` ## Get thread information -Get detailed information and statistics about the threads. +Get the information and statistics of a particular thread. The _:id_ in +the URI must map to a valid thread number between 0 and the configured +value of `threads`. + +``` +GET /maxscale/threads/:id +``` + +#### Response + +`Status: 200 OK` + +```javascript +{ + "links": { + "self": "http://localhost:8989/v1/maxscale/threads/0" + }, + "data": { + "id": "0", + "type": "threads", + "attributes": { + "stats": { + "reads": 2, + "writes": 0, + "errors": 0, + "hangups": 0, + "accepts": 0, + "blocking_polls": 180, + "event_queue_length": 1, + "max_event_queue_length": 1, + "max_exec_time": 0, + "max_queue_time": 0 + } + }, + "links": { + "self": "http://localhost:8989/v1/threads/0" + } + } +} +``` + +#### Supported Request Parameter + +- `pretty` + +## Get information for all threads + +Get the informatino for all threads. Returns a collection of threads resources. ``` GET /maxscale/threads @@ -49,34 +120,97 @@ GET /maxscale/threads #### Response -``` -Status: 200 OK +`Status: 200 OK` +```javascript { - "load_average": { - "historic": 1.05, - "current": 1.00, - "1min": 0.00, - "5min": 0.00, - "15min": 0.00 + "links": { + "self": "http://localhost:8989/v1/maxscale/threads/" }, - "threads": [ + "data": [ { - "id": 0, - "state": "processing", - "file_descriptors": 1, - "event": [ - "in", - "out" - ], - "run_time": 300 + "id": "0", + "type": "threads", + "attributes": { + "stats": { + "reads": 1, + "writes": 0, + "errors": 0, + "hangups": 0, + "accepts": 0, + "blocking_polls": 116, + "event_queue_length": 1, + "max_event_queue_length": 1, + "max_exec_time": 0, + "max_queue_time": 0 + } + }, + "links": { + "self": "http://localhost:8989/v1/threads/0" + } }, { - "id": 1, - "state": "polling", - "file_descriptors": 0, - "event": [], - "run_time": 0 + "id": "1", + "type": "threads", + "attributes": { + "stats": { + "reads": 1, + "writes": 0, + "errors": 0, + "hangups": 0, + "accepts": 0, + "blocking_polls": 116, + "event_queue_length": 1, + "max_event_queue_length": 1, + "max_exec_time": 0, + "max_queue_time": 0 + } + }, + "links": { + "self": "http://localhost:8989/v1/threads/1" + } + }, + { + "id": "2", + "type": "threads", + "attributes": { + "stats": { + "reads": 1, + "writes": 0, + "errors": 0, + "hangups": 0, + "accepts": 0, + "blocking_polls": 116, + "event_queue_length": 1, + "max_event_queue_length": 1, + "max_exec_time": 0, + "max_queue_time": 0 + } + }, + "links": { + "self": "http://localhost:8989/v1/threads/2" + } + }, + { + "id": "3", + "type": "threads", + "attributes": { + "stats": { + "reads": 1, + "writes": 0, + "errors": 0, + "hangups": 0, + "accepts": 0, + "blocking_polls": 116, + "event_queue_length": 1, + "max_event_queue_length": 1, + "max_exec_time": 0, + "max_queue_time": 0 + } + }, + "links": { + "self": "http://localhost:8989/v1/threads/3" + } } ] } @@ -84,7 +218,7 @@ Status: 200 OK #### Supported Request Parameter -- `fields` +- `pretty` ## Get logging information @@ -97,35 +231,35 @@ GET /maxscale/logs #### Response -``` -Status: 200 OK +`Status: 200 OK` +```javascript { - "logdir": "/var/log/maxscale/", - "maxlog": true, - "syslog": false, - "log_levels": { - "error": true, - "warning": true, - "notice": true, - "info": false, - "debug": false + "links": { + "self": "http://localhost:8989/v1/maxscale/logs/" }, - "log_augmentation": { - "function": true - }, - "log_throttling": { - "limit": 8, - "window": 2000, - "suppression": 10000 - }, - "last_flushed": "Wed, 31 Aug 2016 23:29:26 +0300" + "data": { + "attributes": { + "parameters": { + "highprecision": false, + "maxlog": true, + "syslog": true, + "throttling": { + "count": 10, + "suppress_ms": 10000, + "window_ms": 1000 + } + } + }, + "id": "logs", + "type": "logs" + } } ``` #### Supported Request Parameter -- `fields` +- `pretty` ## Flush and rotate log files @@ -152,27 +286,25 @@ GET /maxscale/tasks #### Response -``` -Status: 200 OK +`Status: 200 OK` -[ - { - "name": "Load Average", - "type": "repeated", - "frequency": 10, - "next_due": "Fri Sep 9 14:12:37 2016" - } +```javascript +{ + "links": { + "self": "http://localhost:8989/v1/maxscale/tasks/" + }, + "data": [] // No tasks active } ``` #### Supported Request Parameter -- `fields` +- `pretty` ## Get loaded modules -Retrieve information about all loaded modules. This includes version, API and -maturity information. +Retrieve information about a loaded module. This includes version, API and +maturity information as well as all the parameters that the module defines. ``` GET /maxscale/modules @@ -180,37 +312,158 @@ GET /maxscale/modules #### Response -``` -Status: 200 OK +`Status: 200 OK` -[ - { - "name": "MySQLBackend", - "type": "Protocol", - "version": "V2.0.0", - "api_version": "1.1.0", - "maturity": "GA" +```javascript +{ + "links": { + "self": "http://localhost:8989/v1/maxscale/modules/" }, - { - "name": "qlafilter", - "type": "Filter", - "version": "V1.1.1", - "api_version": "1.1.0", - "maturity": "GA" - }, - { - "name": "readwritesplit", - "type": "Router", - "version": "V1.1.0", - "api_version": "1.0.0", - "maturity": "GA" + "data": { + "id": "readwritesplit", + "type": "module", + "attributes": { + "module_type": "Router", + "version": "V1.1.0", + "description": "A Read/Write splitting router for enhancement read scalability", + "api": "router", + "status": "GA", + "parameters": [ + { + "name": "use_sql_variables_in", + "type": "enum", + "default_value": "all", + "enum_values": [ + "all", + "master" + ] + }, + { + "name": "slave_selection_criteria", + "type": "enum", + "default_value": "LEAST_CURRENT_OPERATIONS", + "enum_values": [ + "LEAST_GLOBAL_CONNECTIONS", + "LEAST_ROUTER_CONNECTIONS", + "LEAST_BEHIND_MASTER", + "LEAST_CURRENT_OPERATIONS" + ] + }, + { + "name": "master_failure_mode", + "type": "enum", + "default_value": "fail_instantly", + "enum_values": [ + "fail_instantly", + "fail_on_write", + "error_on_write" + ] + }, + { + "name": "max_slave_replication_lag", + "type": "int", + "default_value": "-1" + }, + { + "name": "max_slave_connections", + "type": "string", + "default_value": "255" + }, + { + "name": "retry_failed_reads", + "type": "bool", + "default_value": "true" + }, + { + "name": "disable_sescmd_history", + "type": "bool", + "default_value": "true" + }, + { + "name": "max_sescmd_history", + "type": "count", + "default_value": "0" + }, + { + "name": "strict_multi_stmt", + "type": "bool", + "default_value": "true" + }, + { + "name": "master_accept_reads", + "type": "bool", + "default_value": "false" + }, + { + "name": "connection_keepalive", + "type": "count", + "default_value": "0" + } + ] + }, + "links": { + "self": "http://localhost:8989/v1/modules/readwritesplit" + } } } ``` #### Supported Request Parameter -- `fields` -- `range` +- `pretty` -TODO: Add epoll statistics and rest of the supported methods. +## Get all loaded modules + +Retrieve information about all loaded modules. + +``` +GET /maxscale/modules +``` + +#### Response + +`Status: 200 OK` + +```javascript +{ + "links": { + "self": "http://localhost:8989/v1/maxscale/modules/" + }, + "data": [ + { + "id": "qc_sqlite", + "type": "module", + "attributes": { + "module_type": "QueryClassifier", + "version": "V1.0.0", + "description": "Query classifier using sqlite.", + "api": "query_classifier", + "status": "Beta", + "parameters": [] + }, + "links": { + "self": "http://localhost:8989/v1/modules/qc_sqlite" + } + }, + { + "id": "MySQLAuth", + "type": "module", + "attributes": { + "module_type": "Authenticator", + "version": "V1.1.0", + "description": "The MySQL client to MaxScale authenticator implementation", + "api": "authenticator", + "status": "GA", + "parameters": [] + }, + "links": { + "self": "http://localhost:8989/v1/modules/MySQLAuth" + } + }, + ] +} +``` + +#### Supported Request Parameter + +- `pretty`