@cryptotaxi247 / netdata-1 / commits / 217aed8d2

added value_string to live alarms

Costa Tsaousis (ktsaou) committed Feb 5, 2017 at 05:14 UTC 217aed8d2fd69630b70a2b469be1253fd439d396
1 file changed +5
src/health.c
+5
@@ -2518,6 +2518,9 @@ void health_alarm_log2json(RRDHOST *host, BUFFER *wb, uint32_t after) {
2518 }
2519
2520 static inline void health_rrdcalc2json_nolock(BUFFER *wb, RRDCALC *rc) {
2521 + char value_string[100 + 1];
2522 + format_value_and_unit(value_string, 100, rc->value, rc->units, -1);
2523 +
2524 buffer_sprintf(wb,
2525 "\t\t\"%s.%s\": {\n"
2526 "\t\t\t\"id\": %lu,\n"
@@ -2541,6 +2544,7 @@ static inline void health_rrdcalc2json_nolock(BUFFER *wb, RRDCALC *rc) {
2544 "\t\t\t\"delay_multiplier\": %f,\n"
2545 "\t\t\t\"delay\": %d,\n"
2546 "\t\t\t\"delay_up_to_timestamp\": %lu,\n"
2547 + "\t\t\t\"value_string\": \"%s\",\n"
2548 , rc->chart, rc->name
2549 , (unsigned long)rc->id
2550 , rc->name
@@ -2563,6 +2567,7 @@ static inline void health_rrdcalc2json_nolock(BUFFER *wb, RRDCALC *rc) {
2567 , rc->delay_multiplier
2568 , rc->delay_last
2569 , (unsigned long)rc->delay_up_to_timestamp
2570 + , value_string
2571 );
2572
2573 if(unlikely(rc->options & RRDCALC_FLAG_NO_CLEAR_NOTIFICATION)) {