Let's go over this code in detail. The command to be executed on the server is specified in the $command property of the class.
The resolve function that accepts an instance of Symfony\Component\Process\Process. The output of that process can be inspected using $process->getOutput(). If the output contains active we'll call $this->check->succeeded which will mark the check successful. If it does not contain that string $this->check->fail will be called and the check marked as failed. By default the package sends you a notification whenever a check fails. The string that is passed to $this->check->failed will be displayed in the notification.
After creating this class you must register your class in the config file.
Both the check and the host can retrieve and store custom properties. These properties are stored as json in the custom_properties field in the checks and hosts tables.
Here's how to work with custom properties:
// a $model can be instance of `host` or `check`$model->setCustomProperty('key', 'value');$model->getCustomProperty('key'); // returns 'value'$model->forgetCustomProperty('key');$model->getCustomProperty('key'); // returns null
You can retrieve custom properties from your checks like this: