From e9f88af959de6c783661dd180e7361a06ded96b0 Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Sun, 28 Jun 2020 11:43:29 +1000 Subject: [PATCH] Add WiFi metrics to prometheus exporter --- tasmota/xsns_75_prometheus.ino | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasmota/xsns_75_prometheus.ino b/tasmota/xsns_75_prometheus.ino index 542755f80..7bdaa7995 100644 --- a/tasmota/xsns_75_prometheus.ino +++ b/tasmota/xsns_75_prometheus.ino @@ -41,6 +41,13 @@ void HandleMetrics(void) 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); + + // Pseudo-metric providing metadata about the WiFi station. + WSContentSend_P(PSTR("# TYPE tasmota_wifi_station_info gauge\ntasmota_wifi_station_info{bssid=\"%s\",ssid=\"%s\"} 1\n"), WiFi.BSSIDstr().c_str(), WiFi.SSID().c_str()); + + // Wi-Fi Signal strength + WSContentSend_P(PSTR("# TYPE tasmota_wifi_station_signal_dbm gauge\ntasmota_wifi_station_signal_dbm{mac_address=\"%s\"} %d\n"), WiFi.BSSIDstr().c_str(), WiFi.RSSI()); + if (!isnan(global_temperature)) { dtostrfd(global_temperature, Settings.flag2.temperature_resolution, parameter); WSContentSend_P(PSTR("# TYPE global_temperature gauge\nglobal_temperature %s\n"), parameter);