feat(osint): alert when the analyst stops writing briefs
The 2026-11-25..12-04 outage was invisible: deploy/osint-news-summarizer stayed Running with restarts 0 and INFO batch lines while article_summaries froze for nine days, and the scraper kept articles fresh (61.5k rows, newest within minutes). The app has no /metrics endpoint, so add a small read-only Postgres exporter and two Prometheus rules. - osint-analyst-exporter (ns osint): stdlib HTTP server on :9187 serving osint_analyst_last_success_timestamp_seconds (max article_summaries. batch_timestamp), osint_ingest_last_article_timestamp_seconds (max articles.timestamp) and osint_analyst_exporter_up. Runs the pinned summarizer image (python3 + psycopg2), non-root, read-only rootfs, clusterIP Service + ServiceMonitor (release=kube-prometheus-stack). - NetworkPolicy: one port-scoped ingress rule, monitoring -> :9187. Nothing else in monitoring can reach osint. - monitoring/controllers/home/osint-analyst.yaml: OsintAnalystStale (>1h, 30m, warning, with an absent() arm so a dead exporter cannot read as healthy) and OsintIngestAliveButNoBrief (articles <2h old while summaries >2h old, 10m, warning). Both route through the default Telegram receiver.
This commit is contained in:
parent
c5578e9a5a
commit
e4b1ac59a9
5 changed files with 436 additions and 1 deletions
|
|
@ -15,6 +15,9 @@ resources:
|
|||
# Series come from a host textfile exporter (infrastructure/networking/rosenpass/),
|
||||
# so silently missing data is itself an alert.
|
||||
- rosenpass.yaml
|
||||
# Analyst freshness: OsintAnalystStale + OsintIngestAliveButNoBrief, built on
|
||||
# the osint-analyst-exporter timestamps (card t_22334588).
|
||||
- osint-analyst.yaml
|
||||
# Nightly consistent sqlite snapshot of Grafana's dashboards/alerts/users.
|
||||
- grafana-backup.yaml
|
||||
# Egress lockdown for that backup pod: DNS + the backup host only, so no
|
||||
|
|
|
|||
87
monitoring/controllers/home/osint-analyst.yaml
Normal file
87
monitoring/controllers/home/osint-analyst.yaml
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# osint analyst freshness -> Prometheus (card t_22334588)
|
||||
#
|
||||
# On 2026-11-25 the analyst (deploy/osint-news-summarizer) silently stopped
|
||||
# writing article_summaries and stayed dead for nine days. The scraper kept
|
||||
# ingesting normally (61.5k rows in articles, newest within minutes), the pod
|
||||
# stayed Running with restarts 0, and the log carried nothing but INFO batch
|
||||
# lines and 404s at INFO level -- so every signal the cluster already had said
|
||||
# "healthy". These two rules are built on the timestamps the exporter in
|
||||
# apps/base/osint/analyst-exporter.yaml reads straight out of Postgres
|
||||
# (SeriesMonitor osint-analyst-exporter, ns osint, :9187/metrics):
|
||||
#
|
||||
# osint_analyst_last_success_timestamp_seconds max(article_summaries.batch_timestamp)
|
||||
# osint_ingest_last_article_timestamp_seconds max(articles.timestamp)
|
||||
# osint_analyst_exporter_up 1 when the last DB read worked
|
||||
#
|
||||
# OsintAnalystStale is the general "no brief in over an hour" gate; the
|
||||
# summarizer loops every 15 min, so an hour of silence cannot be a slow batch.
|
||||
# OsintIngestAliveButNoBrief is the sharper one: a fresh article row plus a
|
||||
# summary table frozen for two hours names the exact failure -- ingest fine,
|
||||
# analyst dark -- without waiting for the read path or the API to be down.
|
||||
#
|
||||
# The absent() arm on OsintAnalystStale is deliberate: if the exporter, its
|
||||
# ServiceMonitor or its scrape disappears, the series vanishes and "no data"
|
||||
# would otherwise read as "no problem", which is the same invisible-failure
|
||||
# shape this card exists to kill. Routes through the default Alertmanager
|
||||
# receiver (Telegram @Siriusdevops_alert_bot).
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: osint-analyst
|
||||
namespace: monitoring
|
||||
labels:
|
||||
release: kube-prometheus-stack
|
||||
spec:
|
||||
groups:
|
||||
- name: osint-analyst
|
||||
rules:
|
||||
- alert: OsintAnalystStale
|
||||
expr: |
|
||||
(
|
||||
time() - osint_analyst_last_success_timestamp_seconds > 3600
|
||||
)
|
||||
or
|
||||
absent(osint_analyst_last_success_timestamp_seconds)
|
||||
for: 30m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: >-
|
||||
osint analyst has written no brief for over an hour
|
||||
description: >-
|
||||
The newest article_summaries.batch_timestamp is more than an hour
|
||||
old (the summarizer loops every 15 minutes), or the freshness
|
||||
series is missing entirely. The container can still be Running
|
||||
with restarts 0: a wedged analyst looks exactly like an idle one.
|
||||
Check `kubectl -n osint logs deploy/osint-news-summarizer --tail=50`
|
||||
for the interval rc, confirm the exporter target is UP in
|
||||
Prometheus (job osint-analyst-exporter), and test the analyst
|
||||
query directly:
|
||||
`kubectl -n osint exec deploy/osint-db -- psql -U osint -d osint_data -c "select max(batch_timestamp), count(*) from article_summaries"`.
|
||||
A silently dead model/API key is the usual cause.
|
||||
- alert: OsintIngestAliveButNoBrief
|
||||
expr: |
|
||||
(
|
||||
time() - osint_analyst_last_success_timestamp_seconds > 7200
|
||||
)
|
||||
and
|
||||
(
|
||||
time() - osint_ingest_last_article_timestamp_seconds < 7200
|
||||
)
|
||||
for: 10m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: >-
|
||||
osint scraper is ingesting but the analyst has written no brief for 2h
|
||||
description: >-
|
||||
`articles` has a row younger than two hours while
|
||||
`article_summaries` has nothing newer than two hours. Ingest fine
|
||||
+ analyst dark is the shape of the 2026-11-25..12-04 outage, where
|
||||
the pipeline looked healthy for nine days because only the ingest
|
||||
side was moving. Confirm the scraper is genuinely alive
|
||||
(`kubectl -n osint logs deploy/osint-news-scraper --tail=20`) and
|
||||
then debug the analyst side: summarizer logs, NEWS_SUMMARIZE_*
|
||||
env, the resolved SUMMARY_MODEL and the Nous API key/inference
|
||||
endpoint (a dead model or a 404 on every map call writes zero
|
||||
rows while the loop keeps logging rc=0).
|
||||
Loading…
Reference in a new issue