Switched from influx to victoria metrics (more light weight for pi)
This commit is contained in:
@@ -40,13 +40,13 @@ def cfg():
|
|||||||
|
|
||||||
# ── VictoriaMetrics ───────────────────────────────────────────────────────────
|
# ── VictoriaMetrics ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
def write(c, fields):
|
def write(c, fields, collection='weather'):
|
||||||
field_str = ','.join(
|
field_str = ','.join(
|
||||||
f"{k}={'true' if v is True else 'false' if v is False else v}"
|
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
|
for k, v in fields.items() if v is not None
|
||||||
)
|
)
|
||||||
if not field_str: return
|
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 ───────────────────────────────────────────────────────────────────
|
# ── Helpers ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ def read_system(c):
|
|||||||
'disk_used_gb': round(disk.used / 1024**3, 2),
|
'disk_used_gb': round(disk.used / 1024**3, 2),
|
||||||
'disk_total_gb': round(disk.total / 1024**3, 2),
|
'disk_total_gb': round(disk.total / 1024**3, 2),
|
||||||
'disk_percent': disk.percent,
|
'disk_percent': disk.percent,
|
||||||
})
|
}, collection='system')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[System] {e}")
|
print(f"[System] {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user