| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Lightweight Linux server monitoring with Bash, systemd, and alert fan-out to Telegram, Discord, or a generic webhook.
The project is built for self-hosted servers where you want:
server-monitor/
├── .env.example # Local deploy config template
├── .env # Local deploy targets and SSH defaults (ignored)
├── .env.server.example # Server alert config template
├── .env.server # Optional local defaults for deploy.sh (ignored)
├── .deploy/ # Generated per-host env files from deploy.sh (ignored)
├── deploy.sh # Interactive deployment and config generation
├── README.md
├── scripts/
│ ├── lib/
│ │ └── common.sh # Shared env/state helpers
│ ├── monitors/
│ │ ├── brute-force.sh
│ │ ├── log-size.sh
│ │ ├── resources.sh
│ │ ├── services.sh
│ │ └── ssh-login.sh
│ ├── notifiers/
│ │ ├── discord.sh
│ │ ├── telegram.sh
│ │ └── webhook.sh
│ ├── notify.sh
│ └── run-monitors.sh
└── systemd/
├── server-monitor.service
└── server-monitor.timer
deploy.sh now does the full server-side config flow instead of stopping at script upload.
It now:
This means local .env stays local, and the server receives only the generated alert config as .env.
The new defaults are meant to be useful without being noisy:
You can override all of these during deploy or by editing .env.server locally.
cp .env.example .envExample local .env:
SSH_HOST_1="100.64.0.2"
SSH_HOST_2="100.64.0.3"
SSH_USER="ploi"
REMOTE_DIR="/etc/server-monitor"cp .env.server.example .env.serverThis file is optional but useful. deploy.sh uses it as the default answer set for interactive prompts.
./deploy.shUseful variants:
./deploy.sh --server 1
./deploy.sh --host 100.64.0.9 --user ploi
./deploy.sh --cron
./deploy.sh --non-interactive
./deploy.sh --test
./deploy.sh --no-timer
./deploy.sh --no-pamDuring interactive deploy, the script will ask for:
For a single-host deploy, the latest answers are also written back to local .env.server so the next deploy starts from the same values.
Every deploy creates a host-specific file locally:
.deploy/100.64.0.2.env.server
That generated file is copied to the remote machine as:
/etc/server-monitor/.env
The remote .env is installed with:
If cron mode is selected, deploy also generates:
.deploy/<host>.cron.setup.sh
.deploy/<host>.cron.setup.md
For single-host deploys, it also refreshes local cron.setup.md.
| Monitor | Script | Default cadence | Trigger |
|---|---|---|---|
| CPU | scripts/monitors/resources.sh | 1 min | sustained CPU % threshold |
| RAM | scripts/monitors/resources.sh | 1 min | sustained RAM % threshold |
| Disk space | scripts/monitors/resources.sh | 1 min | sustained partition usage threshold |
| Disk I/O wait | scripts/monitors/resources.sh | 1 min | sustained iowait threshold |
| Network spike | scripts/monitors/resources.sh | 1 min | sustained RX/TX MB/s spike |
| Services | scripts/monitors/services.sh | 1 min | selected service is not active |
| Brute force | scripts/monitors/brute-force.sh | 1 min | failed SSH attempts over 5 min |
| Log size | scripts/monitors/log-size.sh | 1440 min | large file or oversized log dir |
| SSH login | scripts/monitors/ssh-login.sh | event-driven | PAM session open |
Service monitoring no longer has to track every enabled unit.
During deploy, the script reads enabled services from the target host and shows a selectable list. The chosen services are stored in:
SERVICES_TO_MONITOR="nginx php8.3-fpm mysql"If you leave this blank in a hand-written env, the monitor falls back to the filtered enabled-service list on the server.
Check configured monitors:
sudo bash /etc/server-monitor/scripts/run-monitors.sh --listForce a full run regardless of cadence:
sudo bash /etc/server-monitor/scripts/run-monitors.sh --forceRun one monitor directly:
sudo bash /etc/server-monitor/scripts/run-monitors.sh servicesSend a test notification:
sudo bash /etc/server-monitor/scripts/notify.sh "Test" "Hello from $(hostname)" "✅" "info"By default deploy.sh installs or reloads:
The timer runs every 60 seconds. Per-monitor cadence is controlled inside the scripts via env values, so you get fine-grained timing without needing multiple timers.
If a timer deployment already exists, deploy does this safely:
If you prefer to manage scheduling yourself, choose cron mode interactively or pass --cron.
Deploy will then:
Recommended cron entry:
* * * * * /bin/bash /etc/server-monitor/scripts/run-monitors.shThat single every-minute cron works because run-monitors.sh already respects the cadence values in /etc/server-monitor/.env.
The deploy and runtime flow was tightened specifically to avoid destabilizing the server.
These were worth implementing immediately rather than leaving as notes:
If you want to push this further, these are the next changes worth considering:
| Back | FazBrowse Home | New Git URL |