You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/product/crons/getting-started/cli.mdx
+36-1Lines changed: 36 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Sentry Crons allows you to monitor the uptime and performance of any scheduled,
18
18
To begin monitoring your recurring, scheduled job:
19
19
20
20
-[Install](/product/cli/installation) the Sentry CLI (min v2.16.1).
21
-
-[Create and configure](https://sentry.io/crons/create/)your first Monitor.
21
+
- Create and configure your first Monitor in [Sentry](https://sentry.io/crons/create/)or [via the CLI](#creating-or-updating-a-monitor-through-a-check-in-optional).
sentry-cli monitors run my-monitor-slug -- node path/to/file.js
60
60
```
61
61
62
+
### Creating or Updating a Monitor Through a Check-In (Optional)
63
+
64
+
You can also use the Sentry CLI to create or update your cron monitor when you run your job. This way, you can avoid having to first set up the monitor through the Sentry web interface.
65
+
66
+
Configure the cron monitor by providing the cron schdule in crontab format using the `--schedule` or the equivalent `-s` argument when executing the `sentry cli monitors run` command. Please make sure to enclose the schedule in quotes, so that your shell parses the argument correctly, like so:
67
+
68
+
```bash
69
+
sentry-cli monitors run --schedule "<expected schedule>"<monitor-slug> -- <command><args>
70
+
```
71
+
72
+
When providing the `--schedule` argument, we also support the following optional arguments to provide additional configuration:
73
+
74
+
-`--check-in-margin`: The allowed margin of minutes after the expected check-in time that the monitor will not be considered missed for.
75
+
-`--max-runtime`: The allowed duration in minutes that the monitor may be in progress for before being considered failed due to timeout.
76
+
-`--timezone`: A valid [tz database identifier string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) (e.g. "Europe/Vienna") representing the monitor's execution schedule's timezone.
77
+
78
+
<Alert>
79
+
80
+
**Known limitation**: When an invalid `--timezone` argument is provided, the command will silently fail to create/update the cron monitor. Therefore, when using this argument, please:
81
+
82
+
- Ensure you are using a valid tz database identifier string when using this argument, and
83
+
- Verify that the cron monitor was created successfully in Sentry after running the command.
If your cron monitor runs in multiple environments you can use the `-e` flag to specify which [Monitor Environment](/product/crons/job-monitoring/#multiple-environments) to send check-ins to.
0 commit comments