MXS-1929: Add parameters to maxctrl create monitor
The parameters for the monitor can now be defined when the monitor is created. This makes the filter, monitor and service creation consistent.
This commit is contained in:
parent
065ee50d53
commit
befb25a14a
@ -10,6 +10,12 @@ report at [Jira](https://jira.mariadb.org).
|
||||
|
||||
## Changed Features
|
||||
|
||||
### MaxCtrl `create monitor`
|
||||
|
||||
The `create monitor` command now accepts a list of key-value parameters that are
|
||||
passed to the monitor as the last argument. This allows creation and
|
||||
configuration of monitors in one command.
|
||||
|
||||
### `query_retries`
|
||||
|
||||
The default value of `query_retries` was changed from 0 to 1. This turns
|
||||
|
@ -142,10 +142,12 @@ exports.builder = function(yargs) {
|
||||
describe: 'Password for the monitor user',
|
||||
type: 'string'
|
||||
})
|
||||
.command('monitor <name> <module>', 'Create a new monitor', function(yargs) {
|
||||
.command('monitor <name> <module> [params...]', 'Create a new monitor', function(yargs) {
|
||||
return yargs.epilog('The list of servers given with the --servers option should not ' +
|
||||
'contain any servers that are already monitored by another monitor.')
|
||||
.usage('Usage: create monitor <name> <module>')
|
||||
'contain any servers that are already monitored by another monitor. ' +
|
||||
'The last argument to this command is a list of key=value parameters ' +
|
||||
'given as the monitor parameters.')
|
||||
.usage('Usage: create monitor <name> <module> [params...]')
|
||||
}, function(argv) {
|
||||
|
||||
var monitor = {
|
||||
@ -157,6 +159,15 @@ exports.builder = function(yargs) {
|
||||
}
|
||||
}
|
||||
|
||||
if (argv.params) {
|
||||
var err = validateParams(argv, argv.params)
|
||||
if (err) {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
|
||||
monitor.data.attributes.parameters = argv.params.reduce(to_obj, {})
|
||||
}
|
||||
|
||||
if (argv.servers) {
|
||||
for (i = 0; i < argv.servers.length; i++) {
|
||||
_.set(monitor, 'data.relationships.servers.data[' + i + ']', {id: argv.servers[i], type: 'servers'})
|
||||
|
Loading…
x
Reference in New Issue
Block a user