From 956e6f5a5c5901de4563f4cc823e08125379556d Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Thu, 25 Jun 2020 20:06:24 +1000 Subject: [PATCH] Add uptime metric to prometheus exporter I'm following the naming practices: https://prometheus.io/docs/practices/naming/ - an application prefix (tasmota_) - a unit suffix in plural form Tested building and flashing: looks like ``` tasmota_uptime_seconds 78 ``` --- tasmota/xsns_91_prometheus.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasmota/xsns_91_prometheus.ino b/tasmota/xsns_91_prometheus.ino index 2a361b550..9e29afe75 100644 --- a/tasmota/xsns_91_prometheus.ino +++ b/tasmota/xsns_91_prometheus.ino @@ -37,6 +37,8 @@ void HandleMetrics(void) char parameter[FLOATSZ]; + WSContentSend_P(PSTR("# TYPE tasmota_uptime_seconds gauge\ntasmota_uptime_seconds %d\n"), uptime); + if (!isnan(global_temperature)) { dtostrfd(global_temperature, Settings.flag2.temperature_resolution, parameter); WSContentSend_P(PSTR("# TYPE global_temperature gauge\nglobal_temperature %s\n"), parameter);