@cryptotaxi247 / netdata-1 / commits / 672aed6aa

JSON output modified according to @ktsaou.

Luis Felipe Dominguez Vega committed Feb 20, 2017 at 08:22 UTC 672aed6aaae1e310751600c3463e9d48e8a1bce0
1 file changed +46 -8
src/backends.c
+46 -8
@@ -102,16 +102,35 @@ static inline int format_dimension_collected_json_plaintext(BUFFER *b, const cha
102 "\"prefix\":\"%s\","
103 "\"hostname\":\"%s\","
104
105 - "\"type\":\"%s\","
105 + "\"chart_id\":\"%s\","
106 + "\"chart_name\":\"%s\","
107 "\"family\":\"%s\","
108 "\"context\": \"%s\","
109 + "\"type\":\"%s\","
110 "\"units\": \"%s\","
109 - "\"title\": \"%s\","
111
112 "\"id\":\"%s\","
112 - "\"subid\":\"%s\","
113 + "\"name\":\"%s\","
114 "\"value\":" COLLECTED_NUMBER_FORMAT ","
114 - "\"timestamp\": %u}\n", prefix, hostname, st->type, st->family, st->context, st->units, st->title, st->id, rd->id, rd->last_collected_value, (uint32_t)rd->last_collected_time.tv_sec);
115 +
116 + "\"timestamp\": %u}\n",
117 + prefix,
118 + hostname,
119 +
120 + st->id,
121 + st->name,
122 + st->family,
123 + st->context,
124 + st->type,
125 + st->units,
126 +
127 + rd->id,
128 + rd->name,
129 + rd->last_collected_value,
130 +
131 + (uint32_t)rd->last_collected_time.tv_sec
132 + );
133 +
134 return 1;
135 }
136
@@ -123,16 +142,35 @@ static inline int format_dimension_stored_json_plaintext(BUFFER *b, const char *
142 "\"prefix\":\"%s\","
143 "\"hostname\":\"%s\","
144
126 - "\"type\":\"%s\","
145 + "\"chart_id\":\"%s\","
146 + "\"chart_name\":\"%s\","
147 "\"family\":\"%s\","
148 "\"context\": \"%s\","
149 + "\"type\":\"%s\","
150 "\"units\": \"%s\","
130 - "\"title\": \"%s\","
151
152 "\"id\":\"%s\","
133 - "\"subid\":\"%s\","
153 + "\"name\":\"%s\","
154 "\"value\":" CALCULATED_NUMBER_FORMAT ","
135 - "\"timestamp\": %u}\n", prefix, hostname, st->type, st->family, st->context, st->units, st->title, st->id, rd->id, value, (uint32_t)before);
155 +
156 + "\"timestamp\": %u}\n",
157 + prefix,
158 + hostname,
159 +
160 + st->id,
161 + st->name,
162 + st->family,
163 + st->context,
164 + st->type,
165 + st->units,
166 +
167 + rd->id,
168 + rd->name,
169 + value,
170 +
171 + (uint32_t)before
172 + );
173 +
174 return 1;
175 }
176 return 0;