-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
34 lines (27 loc) · 837 Bytes
/
index.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
#!/usr/bin/env node
var program = require('commander');
var os = require('os');
var util = require('util');
var Watcher = require('./watcher');
program
.version('0.1.0')
.option('-6,--ipv6', 'Use IPV6 udp socket')
.option('-h,--host [host]', 'Host of the statsd server')
.option('-p,--port [port]', 'Port number of the statsd server', parseInt)
.option('-g,--group [group]', 'Group name of this host.')
.option('-n,--name [name]', 'Name of this host')
.option('--cache-dns [cacheDns]', 'Cache ip address of the host')
.parse(process.argv)
;
var watcher = new Watcher({
host: program.host || '127.0.0.1',
port: program.port || 8125,
name: program.name || os.hostname(),
group: program.group || 'default',
ipv6: program.ipv6,
cacheDns: program.cacheDns
});
watcher.start();
process.on('exit', function() {
watcher.end();
});