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
```
This commit is contained in:
Mark Hansen 2020-06-25 20:06:24 +10:00
parent ad46af6d54
commit 956e6f5a5c
1 changed files with 2 additions and 0 deletions

View File

@ -37,6 +37,8 @@ void HandleMetrics(void)
char parameter[FLOATSZ]; char parameter[FLOATSZ];
WSContentSend_P(PSTR("# TYPE tasmota_uptime_seconds gauge\ntasmota_uptime_seconds %d\n"), uptime);
if (!isnan(global_temperature)) { if (!isnan(global_temperature)) {
dtostrfd(global_temperature, Settings.flag2.temperature_resolution, parameter); dtostrfd(global_temperature, Settings.flag2.temperature_resolution, parameter);
WSContentSend_P(PSTR("# TYPE global_temperature gauge\nglobal_temperature %s\n"), parameter); WSContentSend_P(PSTR("# TYPE global_temperature gauge\nglobal_temperature %s\n"), parameter);