From 0f0681310a920a65b1cbf7cee43bae187cf7f78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarom=C3=ADr=20Wysoglad?= Date: Fri, 25 Aug 2023 17:12:11 +0200 Subject: [PATCH] Add app->collectd variable --- generator/amqp_snd_th.c | 6 ++++-- generator/gen.c | 4 ++-- generator/gen.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/generator/amqp_snd_th.c b/generator/amqp_snd_th.c index d6e79b4f..3953c68d 100644 --- a/generator/amqp_snd_th.c +++ b/generator/amqp_snd_th.c @@ -204,9 +204,11 @@ static void gen_mesg(pn_rwbytes_t *buf, app_data_t *app, char *time_buf) { buf->start = build_log_mesg(app, time_buf); } else if (app->ceilometer) { buf->start = build_ceil_mesg(app, time_buf); - } else { + } else if (app->collectd){ buf->start = build_metric_mesg(app, time_buf); - } + } else { + buf->start = NULL; + } if (buf->start != NULL) buf->size = strlen(buf->start); diff --git a/generator/gen.c b/generator/gen.c index 15117d90..a88d2979 100644 --- a/generator/gen.c +++ b/generator/gen.c @@ -107,6 +107,7 @@ int main(int argc, char **argv) { app.presettled = false; app.logs = false; app.ceilometer = false; + app.collectd = true; int num_threads = 1; @@ -150,8 +151,7 @@ int main(int argc, char **argv) { break; case 'g': if (!strcmp(optarg, "collectd")) { - // used by default - break; + app.collectd = true; } else if (!strcmp(optarg, "ceilometer")) { app.ceilometer = true; } else if (!strcmp(optarg, "rsyslog")) { diff --git a/generator/gen.h b/generator/gen.h index cfb57a51..5f57dffd 100644 --- a/generator/gen.h +++ b/generator/gen.h @@ -29,6 +29,7 @@ typedef struct { int metrics_per_second; int logs; int ceilometer; + int collectd; pthread_t amqp_snd_th;