diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-06-16 15:23:20 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-06-16 16:16:00 +0200 |
commit | a97118c489a59d723538292214efaa10dfcb96df (patch) | |
tree | 853ec20d2af94dc8d3325fa3b781dd535cd72c86 /pkgs/status_engine/host_perfdata.patch | |
parent | b1b8a5623d22a7ee4301afe4e7b9d368ef7ded8f (diff) | |
download | Nix-a97118c489a59d723538292214efaa10dfcb96df.tar.gz Nix-a97118c489a59d723538292214efaa10dfcb96df.tar.zst Nix-a97118c489a59d723538292214efaa10dfcb96df.zip |
Add status engine website
Diffstat (limited to 'pkgs/status_engine/host_perfdata.patch')
-rw-r--r-- | pkgs/status_engine/host_perfdata.patch | 47 |
1 files changed, 47 insertions, 0 deletions
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 @@ | |||
1 | diff --git a/src/statusengine.c b/src/statusengine.c | ||
2 | index 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 | |||