Unverified Commit 4b4411d2 authored by Guillaume Quintard's avatar Guillaume Quintard Committed by Nils Goroll

[vstat] new json schema

parent ff8caf99
......@@ -114,15 +114,13 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
else
printf(",\n");
printf(" \"");
/* build the JSON key name. */
printf("%s\": {\n", pt->name);
printf(" \"description\": \"%s\",\n", pt->sdesc);
printf(" \"%s\": {\n", pt->name);
printf(" \"description\": \"%s\",\n", pt->sdesc);
printf(" \"flag\": \"%c\", ", pt->semantics);
printf(" \"flag\": \"%c\", ", pt->semantics);
printf("\"format\": \"%c\",\n", pt->format);
printf(" \"value\": %ju", (uintmax_t)val);
printf("\n }");
printf(" \"value\": %ju", (uintmax_t)val);
printf("\n }");
return (0);
}
......@@ -137,9 +135,12 @@ do_json(struct vsm *vsm, struct vsc *vsc)
now = time(NULL);
(void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now));
printf("{\n \"timestamp\": \"%s\",\n", time_stamp);
printf("{\n"
" \"version\": 1,\n"
" \"timestamp\": \"%s\",\n"
" \"counters\": {\n", time_stamp);
(void)VSC_Iter(vsc, vsm, do_json_cb, &jp);
printf("\n}\n");
printf("\n }\n}\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment