-
Notifications
You must be signed in to change notification settings - Fork 0
/
ping-monitor-cli.js
57 lines (55 loc) · 1.31 KB
/
ping-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
const meow = require('meow');
const { PingMonitor } = require('./utils/ping-monitor');
const { MonitorClient } = require('./utils/client');
const cli = meow(
`
Usage
$ node ping-monitor-cli.js <target ip>
Options
--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: 'PingMonitor helps you to monitor server availability',
flags: {
timeout: {
type: 'number',
default: 2000,
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 monitor = new PingMonitor(cli.input[0], cli.flags);
const client = new MonitorClient(monitor, cli.flags);
client.start();