Skip to content

Watch your servers

Watch scheduled jobs

Backups and timed jobs stop silently. Add two Kiyesi lines around a job, and you hear when it fails, runs long, or does not run.

In your crontab, put kiyesi job start before the command and kiyesi job done after it, with the job’s exit code:

Terminal window
0 4 * * * /usr/local/bin/kiyesi job start --name nightly-backup; /opt/scripts/backup.sh; /usr/local/bin/kiyesi job done --name nightly-backup --exit $?

Write the full path, /usr/local/bin/kiyesi: cron looks for programs only in /usr/bin and /bin. $? is the exit code of the command just before it, your job.

In a systemd service started by a timer, the same around your own ExecStart:

ExecStartPre=/usr/local/bin/kiyesi job start --name nightly-backup
ExecStart=/opt/scripts/backup.sh
ExecStopPost=/usr/local/bin/kiyesi job done --name nightly-backup --exit $EXIT_STATUS

Your job runs exactly as before: Kiyesi only writes down that it started and how it ended. If Kiyesi cannot record a run, your job is not affected. Give each job a name of letters, digits, dots, dashes and underscores, up to 80 characters.

The agent reads the schedule from your crontab or systemd timer by itself, so it knows when each job should start next. A job started some other way is learned: after three runs, Kiyesi knows its usual interval.

When How serious
Failed A run ends with an exit code other than 0, or, for a systemd timer, systemd says its last run failed before kiyesi job start could record it. The alert names the exit code and gives sudo journalctl -u <unit> -n 50 to read why. Critical
No run recorded No run was recorded within 5 minutes of when it was due (half its interval, for jobs that run more often than every 10 minutes). It may not have started, or its two Kiyesi lines did not run. Warning
Running long A run is still going at three times its usual time, and at least a minute. Warning

Each problem alerts once, with clock times (“due at 04:00 UTC on 11 Oct”), so a reminder read a day later is still true. A warning goes to your team’s channels and the daily digest; a failure also goes to each person’s inbox and is reminded daily. See Critical or warning. The job’s next good run closes the alert with a short “ran successfully again” message.

Open Scheduled jobs in the dashboard, or in a terminal:

Terminal window
kiyesi jobs
kiyesi jobs nightly-backup

Each run’s start, end, exit code and duration, kept 90 days. The command itself is never sent. Runs recorded before 0.40.0, by Kiyesi’s old run command, also kept their last 20 lines of output.

  • The job does not appear. It appears after its first run. Check the agent is connected (kiyesi servers) and the job runs on that server.
  • “Not found yet” under Runs. The agent found no crontab or timer line with kiyesi job done --name and that name. After three runs Kiyesi learns its interval.
  • A job that runs as another user. Any user may run kiyesi job start and kiyesi job done; runs are handed to the agent through a folder only it can read.
  • A job set up before 0.40.0, with Kiyesi’s old run command. That command was removed, as Kiyesi no longer starts anything: change the line to the two above, or the job does not run.