MXS-1973 Support reverse DNS for client hostnames in MaxCtrl
May slow maxscale down when used. Only supported for "list sessions", "show sessions" and "show session <id>".
This commit is contained in:
@ -409,6 +409,16 @@ module.exports = function() {
|
||||
this.error = function(err) {
|
||||
return Promise.reject(colors.red('Error: ') + err)
|
||||
}
|
||||
|
||||
this.rDnsOption = {
|
||||
shortname: 'rdns',
|
||||
optionOn: 'rdns=true',
|
||||
definition : {
|
||||
describe: 'Reverse DNS on client IP. May slow MaxScale down.',
|
||||
type: 'bool',
|
||||
default: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -115,9 +115,15 @@ exports.builder = function(yargs) {
|
||||
.command('sessions', 'List sessions', function(yargs) {
|
||||
return yargs.epilog('List all client sessions.')
|
||||
.usage('Usage: list sessions')
|
||||
.group([rDnsOption.shortname], 'Options:')
|
||||
.option(rDnsOption.shortname, rDnsOption.definition)
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'sessions',[
|
||||
var resource = 'sessions'
|
||||
if (argv[this.rDnsOption.shortname]) {
|
||||
resource += '?' + this.rDnsOption.optionOn
|
||||
}
|
||||
return getCollection(host, resource,[
|
||||
{'Id': 'id'},
|
||||
{'User': 'attributes.user'},
|
||||
{'Host': 'attributes.remote'},
|
||||
|
||||
@ -174,18 +174,30 @@ exports.builder = function(yargs) {
|
||||
'the session is connected and the `Connection IDs` ' +
|
||||
'field lists the IDs for those connections.')
|
||||
.usage('Usage: show session <session>')
|
||||
.group([rDnsOption.shortname], 'Options:')
|
||||
.option(rDnsOption.shortname, rDnsOption.definition)
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'sessions/' + argv.session, session_fields)
|
||||
var resource = 'sessions/' + argv.session
|
||||
if (argv[this.rDnsOption.shortname]) {
|
||||
resource += '?' + this.rDnsOption.optionOn
|
||||
}
|
||||
return getResource(host, resource, session_fields)
|
||||
})
|
||||
})
|
||||
.command('sessions', 'Show all sessions', function(yargs) {
|
||||
return yargs.epilog('Show detailed information about all sessions. ' +
|
||||
'See `help show session` for more details.')
|
||||
.usage('Usage: show sessions')
|
||||
.group([rDnsOption.shortname], 'Options:')
|
||||
.option(rDnsOption.shortname, rDnsOption.definition)
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollectionAsResource(host, 'sessions/', session_fields)
|
||||
var resource = 'sessions/'
|
||||
if (argv[this.rDnsOption.shortname]) {
|
||||
resource += '?' + this.rDnsOption.optionOn
|
||||
}
|
||||
return getCollectionAsResource(host, resource, session_fields)
|
||||
})
|
||||
})
|
||||
.command('filter <filter>', 'Show filter', function(yargs) {
|
||||
|
||||
Reference in New Issue
Block a user