diff --git a/lp/mon-main.js b/lp/mon-main.js index 4cddded68..8d238231e 100644 --- a/lp/mon-main.js +++ b/lp/mon-main.js @@ -15,7 +15,7 @@ for (let i = 2; i < process.argv.length; i++) if (!options.etcd_url) { - console.error('USAGE: '+process.argv[0]+' '+process.argv[1]+' --etcd_url "http://127.0.0.1:2379,..." --etcd_prefix "/vitastor" --etcd_start_timeout 5'); + console.error('USAGE: '+process.argv[0]+' '+process.argv[1]+' --etcd_url "http://127.0.0.1:2379,..." --etcd_prefix "/vitastor" --etcd_start_timeout 5 [--verbose 1]'); process.exit(); } diff --git a/lp/mon.js b/lp/mon.js index 5fc7b3274..17e0403a0 100644 --- a/lp/mon.js +++ b/lp/mon.js @@ -221,6 +221,7 @@ class Mon url += '/v3'; this.etcd_urls.push(scheme+'://'+url); } + this.verbose = config.verbose || 0; this.etcd_prefix = config.etcd_prefix || '/vitastor'; this.etcd_prefix = this.etcd_prefix.replace(/\/\/+/g, '/').replace(/^\/?(.*[^\/])\/?$/, '/$1'); this.etcd_start_timeout = (config.etcd_start_timeout || 5) * 1000; @@ -345,7 +346,10 @@ class Mon else { let stats_changed = false, changed = false; - console.log('Revision '+data.result.header.revision+' events: '); + if (this.verbose) + { + console.log('Revision '+data.result.header.revision+' events: '); + } this.etcd_watch_revision = BigInt(data.result.header.revision)+BigInt(1); for (const e of data.result.events) { @@ -359,7 +363,10 @@ class Mon { changed = true; } - console.log(e); + if (this.verbose) + { + console.log(e); + } } if (stats_changed) {