A basic K.I.S.S uptime monitoring tool made in go
  • Go 73.2%
  • HTML 26.8%
Find a file
2025-12-22 18:55:25 -05:00
alerts v1.0 done 2025-12-22 17:29:39 -05:00
api v1.0 done 2025-12-22 17:29:39 -05:00
database v1.0 done 2025-12-22 17:29:39 -05:00
monitors Fix crash with HTTP monitor 2025-12-22 18:55:25 -05:00
static_html v1.0 done 2025-12-22 17:29:39 -05:00
types v1.0 done 2025-12-22 17:29:39 -05:00
.gitignore v1.0 done 2025-12-22 17:29:39 -05:00
config.json v1.0 done 2025-12-22 17:29:39 -05:00
go.mod v1.0 done 2025-12-22 17:29:39 -05:00
LICENCE.txt v1.0 done 2025-12-22 17:29:39 -05:00
main.go v1.0 done 2025-12-22 17:29:39 -05:00
README.md Fix port numbers in example nginx config 2025-12-22 17:33:30 -05:00

basicUptime

This is a basic K.I.S.S uptime monitoring tool made in go

bbolt is used for the database. It will not be auto cleared as of now and the format may not be fully stable so if it gets too big just delete the file

The included front end uses chart.js and some basic javascript to talk to the backend
It will by default fetch dependancies from CDNs. You may want to tweak the static_html/index.html file and serve them localy

I use this softare for my uptime monitoring so if you want to see how it looks go there

Features

Monitor Types:

  • HTTP/S Monitoring
  • ICMP Monitoring
  • Push Monitors

Notification Types:

  • Discord Webhooks

Aswell there is a small offset set to monitors so they wont all fire at the same time and cause issues

Setup

Compile or download a binary and make an init script for your init system and a config file in the same folder as the binary

You can compile with CGO_ENABLED=0 go build

Config File

The included config file is self explanitory and will launch a working instance but you will want to tweak it

The config file can be a little touchy when loading and make sure to not remove any fields but just leave them blank

Here is the config file here for reference aswell

{
  "user_agent": "basicUptime/1.0",
  "bbolt_db_file": "./db.bbolt",
  "http_port": 8080,
  "html_dir" : "./static_html",
  "monitors": [
    {
      "monitor_external_name": "example.com",
      "monitor_internal_name": "example_com",
      "monitor_type": "http",
      "monitor_url": "https://example.com/",
      "monitor_push_key": "",
      "monitor_frequency": 60,
      "montor_alert_type": "",
      "monitor_alert_urls": []
    }
    {
      "monitor_external_name": "Google DNS",
      "monitor_internal_name": "google_dns",
      "monitor_type": "ping",
      "monitor_url": "8.8.8.8",
      "monitor_push_key": "",
      "monitor_frequency": 60,
      "montor_alert_type": "",
      "monitor_alert_urls": []
    },
    {
      "monitor_external_name": "Push Monitor",
      "monitor_internal_name": "push_monit",
      "monitor_type": "push",
      "monitor_url": "",
      "monitor_push_key": "secret_key",
      "monitor_frequency": 60,
      "montor_alert_type": "discord",
      "monitor_alert_urls": ["https://example.com/replace-with-real-discord-webhook-plz"]
    }
  ]
}

Init Script

This init script should work under alpine linux. Modify as needed for your distro

#!/sbin/openrc-run  
  
name="basicUptime"

# make sure to change to where you put the binary
command="/srv/basicUptime/basicUptime"

command_background=true
pidfile="/var/run/${name}.pid"

# make sure the user is valid and non root
command_user="basicUptime:basicUptime"

# this program's CWD needs to be in the same spot as the config file
# update this path to where you install it
start_pre() {
	cd /srv/basicUptime || return 1
}

# change this if you are not using nginx
depend() {
	need net
	before nginx
}

Nginx

You will want to make sure nginx is caching the proper API endpoints so they can load faster for people and to not stress the server

This basic config will work if the /var/cache/nginx/api_cache folder exists

proxy_cache_path /var/cache/nginx/api_cache levels=1:2 keys_zone=api_cache:10m max_size=100m inactive=10m use_temp_path=off;
server {
    http2 on;

    location / {
        proxy_pass http://localhost:8080/;
        proxy_http_version 1.1;
    }

    location /api/status/ {
        proxy_pass http://localhost:8080/api/status/;
        proxy_http_version 1.1;

        proxy_cache api_cache;
        proxy_cache_valid 200 1m;
        proxy_cache_bypass $http_cache_control;
        add_header X-Proxy-Cache $upstream_cache_status;
    }

    location /api/list_monitors {
        proxy_pass http://localhost:8080/api/list_monitors;
        proxy_http_version 1.1;

        proxy_cache api_cache;
        proxy_cache_valid 200 5m;
        proxy_cache_bypass $http_cache_control;
        add_header X-Proxy-Cache $upstream_cache_status;
    }

    # replace with your domain name
    server_name www.example.com;

    listen 80;
}

You also will want to run certbot to get SSL enabled and working

API

All API endpoints are GET requests

/api/list_monitors Get all monitors tracked by the server.

[
    {
        "internalName":"example_com",
        "externalName":"example.com"
    },
    {
        "internalName":"example_org",
        "externalName":"example.org"
    },
    {
        "internalName":"google_dns",
        "externalName":"Google DNS"
    },
    {
        "internalName":"push_monit",
        "externalName":"Push Monitor"
    }
]

/api/status/{internalName} Last 100 Events. If l == -1 monitor is offline

[
    {
        "t":"2025-12-22T21:27:05Z",
        "l":128.364543
    },
    {
        "t":"2025-12-22T21:28:05Z",
        "l":34.253854
    },
    {
        "t":"2025-12-22T21:29:05Z",
        "l":34.413834
    }
]

/api/push_monior/{monitor_push_key} Send a get request here to mark the push monitor as alive for that cycle

OK