A lightweight monitoring API that periodically checks the status of defined hosts (HTTP endpoints and TCP services).
- Monitors both HTTP endpoints and TCP services
- Automatically checks status at regular intervals (every 2 minutes)
- Tracks response times and uptime history
- Retains metrics history for the past 2 hours
- Simple REST API to access status information
- Web interface for viewing status data
- Persistent storage of host configurations
git clone https://github.com/astrakit/status-api.git
cd status-api
go build
./status-apiThe server starts on port 8080 by default.
GET /api/hosts- Lists all configured hosts with their statusGET /api/hosts/{id}- Get details for a specific host including metrics historyPOST /api/check- Manually trigger a status check for all hosts
Hosts are configured in the hosts.json file which is automatically created when the application first runs. Below is an example configuration:
[
{
"id": "2",
"name": "Development API",
"type": "http",
"address": "https://beta.api.astrakit.cc/api/status",
"is_up": false,
"response_time_ms": 0,
"last_checked": "2025-06-04T09:57:13.100976003+02:00"
},
{
"id": "1",
"name": "Production API",
"type": "http",
"address": "https://api.astrakit.cc/api/status",
"is_up": true,
"response_time_ms": 77,
"last_checked": "2025-06-04T09:57:13.17858747+02:00"
},
{
"id": "3",
"name": "Main website",
"type": "http",
"address": "https://astrakit.cc",
"is_up": true,
"response_time_ms": 77,
"last_checked": "2025-06-04T09:57:13.17858747+02:00"
},
{
"id": "4",
"name": "Database Server",
"type": "tcp",
"address": "192.168.1.100",
"port": 5432,
"is_up": false,
"response_time_ms": 5001,
"last_checked": "2025-06-04T09:57:18.179813645+02:00"
},
{
"id": "5",
"name": "Redis Server",
"type": "tcp",
"address": "localhost",
"port": 6379,
"is_up": false,
"response_time_ms": 0,
"last_checked": "2025-06-04T09:57:13.100615443+02:00"
}
]The application supports two types of host monitoring:
http: For monitoring web endpoints (HTTP/HTTPS)tcp: For monitoring TCP services like databases
For HTTP hosts, provide:
name: A descriptive nametype: Set to "http"address: The URL to check
For TCP hosts, provide:
name: A descriptive nametype: Set to "tcp"address: The hostname or IP addressport: The TCP port number to connect to
Access the web interface by opening http://localhost:8080/ in your browser.
hosts.json: Stores the host configurationmetrics.json: Stores historical metrics data (automatically managed)serve.html: The web interface HTML file
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.