From f8a91fb272cdf90764e4f358ca5b1715261dd8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sun, 15 Apr 2018 08:58:52 +0300 Subject: [PATCH] MXS-1782: Add `show threads` to MaxCtrl Provides same output in MaxCtrl that is in MaxAdmin. --- Documentation/Reference/MaxCtrl.md | 5 +++++ maxctrl/lib/show.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/Reference/MaxCtrl.md b/Documentation/Reference/MaxCtrl.md index 4b602e466..6816a8c09 100644 --- a/Documentation/Reference/MaxCtrl.md +++ b/Documentation/Reference/MaxCtrl.md @@ -148,6 +148,7 @@ Commands: filter Show filter module Show loaded module maxscale Show MaxScale information + threads Show worker thread information logging Show MaxScale logging information commands Show module commands of a module @@ -204,6 +205,10 @@ information of a loaded module. See `help alter maxscale` for more details about altering MaxScale parameters. +### show threads + +`Usage: show threads` + ### show logging `Usage: show logging` diff --git a/maxctrl/lib/show.js b/maxctrl/lib/show.js index 3f6444fdd..50b41ec25 100644 --- a/maxctrl/lib/show.js +++ b/maxctrl/lib/show.js @@ -146,6 +146,20 @@ exports.builder = function(yargs) { ]) }) }) + .command('threads', 'Show worker thread information', function(yargs) { + return yargs.usage('Usage: show threads') + }, function(argv) { + maxctrl(argv, function(host) { + return getCollection(host, 'maxscale/threads', [ + {'ID': 'id'}, + {'Current File Descriptors': 'attributes.stats.current_descriptors'}, + {'Total File Descriptors': 'attributes.stats.total_descriptors'}, + {'Load Percentage (1s)': 'attributes.stats.load.last_second'}, + {'Load Percentage (1m)': 'attributes.stats.load.last_minute'}, + {'Load Percentage (1h)': 'attributes.stats.load.last_hour'} + ]) + }) + }) .command('logging', 'Show MaxScale logging information', function(yargs) { return yargs.epilog('See `help alter logging` for more details about altering ' + 'logging parameters.')