diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-12-05 16:34:37 +0100 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-12-05 17:16:45 +0100 |
| commit | b5688d16b0920aeed3d945fd136a51fe31dfbe24 (patch) | |
| tree | 7287878892af7dab66b63085859e55d7bc6b9453 /statsd/main.cpp | |
| parent | 16c28db384adbe61034eb8a2267cd6a886ffd72f (diff) | |
| download | cmix-b5688d16b0920aeed3d945fd136a51fe31dfbe24.tar.gz cmix-b5688d16b0920aeed3d945fd136a51fe31dfbe24.tar.bz2 cmix-b5688d16b0920aeed3d945fd136a51fe31dfbe24.zip | |
added (untested) statsd for the cmake network.
Diffstat (limited to 'statsd/main.cpp')
| -rw-r--r-- | statsd/main.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/statsd/main.cpp b/statsd/main.cpp new file mode 100644 index 0000000..436e8ad --- /dev/null +++ b/statsd/main.cpp @@ -0,0 +1,45 @@ + +#include "stats.hpp" + +#include "logging.hpp" + +#include <boost/program_options.hpp> + +#include <iostream> + +int main(int argc, char* argv[]) { + namespace po = boost::program_options; + + init_logging(boost::log::trivial::severity_level::trace, "statsd"); + + po::options_description desc("Allowed options"); + desc.add_options() + ("help,h", "produce help message.") + ("port,p", po::value<uint16_t>()->default_value(9200), "Set listening port.") + ("enable_v4", po::value<bool>()->default_value(true), "Enable/disable ipv4 accept support.") + ("interface4,4", po::value<std::string>()->default_value("0.0.0.0"), "Set the ipv4 address to listen on.") + ("enable_v6", po::value<bool>()->default_value(true), "Enable/disable ipv6 accept support.") + ("interface6,6", po::value<std::string>()->default_value("::"), "Set the ipv6 address to listen on.") + ; + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << "\n"; + return 0; + } + + bool en4 = vm["enable_v4"].as<bool>(); + std::string if4 = vm["interface4"].as<std::string>(); + bool en6 = vm["enable_v6"].as<bool>(); + std::string if6 = vm["interface6"].as<std::string>(); + uint16_t port = vm["port"].as<uint16_t>(); + + ListenSettings lsettings{en4, if4, en6, if6, port, false, "", "", ""}; + Stats stats(lsettings); + + stats.run(); + +} |
