Skip to content

wojtczyk/serverload2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

server load

About

Sometimes all you want is a simple self-contained load monitor for your dedicated server or home server.

server load is a small, self-contained Linux load monitor written in Rust. It provides a typed JSON API and a responsive browser dashboard with live load averages, uptime, CPU capacity, and a rolling 24-hour history stored in the open browser tab.

The service is designed to listen on loopback while Apache provides the public URL, optional HTTPS, and optional authentication.

iPhone Desktop
ServerLoad dashboard on iPhone ServerLoad dashboard on desktop

API

GET /api/v1/load returns:

{
  "schema_version": 1,
  "sampled_at": "2026-07-16T12:00:00Z",
  "load_average": {
    "one_minute": 0.12,
    "five_minutes": 0.18,
    "fifteen_minutes": 0.21
  },
  "uptime_seconds": 5097600,
  "logical_cpu_count": 4
}

GET /healthz checks the latest in-memory metrics sample. API responses are never cached by clients. ServerLoad intentionally does not provide JSONP or permissive CORS headers.

Build and run

ServerLoad targets Linux and reads /proc/loadavg and /proc/uptime directly.

cargo build --release
./target/release/serverload

The default listen address is 127.0.0.1:9180. Override it with either:

serverload --listen 127.0.0.1:9200
SERVERLOAD_LISTEN=127.0.0.1:9200 serverload

Binding to a non-loopback address exposes an unauthenticated HTTP service. The recommended production configuration is the loopback default behind Apache.

ServerLoad refuses non-loopback listeners unless the exposure is explicitly acknowledged:

serverload --listen 0.0.0.0:9180 --allow-public-unauthenticated

Metrics are collected in a background task and cached in memory. The default refresh interval is three seconds; use a positive whole number of seconds to override it:

serverload --sample-interval 10

--sample-interval is a command-line option only. SERVERLOAD_LISTEN remains subject to the same non-loopback safety check as --listen.

Install with systemd

sudo install -m 0755 target/release/serverload /usr/local/bin/serverload
sudo install -m 0644 deploy/systemd/serverload.service /etc/systemd/system/serverload.service
sudo systemctl daemon-reload
sudo systemctl enable --now serverload
curl http://127.0.0.1:9180/healthz

The supplied unit uses systemd's DynamicUser support, so no account creation is needed.

Apache

Enable the proxy modules and install one of the examples from deploy/apache:

sudo a2enmod proxy proxy_http headers
sudo install -m 0644 deploy/apache/serverload-http.conf /etc/apache2/sites-available/serverload.conf
sudo a2ensite serverload
sudo apachectl configtest
sudo systemctl reload apache2

Replace serverload.example.com before enabling a configuration.

Optional HTTPS

Use serverload-https.conf, replace its certificate paths, and enable ssl:

sudo a2enmod ssl

The Rust backend remains plain HTTP on loopback; Apache terminates TLS. Certificate provisioning and renewal remain the responsibility of the existing Apache/certificate tooling.

Optional Basic authentication

Use serverload-https-basic-auth.conf and create its password file outside any document root:

sudo htpasswd -c /etc/apache2/serverload.htpasswd your-user

Basic authentication must only be used over HTTPS. The example protects the dashboard, API, and externally proxied health endpoint together.

Development

cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test

The browser polls every five seconds and stores at most 17,280 samples. History is local to the open tab and is reset on refresh.

License

MIT. The dashboard bundles Chart.js, which is also licensed under MIT; see THIRD_PARTY_NOTICES.md.

About

Sometimes all you want is a simple self-contained load monitor for your server.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages