Command line options: add -i (bind to IP address)
Fixes #380
Simon Nagl committed
May 23, 2016 at 22:20 UTC
f0326ab89f1f63321f4d70bd4db0d9ca06986b9a
1 file changed
+4
src/main.c
+4
@@ -196,6 +196,7 @@ struct option_def options[] = {
196
{'D', "Disable fork into background", NULL, NULL},
197
{'h', "Display help message", NULL, NULL},
198
{'P', "File to save a pid while running", "FILE", NULL},
199
+ {'i', "The IP address to listen to.", "address", "All addresses"},
200
{'p', "Port to listen. Can be from 1 to 65535.", "port_number", "19999"},
201
{'s', "Path to access host /proc and /sys when running in a container.", "PATH", NULL},
202
{'t', "The frequency in seconds, for data collection. \
@@ -332,6 +333,9 @@ int main(int argc, char **argv)
333
case 'h':
334
help(0);
335
break;
336
+ case 'i':
337
+ config_set("global", "bind socket to IP", optarg);
338
+ break;
339
case 'P':
340
strncpy(pidfile, optarg, FILENAME_MAX);
341
pidfile[FILENAME_MAX] = '\0';