Switched from influx to victoria metrics (more light weight for pi)

This commit is contained in:
2026-06-27 00:04:22 -04:00
parent 36eda62e7f
commit ce332be419

View File

@@ -40,13 +40,13 @@ def cfg():
# ── VictoriaMetrics ───────────────────────────────────────────────────────────
def write(c, fields):
def write(c, fields, collection='weather'):
field_str = ','.join(
f"{k}={'true' if v is True else 'false' if v is False else v}"
for k, v in fields.items() if v is not None
)
if not field_str: return
requests.post(f"{c['VM_URL']}/write", data=f"weather {field_str}", timeout=2)
requests.post(f"{c['VM_URL']}/write", data=f"{collection} {field_str}", timeout=2)
# ── Helpers ───────────────────────────────────────────────────────────────────
@@ -466,7 +466,7 @@ def read_system(c):
'disk_used_gb': round(disk.used / 1024**3, 2),
'disk_total_gb': round(disk.total / 1024**3, 2),
'disk_percent': disk.percent,
})
}, collection='system')
except Exception as e:
print(f"[System] {e}")