2 Commits

Author SHA1 Message Date
g4st3r
7f91660cd0 Alert formatting and swap threshold 2026-03-07 21:06:24 +00:00
g4st3r
7005255aab Add blackbox exporter and HTTP alerts 2026-03-07 20:57:13 +00:00
5 changed files with 103 additions and 4 deletions

View File

@@ -15,9 +15,11 @@ receivers:
chat_id: -1003779247128
message: |-
{{ range .Alerts }}
*{{ .Labels.alertname }}* ({{ .Labels.severity }})
{{ if eq .Labels.severity "critical" }}🔴{{ else }}⚠️{{ end }} *{{ .Labels.alertname }}* ({{ .Labels.severity }})
{{ .Annotations.summary }}
{{ .Annotations.description }}
Instance: {{ .Labels.instance }}
Details: {{ .GeneratorURL }}
{{ end }}
parse_mode: Markdown
disable_notifications: false

View File

@@ -0,0 +1,19 @@
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: []
method: GET
follow_redirects: true
preferred_ip_protocol: "ip4"
http_5xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: [500, 501, 502, 503, 504]
method: GET
follow_redirects: true
preferred_ip_protocol: "ip4"

View File

@@ -77,6 +77,14 @@ services:
ports:
- "9633:9633"
blackbox-exporter:
image: prom/blackbox-exporter:v0.25.0
restart: unless-stopped
volumes:
- ./blackbox/blackbox.yml:/etc/blackbox_exporter/config.yml:ro
ports:
- "9115:9115"
volumes:
prometheus-data:
grafana-data:

View File

@@ -30,3 +30,55 @@ scrape_configs:
- job_name: revproxy-node
static_configs:
- targets: ["10.8.0.1:9100"]
- job_name: blackbox-http
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://s3.g4st3r.ru
- https://minio.g4st3r.ru
- https://cloud.g4st3r.ru
- https://grafana.g4st3r.ru
- https://prometheus.g4st3r.ru
- https://alert.g4st3r.ru
- https://photos.g4st3r.ru
- https://home.g4st3r.ru
- https://gitlab.g4st3r.ru
- https://openclaw.g4st3r.ru
- https://git.g4st3r.ru
- https://bw.g4st3r.ru
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
- job_name: blackbox-5xx
metrics_path: /probe
params:
module: [http_5xx]
static_configs:
- targets:
- https://s3.g4st3r.ru
- https://minio.g4st3r.ru
- https://cloud.g4st3r.ru
- https://grafana.g4st3r.ru
- https://prometheus.g4st3r.ru
- https://alert.g4st3r.ru
- https://photos.g4st3r.ru
- https://home.g4st3r.ru
- https://gitlab.g4st3r.ru
- https://openclaw.g4st3r.ru
- https://git.g4st3r.ru
- https://bw.g4st3r.ru
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115

View File

@@ -47,13 +47,13 @@ groups:
description: "MemAvailable < 8%"
- alert: SwapUsageHigh
expr: (1 - (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes)) > 0.30
for: 15m
expr: (1 - (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes)) > 0.50
for: 20m
labels:
severity: warning
annotations:
summary: "Swap usage high on {{ $labels.instance }}"
description: "Swap usage > 30%"
description: "Swap usage > 50%"
- alert: DiskFull
expr: (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay"}) < 0.10
@@ -90,3 +90,21 @@ groups:
annotations:
summary: "Container down"
description: "A container has not been seen for >2m"
- alert: HttpEndpointDown
expr: probe_success{job="blackbox-http"} == 0
for: 2m
labels:
severity: critical
annotations:
summary: "HTTP endpoint down: {{ $labels.instance }}"
description: "Blackbox probe failed"
- alert: HttpEndpoint5xx
expr: probe_success{job="blackbox-5xx"} == 1
for: 1m
labels:
severity: critical
annotations:
summary: "HTTP 5xx detected: {{ $labels.instance }}"
description: "Endpoint returned 5xx"