diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-09-04 17:24:10 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-09-04 17:24:10 +0200 |
commit | dcf78ad3ed5b758c5be2c4e401b042912340a916 (patch) | |
tree | 5f60f89a91d73aee61b16670fe330460837e27be /examples/c-collectd | |
parent | 0fd59f060e97b558cf0fdd905817945b782845aa (diff) |
Disable timestamp generation in nDPIsrvd-collectd as default.
* collectd's rrdtool write plugin does silently fail with those ones (dunno why)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/c-collectd')
-rw-r--r-- | examples/c-collectd/c-collectd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/c-collectd/c-collectd.c b/examples/c-collectd/c-collectd.c index e46a50508..0497824e6 100644 --- a/examples/c-collectd/c-collectd.c +++ b/examples/c-collectd/c-collectd.c @@ -11,6 +11,7 @@ #include "nDPIsrvd.h" #define DEFAULT_COLLECTD_EXEC_INST "nDPIsrvd" +//#define GENERATE_TIMESTAMP 1 #define LOG(flags, format, ...) \ if (quiet == 0) \ @@ -244,13 +245,21 @@ static int parse_options(int argc, char ** argv, struct nDPIsrvd_socket * const return 0; } +#ifdef GENERATE_TIMESTAMP #define COLLECTD_PUTVAL_N_FORMAT(name) "PUTVAL \"%s/exec-%s/gauge-" #name "\" interval=%llu %llu:%llu\n" #define COLLECTD_PUTVAL_N(value) \ collectd_hostname, instance_name, collectd_interval_ull, (unsigned long long int)now, \ (unsigned long long int)collectd_statistics.value +#else +#define COLLECTD_PUTVAL_N_FORMAT(name) "PUTVAL \"%s/exec-%s/gauge-" #name "\" interval=%llu N:%llu\n" +#define COLLECTD_PUTVAL_N(value) \ + collectd_hostname, instance_name, collectd_interval_ull, (unsigned long long int)collectd_statistics.value +#endif static void print_collectd_exec_output(void) { +#ifdef GENERATE_TIMESTAMP time_t now = time(NULL); +#endif printf(COLLECTD_PUTVAL_N_FORMAT(flow_new_count) COLLECTD_PUTVAL_N_FORMAT(flow_end_count) COLLECTD_PUTVAL_N_FORMAT(flow_idle_count) COLLECTD_PUTVAL_N_FORMAT(flow_guessed_count) |