monitoring: alert on unknown servers in the Hetzner project
Some checks failed
deploy / ansible (push) Failing after 41s

The VPC ping sweep misses a server that drops ICMP or is not attached
to the private network. Prometheus now lists the project's servers from
the Hetzner API with a read-only token and marks each one known or not
against monitoring_hcloud_servers.

Nothing is scraped from the servers: every discovered target is
Prometheus itself with all samples dropped, which leaves one `up`
series per server. A second alert fires when the list stops updating,
so a revoked token does not silently disable the check.

Assisted-by: Claude:fable-5-2
This commit is contained in:
Sergei Poljanski 2026-11-16 00:13:00 +04:00
commit ebd4f110f4
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -80,12 +80,16 @@ alerts until it is:
|---|---|
| WireGuard client | `wireguard_clients` (`group_vars/all/wireguard.yaml`) |
| Server on the VPC | `security_vpc_hosts` |
| Server in the Hetzner project | `monitoring_hcloud_servers` (`group_vars/all/monitoring.yaml`) |
| Account, sudo or docker member | `security_login_users`, `security_sudo_users`, `security_docker_users` |
| Published or listening port | `security_ports_extra` (host_vars) |
| Privileged container, host network, Docker socket | `security_containers_extra` (host_vars) |
Defaults are in `roles/monitoring_agent/defaults/main.yaml`. The VPC check
is a ping sweep: a device that drops ICMP is not seen.
Prometheus therefore also lists the project's servers from the Hetzner
API (`vault_hcloud_ro_token`, a read-only token) and alerts on an unknown
one, or when the list stops updating.
## Bootstrap playbooks