From 76c61e85b3a1464173acb70849957a9decc3f9c8 Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Sat, 27 Jun 2020 21:21:11 +1000 Subject: [PATCH] Add tasmota_info prometheus psuedo-metric. Exports version, image type, and build timestamp. It's common to export something like this to show version numbers across the fleet. For example, the golang exporter exposes version: ``` go_info{version="go1.14.4"} 1 ``` And prometheus exposes: ``` prometheus_build_info{branch="HEAD",goversion="go1.14.4",revision="eba3fdcbf0d378b66600281903e3aab515732b39",version="2.19.1"} 1 ``` --- tasmota/xsns_75_prometheus.ino | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasmota/xsns_75_prometheus.ino b/tasmota/xsns_75_prometheus.ino index 5f50f8a2d..542755f80 100644 --- a/tasmota/xsns_75_prometheus.ino +++ b/tasmota/xsns_75_prometheus.ino @@ -35,6 +35,9 @@ void HandleMetrics(void) char parameter[FLOATSZ]; + // Pseudo-metric providing metadata about the running firmware version. + WSContentSend_P(PSTR("# TYPE tasmota_info gauge\ntasmota_info{version=\"%s\",image=\"%s\",build_timestamp=\"%s\"} 1\n"), + my_version, my_image, GetBuildDateAndTime().c_str()); WSContentSend_P(PSTR("# TYPE tasmota_uptime_seconds gauge\ntasmota_uptime_seconds %d\n"), uptime); WSContentSend_P(PSTR("# TYPE tasmota_boot_count counter\ntasmota_boot_count %d\n"), Settings.bootcount);