
Install ZabMonitor on your server
From a blank Linux server to a secured monitoring dashboard and API with HTTPS, step by step. ZabMonitor is free and in beta.
Run the installer Requirements Cron jobs Troubleshooting REST API reference Product details
Choose your server's operating system
Pick your system to see what, if anything, you must prepare before running install.sh, and what the installer will add for you.
Ubuntu
Versions: 20.04 LTS, 22.04 LTS, 24.04 LTS (and newer) · Package manager: apt
Before you run the installer
Optional: see your exact version
lsb_release -dsOptional: refresh the package list yourself (the installer does it too)
sudo apt updateWhat the installer adds by itself
python3 (only if missing), curl, iproute2, nginx or apache2, certbot with the nginx/apache plugin, tzdata (only with cron jobs). Anything already installed is detected and left alone.
Good to know on Ubuntu
- Nothing else is required:
sudoandaptare already there. - If ufw is active, the installer opens exactly the ports you choose. Plain iptables/nftables rules are not changed, and neither is your cloud firewall: open ports 80 and 443 (or your custom ports) there yourself.
- Ubuntu 20.04 has Python 3.8: everything works, but cron job time zones by name need Python 3.9+ (fixed offsets like
UTC+09:00work). 20.04 is at or past the end of standard support, so prefer 22.04 or 24.04.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shDebian
Versions: 10, 11, 12 (and newer) · Package manager: apt
Before you run the installer
Minimal Debian often has no sudo: become root instead (then leave out sudo below)
su -If you upload the project as a .zip you need unzip (a .tar.gz needs nothing)
apt install -y unzipOptional: see your version
cat /etc/debian_versionWhat the installer adds by itself
python3 (only if missing), curl, iproute2, nginx or apache2, certbot with the nginx/apache plugin, tzdata (only with cron jobs). Anything already installed is detected and left alone.
Good to know on Debian
- The installer must run as root (directly or through sudo).
- Debian 10 is end of life and its package servers moved to
archive.debian.org, soapt updatefails until you fix/etc/apt/sources.list. Use Debian 11 or 12 if you can. Python is 3.7 on 10, 3.9 on 11, 3.11 on 12 (named cron time zones need 3.9+). - A fresh Debian has no firewall. If you run your own iptables/nftables rules, open the web ports yourself; ufw and firewalld are handled automatically.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
./install.sh # as root; with sudo: sudo ./install.shAlmaLinux
Versions: 8 and 9 · Package manager: dnf
Before you run the installer
Optional: see your version and SELinux mode
cat /etc/almalinux-release
getenforceOptional: update first
sudo dnf -y updateWhat the installer adds by itself
Python 3.9 or 3.11 on version 8 (its system Python 3.6 is too old), curl, iproute, nginx or httpd, epel-release + certbot with the nginx/apache plugin, policycoreutils-python-utils (only for custom ports), tzdata (only with cron jobs). Anything already installed is detected and left alone.
Good to know on AlmaLinux
- SELinux is usually enforcing here. The installer allows the web server to reach the agent and labels any custom web port for you. Check with
getenforce; do not switch SELinux off. - If firewalld is running, the installer opens exactly the ports you choose. Open the same ports at your cloud provider as well.
- EPEL (needed for certbot) is added by the installer; nothing to enable by hand.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shRocky Linux
Versions: 8 and 9 · Package manager: dnf
Before you run the installer
Optional: see your version and SELinux mode
cat /etc/rocky-release
getenforceOptional: update first
sudo dnf -y updateWhat the installer adds by itself
Python 3.9 or 3.11 on version 8 (its system Python 3.6 is too old), curl, iproute, nginx or httpd, epel-release + certbot with the nginx/apache plugin, policycoreutils-python-utils (only for custom ports), tzdata (only with cron jobs). Anything already installed is detected and left alone.
Good to know on Rocky Linux
- SELinux is usually enforcing here. The installer allows the web server to reach the agent and labels any custom web port for you. Check with
getenforce; do not switch SELinux off. - If firewalld is running, the installer opens exactly the ports you choose. Open the same ports at your cloud provider as well.
- EPEL (needed for certbot) is added by the installer; nothing to enable by hand.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shRed Hat Enterprise Linux
Versions: 8 and 9 · Package manager: dnf
Before you run the installer
The server must be registered with Red Hat, or no package can be installed
sudo subscription-manager statuscertbot comes from EPEL, which RHEL does not provide by itself: add it first (use 8 instead of 9 on RHEL 8)
sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpmWhat the installer adds by itself
Python 3.9 or 3.11 on version 8 (system Python 3.6 is too old), curl, iproute, nginx or httpd, certbot with the nginx/apache plugin (from EPEL), policycoreutils-python-utils (only for custom ports), tzdata (only with cron jobs). Anything already installed is detected and left alone.
Good to know on Red Hat Enterprise Linux
- Without EPEL the installer cannot install certbot: it keeps ZabMonitor running over HTTP, warns you, and prints the manual
certbotcommand to run after you add EPEL. - SELinux is usually enforcing here. The installer allows the web server to reach the agent and labels any custom web port for you. Check with
getenforce; do not switch SELinux off. - If firewalld is running, the installer opens exactly the ports you choose. Open the same ports at your cloud provider as well.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shFedora
Versions: Currently supported releases · Package manager: dnf
Before you run the installer
Optional: see your version and SELinux mode
cat /etc/fedora-release
getenforceWhat the installer adds by itself
curl, iproute, nginx or httpd, certbot with the nginx/apache plugin (from Fedora's own repository), policycoreutils-python-utils (only for custom ports), tzdata (only with cron jobs). Python is already new enough.. Anything already installed is detected and left alone.
Good to know on Fedora
- SELinux is usually enforcing here. The installer allows the web server to reach the agent and labels any custom web port for you. Check with
getenforce; do not switch SELinux off. - If firewalld is running, the installer opens exactly the ports you choose. Open the same ports at your cloud provider as well.
- Fedora releases are supported for only about 13 months: use a current one.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shopenSUSE
Versions: Leap 15.x and Tumbleweed · Package manager: zypper
Before you run the installer
Refresh the repositories
sudo zypper refreshLeap 15 ships Python 3.6: install a newer one first if python3 --version says 3.6
sudo zypper install -y python311What the installer adds by itself
Python (if still too old), curl, iproute2, nginx or apache2, certbot with the nginx/apache plugin, tzdata (only with cron jobs). Anything already installed is detected and left alone.
Good to know on openSUSE
- If the installer cannot install certbot it continues over HTTP, warns you and prints the manual command.
- If firewalld is running, the installer opens exactly the ports you choose. Open the same ports at your cloud provider as well. The old SuSEfirewall2 is not handled: open ports there yourself.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shArch Linux
Versions: Rolling release · Package manager: pacman
Before you run the installer
Update first. The installer installs packages without refreshing the package database, which fails with "target not found" on a stale one
sudo pacman -SyuWhat the installer adds by itself
python (if missing), curl, iproute2, nginx, certbot + certbot-nginx. Anything already installed is detected and left alone.
Good to know on Arch Linux
- nginx only. Apache on Arch is deliberately not supported: choose nginx (or
none) when asked. - If ufw is active, the installer opens exactly the ports you choose. Plain iptables/nftables rules are not changed, and neither is your cloud firewall: open ports 80 and 443 (or your custom ports) there yourself.
- Python is always current, so named cron time zones work.
Then run it (after uploading the project folder, see step 3)
cd ZabMonitor
sudo ./install.shOther / not sure
Find out what you have:
cat /etc/os-release
ps -p 1 -o comm= # must print: systemdLook at ID= and ID_LIKE=: ubuntu/debian use the Ubuntu and Debian instructions; rhel, centos, almalinux, rocky, fedora use the RHEL-family ones; suse and arch have their own tiles. Derivatives (Linux Mint, Pop!_OS, Oracle Linux, Amazon Linux 2023) normally work like their family but are not specifically handled.
systemd (Devuan, Void, Gentoo with OpenRC, most containers). Move to Alma, Rocky or Ubuntu LTS instead.Overview
ZabMonitor reports whether a server is alive and how much CPU, memory, disk and network it uses. It has a realtime web dashboard and a JSON API. Everything is protected by an API key.
The agent only listens on localhost. The only public door is nginx or apache, which terminates HTTPS. Without a web server the agent is reachable directly over plain HTTP, which is not recommended.
1. Requirements
| Item | Needed |
|---|---|
| Server OS | A Linux distribution with systemd from the list below (64-bit, x86_64 or ARM64). Not supported: CentOS 7, Alpine, and any system without systemd. |
| Access | root or a user with sudo |
| For HTTPS | A domain name you control, with an A/AAAA record pointing at the server. Inbound ports 80 and 443 (or the custom ports you choose in step 4.5) open to the internet (also at your cloud provider's firewall / security group). |
| Everything else | Installed automatically if missing: Python 3.7+, curl, nginx or apache, certbot. |
1.1 Supported operating systems and versions
| Family | Versions the installer is written for | Package manager | Web server | Python it uses |
|---|---|---|---|---|
| Ubuntu | 20.04 LTS, 22.04 LTS, 24.04 LTS (and newer) | apt | nginx, apache (apache2) | System python3 (3.8 on 20.04, 3.10 on 22.04, 3.12 on 24.04) |
| Debian | 10, 11, 12 (and newer) | apt | nginx, apache (apache2) | System python3 (3.7 on 10, 3.9 on 11, 3.11 on 12) |
| AlmaLinux, Rocky Linux, RHEL | 8 and 9 | dnf / yum | nginx, apache (httpd) | 8: the system Python 3.6 is too old, so the installer adds Python 3.9 or 3.11; 9: system 3.9 |
| Fedora | Currently supported releases | dnf | nginx, apache (httpd) | System python3 |
| openSUSE | Leap 15.x and Tumbleweed | zypper | nginx, apache (apache2) | System python3, or a newer python3x package if the system one is older than 3.7 |
| Arch Linux | Rolling | pacman | nginx only (apache on Arch is deliberately not supported) | System python |
- Always required: systemd, Python 3.7 or newer (the installer installs it if missing; it uses only the Python standard library, no pip packages), and root or
sudo. - Not supported: CentOS 7 (Python too old), Alpine Linux (no systemd,
musl), and any distribution without systemd (for example Devuan, Void, or containers that do not run systemd). - Derivatives (for example Linux Mint, Pop!_OS, Oracle Linux, Amazon Linux 2023, Kali) normally work because they use the same package manager and layout as the family above, but they are not on the list and are not specifically handled.
- Cron job time zones by name (such as
Asia/Tokyo) need Python 3.9 or newer and the system time zone database; the installer addstzdataif it is missing. On Debian 10 and Ubuntu 20.04 (Python 3.7/3.8) only fixed offsets such asUTC+09:00work, unless you install Python 3.9 or newer first. Everything else works on 3.7. - SELinux (Alma, Rocky, RHEL, Fedora): the installer allows the web server to reach the agent and labels custom web ports. Firewall: ufw and firewalld are handled; other firewalls are not changed (the installer tells you which ports to open).
Decide before you start: a domain (e.g. mon.example.com), an email for certificate expiry notices, and whether you want a generated or your own API key.
2. Point your domain at the server
At your DNS provider create an A record (and AAAA if the server has IPv6):
| Type | Name | Value |
|---|---|---|
| A | mon | YOUR.SERVER.IP |
Check it has propagated (from your own computer):
nslookup mon.example.com3. Upload the files to the server
From your computer, copy the whole ZabMonitor folder (it contains install.sh, agent/, web/):
scp -r ZabMonitor user@YOUR.SERVER.IP:~/Then log in and enter the folder:
ssh user@YOUR.SERVER.IP
cd ~/ZabMonitor
chmod +x install.shscp/ssh, or WinSCP. If you edited files on Windows and the script reports ^M errors, run sed -i 's/\r$//' install.sh agent/*.py.4. Run the installer (interactive)
sudo ./install.shThe installer first checks what is already on the machine and installs only what is missing. You will be asked these questions in order. The screens below show a typical run; the exact text on your server may differ slightly.
4.1 API key
==> Package manager: apt
ok python at /usr/bin/python3
API key (used by the dashboard login and the API):
1) generate a strong random key (recommended)
2) enter my own key
Choice [1]: 1Choose 1 unless you must use a specific key. A custom key must be 20-128 characters (letters, digits and . _ ~ + / = -). It is typed hidden and asked twice.
4.2 Server name
Server display name (shown in the dashboard and API) [web-01]: Production Web 01A friendly name for this server. It becomes the page title in the dashboard and the name field in the API. Press Enter to use the machine's hostname. Allowed: 1-64 letters, digits, spaces and . _ ( ) -. Change it later with sudo ./install.sh rename --name "New name" (your key stays the same).
Everything else on the dashboard is read live from the server itself: operating system and kernel (from /etc/os-release and the kernel), architecture, hostname, uptime, CPU, memory, disks, network, temperature, processes and the services you chose. Nothing about the machine is typed in by hand except this name.
4.3 Web server
Web server / reverse proxy (recommended, gives HTTPS):
1) nginx (not installed - will be installed)
2) apache (not installed - will be installed)
3) none (agent listens directly, plain HTTP - not recommended)
Choice [1]: 1The installer shows whether each is already present. Pick the one you already run, or nginx for a new server. Existing sites are not modified; ZabMonitor adds its own separate config file.
4.4 Domain, SSL and email
Domain name for the dashboard (blank = no domain, HTTP on port 8088): mon.example.com
Install a free Let's Encrypt SSL certificate for mon.example.com? [Y/n]: Y
Email for certificate expiry notices (blank = none): admin@example.comIf you answer yes, the installer checks for certbot, installs it with the nginx/apache plugin if absent, requests the certificate, forces HTTP-to-HTTPS redirect, enables HSTS, and sets up automatic renewal.
4.5 Ports
==> Port 8787 is already used by gunicorn; suggesting 8788 for ZabMonitor
Local port for the ZabMonitor agent (127.0.0.1 only) [8788]:
Public HTTP port for nginx [80]:
Public HTTPS port for nginx [443]:ZabMonitor runs on its own local port (default 8787, reachable only from the server itself), and nginx/apache listens on the public ports and forwards to it. The installer checks every port before using it. If a port is taken it shows which program uses it and suggests a free one; you can accept it or type another. With -y or flags it picks the next free port by itself, except for a port you passed explicitly, which stops the install with a clear message.
- Default public ports: 80 for HTTP (8088 if you gave no domain) and 443 for HTTPS. Pick other ports if something else, such as another web server, Docker or a reverse proxy, already owns 80/443.
- Existing nginx/apache: if it is already installed, the installer first shows the ports it listens on (for example
nginx is already installed and is listening on port(s): 80 443 8081) before asking which port the API should run on. If the port is already used by the same web server you chose, it is shared (ZabMonitor gets its own site by domain name), not treated as a conflict. - Firewall: exactly the ports you chose are opened, and closed again by
uninstall --purge. On Alma/Rocky/Fedora with SELinux enforcing, non-standard web ports are labelled automatically (and the label is removed on uninstall). - Certificates and several ports: two different things are involved. (1) Getting the certificate: Let's Encrypt validates the domain only through port 80, whatever ports your sites use. (2) Serving HTTPS: any port works, for example 8444, and several sites with different domains can share 443 or use their own ports; each site has its own certificate. The installer passes your HTTPS port to certbot. With a non-standard HTTPS port it writes the HTTP→HTTPS redirect itself (
http://mon.example.comgoes tohttps://mon.example.com:8444) instead of using certbot's, and does not enable HSTS, because browsers would then upgrade other ports of that name too. The redirect skips/.well-known/acme-challenge/so renewal keeps working. - Let's Encrypt limitation: the certificate authority always validates a domain through port 80. If your public HTTP port is not 80, the certificate only works when port 80 of the server is forwarded to it; otherwise the request fails, ZabMonitor keeps running over HTTP, and the installer tells you. A custom HTTPS port is fine.
- Reinstalling keeps the current ports by default.
Already running nginx or apache with your own applications?
That is a supported setup. The installer is built so your existing sites are not disturbed:
| Topic | What the installer does |
|---|---|
| Your config files | Adds one new file (/etc/nginx/conf.d/zabmonitor.conf; apache: its own site file). No existing nginx/apache file is edited, and nothing is deleted. |
| Reloading | Tests the config first (nginx -t). A graceful reload is used, so running connections to your applications are not dropped. If the test fails, its own file is removed and the install stops. |
| Same domain | Checks whether another site already answers to the domain you enter. If so it refuses and asks for a different one (for example mon.yourdomain.com), so ZabMonitor never takes over or hides your site. |
| Ports 80 / 443 | Shared with your existing sites, because sites are told apart by domain name. Ports used by anything else are detected and never taken. |
| Service settings | The restart-on-failure setting is only added to a web server that the installer itself installed. Your own nginx service is left as is. |
| Firewall | Ports that are already open stay as they are and are never closed by uninstall. Only rules the installer created are removed by --purge. |
| SELinux | A port label is only added if it does not exist yet, and only labels the installer added are removed again. |
| Packages | Your nginx/apache is never removed. --purge removes only packages the installer added (for example certbot). |
| Certificates | certbot --nginx is run for ZabMonitor's domain only, so it changes only ZabMonitor's own site block. |
| Not loaded? | If your nginx.conf does not include conf.d/*.conf, the installer warns you and prints the exact include line to add, because the ZabMonitor site would not be active otherwise. |
One thing to know: the installer reloads nginx once. Do the install in a quiet period if you prefer, and keep a copy of /etc/nginx as with any change to a production server (sudo cp -a /etc/nginx /etc/nginx.bak).
4.6 Services to watch
systemd services to watch (comma separated, blank = none) [nginx,sshd]: nginx,sshd,mysqlAnything listed here is checked every 10 seconds. If one is not active, the dashboard turns red and the API status becomes critical. Use real unit names (check with systemctl list-units --type=service).
4.7 Cron Jobs manager (optional question)
The last question is whether you want the Cron Jobs manager. Everything it needs is inside install.sh, so there is no extra command. Answer no (or just press Enter) and the installer carries on with the next step; nothing for cron is installed and no more cron questions are asked. Answer yes and these follow, in this order:
Enable the Cron Jobs manager? [y/N]: y
Which system user should cron jobs run as?
1) create a new low-privilege user - the default and recommended: no login, no password, no sudo (name: zabcron)
2) root - FULL control of this server
3) an existing user (type the name)
Choice [1]: (Enter)
Name for the new user [zabcron]: (Enter)
Allow typing scripts in the dashboard? [Y/n]: Y
Cron key (a second key, needed on top of the API key to open the Cron jobs tab; it is NOT a Linux password):
1) generate a strong random key (recommended)
2) enter my own key
Choice [1]: (Enter)| Question | Probable answers |
|---|---|
| Enable the Cron Jobs manager? | n (default) if you only want monitoring. y if you want to schedule scripts such as a nightly backup. |
| Which user should jobs run as? | 1 (just press Enter): a new locked-down user, default name zabcron; it is also what -y --cron does. 2 root only if jobs must change the system. 3 to reuse an account such as www-data (the installer warns if it has powerful groups like sudo or docker). |
| Name for the new user | Press Enter for zabcron. Names such as root, www-data, nginx or sshd are refused. |
| Allow typing scripts in the dashboard? | Y for convenience (you can write scripts in the browser). n for the strictest setup: only script files already on the server can be scheduled. |
| Cron key | 1 (Enter): the installer generates a strong random key. 2: type your own (20-128 characters of A-Za-z0-9._~+/=-, asked twice, hidden while typing, and it must differ from the API key). Unattended: set the environment variable ZABMONITOR_CRON_KEY; with -y and no variable a key is generated. |
- No Linux password is asked. The
zabcronaccount deliberately has no password and no login (safest). The "cron key" above is what protects the Cron jobs tab. If you really want a password for the account, see "Passwords: set, reset, lock, expire". - It needs HTTPS. Without a domain and SSL (or a local-only agent) the installer says cron is not enabled and continues; add SSL later and run
sudo ./install.sh cron-enable. If the certificate fails later in the same run, cron is switched off again for the same reason. - At the end the installer shows the cron key once (also when you typed it yourself; it is separate from the API key). Save it too; replace it any time with
sudo ./install.sh regen-key --cron. - Re-running the installer and answering no stops an earlier cron runner (jobs and history are kept).
- Unattended:
--cron,--cron-create-user zabcron,--cron-no-inline(see chapter 5).
4.8 Public REST API (optional question)
After the cron question the installer asks whether you want the public REST API: documented HTTPS endpoints under /rest/v1 that your own programs can call with a token the installer generates (no one types or invents it). Through it a program can read server usage (CPU, memory, disks, network, processes, services) and, if you allow it, manage cron jobs. Every endpoint, parameter and response is in the separate reference API.html. Answer no (or press Enter) and the installer moves on; nothing is installed or opened for it. Answer yes and these follow:
Enable the public REST API? [y/N]: y
What may the first token do?
1) read monitoring data only (CPU, memory, disks, network, processes, services) - the default
2) monitoring data + view cron jobs and their run history
3) everything: also the request log, and create / change / run / delete cron jobs (can run commands on this server)
Choice [1]: (Enter)
Name for this token (to recognise it later) [default]: grafana
Token lifetime in days (0 = never expires) [365]: (Enter)
Accept the token only from these IP addresses/ranges, comma separated (blank = from anywhere): 203.0.113.0/24| Question | Probable answers |
|---|---|
| Enable the public REST API? | n (default) if nothing needs to call the server. y for dashboards (Grafana, Zabbix scripts), uptime checks, or your own automation. |
| What may the first token do? | 1 for monitoring only (safest). 2 to also read cron jobs and history. 3 only for a trusted program that must create or run jobs: this is remote command execution as the allowed cron users. Options 2 and 3 appear only when the Cron Jobs manager is enabled. |
| Name | Anything that tells you which program uses it (grafana, backup-bot). |
| Lifetime | Keep the default 365, or a shorter period such as 90. 0 never expires (not recommended). |
| Allowed addresses | The caller's fixed IP address or range (for example 203.0.113.5, 10.0.0.0/8) when it has one; blank when it does not. |
- Tokens are generated by the system (a random 40-character secret) and shown once, together with its name, scopes and expiry. The server keeps only a salted hash in
/etc/zabmonitor/tokens.json(root-owned). You cannot choose your own token. - It needs HTTPS (or a local-only agent), exactly like the cron manager: without it the installer says the REST API is not enabled and continues. If the certificate fails later in the same run, it is switched off again and the new token is revoked.
- Tokens can only be created on the server, as root:
sudo ./install.sh rest-token create NAME. Nothing reachable over HTTP can create one, even with a full-access token. - Re-running the installer and answering no turns the API off (tokens are kept but stop working).
- Unattended:
--rest --rest-scopes metrics:read --rest-name grafana --rest-days 365 --rest-allow 203.0.113.0/24(see chapter 5).
Use it right away (the token is the long zmt_... string shown at the end of the install):
curl -H "Authorization: Bearer zmt_9e085d6a_..." https://mon.example.com/rest/v1/status4.9 The installer works
==> Installing nginx
==> Creating unprivileged service user
ok agent files installed in /opt/zabmonitor
ok service zabmonitor running (user zabmonitor, sandboxed)
==> Creating the low-privilege user 'zabcron' (no login, no password, no sudo, no extra groups) (only if you enabled cron)
ok cron runner running (jobs may run as: zabcron) (only if you enabled cron)
ok nginx vhost written: /etc/nginx/conf.d/zabmonitor.conf
==> Installing certbot
==> Requesting certificate for mon.example.com (ports 80/443 must be reachable from the internet)
ok SSL certificate installed for mon.example.com
ok auto-renewal via systemd timer
ok renewal dry-run passed
ok ufw: opened web ports
ok API rejects requests without a key (401)
ok API accepts your key (200)
ok REST API refuses requests without a token (401) (only if you enabled the REST API)
ok REST API accepts your token (200) (only if you enabled the REST API)4.10 Save your key
ZabMonitor is installed.
Dashboard : https://mon.example.com
Health : https://mon.example.com/healthz
API : https://mon.example.com/api/v1/status
Your API key (shown once - store it safely):
Xk3Pq9...your-random-key...
Your CRON key (shown once - store it safely; it is NOT the API key): (only if you enabled cron)
Hq7Zt2...your-cron-key...
REST API : https://mon.example.com/rest/v1 (header: Authorization: Bearer <token>) (only if you enabled the REST API)
Your REST API token (shown once - store it safely; it is NOT the API key):
zmt_9e085d6a_Xk3Pq9...your-token...
Name: grafana Scopes: metrics:read Expires: 2027-11-07 Accepted from: 203.0.113.0/24sudo ./install.sh regen-key (API key), sudo ./install.sh regen-key --cron (cron key), or revoke the REST token and create a new one (sudo ./install.sh rest-token revoke ID, then rest-token create NAME).5. Unattended install (automation)
Pass everything as options and add -y. Give the key through an environment variable so it does not appear in the process list.
sudo ZABMONITOR_KEY='your-own-key-20-chars-or-more' ./install.sh -y \
--webserver nginx --domain mon.example.com --ssl \
--email admin@example.com --services nginx,sshd| Option | Meaning |
|---|---|
--generate-key | Create a random key (printed at the end) |
--webserver nginx|apache|none | Choose proxy |
--domain D, --ssl / --no-ssl, --email E | Domain and certificate |
--port N | Port of the ZabMonitor agent (default 8787; the next free port is used if busy and not given explicitly) |
--http-port N | Public HTTP port of nginx/apache (default 80; 8088 without a domain) |
--https-port N | Public HTTPS port when SSL is on (default 443) |
--bind ADDR | Agent bind address when no web server is used |
--cron / --no-cron | Enable or skip the optional Cron Jobs manager (needs HTTPS) |
--cron-users root,backup | Existing system users jobs may run as (default with --cron and no user option: a new zabcron user) |
ZABMONITOR_CRON_KEY (environment) | Your own cron key (never on the command line); without it a key is generated |
--cron-create-user zabcron | Create a locked-down low-privilege user (no login, no password, no sudo) and allow it |
--cron-no-inline | Do not allow typing scripts in the dashboard (only existing script files) |
--rest / --no-rest | Enable or skip the optional public REST API (token authentication; needs HTTPS) |
--rest-scopes LIST | What the first token may do, comma separated: metrics:read, logs:read, cron:read, cron:write (default metrics:read; cron scopes need --cron) |
--rest-name N, --rest-days D, --rest-allow IPS | Token name (default default), lifetime in days (default 365, 0 = never), and the IP addresses/ranges it is accepted from (default anywhere) |
--rest-insecure | Allow the REST API without HTTPS (not recommended) |
--name "My Server" | Display name shown in the dashboard and API (default: hostname) |
--services a,b | systemd units to watch |
--no-firewall | Do not change ufw/firewalld |
6. Verify the deployment
6.1 Service is running
sudo systemctl status zabmonitor
sudo ./install.sh statusExpect active (running) and {"status":"ok"}.
6.2 HTTPS and security checks (from your own computer)
# public health check: no key needed, reveals nothing
curl https://mon.example.com/healthz
# must be rejected (401)
curl -i https://mon.example.com/api/v1/status
# must succeed (200)
curl -H "X-API-Key: YOUR_KEY" https://mon.example.com/api/v1/status
# HTTP must redirect to HTTPS (301)
curl -I http://mon.example.com6.3 Certificate renewal
sudo certbot renew --dry-run
systemctl list-timers | grep certbot7. Use the dashboard
- Open
https://mon.example.comin a browser. - Paste your API key and press Sign in.
- Theme: click Theme: Auto in the top bar to cycle Auto (follows your computer), Light and Dark. The choice is remembered in that browser only. The sign-in page has the same button.
- The page refreshes every 3 seconds. Sign out removes the key from the browser; closing the tab also does.

| Badge | Meaning |
|---|---|
| ok | All values below 85% and all watched services active |
| warning | CPU, memory or a disk is at 85% or more |
| critical | 95% or more, or a watched service is down |
| Unreachable | The browser cannot reach the server at all (server or network down) |
Live logs tab
Click Live logs next to Overview to watch every request that reaches the agent in realtime (refreshes every 2 s). Each row shows time, client IP, method, path, auth result (authenticated, bad key, public, rate limited, locked out), status, duration and size. Click a row to see the full request and response headers and a preview of the response body.

- Filters: status class, auth result, free text (IP, path, user-agent). "Hide routine dashboard polling" is on by default so your own refreshes do not flood the list.
- Pause / Resume, Clear view, Export JSON are in the toolbar.
- Use it to spot attacks: many bad key rows from one IP, scans for
/wp-login.phpor/admin, or locked out entries. - Privacy: API keys, cookies and secret-looking query values are replaced by
[redacted]. The log lives in memory only (last 1000 requests) and is lost when the service restarts. For long-term history usejournalctl -u zabmonitoror the nginx access log.
Cron jobs manager (optional)
The dashboard can run your own scripts on a schedule (for example a daily backup at 12:00 AM) and keep a history of every run: success or failed, when it started, how long it took, the exit code and the full output. You write the schedule and the bash script in the browser.
install.sh. The cron runner is built into it: you never download, copy or start anything by hand. The installer asks whether you want cron jobs; if you say no it continues with the next step and installs nothing for cron, and if you say yes it asks the cron questions (which user, whether typing scripts is allowed), unpacks the runner, creates its service and generates the cron key. Turn it on or off later with the same script.Turn it on
The installer asks "Enable the Cron Jobs manager?" (default: no). Or later:
sudo ./install.sh cron-enable # asks which users jobs may run as; shows a new cron key once
sudo ./install.sh cron-disable # stops the scheduler; jobs and history are kept
sudo ./install.sh regen-key --cron # replace only the cron keyUnattended: sudo ZABMONITOR_KEY=... ./install.sh -y --webserver nginx --domain mon.example.com --ssl --cron --cron-users root,backup (the cron key is generated and shown once, or comes from ZABMONITOR_CRON_KEY).
The questions the installer asks
Enable the Cron Jobs manager? [y/N]: y
Which system user should cron jobs run as? (every job names the user it runs as; only users allowed here can be chosen)
1) create a new low-privilege user - the default and recommended: no login, no password, no sudo (name: zabcron)
2) root - FULL control of this server (see the warning)
3) an existing user (type the name)
Choice [1]: 1
Name for the new user [zabcron]:
Typing scripts in the dashboard (the shell code box):
yes = whoever holds both keys can write any script text in the browser; it runs as the job's user
no = only script FILES that already exist on the server (owned by root, not writable by others) can be scheduled;
the strictest choice: new code can then only be added on the server itself
Allow typing scripts in the dashboard? [Y/n]:
Cron key (a second key, needed on top of the API key to open the Cron jobs tab; it is NOT a Linux password):
1) generate a strong random key (recommended)
2) enter my own key
Choice [1]:Choice 1 (a new low-privilege zabcron user) is the default because a low-privilege user is the safer choice; root is still available (choice 2) and the installer warns when it is allowed. See Users, passwords and permissions for how to prepare the user.
How it is protected
| Protection | What it means |
|---|---|
| Off by default | Nothing runs commands unless you enable it. |
| A second key | The cron key is different from the monitoring API key. Uptime checkers or read-only viewers that have the API key cannot touch cron. The dashboard asks for the cron key when you open the Cron jobs tab (kept only in that browser tab). Both keys are needed for every cron request. |
| Brute-force lockout | Wrong cron keys count toward the same lockout as wrong API keys (5 tries, 15 minutes), and the counters cannot be reset by other requests. |
| HTTPS only | The installer refuses to enable it over plain HTTP, and switches it off again if the certificate fails. (Allowed without SSL only when the agent listens on localhost, for use through an SSH tunnel.) |
| Allowed users | Jobs can only run as the system users you allow (chosen at install time, changed with cron-users; stored in the root-owned config). In the dashboard you type the user name for each job, but only an allowed name is accepted and the web panel can never add one. The installer can create a locked-down low-privilege user for you. |
| Typing scripts is a permission | At install time you decide whether scripts may be typed in the dashboard at all. If not, only script files that already exist on the server (owned by root, not writable by others) can be scheduled, so new code can only be added on the server itself. |
| Separate process (installed for you) | Jobs are run by zabmonitor-cron, a second small process that install.sh sets up automatically when you answer yes. It is separate on purpose, so that breaking into the web part does not give the attacker the part that runs commands. The web agent stays unprivileged and sandboxed and only forwards requests to it over a local socket that only the agent may use. |
| Limits | Per-job timeout (default 60 min, max 24 h), at most 4 jobs at once, a job never overlaps itself, script size 100 KB, output keeps the last 64 KB. |
| Audit | Every create, edit, delete, enable, disable and "run now" is logged with the client IP (journal and the audit log in the database). Scripts and outputs are never written to the request log. |
Typing scripts or using script files
There are two ways to give a job its script. Both exist so that you can choose how strict the server is.
| Write the script here (shell code box) | Run a script file on the server | |
|---|---|---|
| How | You type or paste the bash script in the dashboard. | You enter the full path, for example /usr/local/bin/backup.sh. |
| Who can add new code | Anyone with both keys, from the browser. | Only someone who can already write that file on the server (root). |
| Where it lives | In ZabMonitor's protected database /var/lib/zabmonitor/cron.db (readable by root only). While a run is going it is written to /run/zabmonitor-cron/jobs/run-<number>.sh (owned by the run-as user, mode 0500) and deleted when the run ends. The dashboard shows these paths. | At the path you gave. It is read where it is; nothing is copied. |
| Safest for | Convenience, quick jobs, trusted admins. | Servers where the dashboard must never be able to introduce new code. |
The install-time permission. The installer asks "Allow typing scripts in the dashboard?" (default yes; flag --cron-no-inline for no). If you answer no, the shell code box is hidden in the dashboard and only script files can be scheduled; the page tells people why. If you answer yes, both options are available. Change it any time, with no restart:
sudo ./install.sh cron-inline off # only script files from now on
sudo ./install.sh cron-inline on
sudo ./install.sh cron-inline # show the current settingWhen typing is switched off, jobs that were typed earlier stop running (their runs are recorded as failed with an explanation) until you switch it on again or change them to script files.
The rules for a script file
A job that runs a file is only as safe as that file. ZabMonitor therefore checks the file when you save the job and again before every run, and refuses it when:
- the path is not absolute and clean (
backup.sh,/a/../b.sh,//are refused); - it is not a real regular file, or the path goes through a symbolic link;
- the file is not owned by root or by the user the job runs as (a root job only accepts root-owned files);
- the file or any folder above it can be changed by group or others (this refuses
/tmp, shared folders and world-writable files); - (optional) it is outside the folders listed in
cron_script_dirsin the config.
Install a script so that it passes (here a job running as zabcron):
sudo install -m 0750 -o root -g zabcron backup.sh /usr/local/bin/backup.sh
# owner root (nobody else can change it), group zabcron may read and run it, others nothing
sudo -u zabcron /usr/local/bin/backup.sh # try it as the job user firstA file whose first line is #!/bin/bash or #!/bin/sh is run with bash. Any other interpreter (for example #!/usr/bin/env python3) is run directly, so the file then needs the execute bit (chmod +x).
Create a job

- Open the dashboard, go to Cron jobs, enter the cron key.
- Click + New job. Give it a name, type the user name it should run as in Run as (it is pre-filled with
zabcronwhen that user is allowed, otherwise the first non-root allowed user; you can change it; the allowed names are shown; anything else is refused; a red warning appears forroot) and set a timeout. - Schedule: every N minutes, every hour, every day at a time, every week on a weekday, every month on a day, or a custom cron expression (
m h dom mon dow, with lists, ranges, steps, names likemon-friand macros like@daily). The page shows the next 5 run times so you can check it. Choose the Schedule time zone too: Server time (the default), UTC, or a named zone such asAsia/Tokyo. "Daily at 00:00" inAsia/Tokyoruns at midnight in Tokyo whatever the server's own zone is, with no change to the server. The preview shows the next runs in that zone. - What to run: either write the script in the shell code box (one command or a whole script), or run a script file that already exists on the server by entering its full path (for example
/usr/local/bin/backup.sh). If typing was switched off at install time only the file option is shown. Example for a daily backup at midnight:Script#!/bin/bash set -euo pipefail tar czf /backup/site-$(date +%F).tar.gz /var/www find /backup -name 'site-*.tar.gz' -mtime +14 -delete - Already have a crontab line or a script with a cron schedule? Open Paste a crontab line, or a whole cron + script and paste it, for example
0 0 * * * /usr/local/bin/backup.sh(optionally followed by more script lines, or a# cron: 0 0 * * *comment). The form is filled in for you. - Save job. Use Run now to test it immediately.
A script that starts with a non-bash shebang (for example #!/usr/bin/env python3) is run with that interpreter. The job runs in the home directory of the chosen user with a minimal environment (PATH, HOME, USER) plus ZABMONITOR_JOB_NAME and ZABMONITOR_RUN_ID. A job succeeds when the script exits with code 0.
History: did my backup run, and did it work?
Click History on a job. You see totals and success rate, a day-by-day table (how many runs succeeded or failed each day), and the list of every run. Click a run to read its output. The jobs list also shows a coloured strip for the last 14 days: green = all successful, red = a failure, orange = missed.
Time zones: every job shows its own
Each job has its own Schedule time zone (set in the job editor): Server time (the default), UTC, a fixed offset such as UTC+09:00, or a named zone such as Asia/Tokyo. That zone decides when the job runs and it is also the zone in which everything about that job is shown: the next run time in the jobs list, the times of its runs, the day-by-day table, the 14-day strip and the date range you filter by. The zone is written next to the schedule in the jobs list, and on the job's history page. There is no separate display time zone to switch.
Filter the history by date range
- Date range: Last 24 hours, Today, Yesterday, Last 7 / 30 / 90 days, All kept history, or Custom range with a "From" and "To" date and time (to the minute). The totals, the day-by-day table and the run list all follow the range. "Today", "Yesterday" and the From/To you type are read in the job's own time zone, so a run at 23:30 UTC belongs to the next day for a job set to Asia/Tokyo. Daylight saving is handled.
- Result: show only Successful, Failed, Missed, Skipped or Running runs.
- Each job keeps its newest 500 runs (90 days). If a range contains that many, a note says so: narrow the range to look at older runs.
| Result | Meaning |
|---|---|
| Success | The script exited with code 0. |
| Failed | Non-zero exit code (shown), or the script was killed by a signal. |
| Timed out | It exceeded the job's timeout and was stopped. |
| Missed | The server or the cron service was not running at the scheduled time, so the run was not started. |
| Skipped | The previous run of the same job was still running, or too many jobs were running. |
| Running | In progress; open it to see the output so far. |
History is kept for 90 days and at most 500 runs per job, in /var/lib/zabmonitor/cron.db (readable by root only). Times use the server's time zone; the tab shows which one.
Good to know
- If the server was off at the scheduled time, the run is not made up afterwards; it is recorded as Missed.
- Daylight saving: a daily job at a time that does not exist (02:30 on the spring-forward day) runs once, at the shifted time; a time that happens twice (01:30 on the fall-back day) runs once. Frequent jobs (for example every 15 minutes) skip the repeated hour on the fall-back day, like normal cron on most systems.
- Zone names (
Asia/Tokyo) need Python 3.9 or newer and the system time zone database (the installer addstzdataif missing). If either is missing, the editor offers fixed offsets such asUTC+09:00instead. Fixed offsets never change for daylight saving. - Changing the server's own time zone is a system setting, not a dashboard setting:
sudo timedatectl set-timezone Asia/Tokyo(this affects the whole server, and every job whose schedule uses "Server time"). sudo ./install.sh disableturns the dashboard off but the cron runner keeps running your scheduled jobs. Stop them withcron-disable.- Uninstall keeps your jobs and history by default;
uninstall --purge(or answering yes) deletes/var/lib/zabmonitor. - Check the service with
systemctl status zabmonitor-cronandjournalctl -u zabmonitor-cron.
Users, passwords and permissions for cron jobs
Every job runs as a Linux system user. What a job can do is exactly what that user may do, so choosing and preparing the user is the most important safety decision for the Cron Jobs manager. This chapter explains the choices and shows the normal Linux commands. Replace zabcron with your own user name. All commands are for a root shell or sudo.
1. Which user should jobs run as?
| Choice | Use it when | Risk if someone gets both keys |
|---|---|---|
| root | The job really needs full control: installing packages, restarting services, reading everything. | Full control of the server. Any command, any file. |
A new low-privilege user (the installer's default and recommended; named zabcron) | Backups, cleanups and reports. You give the user only the access the jobs need. | Limited to what that user was given. Cannot change the system. |
| An existing user | The job must write files owned by an application user (for example www-data). | Whatever that user can do. Check its groups first (see below). |
The installer asks this question when you enable the Cron Jobs manager. Non-interactive: nothing given = --cron-create-user zabcron; or --cron-users root, or --cron-users backup. You can combine them, and change the list later (see "Add, list and remove users").
In the dashboard every job has a Run as box where you type the user name. For a new job it is pre-filled with zabcron (the low-privilege user the installer creates) when that user is allowed, otherwise with the first allowed user that is not root, so root is never chosen by accident. Only names on the allowed list are accepted; the page shows the list. A person using the dashboard can never add a user: that needs the server's root account, on purpose.
2. The low-privilege user the installer creates
If you choose "create a new low-privilege user" (default name zabcron) the installer makes an account that can do nothing except run your jobs:
- A system account with its own private group and no other groups. It is not in
sudo,wheel,dockeror any group that grants extra power. - No login: its shell is
/usr/sbin/nologinand no password is set (the password field is locked), so nobody can log in as it by SSH or at the console. - No sudo rights (the installer checks this when
sudois installed). - A private working folder
/var/lib/zabcron(mode0700: only that user and root can enter it). Jobs start in this folder.
It starts with almost no access: it can read files that are readable by everyone (such as /usr/bin and most of /etc), it can write only inside its own folder, and it can run programs. You then give it exactly the access your jobs need (section 4). Check the result at any time:
id zabcron # uid, its own group only
getent passwd zabcron # shell must end in nologin
sudo passwd -S zabcron # second field L = password locked
sudo -l -U zabcron # must say: not allowed to run sudo
ls -ld /var/lib/zabcron # drwx------ zabcron zabcron3. Add, list and remove users later
sudo ./install.sh cron-users list # who may be chosen, with uid, shell and groups (warns about powerful users)
sudo ./install.sh cron-users create reports # make a new locked-down user and allow it
sudo ./install.sh cron-users add backup # allow a user that already exists
sudo ./install.sh cron-users remove backup # stop allowing it (jobs using it will fail until you change them)Changes apply immediately, no restart. The list lives in /etc/zabmonitor/config.json (cron_run_as), which only root can edit. If a job's user is removed from the list, its runs are recorded as Failed: not started, the user is no longer allowed instead of running.
4. Create your own user by hand (the Linux way)
You do not have to use the installer's account. A custom user for backups on Debian/Ubuntu or RHEL/Alma:
# Debian / Ubuntu
sudo adduser --system --group --home /var/lib/backupjob --shell /usr/sbin/nologin backupjob
# Alma / Rocky / RHEL / Fedora / openSUSE
sudo useradd --system --user-group --home-dir /var/lib/backupjob --shell /sbin/nologin backupjob
sudo install -d -m 0700 -o backupjob -g backupjob /var/lib/backupjob # its private folder
sudo ./install.sh cron-users add backupjob # let ZabMonitor offer it--system makes a service account (low numeric id, no mail box, no aging). nologin as shell stops interactive logins. A system account has no password until you set one.
5. Passwords: set, reset, lock, expire
su as that user, and then also give it a real shell.| Task | Command |
|---|---|
| Set or reset a password (root needs no old password) | sudo passwd backupjob |
| Lock the password (nobody can use it to log in) | sudo passwd -l backupjob (undo: sudo passwd -u backupjob) |
| Show the password state | sudo passwd -S backupjob (P usable, L locked, NP none) |
| Force a change at the next login | sudo passwd -e backupjob |
| Show ageing rules | sudo chage -l backupjob |
| Password valid for 90 days at most / never expires | sudo chage -M 90 backupjob / sudo chage -M -1 backupjob |
| Give a login shell only if a person needs it (not recommended for job users) | sudo usermod -s /bin/bash backupjob (back: -s /usr/sbin/nologin) |
Choose a long random password (openssl rand -base64 24) and never reuse one. The ZabMonitor keys are not Linux passwords: replace the monitoring key with sudo ./install.sh regen-key and the cron key with sudo ./install.sh regen-key --cron; the old key stops working at once.
6. Permissions: give the user exactly what the job needs
Linux decides by three questions: who owns the file (owner), which group it belongs to (group) and everybody else (others). Each gets r read (4), w write (2), x execute/enter (1). A folder needs x to be entered and r to be listed.
| Mode | Meaning | Typical use |
|---|---|---|
0700 / rwx------ | owner only | a job user's private folder, secrets |
0750 / rwxr-x--- | owner all, group read+enter, others nothing | script files and shared work folders |
0644 / rw-r--r-- | owner write, everyone read | ordinary files |
0600 / rw------- | owner read+write only | password files, keys |
0777, 0666 | everyone can change it | never use |
Typical recipes for a job user called backupjob:
# a) READ a website's files (a backup job): add a read-only ACL, existing and future files
sudo setfacl -R -m u:backupjob:rX /var/www/site
sudo setfacl -R -d -m u:backupjob:rX /var/www/site
# b) WRITE backups to one folder only
sudo install -d -m 0750 -o backupjob -g backupjob /backup
# c) group-based access (several jobs/users share one data set)
sudo groupadd datareaders
sudo usermod -aG datareaders backupjob
sudo chgrp -R datareaders /srv/data && sudo chmod -R g+rX /srv/data
# d) a database dump: make a read-only database account and keep its password in a private file
sudo install -m 0600 -o backupjob -g backupjob /dev/null /var/lib/backupjob/.my.cnf
sudoedit /var/lib/backupjob/.my.cnf # [client] user=... password=... (never put it in the script)
# e) ONE privileged command (never full sudo): an exact line in a sudoers drop-in
sudo visudo -f /etc/sudoers.d/backupjob # add: backupjob ALL=(root) NOPASSWD: /usr/bin/systemctl restart nginx
sudo -l -U backupjob # shows exactly what it may runTest as the user, before you schedule anything:
sudo -u backupjob -H bash -c 'id; ls -l /var/www/site | head; touch /backup/test && echo write-ok; rm -f /backup/test'
sudo -u backupjob test -r /srv/data/file && echo "can read"
namei -l /srv/data/file # shows which folder in the path blocks access
getfacl /var/www/site # shows ACL entriesJobs start with umask 022 (new files are readable by everyone). Put umask 077 at the top of a script whose output must stay private. Group changes (usermod -aG) apply to every new run automatically.
sudo/wheel (full control), docker/lxd (equals root), disk, shadow, adm; a NOPASSWD: ALL sudoers line; owning a script that root runs; write access to /etc, /usr or other users' homes. sudo ./install.sh cron-users list warns about these. Review with id USER and sudo -l -U USER.7. Remove a user
sudo ./install.sh cron-users remove backupjob # ZabMonitor stops offering it
sudo userdel backupjob # deletes the account, keeps /var/lib/backupjob and its files
sudo userdel -r backupjob # deletes the account AND its home folder (check for backups first)uninstall --purge deletes a user the installer created, but keeps its home folder (it may hold your backups).
8. Use the API
Send the key in a header. Never put it in the URL.
curl -H "X-API-Key: KEY" https://mon.example.com/api/v1/status
curl -H "Authorization: Bearer KEY" "https://mon.example.com/api/v1/metrics?history=1"| Endpoint | Auth | Returns |
|---|---|---|
GET /healthz | none | {"status":"ok"} only |
GET /api/v1/status | key | status, hostname, uptime, cpu/memory/disk percent, alerts |
GET /api/v1/logs, /api/v1/logs/<id> | key | Recent request log (?since=<id>&limit=<n>) and full detail of one entry |
GET /api/v1/metrics | key | Full detail: CPU, load, memory, swap, disks, network, temperature, services, top processes. ?history=1 adds ~6 minutes of samples |
Response codes
| 200 | OK |
|---|---|
| 401 | Missing or wrong key |
| 429 | Rate limited, or IP locked out after 5 wrong keys (15 minutes) |
| 503 | Starting up, or too many connections |
Example: alert script on another machine
#!/bin/sh
s=$(curl -fsS -m 10 -H "X-API-Key: $KEY" https://mon.example.com/api/v1/status) || { echo "DOWN"; exit 2; }
echo "$s" | grep -q '"status":"ok"' || echo "PROBLEM: $s"For external uptime services (UptimeRobot, etc.) use /healthz, which needs no key.
9. Day-to-day operations
| Task | Command |
|---|---|
| Live logs | sudo journalctl -u zabmonitor -f |
| Failed logins | sudo journalctl -u zabmonitor | grep AUTH |
| Who cron jobs may run as | sudo ./install.sh cron-users list | add NAME | create NAME | remove NAME |
| Allow / forbid typing scripts in the dashboard | sudo ./install.sh cron-inline on|off |
| Cron manager on / off / new cron key | sudo ./install.sh cron-enable, cron-disable, regen-key --cron |
| REST API on / off | sudo ./install.sh rest-enable, rest-disable (see REST API reference) |
| REST API tokens: list, create, revoke | sudo ./install.sh rest-token list, rest-token create NAME --rest-scopes metrics:read --rest-days 90, rest-token revoke ID (revoking works at once, no restart) |
| Change the server name | sudo ./install.sh rename --name "New name" |
| Turn off / on temporarily | sudo ./install.sh disable / sudo ./install.sh enable (see section 12) |
| Restart | sudo systemctl restart zabmonitor (also clears all IP lockouts) |
| Change / rotate key | sudo ./install.sh regen-key (old key stops working immediately) |
| Edit settings | sudo nano /etc/zabmonitor/config.json then restart. Options: watch_services, rate_limit_per_min, max_failed_auth, lockout_seconds, public_health |
| Update the program | Upload the new folder, then: Terminal |
Self-healing
- A crash restarts the agent after 3 seconds, indefinitely.
- A hang is detected by the watchdog and the agent is restarted within 60 seconds.
- nginx/apache restart themselves on failure.
- Certificates renew automatically (systemd timer or cron).
Test it: sudo pkill -9 -f zabmonitor.py, wait a few seconds, then check systemctl status zabmonitor.
10. Hardening checklist
ZabMonitor is hardened by default (read-only, unprivileged, sandboxed, hashed key, lockout, strict headers). Secure the server around it too:
- HTTPS enabled (4.4) and
curl -I http://domainredirects - Strong random API key stored in a password manager
- Firewall allows only 22 and your web ports (80/443 by default). Example:
sudo ufw allow OpenSSH && sudo ufw enable. The agent port 8787 must not be public:ss -ltn | grep 8787should show127.0.0.1 - SSH uses keys only (
PasswordAuthentication no) and root login disabled - Automatic security updates (
unattended-upgradeson Ubuntu/Debian,dnf-automaticon RHEL family) - Optional:
fail2banto ban repeated bad logins (the agent logsAUTH-FAILlines to the journal) - Optional: restrict the domain to your office IP in nginx with
allow x.x.x.x; deny all; - Rotate the key periodically and when someone with access leaves
sudo ./install.sh statussays client addresses: vouched for by the web server (see below)
10.1 Client addresses and the proxy secret
The lockout after wrong keys, the request limit, the audit trail and a REST token's address limit all depend on knowing the real address of each caller. nginx/apache pass it to the agent in a header, and the agent believes it only if the same request also carries a secret that only the web server knows. The installer generates that secret on every install, stores it in /etc/zabmonitor/config.json and in the ZabMonitor site file (/etc/nginx/conf.d/zabmonitor.conf, or the apache site and its -le-ssl twin), and makes the site file readable by root only (mode 0600; nginx and apache read their configuration as root).
- Why it matters: without the secret, any program running on the same machine (another user, a hacked website on that host, a cron job) could talk to the agent directly and claim any address: dodge the lockout, lock out someone else, or get past a token's address limit. With the secret it cannot; its requests are counted as coming from
127.0.0.1. - Installs from before this protection have no secret.
sudo ./install.sh statussays so; re-runsudo ./install.sh(it keeps your settings but issues new keys) to add it. - With
--webserver nonethere is no proxy in front, so there is no secret: callers reach the agent directly. - If you edit the ZabMonitor site file by hand or another tool rewrites it, keep the
proxy_set_header X-ZM-Proxy "..."(nginx) orRequestHeader set X-ZM-Proxy "..."(apache) line and keep the file private (sudo chmod 600). If the line is missing, every visitor appears to come from127.0.0.1and shares one request limit and lockout.
11. Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Certificate request failed | DNS not pointing here yet, or port 80/443 blocked (also check the cloud provider firewall). Fix, then run sudo certbot --nginx -d mon.example.com (or --apache). |
| Browser shows 502 Bad Gateway | Agent is down: systemctl status zabmonitor, journalctl -u zabmonitor -n 50. On RHEL family with SELinux: sudo setsebool -P httpd_can_network_connect 1. |
| "Invalid API key" | Wrong key (it is case-sensitive, no spaces). Run regen-key if lost. |
| 429 / "locked out" | 5 wrong keys from your IP. Wait 15 minutes or sudo systemctl restart zabmonitor. |
| "Port ... is already used by ..." | Another program owns that port. Pick the suggested free port, or choose one with --port, --http-port or --https-port. Find the owner yourself with sudo ss -ltnp | grep :PORT. |
| nginx/apache "could not start" during install | Usually port 80 (the distro's default site) or your chosen port is taken by another program. Free it or run the installer again with other ports; the installer removes its own site file before stopping. |
| Browser shows a certificate error after the redirect | The redirect points to the wrong port or another site's certificate. Check that you opened https://mon.example.com:YOURHTTPSPORT, and that the HTTPS port in the nginx/apache site matches the one you chose. |
| Certificate fails with a custom HTTP port | Let's Encrypt validates on port 80 only. Forward port 80 to your HTTP port, or use port 80 for ZabMonitor's site (several sites can share it by domain name). |
| "Python 3.7+ required / could not get Python" | OS is too old. Use a supported release. |
bad interpreter / ^M errors | Windows line endings: sed -i 's/\r$//' install.sh agent/*.py |
| nginx/apache config test failed during install | Installer removed its own config. Read the printed error; usually a conflicting server_name or missing Apache module. Existing sites are untouched. |
Watched service shows unknown / inactive | Wrong unit name. Check systemctl list-units --type=service and edit watch_services. |
| "run_as must be one of: ..." | The typed user is not on the allowed list. Check sudo ./install.sh cron-users list and add it with cron-users add NAME (or create it with cron-users create NAME). |
| "the script file can be changed by other users" / "owned by another user" | The script file or one of its folders is writable by group/others or owned by someone else. Fix with sudo chown root:zabcron FILE && sudo chmod 0750 FILE and chmod go-w on the folders. Files in /tmp are always refused. See "The rules for a script file". |
| Run is "Failed: not started" with "no longer allowed" or "switched off" | The job's user was removed from the list, or typing scripts was switched off while the job still has a typed script. Change the job, or use cron-users add / cron-inline on. |
| A job fails with "Permission denied" | The job user lacks access to a file or folder. Test with sudo -u USER -H bash -c '...', look at namei -l PATH, then grant exactly that access (chapter "Users, passwords and permissions"). |
REST API: 401 invalid or missing token | The token is wrong or cut off (it looks like zmt_<8 hex>_<40 characters>), is sent in the wrong place (it must be Authorization: Bearer ..., never in the URL), or you used the dashboard API key. After 5 wrong tokens in 5 minutes the address is locked out for 15 minutes (429). |
REST API: 401 this token has expired / was revoked | Create a new token: sudo ./install.sh rest-token create NAME. rest-token list shows each token's state and expiry. |
REST API: 403 | Either the token lacks the scope (the answer names required_scope; make a new token with it), or it is limited to other IP addresses (rest-token list shows them). |
REST API: 404 the REST API is not enabled / the cron manager is not enabled | Turn it on: sudo ./install.sh rest-enable (or cron-enable for the cron endpoints). The installer only enables it over HTTPS. |
| Everyone locked out at once / all clients share one request limit after editing the proxy config | The X-ZM-Proxy header line was lost from the ZabMonitor site file, so the agent no longer trusts the client addresses the proxy passes. Re-run sudo ./install.sh (it rewrites the site file with the current secret) or restore the line from /etc/zabmonitor/config.json (proxy_secret). |
| Dashboard blank after login | Open the browser console (F12). If a CSP error appears, a custom proxy rule is rewriting headers. |
12. Disable, remove and delete everything
Three levels, from reversible to complete. All of them run from the folder you installed from.
| Goal | Command | What happens |
|---|---|---|
| Turn off temporarily | sudo ./install.sh disable | Stops the service, disables start at boot, and takes the site out of nginx/apache. The domain no longer serves ZabMonitor. Your config, API key and certificate are kept. |
| Turn back on | sudo ./install.sh enable | Restores the site and starts the service. Same API key as before. |
| Remove ZabMonitor | sudo ./install.sh uninstall | Deletes the service, program files, config, API key, the zabmonitor system user and the proxy site. It asks whether to also delete the certificate, packages and firewall rules (default: no). |
| Delete everything | sudo ./install.sh uninstall --purge | Everything above plus the Let's Encrypt certificate, the firewall ports it opened, and the nginx/apache/certbot packages that this installer added. Things that were already on the server before are never removed. |
12.1 Disable (reversible)
sudo ./install.sh disable
sudo ./install.sh status # enabled: disabled active: inactive
sudo ./install.sh enable # later, to switch it back onenable before the certificate expires (about 90 days) if you want to use it again.12.2 Full removal, step by step
- Run the uninstaller. Use
--purgeto remove the certificate, firewall rules and installed packages too.Non-interactive:Terminalsudo ./install.sh uninstall --purgesudo ./install.sh uninstall --purge -y(without--purge,-yremoves only ZabMonitor itself). - Cron jobs you created in the dashboard are switched off. The cron runner is stopped and removed, so nothing runs any more. Unless you also chose to delete the jobs and history (or used
--purge), the installer marks every job as disabled in the kept database (/var/lib/zabmonitor/cron.db) and prints how many it paused, so nothing can start by itself if you ever install again and turn the manager on; you re-enable each job on purpose. With--purgethe jobs and their history are deleted. - REST API tokens are deleted with the configuration (
/etc/zabmonitor/tokens.jsongoes away with/etc/zabmonitor), so every token stops working. - What it does, in order: stops the service and kills leftover processes of the
zabmonitoruser; deletes the systemd unit, the restart drop-ins for the web server and the renewal cron file; deletes/opt/zabmonitorand/etc/zabmonitor; removes the nginx/apache site and reloads the web server; then (only if you chose it) deletes the certificate, closes the firewall ports, and removes the packages it installed; finally deletes the system user. - It checks its own work. At the end it reports
ZabMonitor completely removed, or lists anything still present (unit, files, user, listening port, proxy site, certificate). - Outside the server, finish by hand:
- Delete the DNS record (
mon.example.com) at your DNS provider. - Remove the inbound 80/443 rules at your cloud provider's firewall if nothing else needs them.
- Delete the API key from your password manager and from any scripts or uptime monitors that used it.
- Delete the DNS record (
12.3 Confirm it is really gone
systemctl status zabmonitor # Unit zabmonitor.service could not be found
ls /opt/zabmonitor /etc/zabmonitor # No such file or directory
id zabmonitor # no such user
sudo ss -ltnp | grep 8787 # no output
sudo certbot certificates # your domain is not listed (after --purge)
curl -I https://mon.example.com # fails, or shows another site; never the dashboard12.4 What is deliberately not removed
- nginx, apache, certbot and their data if they were already installed before ZabMonitor, or if you did not use
--purge. Removing the packages the installer added is only possible in the same uninstall run that deletes ZabMonitor (it remembers what it installed in/etc/zabmonitor/state.env, which uninstall deletes), so decide then: use--purge, or remove them yourself later. Python and curl are never removed (other software uses them). - The SELinux setting
httpd_can_network_connect(RHEL family). Undo withsudo setsebool -P httpd_can_network_connect 0if nothing else needs it. - Old log lines in the system journal. To clear them:
sudo journalctl --vacuum-time=1s(this clears logs of all services). - The DNS record and cloud firewall rules (see step 4 above).
- Your cron jobs and their history in
/var/lib/zabmonitorunless you used--purgeor answered yes (they are your data).
12.5 Manual removal (if the installer folder is gone)
sudo systemctl disable --now zabmonitor
sudo rm -f /etc/systemd/system/zabmonitor.service /etc/cron.d/certbot-zabmonitor
sudo rm -f /etc/systemd/system/*.service.d/zabmonitor-restart.conf
sudo systemctl daemon-reload
sudo rm -rf /opt/zabmonitor /etc/zabmonitor
# proxy site: nginx
sudo rm -f /etc/nginx/conf.d/zabmonitor.conf* && sudo nginx -t && sudo systemctl reload nginx
# proxy site: apache on Debian/Ubuntu
sudo a2dissite zabmonitor; sudo rm -f /etc/apache2/sites-available/zabmonitor.conf* && sudo systemctl reload apache2
# proxy site: apache on RHEL family
sudo rm -f /etc/httpd/conf.d/zabmonitor.conf* && sudo systemctl reload httpd
sudo certbot delete --cert-name mon.example.com # optional: delete the certificate
sudo userdel zabmonitorReference: where things live
| Path | Purpose |
|---|---|
/opt/zabmonitor/ | Program and dashboard files (root-owned, read-only to the service) |
/etc/zabmonitor/config.json | Settings and hashed key (mode 0640) |
/etc/zabmonitor/tokens.json | REST API tokens: only salted hashes, names, scopes, expiry, allowed addresses (mode 0640, root:zabmonitor; read again whenever it changes) |
/etc/systemd/system/zabmonitor.service | Service definition with sandboxing and watchdog |
/etc/nginx/conf.d/zabmonitor.conf | nginx proxy (apache: sites-available/, conf.d/ or vhosts.d/) |
/etc/letsencrypt/ | Certificates (managed by certbot) |
Terminal screens in this guide are examples written from the installer's actual messages, not captures from a live server. Dashboard pictures come from a demo with simulated numbers.
Get ZabMonitor free
Ask us for the files, and tell us which Linux system you will install it on.
