▲ 110 ▼ How do you monitor your servers? (lemmy.sdf.org) submitted 1 month ago by user224@lemmy.sdf.org to c/selfhosted@lemmy.world 97 comments fedilink hide all child comments Running services, network usage, memory usage, bandwidth, disk I/O, successful logins, whether the thing is even alive, etc... So far my only method has been "hope and pray".
[–] WeirdGoesPro@lemmy.dbzer0.com 7 points 1 month ago (2 children) Can you teach me this wizardry? permalink fedilink source parent hideshow 2 child comments replies: [–] lIlIlIlIlIlIl@lemmy.world 5 points 1 month ago (1 child) Sure! In Uptime Kuma, add a monitor with type Push. It gives you a URL with a unique token, and the monitor goes into “down” state if nothing calls that URL within the heartbeat interval. Then have a cron (or a systemd timer or whatever) run this on the machine with the drive every 5 or 10 minutes: use=$(df --output=pcent /mnt/yourdrive | tail -1 | tr -dc ‘0-9’) curl -fsS -G “http://your-kuma:3001/api/push/TOKEN --data-urlencode “status=up” --data-urlencode “msg=${use}% used” --data-urlencode “ping=${use}” Ping is of course meant to be response time, but Kuma will graph any number you toss in, so you get a “filled” chart for the drive. I also send status=down once usage passes a threshold. And if the box itself should fall over for some reason, the missing check-ins trigger the alert too. (I typed this quick on my phone, so please double-check and probably don’t blindly copy-paste) permalink fedilink source parent hideshow 1 child comment replies: [–] WeirdGoesPro@lemmy.dbzer0.com 2 points 1 month ago Thank you! This is dope! permalink fedilink source parent
[–] lIlIlIlIlIlIl@lemmy.world 5 points 1 month ago (1 child) Sure! In Uptime Kuma, add a monitor with type Push. It gives you a URL with a unique token, and the monitor goes into “down” state if nothing calls that URL within the heartbeat interval. Then have a cron (or a systemd timer or whatever) run this on the machine with the drive every 5 or 10 minutes: use=$(df --output=pcent /mnt/yourdrive | tail -1 | tr -dc ‘0-9’) curl -fsS -G “http://your-kuma:3001/api/push/TOKEN --data-urlencode “status=up” --data-urlencode “msg=${use}% used” --data-urlencode “ping=${use}” Ping is of course meant to be response time, but Kuma will graph any number you toss in, so you get a “filled” chart for the drive. I also send status=down once usage passes a threshold. And if the box itself should fall over for some reason, the missing check-ins trigger the alert too. (I typed this quick on my phone, so please double-check and probably don’t blindly copy-paste) permalink fedilink source parent hideshow 1 child comment replies: [–] WeirdGoesPro@lemmy.dbzer0.com 2 points 1 month ago Thank you! This is dope! permalink fedilink source parent
[–] WeirdGoesPro@lemmy.dbzer0.com 2 points 1 month ago Thank you! This is dope! permalink fedilink source parent