Reconcile discovered jobs as monitors
discover_monitors_reconcileTurn a repo or host scan into monitors: create one per unmonitored source while leaving existing monitors untouched, so re-runs give safe drift detection.
Instructions
Requires the write scope or higher. Turns a scan of a repository or host (sources, every scheduled job found) into monitors. Creates one monitor per source not already monitored; never deletes, pauses or edits existing monitors, so a scheduled re-run is safe drift detection. Returns created, existing (unmodified, hand-tuned values intact) and orphaned (source not in this scan; still running and alerting). Each created monitor can page a person; this endpoint has no delete path. source_kind plus source_ref is the diff key, so source_ref has to stay stable: a changed ref creates a duplicate; a crontab ref names the file and the command, so each line is its own source. Kinds: 'crontab' (crontab -l, /etc/cron.d/*, /etc/crontab), 'github-actions' (on.schedule.cron), 'k8s-cronjob' (spec.schedule), 'systemd-timer' (OnCalendar=). A source without schedule_cron becomes on-demand. crontab and systemd-timer fire in the host's local time (timedatectl show -p Timezone --value or readlink /etc/localtime prints it); github-actions and k8s-cronjob in UTC. A stated tz is stored as given: the API cannot tell a guessed 'UTC' from one read from the host. list_monitors shows each source.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sources | Yes | The full scan as a JSON array string, e.g. '[{"source_kind":"crontab","source_ref":"/etc/cron.d/backup:/usr/local/bin/backup.sh","schedule_cron":"0 3 * * *","tz":"Europe/Berlin"}]'. Fields: source_kind, source_ref (required), name (default source_ref), schedule_cron (5-field, when one was read), tz (IANA zone the cron fires in; required on a crontab or systemd-timer entry with schedule_cron), suggested_expect_every_s (overrides the silence floor). An omitted source is reported orphaned; '[]' orphans every discovered monitor, deleting none. At most 1000 entries; a repeated source_kind/source_ref pair is rejected. The 100-monitor cap covers the whole batch; one invalid entry rejects it all. |