... | ... |
@@ -69,6 +69,8 @@ char updtmpdir[512], dbdir[512]; |
69 | 69 |
int sigchld_wait = 1; |
70 | 70 |
const char *pidfile = NULL; |
71 | 71 |
|
72 |
+void submit_host_info(struct optstruct *opts); |
|
73 |
+ |
|
72 | 74 |
static void |
73 | 75 |
sighandler (int sig) |
74 | 76 |
{ |
... | ... |
@@ -331,6 +333,8 @@ main (int argc, char **argv) |
331 | 331 |
return 0; |
332 | 332 |
} |
333 | 333 |
|
334 |
+ submit_host_info(opts); |
|
335 |
+ |
|
334 | 336 |
if (optget (opts, "HTTPProxyPassword")->enabled) |
335 | 337 |
{ |
336 | 338 |
if (CLAMSTAT (cfgfile, &statbuf) == -1) |
... | ... |
@@ -726,3 +730,32 @@ main (int argc, char **argv) |
726 | 726 |
|
727 | 727 |
return (ret); |
728 | 728 |
} |
729 |
+ |
|
730 |
+void submit_host_info(struct optstruct *opts) |
|
731 |
+{ |
|
732 |
+ struct optstruct *opt; |
|
733 |
+ struct cl_engine *engine; |
|
734 |
+ cli_intel_t *intel; |
|
735 |
+ |
|
736 |
+ engine = cl_engine_new(); |
|
737 |
+ if (!(engine)) |
|
738 |
+ return; |
|
739 |
+ |
|
740 |
+ intel = engine->stats_data; |
|
741 |
+ if (!(intel)) { |
|
742 |
+ engine->cb_stats_submit = NULL; |
|
743 |
+ cl_engine_free(engine); |
|
744 |
+ return; |
|
745 |
+ } |
|
746 |
+ |
|
747 |
+ intel->host_info = calloc(1, strlen(TARGET_OS_TYPE) + strlen(TARGET_ARCH_TYPE) + 2); |
|
748 |
+ if (!(intel->host_info)) { |
|
749 |
+ engine->cb_stats_submit = NULL; |
|
750 |
+ cl_engine_free(engine); |
|
751 |
+ return; |
|
752 |
+ } |
|
753 |
+ |
|
754 |
+ sprintf(intel->host_info, "%s %s", TARGET_OS_TYPE, TARGET_ARCH_TYPE); |
|
755 |
+ |
|
756 |
+ cl_engine_free(engine); |
|
757 |
+} |
... | ... |
@@ -79,6 +79,9 @@ char *export_stats_to_json(struct cl_engine *engine, cli_intel_t *intel) |
79 | 79 |
|
80 | 80 |
bufsz = JSON_BUFSZ; |
81 | 81 |
sprintf(buf, "{\n\t\"hostid\": \"%s\",\n", hostid); |
82 |
+ if (intel->host_info) |
|
83 |
+ sprintf(buf+strlen(buf), "\t\"host_info\": \"%s\",\n", intel->host_info); |
|
84 |
+ |
|
82 | 85 |
sprintf(buf+strlen(buf), "\t\"samples\": [\n"); |
83 | 86 |
curused = strlen(buf); |
84 | 87 |
|