diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-13 23:03:41 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-13 23:03:41 +0200 |
commit | 36114d3debff2d233ea50f3fd54d057ad96d314b (patch) | |
tree | 358d2f16ef6ca2dd7a4d8031b66cbe2f3a8330a4 /src/rrd2json.c | |
parent | 2cd349f942f8e973e12bc907c8b67c81ed78f2e9 (diff) |
allow custom defined information on the dashboard; fixes #1936
Diffstat (limited to 'src/rrd2json.c')
-rw-r--r-- | src/rrd2json.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rrd2json.c b/src/rrd2json.c index 484b4bbb71..4d853930cc 100644 --- a/src/rrd2json.c +++ b/src/rrd2json.c @@ -78,25 +78,30 @@ void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb) { rrd_stats_api_v1_chart_with_data(st, wb, NULL, NULL); } -void rrd_stats_api_v1_charts(RRDHOST *host, BUFFER *wb) -{ +void rrd_stats_api_v1_charts(RRDHOST *host, BUFFER *wb) { + static char *custom_dashboard_info_js_filename = NULL; size_t c, dimensions = 0, memory = 0, alarms = 0; RRDSET *st; time_t now = now_realtime_sec(); + if(unlikely(!custom_dashboard_info_js_filename)) + custom_dashboard_info_js_filename = config_get(CONFIG_SECTION_WEB, "custom dashboard_info.js", ""); + buffer_sprintf(wb, "{\n" "\t\"hostname\": \"%s\"" ",\n\t\"version\": \"%s\"" ",\n\t\"os\": \"%s\"" ",\n\t\"update_every\": %d" ",\n\t\"history\": %ld" + ",\n\t\"custom_info\": \"%s\"" ",\n\t\"charts\": {" , host->hostname , program_version , host->os , host->rrd_update_every , host->rrd_history_entries + , custom_dashboard_info_js_filename ); c = 0; |