From a97118c489a59d723538292214efaa10dfcb96df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 16 Jun 2020 15:23:20 +0200 Subject: Add status engine website --- pkgs/status_engine/host_perfdata.patch | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pkgs/status_engine/host_perfdata.patch (limited to 'pkgs/status_engine/host_perfdata.patch') diff --git a/pkgs/status_engine/host_perfdata.patch b/pkgs/status_engine/host_perfdata.patch new file mode 100644 index 0000000..0c8a20b --- /dev/null +++ b/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; + -- cgit v1.2.3