-
Notifications
You must be signed in to change notification settings - Fork 0
/
http-monitor-cli.js
63 lines (61 loc) · 1.45 KB
/
http-monitor-cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const meow = require('meow');
const { HttpMonitor } = require('./utils/http-monitor');
const { MonitorClient } = require('./utils/client');
const cli = meow(
`
Usage
$ node http-monitor-cli.js <target url>
Options
--config-file Path to request config file
--timeout -t Request timeout in milliseconds
--interval -i Time between requests in milliseconds
--period -p Period for calculating intermediate statistics in minutes
--no-save Do not save results
--no-chart Hide real time chart
--verbose Show debug information
`,
{
description: 'HttpMonitor helps you to monitor server availability',
flags: {
configFile: {
type: 'string',
default: '',
},
timeout: {
type: 'number',
default: 9000,
alias: 't',
},
interval: {
type: 'number',
default: 2000,
alias: 'i',
},
period: {
type: 'number',
default: 15,
alias: 'p',
},
save: {
type: 'boolean',
default: true,
},
chart: {
type: 'boolean',
default: true,
},
verbose: {
type: 'boolean',
default: false,
},
testing: {
type: 'boolean',
default: false,
},
},
}
);
const target = cli.input[0];
const monitor = new HttpMonitor(target, cli.flags);
const client = new MonitorClient(monitor, cli.flags);
client.start();