]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - pkgs/status_engine/host_perfdata.patch
Add umami
[perso/Immae/Config/Nix.git] / pkgs / status_engine / host_perfdata.patch
CommitLineData
a97118c4
IB
1diff --git a/src/statusengine.c b/src/statusengine.c
2index cc0b06e..2a18dec 100644
3--- a/src/statusengine.c
4+++ b/src/statusengine.c
5@@ -304,6 +304,7 @@ int enable_ocsp = 0;
6
7 int use_restart_data=1;
8 int use_service_perfdata=0;
9+int use_host_perfdata=0;
10
11 int statusengine_process_config_var(char *arg);
12 int statusengine_process_module_args(char *args);
13@@ -612,6 +613,9 @@ int statusengine_process_config_var(char *arg) {
14 } else if (!strcmp(var, "use_service_perfdata")) {
15 use_service_perfdata = atoi(val);
16 logswitch(NSLOG_INFO_MESSAGE, "start with enabled use_service_perfdata");
17+ } else if (!strcmp(var, "use_host_perfdata")) {
18+ use_host_perfdata = atoi(val);
19+ logswitch(NSLOG_INFO_MESSAGE, "start with enabled use_host_perfdata");
20 } else {
21 return ERROR;
22 }
23@@ -1067,6 +1071,24 @@ int statusengine_handle_data(int event_type, void *data){
24 json_object_put(my_object);
25 free(raw_command);
26
27+ if(use_host_perfdata){
28+ my_object = json_object_new_object();
29+ json_object_object_add(my_object, "type", json_object_new_int(hostcheck->type));
30+ json_object_object_add(my_object, "flags", json_object_new_int(hostcheck->flags));
31+ json_object_object_add(my_object, "attr", json_object_new_int(hostcheck->attr));
32+ json_object_object_add(my_object, "timestamp", json_object_new_int(hostcheck->timestamp.tv_sec));
33+
34+ json_object *hostcheck_object = json_object_new_object();
35+ HOSTCHECKFIELD_STRING(host_name);
36+ HOSTCHECKFIELD_STRING(perf_data);
37+ json_object_object_add(hostcheck_object, "start_time", json_object_new_int64(nag_hostcheck->start_time.tv_sec));
38+
39+ json_object_object_add(my_object, "hostcheck", hostcheck_object);
40+ const char* json_string = json_object_to_json_string(my_object);
41+ statusengine_send_job("statusngin_host_perfdata", (void *)json_string);
42+
43+ json_object_put(my_object);
44+ }
45 }
46 break;
47