mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-17 16:26:59 +00:00
output: json nan values need quoting
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
8fe7dc2c03
commit
eb7547c742
1 changed files with 17 additions and 8 deletions
|
|
@ -540,11 +540,20 @@ static int output_json(const int print_mac_addreses)
|
||||||
fprintf(outfile, "\"used\":%g, ", shared_p->used);
|
fprintf(outfile, "\"used\":%g, ", shared_p->used);
|
||||||
fprintf(outfile, "\"touched\":%g, ", shared_p->touched);
|
fprintf(outfile, "\"touched\":%g, ", shared_p->touched);
|
||||||
fprintf(outfile, "\"free\":%g, ", shared_p->available - shared_p->used);
|
fprintf(outfile, "\"free\":%g, ", shared_p->available - shared_p->used);
|
||||||
|
if (shared_p->available == 0)
|
||||||
|
fprintf(outfile, "\"percent\":\"%g\", ", oh.percent);
|
||||||
|
else
|
||||||
fprintf(outfile, "\"percent\":%g, ", oh.percent);
|
fprintf(outfile, "\"percent\":%g, ", oh.percent);
|
||||||
fprintf(outfile, "\"touch_count\":%g, ", oh.tc);
|
fprintf(outfile, "\"touch_count\":%g, ", oh.tc);
|
||||||
|
if (shared_p->available == 0)
|
||||||
|
fprintf(outfile, "\"touch_percent\":\"%g\", ", oh.tcp);
|
||||||
|
else
|
||||||
fprintf(outfile, "\"touch_percent\":%g, ", oh.tcp);
|
fprintf(outfile, "\"touch_percent\":%g, ", oh.tcp);
|
||||||
if (config.backups_found == 1) {
|
if (config.backups_found == 1) {
|
||||||
fprintf(outfile, "\"backup_count\":%g, ", shared_p->backups);
|
fprintf(outfile, "\"backup_count\":%g, ", shared_p->backups);
|
||||||
|
if (shared_p->available == 0)
|
||||||
|
fprintf(outfile, "\"backup_percent\":\"%g\", ", oh.bup);
|
||||||
|
else
|
||||||
fprintf(outfile, "\"backup_percent\":%g, ", oh.bup);
|
fprintf(outfile, "\"backup_percent\":%g, ", oh.bup);
|
||||||
}
|
}
|
||||||
fprintf(outfile, "\"status\":%d ", oh.status);
|
fprintf(outfile, "\"status\":%d ", oh.status);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue