|
Hi,
it is currently not possible to easily parse output for maxadmin commands.
It would be great to have a common interface to get the output in a parsable (json,sql, csv, xml, ....) format.
The list serversjson command, which was added in 1.1, is a good start, but we would need this for every command.
Maybe forcing commands/modules/plugins to follow a common scheme will be required before implemeting this is possible.
Thanks,
Joffrey
# echo "list servers" | ./bin/maxadmin -uadmin -p mariadb
|
MaxScale> Servers.
|
-------------------+-----------------+-------+-------------+--------------------
|
Server | Address | Port | Connections | Status
|
-------------------+-----------------+-------+-------------+--------------------
|
server1 | 10.251.100.6 | 3306 | 1 | Down
|
server2 | 10.251.100.7 | 3306 | 0 | Slave, Synced, Running
|
server3 | 10.251.100.8 | 3306 | 0 | Master, Synced, Running
|
-------------------+-----------------+-------+-------------+--------------------
|
|
Example of preferred output (but for every command):
# echo "show serversjson" | ./bin/maxadmin -uadmin -p mariadb
|
MaxScale> [
|
{
|
"server": "10.251.100.6",
|
"status": "Down",
|
"protocol": "MySQLBackend",
|
"port": "3306",
|
"version": "10.0.17-MariaDB-1~wheezy-wsrep",
|
"nodeId": "-1",
|
"masterId": "-1",
|
"replDepth": "-1",
|
"totalConnections": "1",
|
"currentConnections": "1",
|
"currentOps": "0"
|
},
|
{
|
"server": "10.251.100.7",
|
"status": "Slave, Synced, Running",
|
"protocol": "MySQLBackend",
|
"port": "3306",
|
"version": "10.0.17-MariaDB-1~wheezy-wsrep-log",
|
"nodeId": "1",
|
"masterId": "-1",
|
"replDepth": "0",
|
"totalConnections": "1",
|
"currentConnections": "0",
|
"currentOps": "0"
|
},
|
{
|
"server": "10.251.100.8",
|
"status": "Master, Synced, Running",
|
"protocol": "MySQLBackend",
|
"port": "3306",
|
"version": "10.0.17-MariaDB-1~wheezy-wsrep-log",
|
"nodeId": "0",
|
"masterId": "-1",
|
"replDepth": "0",
|
"totalConnections": "3",
|
"currentConnections": "0",
|
"currentOps": "0"
|
}
|
]
|
|