PHP code example of jcergolj / extra-checks-for-spatie-laravel-server-monitor

1. Go to this page and download the library: Download jcergolj/extra-checks-for-spatie-laravel-server-monitor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jcergolj / extra-checks-for-spatie-laravel-server-monitor example snippets


'checks' => [
    'diskspace' => Spatie\ServerMonitor\CheckDefinitions\Diskspace::class,
    'elasticsearch' => Spatie\ServerMonitor\CheckDefinitions\Elasticsearch::class,
    'memcached' => Spatie\ServerMonitor\CheckDefinitions\Memcached::class,
    'mysql' => Spatie\ServerMonitor\CheckDefinitions\MySql::class,
    'cpu-load' => Jcergolj\CustomChecks\CpuLoadCheck::class,
    'redis' => Jcergolj\CustomChecks\RedisCheck::class,
    'redis-memory' => Jcergolj\CustomChecks\RedisMemoryCheck::class,
    'horizon-artisan-command' => Jcergolj\CustomChecks\HorizonArtisanCommandCheck::class,
    'horizon-supervisor' => Jcergolj\CustomChecks\HorizonSupervisorCheck::class,
    'horizon-worker' => Jcergolj\CustomChecks\HorizonWorkerCheck::class,
    'queue-worker' => Jcergolj\CustomChecks\QueueWorkerCheck::class,
    'db-connection-count' => Jcergolj\CustomChecks\DbConnectionCountCheck::class,
],

// config/server-monitor.php
'cpu_load' => [
    'one_minute_threshold' => 1.6,
    'five_minute_threshold' => 1.2,
    'fifteen_minute_threshold' => 1.1,
]

// config/server-monitor.php
'redis' => [
    'memory_threshold' => 6000000,
]

// config/server-monitor.php
'horizon' => [
    'artisan_command_processes' => 2,
]

// config/server-monitor.php
'horizon' => [
    'supervisor_processes' => 2,
]

// config/server-monitor.php
'horizon' => [
    'min_worker_processes' => 2,
    'max_worker_processes' => 2,
]

// config/server-monitor.php
'queue' => [
    'worker_processes' => 2,
]

// config/server-monitor.php
'mysql' => [
    'connections' => 50,
]



return [

    /*
     * These are the checks that can be performed on your servers. You can add your own
     * checks. The only rverMonitor\CheckDefinitions\Diskspace::class,
        'elasticsearch' => Spatie\ServerMonitor\CheckDefinitions\Elasticsearch::class,
        'memcached' => Spatie\ServerMonitor\CheckDefinitions\Memcached::class,
        'mysql' => Spatie\ServerMonitor\CheckDefinitions\MySql::class,
    ],

    /*
     * The default value for how often the checks will run,
     * after the last successful one.
     */
    'next_run_in_minutes' => env('SERVER_MONITOR_NEXT_RUN_IN_MINUTES', 10),

    /*
     * The performance of the package can be increased by allowing a high number
     * of concurrent ssh connections. Set this to a lower value if you're
     * getting weird errors running the check.
     */
    'concurrent_ssh_connections' => 5,

    /*
     * This string will be prepended to the ssh command generated by the package.
     */
    'ssh_command_prefix' => '',

    /*
     * This string will be appended to the ssh command generated by the package.
     */
    'ssh_command_suffix' => '',

    'notifications' => [

        'notifications' => [
            Spatie\ServerMonitor\Notifications\Notifications\CheckSucceeded::class => [],
            Spatie\ServerMonitor\Notifications\Notifications\CheckRestored::class => ['slack'],
            Spatie\ServerMonitor\Notifications\Notifications\CheckWarning::class => ['slack'],
            Spatie\ServerMonitor\Notifications\Notifications\CheckFailed::class => ['slack'],
        ],

        /*
         * To avoid burying you in notifications, we'll only send one every given amount
         * of minutes when a check keeps emitting warning or keeps failing.
         */
        'throttle_failing_notifications_for_minutes' => 60,

        // Separate the email by , to add many recipients
        'mail' => [
            'to' => '[email protected]',
        ],

        'slack' => [
            'webhook_url' => env('SERVER_MONITOR_SLACK_WEBHOOK_URL'),
        ],

        /*
         * Here you can specify the notifiable to which the notifications should be sent. The default
         * notifiable will use the variables specified in this config file.
         */
        'notifiable' => \Spatie\ServerMonitor\Notifications\Notifiable::class,

        /*
         * The date format used in notifications.
         */
        'date_format' => 'd/m/Y',
    ],

    /*
     * To add or modify behaviour to the `Host` model you can specify your
     * own model here. The only