Merge branch '2.3' into 2.4
This commit is contained in:
@ -112,7 +112,7 @@ module.exports = function() {
|
||||
row = []
|
||||
|
||||
fields.forEach(function(p) {
|
||||
var v = _.getPath(i, p[Object.keys(p)[0]], '')
|
||||
var v = _.getPath(i, p.path, '')
|
||||
|
||||
if (Array.isArray(v)) {
|
||||
v = v.join(', ')
|
||||
@ -162,7 +162,7 @@ module.exports = function() {
|
||||
var header = []
|
||||
|
||||
fields.forEach(function(i) {
|
||||
header.push(Object.keys(i))
|
||||
header.push(i.name)
|
||||
})
|
||||
|
||||
var table = getTable(header)
|
||||
@ -188,7 +188,7 @@ module.exports = function() {
|
||||
var header = []
|
||||
|
||||
fields.forEach(function(i) {
|
||||
header.push(Object.keys(i))
|
||||
header.push(i.name)
|
||||
})
|
||||
|
||||
var table = getTable(header)
|
||||
@ -197,7 +197,7 @@ module.exports = function() {
|
||||
row = []
|
||||
|
||||
fields.forEach(function(p) {
|
||||
var v = _.getPath(i, p[Object.keys(p)[0]], '')
|
||||
var v = _.getPath(i, p[p.name], '')
|
||||
|
||||
if (Array.isArray(v) && typeof(v[0]) != 'object') {
|
||||
v = v.join(', ')
|
||||
@ -229,7 +229,7 @@ module.exports = function() {
|
||||
separator = '\n'
|
||||
var max_field_length = 0
|
||||
fields.forEach(function (i) {
|
||||
var k = Object.keys(i)[0]
|
||||
var k = i.name
|
||||
if (k.length > max_field_length) {
|
||||
max_field_length = k.length
|
||||
}
|
||||
@ -244,8 +244,8 @@ module.exports = function() {
|
||||
}
|
||||
|
||||
fields.forEach(function(i) {
|
||||
var k = Object.keys(i)[0]
|
||||
var path = i[k]
|
||||
var k = i.name
|
||||
var path = i.path
|
||||
var v = _.getPath(data, path, '')
|
||||
|
||||
if (Array.isArray(v) && typeof(v[0]) != 'object') {
|
||||
@ -422,6 +422,24 @@ module.exports = function() {
|
||||
default: false
|
||||
}
|
||||
}
|
||||
|
||||
this.fieldDescriptions = function(fields) {
|
||||
var t = new Table({chars: {
|
||||
'top' : '', 'top-mid': '', 'top-left': '', 'top-right': '', 'left': ' ', 'right': '',
|
||||
'left-mid': '' , 'mid': '' , 'mid-mid': '', 'right-mid': '' , 'middle': '',
|
||||
'bottom' : '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '',
|
||||
}})
|
||||
|
||||
t.push(['Field', 'Description'])
|
||||
t.push(['-----', '-----------'])
|
||||
|
||||
|
||||
for (f of fields) {
|
||||
t.push([f.name, f.description])
|
||||
}
|
||||
|
||||
return '\n\n' + t.toString()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -441,8 +459,6 @@ var tsvopts = {
|
||||
'padding-right': 0,
|
||||
compact: true
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getList() {
|
||||
|
@ -13,24 +13,252 @@
|
||||
|
||||
require('./common.js')()
|
||||
|
||||
const list_servers_fields = [
|
||||
{
|
||||
name: 'Server',
|
||||
path: 'id',
|
||||
description: 'Server name'
|
||||
},
|
||||
{
|
||||
name: 'Address',
|
||||
path: 'attributes.parameters.address',
|
||||
description: 'Address where the server listens'
|
||||
},
|
||||
{
|
||||
name: 'Port',
|
||||
path: 'attributes.parameters.port',
|
||||
description: 'The port on which the server listens'
|
||||
},
|
||||
{
|
||||
name: 'Connections',
|
||||
path: 'attributes.statistics.connections',
|
||||
description: 'Current connection count'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Server state'
|
||||
},
|
||||
{
|
||||
name: 'GTID',
|
||||
path: 'attributes.gtid_current_pos',
|
||||
description: 'Current value of @@gtid_current_pos'
|
||||
}
|
||||
]
|
||||
|
||||
const list_services_fields = [
|
||||
{
|
||||
name: 'Service',
|
||||
path: 'id',
|
||||
description: 'Service name'
|
||||
},
|
||||
{
|
||||
name: 'Router',
|
||||
path: 'attributes.router',
|
||||
description: 'Router used by the service'
|
||||
},
|
||||
{
|
||||
name: 'Connections',
|
||||
path: 'attributes.connections',
|
||||
description: 'Current connection count'
|
||||
},
|
||||
{
|
||||
name: 'Total Connections',
|
||||
path: 'attributes.total_connections',
|
||||
description: 'Total connection count'
|
||||
},
|
||||
{
|
||||
name: 'Servers',
|
||||
path: 'relationships.servers.data[].id',
|
||||
description: 'Servers that the service uses'
|
||||
}
|
||||
]
|
||||
|
||||
const list_listeners_fields = [
|
||||
{
|
||||
name: 'Name',
|
||||
path: 'id',
|
||||
description: 'Listener name'
|
||||
},
|
||||
{
|
||||
name: 'Port',
|
||||
path: 'attributes.parameters.port',
|
||||
description: 'The port where the listener listens'
|
||||
},
|
||||
{
|
||||
name: 'Host',
|
||||
path: 'attributes.parameters.host',
|
||||
description: 'The address or socket where the listener listens'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Listener state'
|
||||
}
|
||||
]
|
||||
|
||||
const list_monitors_fields = [
|
||||
{
|
||||
name: 'Monitor',
|
||||
path: 'id',
|
||||
description: 'Monitor name'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Monitor state'
|
||||
},
|
||||
{
|
||||
name: 'Servers',
|
||||
path: 'relationships.servers.data[].id',
|
||||
description: 'The servers that this monitor monitors'
|
||||
}
|
||||
]
|
||||
|
||||
const list_sessions_fields = [
|
||||
{
|
||||
name: 'Id',
|
||||
path: 'id',
|
||||
description: 'Session ID'
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
path: 'attributes.user',
|
||||
description: 'Username'
|
||||
},
|
||||
{
|
||||
name: 'Host',
|
||||
path: 'attributes.remote',
|
||||
description: 'Client host address'
|
||||
},
|
||||
{
|
||||
name: 'Connected',
|
||||
path: 'attributes.connected',
|
||||
description: 'Time when the session started'
|
||||
},
|
||||
{
|
||||
name: 'Idle',
|
||||
path: 'attributes.idle',
|
||||
description: 'How long the session has been idle, in seconds'
|
||||
},
|
||||
{
|
||||
name: 'Service',
|
||||
path: 'relationships.services.data[].id',
|
||||
description: 'The service where the session connected'
|
||||
}
|
||||
]
|
||||
|
||||
const list_filters_fields = [
|
||||
{
|
||||
name: 'Filter',
|
||||
path: 'id',
|
||||
description: 'Filter name'
|
||||
},
|
||||
{
|
||||
name: 'Service',
|
||||
path: 'relationships.services.data[].id',
|
||||
description: 'Services that use the filter'
|
||||
},
|
||||
{
|
||||
name: 'Module',
|
||||
path: 'attributes.module',
|
||||
description: 'The module that the filter uses'
|
||||
}
|
||||
]
|
||||
|
||||
const list_modules_fields = [
|
||||
{
|
||||
name: 'Module',
|
||||
path: 'id',
|
||||
description: 'Module name'
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
path: 'attributes.module_type',
|
||||
description: 'Module type'
|
||||
},
|
||||
{
|
||||
name: 'Version',
|
||||
path: 'attributes.version',
|
||||
description: 'Module version'
|
||||
}
|
||||
]
|
||||
|
||||
const list_threads_fields = [
|
||||
{
|
||||
name: 'Id',
|
||||
path: 'id',
|
||||
description: 'Thread ID'
|
||||
},
|
||||
{
|
||||
name: 'Current FDs',
|
||||
path: 'attributes.stats.current_descriptors',
|
||||
description: 'Current number of managed file descriptors'
|
||||
},
|
||||
{
|
||||
name: 'Total FDs',
|
||||
path: 'attributes.stats.total_descriptors',
|
||||
description: 'Total number of managed file descriptors'
|
||||
},
|
||||
{
|
||||
name: 'Load (1s)',
|
||||
path: 'attributes.stats.load.last_second',
|
||||
description: 'Load percentage over the last second'
|
||||
},
|
||||
{
|
||||
name: 'Load (1m)',
|
||||
path: 'attributes.stats.load.last_minute',
|
||||
description: 'Load percentage over the last minute'
|
||||
},
|
||||
{
|
||||
name: 'Load (1h)',
|
||||
path: 'attributes.stats.load.last_hour',
|
||||
description: 'Load percentage over the last hour'
|
||||
}
|
||||
]
|
||||
|
||||
const list_users_fields = [
|
||||
{
|
||||
name: 'Name',
|
||||
path: 'id',
|
||||
description: 'User name'
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
path: 'type',
|
||||
description: 'User type'
|
||||
},
|
||||
{
|
||||
name: 'Privileges',
|
||||
path: 'attributes.account',
|
||||
description: 'User privileges'
|
||||
},
|
||||
]
|
||||
|
||||
const list_commands_fields = [
|
||||
{
|
||||
name: 'Module',
|
||||
path: 'id',
|
||||
description: 'Module name'
|
||||
},
|
||||
{
|
||||
name: 'Commands',
|
||||
path: 'attributes.commands[].id',
|
||||
description: 'Available commands'
|
||||
}
|
||||
]
|
||||
|
||||
exports.command = 'list <command>'
|
||||
exports.desc = 'List objects'
|
||||
exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('servers', 'List servers', function(yargs) {
|
||||
return yargs.epilog('List all servers in MaxScale.')
|
||||
return yargs.epilog('List all servers in MaxScale.' +
|
||||
fieldDescriptions(list_servers_fields))
|
||||
.usage('Usage: list servers')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
fields = [
|
||||
{'Server': 'id'},
|
||||
{'Address': 'attributes.parameters.address'},
|
||||
{'Port': 'attributes.parameters.port'},
|
||||
{'Connections': 'attributes.statistics.connections'},
|
||||
{'State': 'attributes.state'},
|
||||
{'GTID': 'attributes.gtid_current_pos'}
|
||||
]
|
||||
|
||||
// First, get the list of all servers
|
||||
return getJson(host, 'servers')
|
||||
@ -76,52 +304,41 @@ exports.builder = function(yargs) {
|
||||
}
|
||||
})
|
||||
})
|
||||
.then(() => filterResource(res, fields))
|
||||
.then((res) => rawCollectionAsTable(res, fields))
|
||||
.then(() => filterResource(res, list_servers_fields))
|
||||
.then((res) => rawCollectionAsTable(res, list_servers_fields))
|
||||
})
|
||||
})
|
||||
})
|
||||
.command('services', 'List services', function(yargs) {
|
||||
return yargs.epilog('List all services and the servers they use.')
|
||||
return yargs.epilog('List all services and the servers they use.' +
|
||||
fieldDescriptions(list_services_fields))
|
||||
.usage('Usage: list services')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'services',[
|
||||
{'Service': 'id'},
|
||||
{'Router': 'attributes.router'},
|
||||
{'Connections': 'attributes.connections'},
|
||||
{'Total Connections': 'attributes.total_connections'},
|
||||
{'Servers': 'relationships.servers.data[].id'}
|
||||
])
|
||||
return getCollection(host, 'services', list_services_fields)
|
||||
})
|
||||
})
|
||||
.command('listeners <service>', 'List listeners of a service', function(yargs) {
|
||||
return yargs.epilog('List listeners for a service.')
|
||||
return yargs.epilog('List listeners for a service.' +
|
||||
fieldDescriptions(list_listeners_fields))
|
||||
.usage('Usage: list listeners <service>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getSubCollection(host, 'services/' + argv.service, 'attributes.listeners', [
|
||||
{'Name': 'id'},
|
||||
{'Port': 'attributes.parameters.port'},
|
||||
{'Host': 'attributes.parameters.host'},
|
||||
{'State': 'attributes.state'}
|
||||
])
|
||||
return getSubCollection(host, 'services/' + argv.service, 'attributes.listeners', list_listeners_fields)
|
||||
})
|
||||
})
|
||||
.command('monitors', 'List monitors', function(yargs) {
|
||||
return yargs.epilog('List all monitors in MaxScale.')
|
||||
return yargs.epilog('List all monitors in MaxScale.' +
|
||||
fieldDescriptions(list_monitors_fields))
|
||||
.usage('Usage: list monitors')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'monitors', [
|
||||
{'Monitor': 'id'},
|
||||
{'State': 'attributes.state'},
|
||||
{'Servers': 'relationships.servers.data[].id'}
|
||||
])
|
||||
return getCollection(host, 'monitors', list_monitors_fields)
|
||||
})
|
||||
})
|
||||
.command('sessions', 'List sessions', function(yargs) {
|
||||
return yargs.epilog('List all client sessions.')
|
||||
return yargs.epilog('List all client sessions.' +
|
||||
fieldDescriptions(list_sessions_fields))
|
||||
.usage('Usage: list sessions')
|
||||
.group([rDnsOption.shortname], 'Options:')
|
||||
.option(rDnsOption.shortname, rDnsOption.definition)
|
||||
@ -131,76 +348,53 @@ exports.builder = function(yargs) {
|
||||
if (argv[this.rDnsOption.shortname]) {
|
||||
resource += '?' + this.rDnsOption.optionOn
|
||||
}
|
||||
return getCollection(host, resource,[
|
||||
{'Id': 'id'},
|
||||
{'User': 'attributes.user'},
|
||||
{'Host': 'attributes.remote'},
|
||||
{'Connected': 'attributes.connected'},
|
||||
{'Idle': 'attributes.idle'},
|
||||
{'Service': 'relationships.services.data[].id'}
|
||||
])
|
||||
return getCollection(host, 'sessions', list_sessions_fields)
|
||||
})
|
||||
})
|
||||
.command('filters', 'List filters', function(yargs) {
|
||||
return yargs.epilog('List all filters in MaxScale.')
|
||||
return yargs.epilog('List all filters in MaxScale.' +
|
||||
fieldDescriptions(list_filters_fields))
|
||||
.usage('Usage: list filters')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'filters', [
|
||||
{'Filter': 'id'},
|
||||
{'Service': 'relationships.services.data[].id'},
|
||||
{'Module': 'attributes.module'}
|
||||
])
|
||||
return getCollection(host, 'filters', list_filters_fields)
|
||||
})
|
||||
})
|
||||
.command('modules', 'List loaded modules', function(yargs) {
|
||||
return yargs.epilog('List all currently loaded modules.')
|
||||
return yargs.epilog('List all currently loaded modules.' +
|
||||
fieldDescriptions(list_modules_fields))
|
||||
.usage('Usage: list modules')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'maxscale/modules',[
|
||||
{'Module':'id'},
|
||||
{'Type':'attributes.module_type'},
|
||||
{'Version': 'attributes.version'}
|
||||
])
|
||||
return getCollection(host, 'maxscale/modules', list_modules_fields)
|
||||
})
|
||||
})
|
||||
.command('threads', 'List threads', function(yargs) {
|
||||
return yargs.epilog('List all worker threads.')
|
||||
return yargs.epilog('List all worker threads.' +
|
||||
fieldDescriptions(list_threads_fields))
|
||||
.usage('Usage: list threads')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'maxscale/threads', [
|
||||
{'Id': 'id'},
|
||||
{'Current FDs': 'attributes.stats.current_descriptors'},
|
||||
{'Total FDs': 'attributes.stats.total_descriptors'},
|
||||
{'Load (1s)': 'attributes.stats.load.last_second'},
|
||||
{'Load (1m)': 'attributes.stats.load.last_minute'},
|
||||
{'Load (1h)': 'attributes.stats.load.last_hour'}
|
||||
])
|
||||
return getCollection(host, 'maxscale/threads', list_threads_fields)
|
||||
})
|
||||
})
|
||||
.command('users', 'List created users', function(yargs) {
|
||||
return yargs.epilog('List network the users that can be used to connect to the MaxScale REST API as well as enabled local accounts.')
|
||||
return yargs.epilog('List network the users that can be used to connect to the MaxScale REST API' +
|
||||
' as well as enabled local accounts.' +
|
||||
fieldDescriptions(list_users_fields))
|
||||
.usage('Usage: list users')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'users',[
|
||||
{'Name':'id'},
|
||||
{'Type':'type'},
|
||||
{'Privileges':'attributes.account'},
|
||||
])
|
||||
return getCollection(host, 'users', list_users_fields)
|
||||
})
|
||||
})
|
||||
.command('commands', 'List module commands', function(yargs) {
|
||||
return yargs.epilog('List all available module commands.')
|
||||
return yargs.epilog('List all available module commands.' +
|
||||
fieldDescriptions(list_commands_fields))
|
||||
.usage('Usage: list commands')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'maxscale/modules',[
|
||||
{'Module':'id'},
|
||||
{'Commands': 'attributes.commands[].id'}
|
||||
])
|
||||
return getCollection(host, 'maxscale/modules', list_commands_fields)
|
||||
})
|
||||
})
|
||||
.usage('Usage: list <command>')
|
||||
|
@ -14,94 +14,438 @@
|
||||
require('./common.js')()
|
||||
|
||||
const server_fields = [
|
||||
{'Server': 'id'},
|
||||
{'Address': 'attributes.parameters.address'},
|
||||
{'Port': 'attributes.parameters.port'},
|
||||
{'State': 'attributes.state'},
|
||||
{'Last Event': 'attributes.last_event'},
|
||||
{'Triggered At': 'attributes.triggered_at'},
|
||||
{'Services': 'relationships.services.data[].id'},
|
||||
{'Monitors': 'relationships.monitors.data[].id'},
|
||||
{'Master ID': 'attributes.master_id'},
|
||||
{'Node ID': 'attributes.node_id'},
|
||||
{'Slave Server IDs': 'attributes.slaves'},
|
||||
{'Statistics': 'attributes.statistics'},
|
||||
{'Parameters': 'attributes.parameters'}
|
||||
{
|
||||
name: 'Server',
|
||||
path: 'id',
|
||||
description: 'Server name'
|
||||
},
|
||||
{
|
||||
name: 'Address',
|
||||
path: 'attributes.parameters.address',
|
||||
description: 'Address where the server listens'
|
||||
},
|
||||
{
|
||||
name: 'Port',
|
||||
path: 'attributes.parameters.port',
|
||||
description: 'The port on which the server listens'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Server state'
|
||||
},
|
||||
{
|
||||
name: 'Last Event',
|
||||
path: 'attributes.last_event',
|
||||
description: 'The type of the latest event'
|
||||
},
|
||||
{
|
||||
name: 'Triggered At',
|
||||
path: 'attributes.triggered_at',
|
||||
description: 'Time when the latest event was triggered at'
|
||||
},
|
||||
{
|
||||
name: 'Services',
|
||||
path: 'relationships.services.data[].id',
|
||||
description: 'Services that use this server'
|
||||
},
|
||||
{
|
||||
name: 'Monitors',
|
||||
path: 'relationships.monitors.data[].id',
|
||||
description: 'Monitors that monitor this server'
|
||||
},
|
||||
{
|
||||
name: 'Master ID',
|
||||
path: 'attributes.master_id',
|
||||
description: 'The server ID of the master'
|
||||
},
|
||||
{
|
||||
name: 'Node ID',
|
||||
path: 'attributes.node_id',
|
||||
description: 'The node ID of this server'
|
||||
},
|
||||
{
|
||||
name: 'Slave Server IDs',
|
||||
path: 'attributes.slaves',
|
||||
description: 'List of slave server IDs'
|
||||
},
|
||||
{
|
||||
name: 'Statistics',
|
||||
path: 'attributes.statistics',
|
||||
description: 'Server statistics'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'Server parameters'
|
||||
}
|
||||
]
|
||||
|
||||
const service_fields = [
|
||||
{'Service': 'id'},
|
||||
{'Router': 'attributes.router'},
|
||||
{'State': 'attributes.state'},
|
||||
{'Started At': 'attributes.started'},
|
||||
{'Current Connections': 'attributes.connections'},
|
||||
{'Total Connections': 'attributes.total_connections'},
|
||||
{'Servers': 'relationships.servers.data[].id'},
|
||||
{'Parameters': 'attributes.parameters'},
|
||||
{'Router Diagnostics': 'attributes.router_diagnostics'}
|
||||
{
|
||||
name: 'Service',
|
||||
path: 'id',
|
||||
description: 'Service name'
|
||||
},
|
||||
{
|
||||
name: 'Router',
|
||||
path: 'attributes.router',
|
||||
description: 'Router that the service uses'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Service state'
|
||||
},
|
||||
{
|
||||
name: 'Started At',
|
||||
path: 'attributes.started',
|
||||
description: 'When the service was started'
|
||||
},
|
||||
{
|
||||
name: 'Current Connections',
|
||||
path: 'attributes.connections',
|
||||
description: 'Current connection count'
|
||||
},
|
||||
{
|
||||
name: 'Total Connections',
|
||||
path: 'attributes.total_connections',
|
||||
description: 'Total connection count'
|
||||
},
|
||||
{
|
||||
name: 'Servers',
|
||||
path: 'relationships.servers.data[].id',
|
||||
description: 'Servers that the service uses'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'Service parameter'
|
||||
},
|
||||
{
|
||||
name: 'Router Diagnostics',
|
||||
path: 'attributes.router_diagnostics',
|
||||
description: 'Diagnostics provided by the router module'
|
||||
}
|
||||
]
|
||||
|
||||
const monitor_fields = [
|
||||
{'Monitor': 'id'},
|
||||
{'State': 'attributes.state'},
|
||||
{'Servers': 'relationships.servers.data[].id'},
|
||||
{'Parameters': 'attributes.parameters'},
|
||||
{'Monitor Diagnostics': 'attributes.monitor_diagnostics'}
|
||||
{
|
||||
name: 'Monitor',
|
||||
path: 'id',
|
||||
description: 'Monitor name'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Monitor state'
|
||||
},
|
||||
{
|
||||
name: 'Servers',
|
||||
path: 'relationships.servers.data[].id',
|
||||
description: 'The servers that this monitor monitors'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'Monitor parameters'
|
||||
},
|
||||
{
|
||||
name: 'Monitor Diagnostics',
|
||||
path: 'attributes.monitor_diagnostics',
|
||||
description: 'Diagnostics provided by the monitor module'
|
||||
}
|
||||
]
|
||||
|
||||
const session_fields = [
|
||||
{'Id': 'id'},
|
||||
{'Service': 'relationships.services.data[].id'},
|
||||
{'State': 'attributes.state'},
|
||||
{'User': 'attributes.user'},
|
||||
{'Host': 'attributes.remote'},
|
||||
{'Connected': 'attributes.connected'},
|
||||
{'Idle': 'attributes.idle'},
|
||||
{'Connections': 'attributes.connections[].server'},
|
||||
{'Connection IDs': 'attributes.connections[].protocol_diagnostics.connection_id'},
|
||||
{'Queries': 'attributes.queries[].statement'},
|
||||
{'Log': 'attributes.log'}
|
||||
{
|
||||
name: 'Id',
|
||||
path: 'id',
|
||||
description: 'Session ID'
|
||||
},
|
||||
{
|
||||
name: 'Service',
|
||||
path: 'relationships.services.data[].id',
|
||||
description: 'The service where the session connected'
|
||||
},
|
||||
{
|
||||
name: 'State',
|
||||
path: 'attributes.state',
|
||||
description: 'Session state'
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
path: 'attributes.user',
|
||||
description: 'Username'
|
||||
},
|
||||
{
|
||||
name: 'Host',
|
||||
path: 'attributes.remote',
|
||||
description: 'Client host address'
|
||||
},
|
||||
{
|
||||
name: 'Connected',
|
||||
path: 'attributes.connected',
|
||||
description: 'Time when the session started'
|
||||
},
|
||||
{
|
||||
name: 'Idle',
|
||||
path: 'attributes.idle',
|
||||
description: 'How long the session has been idle, in seconds'
|
||||
},
|
||||
{
|
||||
name: 'Connections',
|
||||
path: 'attributes.connections[].server',
|
||||
description: 'Ordered list of backend connections'
|
||||
},
|
||||
{
|
||||
name: 'Connection IDs',
|
||||
path: 'attributes.connections[].protocol_diagnostics.connection_id',
|
||||
description: 'Thread IDs for the backend connections'
|
||||
},
|
||||
{
|
||||
name: 'Queries',
|
||||
path: 'attributes.queries[].statement',
|
||||
description: 'Query history'
|
||||
},
|
||||
{
|
||||
name: 'Log',
|
||||
path: 'attributes.log',
|
||||
description: 'Per-session log messages'
|
||||
}
|
||||
]
|
||||
|
||||
const filter_fields = [
|
||||
{'Filter': 'id'},
|
||||
{'Module': 'attributes.module'},
|
||||
{'Services': 'relationships.services.data[].id'},
|
||||
{'Parameters': 'attributes.parameters'}
|
||||
{
|
||||
name: 'Filter',
|
||||
path: 'id',
|
||||
description: 'Filter name'
|
||||
},
|
||||
{
|
||||
name: 'Module',
|
||||
path: 'attributes.module',
|
||||
description: 'The module that the filter uses'
|
||||
},
|
||||
{
|
||||
name: 'Services',
|
||||
path: 'relationships.services.data[].id',
|
||||
description: 'Services that use the filter'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'Filter parameters'
|
||||
}
|
||||
]
|
||||
|
||||
const module_fields = [
|
||||
{'Module': 'id'},
|
||||
{'Type': 'attributes.module_type'},
|
||||
{'Version': 'attributes.version'},
|
||||
{'Maturity': 'attributes.maturity'},
|
||||
{'Description': 'attributes.description'},
|
||||
{'Parameters': 'attributes.parameters'},
|
||||
{'Commands': 'attributes.commands'}
|
||||
{
|
||||
name: 'Module',
|
||||
path: 'id',
|
||||
description: 'Module name'
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
path: 'attributes.module_type',
|
||||
description: 'Module type'
|
||||
},
|
||||
{
|
||||
name: 'Version',
|
||||
path: 'attributes.version',
|
||||
description: 'Module version'
|
||||
},
|
||||
{
|
||||
name: 'Maturity',
|
||||
path: 'attributes.maturity',
|
||||
description: 'Module maturity'
|
||||
},
|
||||
{
|
||||
name: 'Description',
|
||||
path: 'attributes.description',
|
||||
description: 'Short description about the module'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'All the parameters that the module accepts'
|
||||
},
|
||||
{
|
||||
name: 'Commands',
|
||||
path: 'attributes.commands',
|
||||
description: 'Commands that the module provides'
|
||||
}
|
||||
]
|
||||
|
||||
const thread_fields = [
|
||||
{'Id': 'id'},
|
||||
{'Accepts': 'attributes.stats.accepts'},
|
||||
{'Reads': 'attributes.stats.reads'},
|
||||
{'Writes': 'attributes.stats.writes'},
|
||||
{'Hangups': 'attributes.stats.hangups'},
|
||||
{'Errors': 'attributes.stats.errors'},
|
||||
{'Blocking polls': 'attributes.stats.blocking_polls'},
|
||||
{'Avg event queue length': 'attributes.stats.avg_event_queue_length'},
|
||||
{'Max event queue length': 'attributes.stats.max_event_queue_length'},
|
||||
{'Max exec time': 'attributes.stats.max_exec_time'},
|
||||
{'Max queue time': 'attributes.stats.max_queue_time'},
|
||||
{'Current FDs': 'attributes.stats.current_descriptors'},
|
||||
{'Total FDs': 'attributes.stats.total_descriptors'},
|
||||
{'Load (1s)': 'attributes.stats.load.last_second'},
|
||||
{'Load (1m)': 'attributes.stats.load.last_minute'},
|
||||
{'Load (1h)': 'attributes.stats.load.last_hour'},
|
||||
{'QC cache size': 'attributes.stats.query_classifier_cache.size'},
|
||||
{'QC cache inserts': 'attributes.stats.query_classifier_cache.inserts'},
|
||||
{'QC cache hits': 'attributes.stats.query_classifier_cache.hits'},
|
||||
{'QC cache misses': 'attributes.stats.query_classifier_cache.misses'},
|
||||
{'QC cache evictions': 'attributes.stats.query_classifier_cache.evictions'},
|
||||
{
|
||||
name: 'Id',
|
||||
path: 'id',
|
||||
description: 'Thread ID'
|
||||
},
|
||||
{
|
||||
name: 'Accepts',
|
||||
path: 'attributes.stats.accepts',
|
||||
description: 'Number of TCP accepts done by this thread'
|
||||
},
|
||||
{
|
||||
name: 'Reads',
|
||||
path: 'attributes.stats.reads',
|
||||
description: 'Number of EPOLLIN events'
|
||||
},
|
||||
{
|
||||
name: 'Writes',
|
||||
path: 'attributes.stats.writes',
|
||||
description: 'Number of EPOLLOUT events'
|
||||
},
|
||||
{
|
||||
name: 'Hangups',
|
||||
path: 'attributes.stats.hangups',
|
||||
description: 'Number of EPOLLHUP and EPOLLRDUP events'
|
||||
},
|
||||
{
|
||||
name: 'Errors',
|
||||
path: 'attributes.stats.errors',
|
||||
description: 'Number of EPOLLERR events'
|
||||
},
|
||||
{
|
||||
name: 'Avg event queue length',
|
||||
path: 'attributes.stats.avg_event_queue_length',
|
||||
description: 'Average number of events returned by one epoll_wait call'
|
||||
},
|
||||
{
|
||||
name: 'Max event queue length',
|
||||
path: 'attributes.stats.max_event_queue_length',
|
||||
description: 'Maximum number of events returned by one epoll_wait call'
|
||||
},
|
||||
{
|
||||
name: 'Max exec time',
|
||||
path: 'attributes.stats.max_exec_time',
|
||||
description: 'The longest time spent processing events returned by a epoll_wait call'
|
||||
},
|
||||
{
|
||||
name: 'Max queue time',
|
||||
path: 'attributes.stats.max_queue_time',
|
||||
description: 'The longest time an event had to wait before it was processed'
|
||||
},
|
||||
{
|
||||
name: 'Current FDs',
|
||||
path: 'attributes.stats.current_descriptors',
|
||||
description: 'Current number of managed file descriptors'
|
||||
},
|
||||
{
|
||||
name: 'Total FDs',
|
||||
path: 'attributes.stats.total_descriptors',
|
||||
description: 'Total number of managed file descriptors'
|
||||
},
|
||||
{
|
||||
name: 'Load (1s)',
|
||||
path: 'attributes.stats.load.last_second',
|
||||
description: 'Load percentage over the last second'
|
||||
},
|
||||
{
|
||||
name: 'Load (1m)',
|
||||
path: 'attributes.stats.load.last_minute',
|
||||
description: 'Load percentage over the last minute'
|
||||
},
|
||||
{
|
||||
name: 'Load (1h)',
|
||||
path: 'attributes.stats.load.last_hour',
|
||||
description: 'Load percentage over the last hour'
|
||||
},
|
||||
{
|
||||
name: 'QC cache size',
|
||||
path: 'attributes.stats.query_classifier_cache.size',
|
||||
description: 'Query classifier size'
|
||||
},
|
||||
{
|
||||
name: 'QC cache inserts',
|
||||
path: 'attributes.stats.query_classifier_cache.inserts',
|
||||
description: 'Number of times a new query was added into the query classification cache'
|
||||
},
|
||||
{
|
||||
name: 'QC cache hits',
|
||||
path: 'attributes.stats.query_classifier_cache.hits',
|
||||
description: 'How many times a query classification was found in the query classification cache'
|
||||
},
|
||||
{
|
||||
name: 'QC cache misses',
|
||||
path: 'attributes.stats.query_classifier_cache.misses',
|
||||
description: 'How many times a query classification was not found in the query classification cache'
|
||||
},
|
||||
{
|
||||
name: 'QC cache evictions',
|
||||
path: 'attributes.stats.query_classifier_cache.evictions',
|
||||
description: 'How many times a query classification result was evicted from the query classification cache'
|
||||
},
|
||||
]
|
||||
|
||||
const show_maxscale_fields = [
|
||||
{
|
||||
name: 'Version',
|
||||
path: 'attributes.version',
|
||||
description: 'MaxScale version'
|
||||
},
|
||||
{
|
||||
name: 'Commit',
|
||||
path: 'attributes.commit',
|
||||
description: 'MaxScale commit ID'
|
||||
},
|
||||
{
|
||||
name: 'Started At',
|
||||
path: 'attributes.started_at',
|
||||
description: 'Time when MaxScale was started'
|
||||
},
|
||||
{
|
||||
name: 'Activated At',
|
||||
path: 'attributes.activated_at',
|
||||
description: 'Time when MaxScale left passive mode'
|
||||
},
|
||||
{
|
||||
name: 'Uptime',
|
||||
path: 'attributes.uptime',
|
||||
description: 'Time MaxScale has been running'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'Global MaxScale parameters'
|
||||
}
|
||||
]
|
||||
|
||||
const show_logging_fields = [
|
||||
{
|
||||
name: 'Current Log File',
|
||||
path: 'attributes.log_file',
|
||||
description: 'The current log file MaxScale is logging into'
|
||||
},
|
||||
{
|
||||
name: 'Enabled Log Levels',
|
||||
path: 'attributes.log_priorities',
|
||||
description: 'List of log levels enabled in MaxScale'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters',
|
||||
description: 'Logging parameters'
|
||||
}
|
||||
]
|
||||
|
||||
const show_commands_fields = [
|
||||
{
|
||||
name: 'Command',
|
||||
path: 'id',
|
||||
description: 'Command name'
|
||||
},
|
||||
{
|
||||
name: 'Parameters',
|
||||
path: 'attributes.parameters[].type',
|
||||
description: 'Parameters the command supports'
|
||||
},
|
||||
{
|
||||
name: 'Descriptions',
|
||||
path: 'attributes.parameters[].description',
|
||||
description: 'Parameter descriptions'
|
||||
}
|
||||
]
|
||||
|
||||
exports.command = 'show <command>'
|
||||
@ -113,7 +457,7 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a server. The `Parameters` ' +
|
||||
'field contains the currently configured parameters for this ' +
|
||||
'server. See `help alter server` for more details about altering ' +
|
||||
'server parameters.')
|
||||
'server parameters.' + fieldDescriptions(server_fields))
|
||||
.usage('Usage: show server <server>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -121,7 +465,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('servers', 'Show all servers', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about all servers.')
|
||||
return yargs.epilog('Show detailed information about all servers.' +
|
||||
fieldDescriptions(server_fields))
|
||||
.usage('Usage: show servers')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -132,7 +477,7 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a service. The `Parameters` ' +
|
||||
'field contains the currently configured parameters for this ' +
|
||||
'service. See `help alter service` for more details about altering ' +
|
||||
'service parameters.')
|
||||
'service parameters.' + fieldDescriptions(service_fields))
|
||||
.usage('Usage: show service <service>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -140,7 +485,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('services', 'Show all services', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about all services.')
|
||||
return yargs.epilog('Show detailed information about all services.' +
|
||||
fieldDescriptions(service_fields))
|
||||
.usage('Usage: show services')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -151,7 +497,7 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a monitor. The `Parameters` ' +
|
||||
'field contains the currently configured parameters for this ' +
|
||||
'monitor. See `help alter monitor` for more details about altering ' +
|
||||
'monitor parameters.')
|
||||
'monitor parameters.' + fieldDescriptions(monitor_fields))
|
||||
.usage('Usage: show monitor <monitor>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -159,7 +505,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('monitors', 'Show all monitors', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about all monitors.')
|
||||
return yargs.epilog('Show detailed information about all monitors.' +
|
||||
fieldDescriptions(monitor_fields))
|
||||
.usage('Usage: show monitors')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -173,7 +520,8 @@ exports.builder = function(yargs) {
|
||||
'ID of a particular session.\n\n' +
|
||||
'The `Connections` field lists the servers to which ' +
|
||||
'the session is connected and the `Connection IDs` ' +
|
||||
'field lists the IDs for those connections.')
|
||||
'field lists the IDs for those connections.' +
|
||||
fieldDescriptions(session_fields))
|
||||
.usage('Usage: show session <session>')
|
||||
.group([rDnsOption.shortname], 'Options:')
|
||||
.option(rDnsOption.shortname, rDnsOption.definition)
|
||||
@ -188,7 +536,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('sessions', 'Show all sessions', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about all sessions. ' +
|
||||
'See `help show session` for more details.')
|
||||
'See `help show session` for more details.' +
|
||||
fieldDescriptions(session_fields))
|
||||
.usage('Usage: show sessions')
|
||||
.group([rDnsOption.shortname], 'Options:')
|
||||
.option(rDnsOption.shortname, rDnsOption.definition)
|
||||
@ -202,7 +551,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('filter <filter>', 'Show filter', function(yargs) {
|
||||
return yargs.epilog('The list of services that use this filter is show in the `Services` field.')
|
||||
return yargs.epilog('The list of services that use this filter is show in the `Services` field.' +
|
||||
fieldDescriptions(filter_fields))
|
||||
.usage('Usage: show filter <filter>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -210,7 +560,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('filters', 'Show all filters', function(yargs) {
|
||||
return yargs.epilog('Show detailed information of all filters.')
|
||||
return yargs.epilog('Show detailed information of all filters.' +
|
||||
fieldDescriptions(filter_fields))
|
||||
.usage('Usage: show filters')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -219,7 +570,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('module <module>', 'Show loaded module', function(yargs) {
|
||||
return yargs.epilog('This command shows all available parameters as well as ' +
|
||||
'detailed version information of a loaded module.')
|
||||
'detailed version information of a loaded module.' +
|
||||
fieldDescriptions(module_fields))
|
||||
.usage('Usage: show module <module>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -227,7 +579,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('modules', 'Show all loaded modules', function(yargs) {
|
||||
return yargs.epilog('Displays detailed information about all modules.')
|
||||
return yargs.epilog('Displays detailed information about all modules.' +
|
||||
fieldDescriptions(module_fields))
|
||||
.usage('Usage: show modules')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -236,22 +589,16 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('maxscale', 'Show MaxScale information', function(yargs) {
|
||||
return yargs.epilog('See `help alter maxscale` for more details about altering ' +
|
||||
'MaxScale parameters.')
|
||||
'MaxScale parameters.' + fieldDescriptions(show_maxscale_fields))
|
||||
.usage('Usage: show maxscale')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'maxscale', [
|
||||
{'Version': 'attributes.version'},
|
||||
{'Commit': 'attributes.commit'},
|
||||
{'Started At': 'attributes.started_at'},
|
||||
{'Activated At': 'attributes.activated_at'},
|
||||
{'Uptime': 'attributes.uptime'},
|
||||
{'Parameters': 'attributes.parameters'}
|
||||
])
|
||||
return getResource(host, 'maxscale', show_maxscale_fields)
|
||||
})
|
||||
})
|
||||
.command('thread <thread>', 'Show thread', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a worker thread.')
|
||||
return yargs.epilog('Show detailed information about a worker thread.' +
|
||||
fieldDescriptions(thread_fields))
|
||||
.usage('Usage: show thread <thread>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -259,7 +606,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('threads', 'Show all threads', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about all worker threads.')
|
||||
return yargs.epilog('Show detailed information about all worker threads.' +
|
||||
fieldDescriptions(thread_fields))
|
||||
.usage('Usage: show threads')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -268,28 +616,21 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('logging', 'Show MaxScale logging information', function(yargs) {
|
||||
return yargs.epilog('See `help alter logging` for more details about altering ' +
|
||||
'logging parameters.')
|
||||
'logging parameters.' + fieldDescriptions(show_logging_fields))
|
||||
.usage('Usage: show logging')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'maxscale/logs', [
|
||||
{'Current Log File': 'attributes.log_file'},
|
||||
{'Enabled Log Levels': 'attributes.log_priorities'},
|
||||
{'Parameters': 'attributes.parameters'}
|
||||
])
|
||||
return getResource(host, 'maxscale/logs', show_logging_fields)
|
||||
})
|
||||
})
|
||||
.command('commands <module>', 'Show module commands of a module', function(yargs) {
|
||||
return yargs.epilog('This command shows the parameters the command expects with ' +
|
||||
'the parameter descriptions.')
|
||||
'the parameter descriptions.' + fieldDescriptions(show_commands_fields))
|
||||
.usage('Usage: show commands <module>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getSubCollection(host, 'maxscale/modules/' + argv.module, 'attributes.commands', [
|
||||
{'Command': 'id'},
|
||||
{'Parameters': 'attributes.parameters[].type'},
|
||||
{'Descriptions': 'attributes.parameters[].description'}
|
||||
])
|
||||
return getSubCollection(host, 'maxscale/modules/' + argv.module, 'attributes.commands',
|
||||
show_commands_fields)
|
||||
})
|
||||
})
|
||||
.command('qc_cache', 'Show query classifier cache', function(yargs) {
|
||||
|
Reference in New Issue
Block a user