Add --verbose 1 flag for mon
parent
eadd454992
commit
49ec8c7c63
|
@ -15,7 +15,7 @@ for (let i = 2; i < process.argv.length; i++)
|
||||||
|
|
||||||
if (!options.etcd_url)
|
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();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,7 @@ class Mon
|
||||||
url += '/v3';
|
url += '/v3';
|
||||||
this.etcd_urls.push(scheme+'://'+url);
|
this.etcd_urls.push(scheme+'://'+url);
|
||||||
}
|
}
|
||||||
|
this.verbose = config.verbose || 0;
|
||||||
this.etcd_prefix = config.etcd_prefix || '/vitastor';
|
this.etcd_prefix = config.etcd_prefix || '/vitastor';
|
||||||
this.etcd_prefix = this.etcd_prefix.replace(/\/\/+/g, '/').replace(/^\/?(.*[^\/])\/?$/, '/$1');
|
this.etcd_prefix = this.etcd_prefix.replace(/\/\/+/g, '/').replace(/^\/?(.*[^\/])\/?$/, '/$1');
|
||||||
this.etcd_start_timeout = (config.etcd_start_timeout || 5) * 1000;
|
this.etcd_start_timeout = (config.etcd_start_timeout || 5) * 1000;
|
||||||
|
@ -345,7 +346,10 @@ class Mon
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let stats_changed = false, changed = false;
|
let stats_changed = false, changed = false;
|
||||||
|
if (this.verbose)
|
||||||
|
{
|
||||||
console.log('Revision '+data.result.header.revision+' events: ');
|
console.log('Revision '+data.result.header.revision+' events: ');
|
||||||
|
}
|
||||||
this.etcd_watch_revision = BigInt(data.result.header.revision)+BigInt(1);
|
this.etcd_watch_revision = BigInt(data.result.header.revision)+BigInt(1);
|
||||||
for (const e of data.result.events)
|
for (const e of data.result.events)
|
||||||
{
|
{
|
||||||
|
@ -359,8 +363,11 @@ class Mon
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
if (this.verbose)
|
||||||
|
{
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (stats_changed)
|
if (stats_changed)
|
||||||
{
|
{
|
||||||
this.schedule_update_stats();
|
this.schedule_update_stats();
|
||||||
|
|
Loading…
Reference in New Issue