Skip to content

Instantly share code, notes, and snippets.

@ipedrazas
Created February 28, 2020 18:08
Show Gist options
  • Save ipedrazas/5199d81f2a7bf0f8ed625369a8b3e777 to your computer and use it in GitHub Desktop.
Save ipedrazas/5199d81f2a7bf0f8ed625369a8b3e777 to your computer and use it in GitHub Desktop.
Flux query to get alerts
from(bucket: "_monitoring") |>
range(start: -7d, stop: 1582912196) |>
filter(fn: (r) => r._measurement == "statuses" and r._field == "_message") |>
keep(columns: ["_time", "_value", "_check_id", "_check_name", "_level"]) |>
rename(columns: {"_time": "time", "_value": "message", "_check_id": "checkID", "_check_name": "checkName", "_level": "level"}) |>
group() |>
sort(columns: ["time"], desc: true) |>
limit(n: 100, offset: 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment