schedule-monitor:verify
php artisan schedule-monitor:verify checks that the Oh Dear integration is configured: that an API token and a monitor id are set, and that the Oh Dear API accepts them. Run it once after setting up Oh Dear, before the first sync, and whenever pings or syncs start failing.
| Property | Value |
|---|---|
| Signature | schedule-monitor:verify |
| Description | Verify that the Oh Dear connection is configured correctly |
| Options | none |
| Network | One GET monitors/{monitor_id} request to the Oh Dear API |
| Writes | Nothing |
Usage
php artisan schedule-monitor:verify
What It Checks
The checks run in order, and the first failure stops the command with an exception (so the command exits with a non-zero status):
| Step | Success message | Failure |
|---|---|---|
| 1. Oh Dear client class present | The Oh Dear SDK is installed. |
Always passes in 4.x (see the note below). |
| 2. API token | Oh Dear API token found. |
No API token found. ... (full text below) |
| 3. Monitor id | Oh Dear monitor id found. |
No monitor id found. ... (full text below) |
| 4. Connection | Successfully connected to Oh Dear. The configured monitor URL is: {url} |
Failed to GET monitors/{id}: {HTTP client error} |
The full failure messages of steps 2 and 3 are:
No API token found. Make sure you added an API token to the `api_token` key of the `schedule-monitor` config file. You can generate a new token here: https://ohdear.app/user/api-tokens
No monitor id found. Make sure you added an monitor id to the `monitor_id` key of the `schedule-monitor` config file. You can found your monitor id on the settings page of a monitor on Oh Dear.
Steps 2 and 3 only check that the values are not empty. Step 4 performs a real API request with the token to {api_url}/monitors/{monitor_id}, so a wrong token, a wrong monitor id, a monitor that belongs to another team, or a blocked network all show up there.
Note: Step 1 still prints "The Oh Dear SDK is installed." but since version 4 the package talks to the Oh Dear API with Laravel's HTTP client and checks for its own internal
OhDearclass, which always exists. You do not need to install an Oh Dear SDK.
Successful Output
Output similar to:
Verifying if Oh Dear is configured correctly...
The Oh Dear SDK is installed.
Oh Dear API token found.
Oh Dear monitor id found.
Trying to reach Oh Dear...
Successfully connected to Oh Dear. The configured monitor URL is: https://example.com
All ok! Run php artisan schedule-monitor:sync to sync your scheduled tasks with oh dear.
What It Does Not Check
- It does not check that the ping endpoint (
ping.ohdear.app, or yourendpoint_url) is reachable from your servers. Pings use a different host than the API. Use debug logging to diagnose ping failures. - It does not check that a queue worker is processing the ping jobs.
- It does not sync anything. Run
schedule-monitor:syncafterwards.
Using It in CI or Deploy Scripts
Because a failing check throws and makes the command exit with a non-zero status, you can run it before the sync in a deployment script to fail early on missing credentials:
php artisan schedule-monitor:verify && php artisan schedule-monitor:sync
Only do this in environments where Oh Dear is configured; without a token the command always fails.