-
Notifications
You must be signed in to change notification settings - Fork 0
Alerts
no0p edited this page Oct 19, 2014
·
3 revisions
An alert is triggered when an "alert query" returns a null value in the first column of the first cell.
This convention means that adding an alert condition just involves writing an SQL statement against the pgantenna tables.
SELECT measured_at as is_alive
FROM heartbeats
WHERE measured_at > (clock_timestamp() - interval '1 minute')
LIMIT 1WITH last_stats as (
SELECT DISTINCT ON (filesystem_id)
filesystem_id, measured_at, blk_avail, blks_in_frags
FROM stat_filesystems
ORDER BY filesystem_id, measured_at DESC
)
SELECT filesystems.name
FROM filesystems
INNER JOIN last_stats ON last_stats.filesystem_id = filesystems.id
WHERE ((blk_avail * blksize) / (blks_in_frags * fragsize)::numeric) < 0.2