kiss server monitoring tool with email alerts
go monitoring
at main 101 lines 1.9 kB view raw view rendered
1# ServMon 2 3KISS (Keep It Simple, Stupid) server monitoring tool with email alerts. 4 5For those who want to keep it simple instead of using complex setups like Prometheus, Grafana, and Alertmanager. 6 7## Features 8 9- **CPU & Memory Monitoring** - Alert on high usage 10- **Disk Monitoring** - Monitor multiple partitions 11- **HTTP Health Checks** - Monitor endpoint availability 12- **Journalctl Monitoring** - Scan systemd logs for errors 13- **Reboot Detection** - Email notification on system reboot 14- **Email Alerts** - Rich formatting with severity levels 15- **Smart Cooldowns** - Prevent alert spam 16 17## Installation 18 19```bash 20go install pkg.rbrt.fr/servmon@latest 21``` 22 23## Configuration 24 25Edit `~/.servmon.yaml` or `/etc/servmon/config.yaml`: 26 27```yaml 28alert_thresholds: 29 cpu: 30 threshold: 90 31 duration: 5m0s 32 cooldown: 30m0s 33 check_interval: 10s 34 35 memory: 36 threshold: 80 37 cooldown: 30m0s 38 check_interval: 10s 39 40 disks: 41 - path: / 42 threshold: 90 43 cooldown: 4h0m0s 44 check_interval: 1m0s 45 46 http: 47 url: http://localhost:8080/health 48 timeout: 5s 49 sample_rate: 10 50 failure_threshold: 20 51 check_interval: 1m0s 52 cooldown: 15m0s 53 54 journalctl: 55 enabled: true 56 check_interval: 5m0s 57 lookback_period: 5m0s 58 error_threshold: 10 59 priority: err 60 cooldown: 30m0s 61 62 reboot: 63 enabled: true 64 uptime_threshold: 10m0s 65 66email: 67 smtp_server: smtp.gmail.com 68 smtp_port: 587 69 from: alerts@yourdomain.com 70 to: admin@yourdomain.com 71 username: alerts@yourdomain.com 72 password: your-app-password 73``` 74 75## Usage 76 77### Run Manually 78 79```bash 80servmon --config ~/.servmon.yaml 81``` 82 83### Systemd Service 84 85```bash 86# Start 87sudo systemctl start servmon 88 89# Enable auto-start 90sudo systemctl enable servmon 91 92# View logs 93sudo journalctl -u servmon -f 94 95# Check status 96sudo systemctl status servmon 97``` 98 99## License 100 101[MIT](license).