Network uptime monitor - Go Lang
  • Go 67.6%
  • HTML 17%
  • JavaScript 8.4%
  • CSS 7%
Find a file
nahakubuilder d574853f66 updated
2026-11-19 18:06:51 +00:00
internal updated 2026-11-19 18:06:51 +00:00
.gitignore first 2026-11-18 17:48:58 +00:00
go.mod first 2026-11-18 17:48:58 +00:00
go.sum first 2026-11-18 17:48:58 +00:00
main.go first 2026-11-18 17:48:58 +00:00
README.md updated 2026-11-19 18:06:51 +00:00

UptimeMon

UptimeMon is a self-hosted uptime monitoring application written in Go. It schedules HTTP(S), TCP, UDP, and ICMP checks, stores latency and packet-loss history in SQLite, and provides a web dashboard, charts, target groups, CSV import/export, multi-user access, and read-only public status pages.

Features

  • HTTP/HTTPS checks with GET or HEAD, expected status codes/ranges, redirect following, and optional TLS certificate verification bypass.
  • TCP connect checks and UDP checks with optional response matching.
  • ICMP echo checks for IPv4 and IPv6.
  • Configurable check interval (1 second to 24 hours), timeout, and 1-10 probes per check.
  • Latency, jitter, packet loss, uptime, and per-target history charts for 1 hour, 6 hours, 24 hours, 7 days, and 30 days.
  • Dashboard with compact and card views, quick enable/disable actions, and live status updates.
  • Groups for organizing checks and granting selected users access to restricted status pages.
  • Public or restricted status pages at /public/<slug> with automatically refreshing status, uptime, latency, jitter, loss, and charts. Pages show target names but not target addresses.
  • Admin and regular-user roles with session-based authentication. Regular users can update their account and open dashboards shared with them.
  • CSV export and validated, all-or-nothing import.
  • Automatic result retention and SQLite schema migrations.

Requirements

  • Go 1.27.3 or newer to build from source.
  • Linux, macOS, or another platform supported by Go and SQLite.
  • For ICMP checks, permission to use ping sockets or raw ICMP sockets. On Linux this usually means either a suitable net.ipv4.ping_group_range value or CAP_NET_RAW. In containers, add the NET_RAW capability if ICMP checks are required.

    run command to allow it for executable: sudo setcap cap_net_raw=ep /path/to/uptimemon or using service:

    [Service]
    AmbientCapabilities=CAP_NET_RAW
    CapabilityBoundingSet=CAP_NET_RAW
    

Quick start

go build -o uptimemon .
chmod +x uptimemon
./uptimemon

The server listens on :8080 and stores its database at data/uptime.db by default. Open http://localhost:8080 and sign in.

The first startup creates an administrator account when no users exist. The default credentials are admin / admin, and the account is prompted to change its password at first login. Change this password immediately. Set UPTIME_ADMIN_USER and UPTIME_ADMIN_PASSWORD before the first startup to create different initial credentials. These two variables remain environment-only because they are used only when the database has no users.

Configuration

On first start, UptimeMon creates data/app.conf from the defaults below and any UPTIME_* environment variables that are set. After the file exists, it is the authoritative configuration source. Environment variables fill only settings missing from the file. The file is written with mode 0600.

Administrators can view and edit the stored settings on the Settings page. Changes are saved to data/app.conf and take effect after UptimeMon restarts. The file uses simple key = value lines and accepts both addr and UPTIME_ADDR-style keys.

Variable Default Description
UPTIME_ADDR :8080 HTTP listen address.
UPTIME_DB data/uptime.db SQLite database path. Parent directories are created automatically.
UPTIME_SESSION_HOURS 72 Session lifetime in hours (1-8760).
UPTIME_RETENTION_DAYS 30 Days of check history to retain (1-3650).
UPTIME_COOKIE_SECURE false Mark session and CSRF cookies Secure. Enable when serving over HTTPS.
UPTIME_MAX_CONCURRENT 32 Maximum concurrent checks (1-512).
UPTIME_TRUST_PROXY false Trust X-Forwarded-Proto and X-Forwarded-For from a reverse proxy.
UPTIME_TLS_CERT empty TLS certificate file. Must be set together with UPTIME_TLS_KEY.
UPTIME_TLS_KEY empty TLS private key file.
UPTIME_LOG_LEVEL info One of debug, info, warn, or error.
UPTIME_ADMIN_USER admin Initial administrator username, used only when the database has no users. Environment-only.
UPTIME_ADMIN_PASSWORD admin Initial administrator password, used only when the database has no users. Environment-only.

When TLS is not terminated by UptimeMon itself, run it behind a reverse proxy and set UPTIME_COOKIE_SECURE=true. If the proxy also supplies client and protocol forwarding headers, set UPTIME_TRUST_PROXY=true.

Checks and status

  • HTTP/HTTPS addresses must be full URLs. The default expected status range is 200-399; use a value like 200 or 200-299 to customize it. Up to 10 redirects are followed. Certificate verification can be disabled per target.
  • TCP checks open a connection to the configured host and port.
  • UDP checks send a payload (default uptimemon-probe) and can optionally wait for a response and require that the response contains a given string.
  • ICMP checks send an echo request to a hostname or IP address.

A target is up when its latest check receives a response. It is degraded when some probes in the latest check were lost, down after a failed check, paused when disabled, and pending before its first result.

For checks with multiple probes, jitter is calculated between consecutive probes in the same check. For single-probe checks, UptimeMon compares the current response time with the previous successful response time.

Intervals can be as short as one second, but must be long enough for the configured timeout and number of probes.

Public status pages

Administrators can create status pages under Public pages. Each page has a unique slug, a Public on/off setting, and an ordered selection of individual targets and/or groups. Group items expand to their current targets, and duplicate targets are shown only once.

  • When Public is on, anyone with the URL can view the page.
  • When Public is off, only administrators and signed-in users in an assigned access group can view the page and its metrics.

Access groups are selected on the status page form. Their member users are managed from the group form. A regular user's home page lists the restricted dashboards shared with them. Administrators always have access and are not listed in group membership.

Each status page provides:

  • /public/<slug> - live dashboard
  • /public/<slug>/targets/<id> - target charts and summary
  • /public/<slug>/status.json - scoped status and metric data
  • /public/<slug>/targets/<id>/metrics - scoped chart data

Status pages expose target names and monitoring metrics, but not target addresses or configuration. They are marked noindex, nofollow. For public pages, treat the slug as shareable information rather than as an authentication secret.

Groups

Groups are created from Groups. A group can contain targets and regular users:

  • Target membership controls which targets a group publishes when selected as content on a status page. A target belongs to at most one group. Deleting a group leaves its targets intact and ungrouped.
  • User membership controls who can open a restricted status page when the group is selected as an access group on that page. Deleting a group removes its status-page access grants.

The same group can be used for content, access, or both. The group form lists the status pages that use it as content or access, making dependencies visible before editing or deleting it. Administrators always have access to every page and do not need to be group members.

CSV import and export

Use Export CSV on the dashboard to download all targets. Imports are validated before anything is written; if any row is invalid, no targets are added. Imports are add-only and do not modify existing targets.

Limits: 8 MiB per file and 1,000 targets per import.

The CSV header is:

name,type,address,port,method,interval_seconds,timeout_ms,samples,enabled,ignore_tls,expected_status,udp_payload,udp_expect_response,udp_response_match

Only name, type, and address are required. Defaults are applied for missing optional columns, and type-specific fields are ignored for other check types.

Data and administration

UptimeMon uses SQLite in WAL mode and applies schema migrations automatically on startup. Check results older than the retention period are removed periodically.

Administrators can manage targets, groups, users, and status pages. Regular users can update their own sign-in details from Account and open status pages shared with them. Changing a password signs out other sessions for that account.

The health endpoint is GET /healthz; it returns 200 when the database is reachable and 503 otherwise.

Production notes

  • Change the initial administrator password and use long, unique passwords.
  • Serve the application over HTTPS and set UPTIME_COOKIE_SECURE=true.
  • Restrict database file access and back up the SQLite database regularly.
  • Grant only the privileges needed for the check types you use. ICMP requires ping or raw-socket permissions; HTTP, TCP, and UDP checks do not.
  • Run behind a reverse proxy if you need TLS termination, access control, or additional network restrictions.

Run as service:

# Create/update the service file:
sudo nano /etc/systemd/system/uptimemon.service

# Content:
[Unit]
Description=UptimeMon uptime monitoring
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=uptimemon
Group=uptimemon
WorkingDirectory=/opt/docker/uptimemon
ExecStart=/opt/docker/uptimemon/uptimemon
Restart=on-failure
RestartSec=5s
UMask=0077

# Allows ICMP checks without root/setcap. Remove these two lines if you
# enable unprivileged ping sockets via net.ipv4.ping_group_range instead.
AmbientCapabilities=CAP_NET_RAW
CapabilityBoundingSet=CAP_NET_RAW

NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/docker/uptimemon/data

[Install]
WantedBy=multi-user.target

# Enable service and check it:
sudo systemctl daemon-reload
sudo systemctl enable --now uptimemon
sudo systemctl status uptimemon
journalctl -u uptimemon -f