Skip to content

Commit

Permalink
fix sending performance data into multiple queues
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Feb 23, 2024
1 parent facd6a8 commit 2910d66
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions neb_module_naemon/mod_gearman.c
Expand Up @@ -1451,8 +1451,6 @@ int handle_perfdata(int event_type, void *data) {
break;
}

make_uniq(uniq, "%s", hostchkdata->host_name);

/* replace newlines with actual newlines */
perf_data = replace_str(hostchkdata->perf_data, "\\n", "\n");

Expand Down Expand Up @@ -1491,8 +1489,6 @@ int handle_perfdata(int event_type, void *data) {
break;
}

make_uniq(uniq, "%s-%s", srvchkdata->host_name, srvchkdata->service_description);

/* replace newlines with actual newlines */
perf_data = replace_str(srvchkdata->perf_data, "\\n", "\n");

Expand Down Expand Up @@ -1526,6 +1522,19 @@ int handle_perfdata(int event_type, void *data) {
int i = 0;
for (i = 0; i < mod_gm_opt->perfdata_queues_num; i++) {
char *perfdata_queue = mod_gm_opt->perfdata_queues_list[i];

/* generate uuid including the queue name. it seems like pushing the same uuid into different queues still overwrites them. */
if(mod_gm_opt->perfdata_mode == GM_PERFDATA_OVERWRITE) {
switch (event_type) {
case NEBCALLBACK_HOST_CHECK_DATA:
make_uniq(uniq, "%s-%s", perfdata_queue, hostchkdata->host_name);
break;
case NEBCALLBACK_SERVICE_CHECK_DATA:
make_uniq(uniq, "%s-%s-%s", perfdata_queue, srvchkdata->host_name, srvchkdata->service_description);
break;
}
}

/* add our job onto the queue */
if(add_job_to_queue(&client,
mod_gm_opt->server_list,
Expand Down

0 comments on commit 2910d66

Please sign in to comment.