From 16c28db384adbe61034eb8a2267cd6a886ffd72f Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Thu, 1 Dec 2016 21:42:51 +0100 Subject: Added the client side code for the statsd in the nodes. --- node/main.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'node/main.cpp') diff --git a/node/main.cpp b/node/main.cpp index 02838f1..1e76a1f 100644 --- a/node/main.cpp +++ b/node/main.cpp @@ -27,6 +27,8 @@ int main(int argc, char* argv[]) { ("key,k", po::value(), "The key file (in pem format).") ("dhparam,d", po::value(), "The dhparam file.") ("certdir", po::value(), "Directory containing trusted certificates.") + ("statsd,s", po::value(), "The address of the statistics daemon.") + ("name,a", po::value(), "The name to use in the stats daemon file") ; po::variables_map vm; @@ -126,6 +128,22 @@ int main(int argc, char* argv[]) { NodeNetworkSettings nsettings{is_first, is_last, uri.host, uri.port, certdir, minimum_nr_messages}; - Node node(lsettings, nsettings); + bool run_stats = vm.count("statsd"); + + Uri statsd_uri; + if(run_stats) { + statsd_uri = parse_uri(vm["statsd"].as()); + } + + std::string name; + if(vm.count("name")) { + name = vm["name"].as(); + } else { + name = uri.port; + } + + PerformanceSettings psettings{run_stats, statsd_uri.host, statsd_uri.port, name}; + + Node node(lsettings, nsettings, psettings); node.run(); } -- cgit v1.2.3-70-g09d2