Building a Simple Server Monitoring Script in My Homelab
*Why monitoring matters *
Monitoring matters because it provides a shared feedback loop, necessary visibility in the system metrics, performance, security, it also enables rapid issue detection, and continous improvement
See my code in my github here:- https://github.com/KithupaG/Homelab/blob/main/monitoring/server-stats.sh
How I built it
I used functions to house the processes, adhering to the laws of writing code, inside those functions I housed the shell commands such as top
, free
, df
, ps
etc to fetch the data and used awk
to tabularize the data.
- Demo output.
- Future plan
- Add logging to a file →
server_stats.log
. - Output as JSON so it integrates with Prometheus/ELK.
- Connect to Grafana and make dashboards.