summaryrefslogtreecommitdiff
path: root/procedures/genesis_uptime_monitor.md
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-06-30 20:06:28 +0000
committerdoc <doc@filenotfound.org>2025-06-30 20:06:28 +0000
commit717fcb9c81d2bc3cc7a84a3ebea6572d7ff0f5cf (patch)
tree7cbd6a8d5046409a82b22d34b01aac93b3e24818 /procedures/genesis_uptime_monitor.md
parent8368ff389ec596dee6212ebeb85e01c638364fb3 (diff)
uploading documentationHEADmaster
Diffstat (limited to 'procedures/genesis_uptime_monitor.md')
-rw-r--r--procedures/genesis_uptime_monitor.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/procedures/genesis_uptime_monitor.md b/procedures/genesis_uptime_monitor.md
new file mode 100644
index 0000000..6505f06
--- /dev/null
+++ b/procedures/genesis_uptime_monitor.md
@@ -0,0 +1,57 @@
+# Genesis Uptime Monitor
+
+This package sets up a simple service uptime tracker on your local server (e.g., Krang). It includes:
+
+- A Python Flask API to report 24-hour uptime
+- A bash script to log uptime results every 5 minutes
+- A systemd unit to keep the API running
+
+## Setup Instructions
+
+### 1. Install Requirements
+
+```bash
+sudo apt install python3-venv curl
+cd ~
+python3 -m venv genesis_api
+source genesis_api/bin/activate
+pip install flask
+```
+
+### 2. Place Files
+
+- `uptime_server.py` → `/home/doc/uptime_server.py`
+- `genesis_check.sh` → `/usr/local/bin/genesis_check.sh` (make it executable)
+- `genesis_uptime_api.service` → `/etc/systemd/system/genesis_uptime_api.service`
+
+### 3. Enable Cron
+
+Edit your crontab with `crontab -e` and add:
+
+```cron
+*/5 * * * * /usr/local/bin/genesis_check.sh
+```
+
+### 4. Start API Service
+
+```bash
+sudo systemctl daemon-reload
+sudo systemctl enable --now genesis_uptime_api
+```
+
+Then browse to `http://localhost:5000/api/uptime/radio`
+
+## Web Integration
+
+In your HTML, add a div and script like this:
+
+```html
+<div id="radioUptime"><small>Uptime: Loading…</small></div>
+<script>
+fetch('/api/uptime/radio')
+ .then(r => r.json())
+ .then(data => {
+ document.getElementById('radioUptime').innerHTML = `<small>Uptime: ${data.uptime}% (24h)</small>`;
+ });
+</script>
+```