83 Commits

Author SHA1 Message Date
Markus Mäkelä
d16fbd4cdf
Expand list users output in maxctrl
The output now lists the type and privileges of each user.
2018-09-10 11:21:06 +03:00
Markus Mäkelä
befb25a14a
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.
2018-08-23 15:46:46 +03:00
Markus Mäkelä
fc7436c52a
Add interactive mode to MaxCtrl
If no command is given, MaxCtrl is started in an interactive mode.
2018-08-22 16:40:36 +03:00
Markus Mäkelä
f6cd8b6454
Fill the gaps in MaxCtrl testing
The MaxCtrl test suite now covers most of the code that can be tested
within reasonable limits. Also removed some dead code in `list servers`.
2018-08-09 12:56:53 +03:00
Markus Mäkelä
50c20e79ee
MXS-1929: Reject promise on invalid input
If a value that is not of key-value format was given to the create
commands, the code previously threw an exception. This causes tests to
misbehave so changing it to a rejected promise is more appropriate.
2018-08-09 12:56:52 +03:00
Markus Mäkelä
f3a64f0b56
MXS-1929: Rename alter service filters
The command naming caused problems when other parts of the service were
being altered. The parser doesn't seem to handle the case of overlapping
commands that well.

Updated test cases with new code and adjusted syntax accordingly.
2018-08-09 12:54:16 +03:00
Markus Mäkelä
25bc385db2
MXS-1929: Check presence of filter parameters
The parameters were made optional as not all filters require parameters.
2018-08-09 12:54:10 +03:00
Johan Wikman
cf4521503f MXS-2000 Add 'show thread[s]' to maxctrl
Show thread[s] shows detailed information about threads.
2018-08-09 08:35:57 +03:00
Johan Wikman
515cc3231c MXS-2000 Introduce 'maxctrl list threads'
Basically the same as the existing 'show threads', with a bit
shorter names. The current 'show threads' will be changed to
resemble the other 'show' commands, that is, the output is a
list of detailed information of each object.
2018-08-09 08:35:57 +03:00
Markus Mäkelä
6c6567cce7
MXS-1929: Add alter service filters MaxCtrl command
The command sets the active set of filters for a service. This allows
modifications to the filter list at runtime via MaxCtrl.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
8cb3a85afd
MXS-1929: Fix MaxCtrl errors
The filter parameters were a mandatory argument even for filters that
don't need parameters. Also fixed the usage information.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
3f338c8672
MXS-1929: Add create/destroy filter commands
Added the creation and destruction commands for filters to MaxCtrl.
2018-07-31 09:41:10 +03:00
Markus Mäkelä
fb3101f7c4
MXS-1929: Improve JSON type error messages
If an invalid value or type is given to the REST API, having the expected
type as well as the given type make problem resolution easier.

Also added a value check into MaxCtrl for listener ports.
2018-07-31 09:41:10 +03:00
Markus Mäkelä
9e9f0b5959
MXS-1929: Fix typo in maxctrl help output
Also split the sentence to make it clearer to read.
2018-07-31 09:41:09 +03:00
Markus Mäkelä
146fe76c7a
MXS-1929: Add create/destroy service MaxCtrl commands
Added commands for creating and destroying services. The create command
allows server and filter relationships to be defined but they are not yet
processed by MaxScale. This will be done once the use of filters is made
dynamic.
2018-07-31 09:41:07 +03:00
Markus Mäkelä
bfd3d2975d
Merge branch '2.2' into develop 2018-07-06 14:56:19 +03:00
Markus Mäkelä
f5110209f7
MXS-1942: Use MaxScale version in MaxCtrl
Displaying the MaxScale version helps identify which package the
executable was bundled with. As the MaxCtrl source is a part of MaxScale,
there's no need for separate versioning.
2018-07-05 12:47:28 +03:00
Markus Mäkelä
44ef4912e8
Merge branch '2.2' into develop 2018-07-03 21:13:41 +03:00
Markus Mäkelä
d96a8b1773
Remove call to pingCluster with only one server
If only one server is used, the amount of requests can be reduced from a
minimum of two to a minimum of one. In most cases this cuts down the
response time in half.
2018-07-03 01:58:43 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
6278f27ab6
Merge branch '2.2' into develop 2018-06-20 10:26:29 +03:00
Markus Mäkelä
6df0804e70
Add missing tls-passphrase documentation
The tls-passphrase was not documented in MaxCtrl. Also regenerated the
documentation.
2018-06-18 11:32:28 +03:00
Markus Mäkelä
6d1c0e5ba6
MXS-1417: Add drain server command to MaxCtrl
The `drain server` commands removes a server from all services and waits
until all the connections for it are closed. Once the server is no longer
in use, it will be set into maintenance mode and put back into the
services where it was removed from.
2018-05-22 17:46:26 +03:00
Markus Mäkelä
a60f55e375
MXS-553: Display connections and their IDs in MaxCtrl
The `show sessions` output now displays the servers each session is
connected to along with their connections IDs. The output format of the
data is not the most compact representation but it should make it
relatively easy to parse.
2018-05-22 17:46:25 +03:00
Markus Mäkelä
b6eff12334
Merge branch '2.2' into develop 2018-05-07 09:57:47 +03:00
Markus Mäkelä
43cfa5eab5
Fix TSV output in MaxCtrl
The output in --tsv mode could break the TSV format if newlines or tabs
were included in the data.
2018-05-07 09:57:08 +03:00
Markus Mäkelä
4a0df97e02
Merge branch '2.2' into develop 2018-05-04 10:18:48 +03:00
Markus Mäkelä
8b5221e13a
Fix error message when no command is given
The error message when no commad was given referred to the unknown command
[""]. Due to the way the command was printed, it was quite confusing.
2018-05-03 10:48:32 +03:00
Markus Mäkelä
658329b648
Merge branch '2.2' into develop 2018-05-03 10:00:44 +03:00
Markus Mäkelä
bc21a28741
Add sum helper to api command
Calculating sums for values is useful for monitoring and scripting
purposes.
2018-05-03 09:50:45 +03:00
Markus Mäkelä
fff727e0c2
MXS-1782: Take getCollectionAsResource into use
Each `show` type command that takes a resource name now also has a version
that prints all resources of that type.

