Skip to main content

One post tagged with "SQL"

Alerting on business data with SQL queries.

View all tags

SQL query alerting: monitor failed orders in MySQL

· 8 min read
Eric Qin

A MySQL order-outcomes table feeds a five-minute count query, a threshold and a notification

SQL query alerting runs a query on a schedule and checks a numeric result against a condition. It is useful when the number you care about already lives in a business database: failed orders, overdue jobs or a queue that has stopped draining.

This example counts failed orders in MySQL over the last five minutes and configures Nightingale to alert when that count stays at five or more for two minutes. It also handles the quiet case: no failed orders should produce a numeric zero that lets the alert recover.