Naijacloud
Docs

Cron monitors

A failing job usually leaves an error behind. A job that never runs leaves nothing at all. A cron monitor expects a ping on schedule, so silence is noticed too.

4 min read

Watching a job

Open Argus → Crons and choose Watch a cron job:

  1. Name. How the job appears in alerts, like nightly-invoices.
  2. Schedule. A five-field cron expression, in WAT. 0 2 * * * is every day at 02:00.
  3. Allow it to be late by. Minutes after the due time before a run counts as missed. 10 unless you change it.

Argus then gives the job its own ping URL:

Ping URL
https://argus-in.naijacloud.com/c/<token>

Add it to the end of your job. Run the job once by hand to check it: the page switches from Waiting for the first ping as soon as the ping arrives.

crontab
bash
0 2 * * * your-command \ && curl -fsS https://argus-in.naijacloud.com/c/<token> \ || curl -fsS https://argus-in.naijacloud.com/c/<token>/fail

The ping URLs

Any method works (GET, POST or HEAD), so curl, wget or a browser can ping. Argus answers OK.

URLMeans
/c/<token>The run finished successfully
/c/<token>/startThe run started. Send it too if you want run times
/c/<token>/failThe run failed
/c/<token>/<exit code>The run finished with this exit code, 0 to 255. Anything but 0 is a failure

Passing the exit code means one line covers both outcomes:

Report the exit code
bash
your-command; curl -fsS "https://argus-in.naijacloud.com/c/<token>/$?"

A POST body is kept with the run, up to the first 2 KB, so a job can send the last lines of its output. It is scrubbed like everything else Argus stores.

Send output with the ping
bash
your-command 2>&1 | tail -c 2000 \ | curl -fsS --data-binary @- https://argus-in.naijacloud.com/c/<token>

What Argus flags

  • Missed. No ping by the due time plus the grace period.
  • Failed. A /fail ping, or a non-zero exit code.
  • Late or slow. The run finished after the grace period, or took more than twice the average of its last ten good runs (and over a minute).

A job that has never pinged isn't judged: until the first ping, Argus doesn't know it is wired up. The next due time is worked out from the later of the ping and the time the run was due, so a job that runs early doesn't cause a false miss.

A missed or failed run opens an incident and tells your workspace's alert recipients by email, and every channel that is on, once, however many sweeps it stays that way, and again when the job is back on time. Pause a job to stop it being judged while you work on it.