Added test cases for newly added commands.
2018-04-17 09:43:57 +03:00
Markus Mäkelä
87ce1f6dab
MXS-1782: Separate resource fetching and processing
The requesting of a resource and the processing was integrated into one
function. Moving the processing part into a separate function allows easy
processing of resource collections.

This refactoring made the creation of the getCollectionAsResource function
possible. It enables `show` type commands for resouce collections
(servers, services etc.).
2018-04-17 09:43:57 +03:00
Markus Mäkelä
32fdc3d454
MXS-1782: Add listener state to REST API
The state of each individual listener is now displayed in the REST
API. Created common functions for printing the listener state and took
them into use. Added the new state into MaxCtrl output.
2018-04-17 09:43:57 +03:00
Markus Mäkelä
f8a91fb272
MXS-1782: Add show threads to MaxCtrl
Provides same output in MaxCtrl that is in MaxAdmin.
2018-04-17 09:43:56 +03:00
Markus Mäkelä
957f9865d6
Update MaxCtrl documentation
Updated MaxCtrl documentation.
2018-04-17 09:34:12 +03:00
Markus Mäkelä
5855b307bd
Add raw REST API calls to MaxCtrl
Being able to perform raw REST API calls that leverage the value
extraction capabilities of Node.js gives more control to the end user. It
also doubles as a handy tool for creating scripts that only require one
particular value from the REST API.
2018-04-17 09:34:11 +03:00
Markus Mäkelä
2df47d8999
Read MaxCtrl password from stdin when none provided
When the -p parameter is given without an argument, the password is read
from the command line. This allows passwords to be given to MaxCtrl in a
safer manner.
2018-03-06 13:35:14 +02:00
Markus Mäkelä
b8df0dfc02
Print actual command on bad command
When a bad command is given, print the actual command.
2018-03-06 13:35:14 +02:00
Markus Mäkelä
d133ebf32d
Remove ANSI color codes when --tsv is defined
When TSV output is requested, the output should not contain the ANSI color
codes. This appears to be a "feature" of the table generation library but
it is quite simple to work around.
2018-02-20 09:59:05 +02:00
Markus Mäkelä
5806a27f9a
MXS-1656: Request each monitor only once
When the servers were iterated, each related monitor was requested. This
caused as many requests for monitors as there are servers.

By creating a set of unique monitor names and requesting them once, we
avoid the redundant requests from the monitor.
2018-02-20 09:59:05 +02:00
Markus Mäkelä
f4af4fa038
MXS-1656: Rename misleading functions
The function getResource had two different implementations that did very
different things. The newer version, that returns the raw JSON object that
represents a resource, was renamed to getJson.
2018-02-20 09:59:05 +02:00
Markus Mäkelä
ee3612da42
MXS-1656: Add GTID field to list servers
Added the `GTID` field to make it easier to track GTID values of the
servers. This is done by requesting the related monitors for each server
and injecting an extra parameter into the server resource.
2018-02-20 09:59:05 +02:00
Markus Mäkelä
558ea4babe
MXS-1656: Split resource collection functions into smaller parts
Split the getCollection function into smaller, reusable parts. This is
needed to display the GTID information in `list servers`.
2018-02-20 09:59:03 +02:00
Markus Mäkelä
5716f0b210
Add support for self-signed certificates to MaxCtrl
MaxCtrl now supports explicit paths for certificates and optional server
certificate verification. This allows testing by using a self-signed
certificate with the server certificate verification turned off.
2018-02-13 14:54:32 +02:00
Markus Mäkelä
8e4c6a9eee
Use HTTPS also for pings
If HTTPS requests are used, the pings should also be done with HTTPS.
2018-02-13 12:55:34 +02:00
Markus Mäkelä
823fe902d4
Add passive to help alter maxscale output
The command was missing from the help output.
2018-02-08 12:35:04 +02:00
Markus Mäkelä
c6f7f22117 Use comma separated lists in MaxCtrl options
Using commas instead of spaces prevents a the misinterpretation of
commands as hostnames. If the `--hosts` option was given just before a
command, it would consume the commands as arguments to the `--hosts` list.
2018-01-10 13:00:31 +02:00
Johan Wikman
89d1f81e37 Merge branch '2.2' into 2.2-mrm 2017-09-28 15:19:20 +03:00
Markus Mäkelä
f102a563e9 Add explicit usage to each command
The yargs framework combined with the pkg packaging causes the executable
name to be mangled on installation. For this reason, the usage should be
explicitly added to each command.
2017-09-28 12:40:51 +03:00
Markus Mäkelä
ef2ee38ccf MXS-1446: Store more detailed event information
The timestamp of the last change from passive to active is now
tracked. This, with the timestamps of the last master_down and master_up
events, allows detection of cases when MaxScale was failed over but the
failover was not done.

Currently, only a warning is logged if no new master has appeared within
90 seconds of a master_down event and MaxScale was set to active from
passive.

The last event and when the event was triggered is now shown for all
servers. The latest change from passive to active is also shown.
2017-09-27 19:32:58 +03:00