Skip to content

Cronjobs

The Syncer manages all its automation cronjobs internally. You define which modules to run, in what order, and for which accounts — all from the UI.

Cronjob Groups

Go to: Settings → Cronjobs → Cronjob Group

A Cronjob Group defines:

  • An interval — how often the group should run: every 15 minutes, every hour, once daily, or Custom interval in minutes with the minutes entered in the field below it
  • A time range — the window during which the group is allowed to run
  • An ordered list of jobs to execute

Jobs inside a group run sequentially. If any job fails, the entire group stops. This is intentional — for example, you do not want hosts to be deleted from Checkmk if the import step failed beforehand.

To run the remaining jobs anyway, enable Continue On Error on the group; the group still counts as failed.

State Table

Go to: Settings → Cronjobs → State Table

The State Table keeps one entry per group, showing:

  • When the group will run next
  • The result of the last run
  • Any error messages

To force a group to run immediately or to reset its state, delete or edit its State Table entry.

Status panel on the start page

Since 4.3

The dashboard (start page) shows a Cron Jobs panel below Recent Errors with each group's status — ok, running, error or disabled, plus a queued marker when a one-off run is already pending — and its last start time. The Run button schedules the group for the next cron pass (it sets the group's "run once next" flag). The panel is only shown to users with the Cron permission (or global admins).

When at least one group is enabled but cron run_jobs has not run for an hour, or never, the panel starts with a warning: then the system cron does not call the Syncer and no group runs on its schedule. Set it up as shown below.

Running the Scheduler

The Syncer does not have a built-in scheduler daemon. Instead, call the run command periodically from your system cron — every 5 to 10 minutes is typical:

Set it up in one step: run this as the user the Syncer runs as, from the directory that holds local_config.py (for a PyPI install /opt/cmdbsyncer):

cmdbsyncer cron install

It adds the entry to the crontab of that user, every 5 minutes, and changes nothing when the crontab already runs cron run_jobs. Other entries of the crontab are kept.

Option Meaning
--interval N Minutes between two runs, default 5
--print Only print the line, e.g. for /etc/cron.d
--allow-root Install it for root anyway; refused by default

The entry changes into the directory of local_config.py and calls the cmdbsyncer command with the Python it was installed with, so it works under the bare environment of cron. Normal output is dropped, the Syncer logs every pass under Settings, Log; errors still reach cron's mail or syslog.

By hand:

./cmdbsyncer cron run_jobs

Full example with environment activation:

*/5 * * * * cd /opt/cmdbsyncer && source ./venv/bin/activate && ./cmdbsyncer cron run_jobs

PyPI install (the cmdbsyncer binary lives inside the venv created by pip install cmdbsyncer; cd into the deployment directory so local_config.py is picked up):

*/5 * * * * cd /opt/cmdbsyncer && /opt/cmdbsyncer/venv/bin/cmdbsyncer cron run_jobs

If running from a different cwd is unavoidable (e.g. a system cron without cd), point the binary at the deployment directory explicitly:

*/5 * * * * CMDBSYNCER_CONFIG_DIR=/opt/cmdbsyncer /opt/cmdbsyncer/venv/bin/cmdbsyncer cron run_jobs

Docker:

*/5 * * * * docker exec CONTAINER_ID /srv/cmdbsyncer cron run_jobs

Docker Compose:

*/5 * * * * docker compose -f /opt/cmdbsyncer/docker-compose.yml exec -T cmdbsyncer /srv/cmdbsyncer cron run_jobs