Manage each site's checks with the PHP SDK
This page will get you started managing the Oh Dear checks per site, with the PHP SDK. Make sure you've read the getting started guide first. Once that's done, you should have our package & authentication ready to go.
Get all checks per site #
The simplest example is one where we list all your checks for a particular site. First, make sure you retrieve the sites via the SDK.
You can get all checks of a site with the
$checks = $site->checks;
This will return an array with instances of
$check->id; // returns the id $check->type; // returns the check type eg. 'uptime' or 'mixed-content'
OhDear\PhpSdk\Resources\Check instance has several methods you can call.
Disabling a check #
If you want to disable a check just call disable on it.
$check->disable(); // OhDear will not run the check anymore
Enabling a check #
If you want to enable the check just call enable on it.
$check->enable(); // back in business
Requesting a new run #
If you want Oh Dear to perform a specific check now, call the
$check->requestRun(); // OhDear will perform the check in a bit
It'll be added to the queue and checked instantly.
Snoozing a check #
We can temporarily stop sending notifications for checks, by snoozing them. You can call the
snooze($minutes) method to snooze.
$check->snooze(10); // Silence all notifications for 10 minutes
Unsnoozing a check #
To remove an existing snooze, you can call the
$check->unsnooze(); // Any existing snooze will now be removed
From then on, all new notifications will be sent again.