monitoring: alert on unknown servers in the Hetzner project
Some checks failed
deploy / ansible (push) Failing after 41s
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:
parent
56dd0255dc
commit
ebd4f110f4
1 changed files with 381 additions and 190 deletions
|
|
@ -255,6 +255,38 @@ groups:
|
|||
for: 2m
|
||||
labels: { severity: critical }
|
||||
annotations: { summary: "{{ $labels.ip }} answers on the VPC (seen from {{ $labels.host }}) and is not in security_vpc_hosts" }
|
||||
- uid: sec-hcloud-server-unknown
|
||||
title: "Unknown server in the Hetzner project"
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: { from: 900, to: 0 }
|
||||
datasourceUid: prometheus
|
||||
model: { refId: A, expr: "up{job=\"hcloud\",known=\"false\"}", instant: true, intervalMs: 30000, maxDataPoints: 43200 }
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model: { refId: C, type: threshold, expression: A, conditions: [ { evaluator: { type: gt, params: [0] } } ] }
|
||||
noDataState: OK
|
||||
execErrState: Error
|
||||
for: 2m
|
||||
labels: { severity: critical }
|
||||
annotations: { summary: "Server {{ $labels.server }} ({{ $labels.type }}, {{ $labels.public_ip }}, private {{ $labels.private_ip }}) exists in the Hetzner project and is not in monitoring_hcloud_servers" }
|
||||
- uid: sec-hcloud-inventory-stale
|
||||
title: "Hetzner server list not updating"
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: { from: 900, to: 0 }
|
||||
datasourceUid: prometheus
|
||||
model: { refId: A, expr: "absent(up{job=\"hcloud\"}) or increase(prometheus_sd_refresh_failures_total{mechanism=\"hetzner\"}[30m]) > 3", instant: true, intervalMs: 30000, maxDataPoints: 43200 }
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model: { refId: C, type: threshold, expression: A, conditions: [ { evaluator: { type: gt, params: [0] } } ] }
|
||||
noDataState: OK
|
||||
execErrState: Error
|
||||
for: 10m
|
||||
labels: { severity: critical }
|
||||
annotations: { summary: "Prometheus cannot list the servers of the Hetzner project (token revoked or API unreachable): new servers go unnoticed" }
|
||||
- uid: sec-user-unknown
|
||||
title: "Unknown login account"
|
||||
condition: C
|
||||
|
|
|
|||
Loading…
Reference in a new issue