From ac2c07925af00df7f149141e2dfc62c09938e925 Mon Sep 17 00:00:00 2001 From: Dirk Heilig Date: Thu, 29 Aug 2024 10:43:48 +0200 Subject: [PATCH] add json output --- mqtt2prom/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mqtt2prom/run b/mqtt2prom/run index d07a798..797d89c 100755 --- a/mqtt2prom/run +++ b/mqtt2prom/run @@ -274,7 +274,7 @@ function output(): void $prom .= $entry["name"] . $labels . " " . $entry["value"] . "\n"; } file_put_contents("/www/metrics/new.prom", $prom); - file_put_contents("/www/metrics/json", $json); + file_put_contents("/www/metrics/json", json_encode($json,JSON_PRETTY_PRINT+JSON_UNESCAPED_SLASHES+JSON_UNESCAPED_UNICODE)); rename("/www/metrics/new.prom", "/www/metrics/index.prom"); // return $prom; }