add new subcommand + skeleton files
This commit is contained in:
parent
bcfcfb628e
commit
b029f176b6
@ -8,6 +8,7 @@ set (IXBOTS_SOURCES
|
|||||||
ixbots/IXCobraToSentryBot.cpp
|
ixbots/IXCobraToSentryBot.cpp
|
||||||
ixbots/IXCobraToStatsdBot.cpp
|
ixbots/IXCobraToStatsdBot.cpp
|
||||||
ixbots/IXCobraToStdoutBot.cpp
|
ixbots/IXCobraToStdoutBot.cpp
|
||||||
|
ixbots/IXCobraMetricsToStatsdBot.cpp
|
||||||
ixbots/IXStatsdClient.cpp
|
ixbots/IXStatsdClient.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ set (IXBOTS_HEADERS
|
|||||||
ixbots/IXCobraToSentryBot.h
|
ixbots/IXCobraToSentryBot.h
|
||||||
ixbots/IXCobraToStatsdBot.h
|
ixbots/IXCobraToStatsdBot.h
|
||||||
ixbots/IXCobraToStdoutBot.h
|
ixbots/IXCobraToStdoutBot.h
|
||||||
|
ixbots/IXCobraMetricsToStatsdBot.h
|
||||||
ixbots/IXStatsdClient.h
|
ixbots/IXStatsdClient.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
32
ws/ws.cpp
32
ws/ws.cpp
@ -14,6 +14,7 @@
|
|||||||
#include <ixbots/IXCobraToSentryBot.h>
|
#include <ixbots/IXCobraToSentryBot.h>
|
||||||
#include <ixbots/IXCobraToStatsdBot.h>
|
#include <ixbots/IXCobraToStatsdBot.h>
|
||||||
#include <ixbots/IXCobraToStdoutBot.h>
|
#include <ixbots/IXCobraToStdoutBot.h>
|
||||||
|
#include <ixbots/IXCobraMetricsToStatsdBot.h>
|
||||||
#include <ixcore/utils/IXCoreLogger.h>
|
#include <ixcore/utils/IXCoreLogger.h>
|
||||||
#include <ixsentry/IXSentryClient.h>
|
#include <ixsentry/IXSentryClient.h>
|
||||||
#include <ixwebsocket/IXNetSystem.h>
|
#include <ixwebsocket/IXNetSystem.h>
|
||||||
@ -326,7 +327,7 @@ int main(int argc, char** argv)
|
|||||||
addTLSOptions(cobraMetricsPublish);
|
addTLSOptions(cobraMetricsPublish);
|
||||||
addCobraConfig(cobraMetricsPublish);
|
addCobraConfig(cobraMetricsPublish);
|
||||||
|
|
||||||
CLI::App* cobra2statsd = app.add_subcommand("cobra_to_statsd", "Cobra metrics to statsd");
|
CLI::App* cobra2statsd = app.add_subcommand("cobra_to_statsd", "Cobra to statsd");
|
||||||
cobra2statsd->fallthrough();
|
cobra2statsd->fallthrough();
|
||||||
cobra2statsd->add_option("--host", hostname, "Statsd host");
|
cobra2statsd->add_option("--host", hostname, "Statsd host");
|
||||||
cobra2statsd->add_option("--port", statsdPort, "Statsd port");
|
cobra2statsd->add_option("--port", statsdPort, "Statsd port");
|
||||||
@ -341,7 +342,17 @@ int main(int argc, char** argv)
|
|||||||
addTLSOptions(cobra2statsd);
|
addTLSOptions(cobra2statsd);
|
||||||
addCobraBotConfig(cobra2statsd);
|
addCobraBotConfig(cobra2statsd);
|
||||||
|
|
||||||
CLI::App* cobra2sentry = app.add_subcommand("cobra_to_sentry", "Cobra metrics to sentry");
|
CLI::App* cobraMetrics2statsd = app.add_subcommand("cobra_metrics_to_statsd", "Cobra metrics to statsd");
|
||||||
|
cobraMetrics2statsd->fallthrough();
|
||||||
|
cobraMetrics2statsd->add_option("--host", hostname, "Statsd host");
|
||||||
|
cobraMetrics2statsd->add_option("--port", statsdPort, "Statsd port");
|
||||||
|
cobraMetrics2statsd->add_option("--prefix", prefix, "Statsd prefix");
|
||||||
|
cobraMetrics2statsd->add_flag("-v", verbose, "Verbose");
|
||||||
|
cobraMetrics2statsd->add_option("--pidfile", pidfile, "Pid file");
|
||||||
|
addTLSOptions(cobraMetrics2statsd);
|
||||||
|
addCobraBotConfig(cobraMetrics2statsd);
|
||||||
|
|
||||||
|
CLI::App* cobra2sentry = app.add_subcommand("cobra_to_sentry", "Cobra to sentry");
|
||||||
cobra2sentry->fallthrough();
|
cobra2sentry->fallthrough();
|
||||||
cobra2sentry->add_option("--dsn", dsn, "Sentry DSN");
|
cobra2sentry->add_option("--dsn", dsn, "Sentry DSN");
|
||||||
cobra2sentry->add_flag("-v", verbose, "Verbose");
|
cobra2sentry->add_flag("-v", verbose, "Verbose");
|
||||||
@ -568,6 +579,23 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (app.got_subcommand("cobra_metrics_to_statsd"))
|
||||||
|
{
|
||||||
|
ix::StatsdClient statsdClient(hostname, statsdPort, prefix);
|
||||||
|
|
||||||
|
std::string errMsg;
|
||||||
|
bool initialized = statsdClient.init(errMsg);
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
|
spdlog::error(errMsg);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = (int) ix::cobra_metrics_to_statsd_bot(
|
||||||
|
cobraBotConfig, statsdClient, verbose);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (app.got_subcommand("cobra_to_sentry"))
|
else if (app.got_subcommand("cobra_to_sentry"))
|
||||||
{
|
{
|
||||||
ix::SentryClient sentryClient(dsn);
|
ix::SentryClient sentryClient(dsn);
|
||||||
|
Loading…
Reference in New Issue
Block a user