Skip to main content

Alert Rules

Alert rules let you fire a silent failure alert based on the output of a successful job — without your job needing to throw an error.

The problem they solve

Some jobs succeed technically but produce a bad outcome. A database sync job that connects fine but processes zero rows is a success from the process's perspective, but it probably shouldn't be silent.

With alert rules, you can configure Crontify to fire an alert whenever a job succeeds but the result doesn't look right.

How they work

  1. Your job sends a /success ping and includes a meta object with numeric fields
  2. Crontify evaluates each alert rule against the meta object
  3. If a rule's condition is true, a silent_failure alert fires on all attached channels
  4. The run retains success status — a silent failure is not a crash

Rule structure

Each rule has three parts:

FieldDescription
FieldA key from the meta object — alphanumeric and underscores, max 50 characters
OperatorOne of lt, gt, eq, ne
ThresholdA numeric value to compare against

Operators

OperatorMeaningExample
ltLess thanrows_processed lt 100 — alert if fewer than 100 rows
gtGreater thanerror_count gt 0 — alert if any errors occurred
eqEqualsrows_processed eq 0 — alert if exactly zero rows
neNot equalsexit_code ne 0 — alert if exit code is non-zero

A rule fires when the condition evaluates to true. rows_processed eq 0 fires when the value is zero — not when it fails to be zero.

What happens if the field is missing?

If the field named in a rule is absent from the meta payload, the rule is silently skipped — no alert fires. A missing field and a zero value are treated as different things by design.

SDK usage

await monitor.success({
meta: {
rows_processed: 0, // A rule of `rows_processed eq 0` would fire
emails_sent: 0,
duration_ms: 1200,
},
});
await monitor.fail({
message: 'Query timed out',
meta: { exit_code: 1 },
});

Configuring rules

Rules are configured per monitor from the monitor form (New Monitor or Edit Monitor). Each monitor supports up to 5 rules.

To add a rule:

  1. Scroll to the Alert Rules section of the monitor form
  2. Enter a field name, choose an operator, and set a threshold
  3. Click + Add Rule
  4. Save the monitor

Rules take effect immediately — the next success ping that includes the relevant field will be evaluated.

Alert deduplication

Silent failure alerts follow the same cooldown rules as other alert types. If your job fires a silent_failure alert every minute, the cooldown (default 60 minutes) ensures you're not flooded with notifications.