X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=flakes%2Fmypackages%2Fpkgs%2Fstatus_engine%2Fhost_perfdata.patch;h=0c8a20b41450cea29192eb597d22e6d816bb0bc7;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/flakes/mypackages/pkgs/status_engine/host_perfdata.patch b/flakes/mypackages/pkgs/status_engine/host_perfdata.patch new file mode 100644 index 0000000..0c8a20b --- /dev/null +++ b/flakes/mypackages/pkgs/status_engine/host_perfdata.patch @@ -0,0 +1,47 @@ +diff --git a/src/statusengine.c b/src/statusengine.c +index cc0b06e..2a18dec 100644 +--- a/src/statusengine.c ++++ b/src/statusengine.c +@@ -304,6 +304,7 @@ int enable_ocsp = 0; + + int use_restart_data=1; + int use_service_perfdata=0; ++int use_host_perfdata=0; + + int statusengine_process_config_var(char *arg); + int statusengine_process_module_args(char *args); +@@ -612,6 +613,9 @@ int statusengine_process_config_var(char *arg) { + } else if (!strcmp(var, "use_service_perfdata")) { + use_service_perfdata = atoi(val); + logswitch(NSLOG_INFO_MESSAGE, "start with enabled use_service_perfdata"); ++ } else if (!strcmp(var, "use_host_perfdata")) { ++ use_host_perfdata = atoi(val); ++ logswitch(NSLOG_INFO_MESSAGE, "start with enabled use_host_perfdata"); + } else { + return ERROR; + } +@@ -1067,6 +1071,24 @@ int statusengine_handle_data(int event_type, void *data){ + json_object_put(my_object); + free(raw_command); + ++ if(use_host_perfdata){ ++ my_object = json_object_new_object(); ++ json_object_object_add(my_object, "type", json_object_new_int(hostcheck->type)); ++ json_object_object_add(my_object, "flags", json_object_new_int(hostcheck->flags)); ++ json_object_object_add(my_object, "attr", json_object_new_int(hostcheck->attr)); ++ json_object_object_add(my_object, "timestamp", json_object_new_int(hostcheck->timestamp.tv_sec)); ++ ++ json_object *hostcheck_object = json_object_new_object(); ++ HOSTCHECKFIELD_STRING(host_name); ++ HOSTCHECKFIELD_STRING(perf_data); ++ json_object_object_add(hostcheck_object, "start_time", json_object_new_int64(nag_hostcheck->start_time.tv_sec)); ++ ++ json_object_object_add(my_object, "hostcheck", hostcheck_object); ++ const char* json_string = json_object_to_json_string(my_object); ++ statusengine_send_job("statusngin_host_perfdata", (void *)json_string); ++ ++ json_object_put(my_object); ++ } + } + break; +