Monitoring¶
Monitoring for the VPS is split across two hosts. The VPS exports metrics; linux-01 scrapes them over Tailscale and pages you through the existing Alertmanager → ntfy bridge.
Sanitized copies: config/vps/etc/default/prometheus-node-exporter, config/vps/usr/local/sbin/goc-vps-sec-metrics.sh, config/linux-01/etc/prometheus/.
Scrape jobs on linux-01¶
These jobs were already present; they were not changed on 24–25 Nov 2026. The snippet in the repo is a reference excerpt of scrape_configs.
| Job | Target | Labels |
|---|---|---|
vps-node |
<VPS_TAILSCALE_IP>:9100 |
host="goc-vps" |
vps-nginx |
<VPS_TAILSCALE_IP>:9113 |
host="goc-vps" |
vps-nautobot |
local exporter on linux-01 at 127.0.0.1:9812 |
host="goc-vps", instance="cbgoc-cloud.top" |
Exporters on the VPS listen on loopback and the VPS Tailscale address only. ufw allows 9100 and 9113 on tailscale0, not on the public interface. prompts-chat is not scraped as its own exporter; linux-01 watches the systemd unit state through vps-node.
node_exporter on the VPS¶
/etc/default/prometheus-node-exporter ARGS add a systemd collector limited to the units this stack cares about, including prompts-chat.service:
--collector.systemd --collector.systemd.unit-include=(ollama|prompts-chat|fail2ban|ssh|geoip-ssh-sets|geoip-ssh-update)[.]service|geoip-ssh-update[.]timer
Listen addresses: 127.0.0.1:9100 and <VPS_TAILSCALE_IP>:9100. The Debian textfile collector directory is /var/lib/prometheus/node-exporter/.
Change the unit list, then systemctl restart prometheus-node-exporter. Rollback: restore the backup under /root/config-backups/prompts-2026-11-24/prometheus-node-exporter.default.bak (or the earlier copies under /root/config-backups/ollama-2026-11-24/).
Security metrics (textfile collector)¶
/usr/local/sbin/goc-vps-sec-metrics.sh runs every 2 minutes from goc-vps-sec-metrics.timer and writes /var/lib/prometheus/node-exporter/goc_vps_security.prom atomically. No IPs or usernames are exported.
| Metric | Labels | Meaning |
|---|---|---|
goc_fail2ban_up |
1 if fail2ban answered | |
goc_fail2ban_banned_current |
jail |
IPs banned now |
goc_fail2ban_banned_total |
jail |
bans since fail2ban start |
goc_fail2ban_failed_current / _failed_total |
jail |
failures tracked now / since start |
goc_ssh_geo_drop_packets_total / _bytes_total |
family (ipv4/ipv6) |
SSH packets dropped by the geo-block (reset on ufw reload) |
goc_ssh_geo_rule_present |
family |
1 if the geo DROP rule is loaded |
goc_ssh_geo_ipset_entries |
set |
size of geo-ssh-allow4 / geo-ssh-allow6 |
goc_ssh_login_alerts_total |
SSH login alerts sent (log lines) | |
goc_ssh_login_alerts_failed_total |
alerts that did not get HTTP 200 | |
goc_ssh_login_alerts_last_timestamp_seconds |
time of last alert | |
goc_vps_sec_metrics_last_run_timestamp_seconds |
exporter heartbeat |
Check with systemctl status goc-vps-sec-metrics.timer and by reading the .prom file. Remove: systemctl disable --now goc-vps-sec-metrics.timer, then delete the script, units, and .prom file.
Alert rules¶
File on linux-01: /etc/prometheus/rules/vps-ollama.yml (loaded via rule_files: /etc/prometheus/rules/*.yml).
| Alert | Expression (summary) | For | Labels |
|---|---|---|---|
VPSOllamaDown |
ollama.service active != 1 |
5m | severity: warning |
VPSOllamaMetricMissing |
ollama.service state absent |
15m | severity: warning |
VPSSwapHeavy |
VPS swap > 50% used | 15m | severity: warning |
VPSPromptsChatDown |
prompts-chat.service active != 1 |
5m | severity: warning |
VPSPromptsChatMetricMissing |
prompts-chat.service state absent |
15m | severity: warning |
Alerts go through the existing Alertmanager → ntfy bridge (same topic as the SSH login hook; the topic is not stored in this repo).
Change a rule, then:
Rollback: remove the file, promtool check config /etc/prometheus/prometheus.yml && systemctl reload prometheus. To drop only the prompts-library alerts, delete the VPSPromptsChat* rules and reload.
If VPSSwapHeavy fires, the model or context is too large. Lower OLLAMA_CONTEXT_LENGTH, shorten OLLAMA_KEEP_ALIVE, or use a smaller model. See the runbook. A test chat with qwen3:4b loaded used about 1.5 GiB of swap; idle after the keep-alive unload dropped swap use back to a few MiB.
Ad-hoc checks¶
On the VPS:
systemctl is-active ollama prompts-chat nginx fail2ban ssh tailscaled prometheus-node-exporter
curl -s http://127.0.0.1:8090/healthz
ollama ps; free -h; swapon --show
fail2ban-client status sshd
ipset list geo-ssh-allow4 -t | grep entries
tail -5 /var/log/ssh-login-ntfy.log
ls /var/run/reboot-required 2>/dev/null && echo "reboot needed"
From linux-01, in Prometheus or Grafana: up{job="vps-node"}, node_systemd_unit_state{job="vps-node",state="active"}, and the goc_* metrics. From a tailnet client, curl -s http://goc-vps:8090/healthz (or curl -H "Host: goc-vps:8090" http://<VPS_TAILSCALE_IP>:8090/healthz if local DNS overrides goc-vps).