Remove down-site alert from printed briefing

This commit is contained in:
2026-03-17 15:04:16 -04:00
parent cd05366c78
commit 5061c21b94
+2 -23
View File
@@ -290,22 +290,6 @@ def get_financial_snapshot():
return None return None
def get_uptime_kuma_status():
try:
res = os.popen(
"ssh -o StrictHostKeyChecking=no pve173 "
"\"pct exec 147 -- sqlite3 /app/uptime-kuma/data/kuma.db "
"'SELECT name FROM monitor WHERE active = 1 AND id IN "
"(SELECT monitor_id FROM heartbeat WHERE id IN "
"(SELECT MAX(id) FROM heartbeat GROUP BY monitor_id) AND status = 0);'\""
).read().strip()
if res:
return res.replace("\n", ", ")
except:
pass
return None
def get_reddit_top(): def get_reddit_top():
try: try:
r = requests.get( r = requests.get(
@@ -354,7 +338,7 @@ def shorten_url(long_url):
# ── ESC/POS receipt builder ─────────────────────────────────────────────────── # ── ESC/POS receipt builder ───────────────────────────────────────────────────
def build_receipt(articles, zfs, reddit, grafana, weather, finance, kuma): def build_receipt(articles, zfs, reddit, grafana, weather, finance):
from escpos.printer import Dummy as EscPosDummy from escpos.printer import Dummy as EscPosDummy
p = EscPosDummy(profile="default") p = EscPosDummy(profile="default")
@@ -374,10 +358,6 @@ def build_receipt(articles, zfs, reddit, grafana, weather, finance, kuma):
s(align='left', bold=False) s(align='left', bold=False)
if weather: if weather:
p.text(f"Wx: {weather}\n") p.text(f"Wx: {weather}\n")
if kuma:
s(align='left', bold=True)
p.text(f"ALERT: {kuma}\n")
s(align='left', bold=False)
if zfs: if zfs:
p.text(f"ZFS: {zfs['alloc']}/{zfs['size']} ({zfs['cap']}) {zfs['health']}\n") p.text(f"ZFS: {zfs['alloc']}/{zfs['size']} ({zfs['cap']}) {zfs['health']}\n")
if grafana: if grafana:
@@ -445,13 +425,12 @@ def main():
grafana = get_grafana_metrics() grafana = get_grafana_metrics()
weather = get_weather() weather = get_weather()
finance = get_financial_snapshot() finance = get_financial_snapshot()
kuma = get_uptime_kuma_status()
if not items: if not items:
print("[!] No unread articles — printing dashboard only.") print("[!] No unread articles — printing dashboard only.")
articles = summarize_news(items, count=5, length="30-50 words") if items else [] articles = summarize_news(items, count=5, length="30-50 words") if items else []
raw = build_receipt(articles, zfs, reddit, grafana, weather, finance, kuma) raw = build_receipt(articles, zfs, reddit, grafana, weather, finance)
print_receipt(raw) print_receipt(raw)
if articles: if articles: