No description
  • Go 90.8%
  • Nix 9.2%
Find a file
2026-03-24 17:53:55 +01:00
config convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
internal fix: rename ambiguous json field to data 2026-03-24 17:53:55 +01:00
middleware refactor: large rework of codebase, separate logic out from main into packages, improve testability and all around improvements without adding or removing any functionality 2026-02-07 23:51:05 +01:00
notification fix: populate previously smtp error in mail protocol 2026-03-24 17:52:11 +01:00
.gitignore convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
config.yaml convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
flake.lock Initial commit 2026-01-31 14:57:23 +01:00
flake.nix convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
go.mod convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
go.sum convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
LICENSE Run file parsing async 2026-02-20 00:02:05 +01:00
main.go fix: exit on startup auth test failure instead of silently continuing 2026-03-06 17:11:07 +01:00
README.md convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00
service-uptime-center.nix convert config to yaml instead of toml for better nix module support when writing the file from nix declaratively 2026-02-24 00:36:24 +01:00

Service Uptime Center

A lightweight, self-hosted service monitoring system that tracks heartbeats from your services and sends notifications when they go down.

Features

  • Heartbeat Monitoring: Services send periodic pulses via HTTP POST
  • Configurable Timeouts: Set individual timeout thresholds per service
  • Notification Channels: Email and ntfy.sh
  • Fallback Notifications: Optional secondary notifiers when primary ones fail
  • Self-Monitoring: The system monitors itself and reports its own health

Quick Start

1. Configuration

Create a config.yaml file, you only need to configure the notifiers that you plan on using, the rest can be left blank:

notifiers:
  - mail
fallback_notifiers:
  - ntfy

notification_settings:
  mail:
    from: "alerts@yourdomain.com"
    to: "you@yourdomain.com"
    smtp:
      outgoing: "smtp.yourdomain.com"
      port: 587
      user: "alerts@yourdomain.com"
      password_file: "path/to/file"
  ntfy:
    server: "https://ntfy.sh"
    topic: "service-alerts"
    token_file: "path/to/token-file" # optional

service_settings:
  services:
    - name: "web-app"
      heartbeat_timeout_duration: "12h"
    - name: "api-server"
      heartbeat_timeout_duration: "12h"

time_settings:
  incident_poll_frequency: "2h"
  successful_report_cooldown: "24h"

2. Create Password Files

Create an authentication token file:

echo "your-secret-token" > auth-token.txt
chmod 600 auth-token.txt

If using email notifications, create an SMTP password file:

echo "your-smtp-password" > smtp-password.txt
chmod 600 smtp-password.txt

If using ntfy with a token, create a token file:

echo "your-ntfy-token" > ntfy-token.txt
chmod 600 ntfy-token.txt

3. Run the Service

./service-uptime-center --config-path config.yaml --pw-file password/file/path.txt --port 8080

4. Configure Your Services

Have your services send heartbeat pulses:

curl -X POST http://localhost:8080/api/v1/pulse \
  -H "Authorization: Bearer your-secret-token" \
  -H "Content-Type: application/json" \
  -d '{"service_name": "web-app"}'

API Endpoints

POST /api/v1/pulse

Send a heartbeat for a service.

Headers:

  • Authorization: Bearer <token>
  • Content-Type: application/json

Body:

{
  "service_name": "your-service-name"
}

GET /api/v1/health

Check if the monitoring service is running.

License

MIT License - see LICENSE file for details.