Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Server Monitor Laravel Package

spatie/laravel-server-monitor

Monitor the health of your servers from Laravel. Includes built-in checks (disk, memory, processes, etc.), easy custom checks, and notifications via Slack or email when something goes wrong.

View on GitHub
Deep Wiki
Context7

title: Manipulating processes weight: 4

Under the hood Symfony\Component\Process is used to connect to your server and performing the command from your check. You can manipulate this Process right before it is executed.

To do this you must create a class that implements Spatie\ServerMonitor\Manipulators\Manipulator. That interface has only a single method to implement:

public function manipulateProcess(Process $process, Check $check): Process;

Let's take a look at an example implementation. In the code below we're going to change the command and up the timeout if the check is being performed on a certain host.

namespace App\ServerMonitor\Manipulators;

use Spatie\ServerMonitor\Models\Check;
use Symfony\Component\Process\Process;

class MyManipulator implements Manipulator
{
    public function manipulateProcess(Process $process, Check $check): Process
    {
        if ($check->host->name = 'my-host') {
            $manipulatedCommand = "{$process->getCommandLine()} appending extra options";
            
            $process->setCommandLine($manipulatedCommand);
            
            $process->setTimeout(60);
        }
        
        return $process;
    }
}

After creating the class you must specify it's fully qualified name in the process_manipulator key of the server-monitor config file.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport