PHPackages                             jcergolj/extra-checks-for-spatie-laravel-server-monitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jcergolj/extra-checks-for-spatie-laravel-server-monitor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jcergolj/extra-checks-for-spatie-laravel-server-monitor
=======================================================

Additional custom checks for Spatie laravel-server-monitor package

v1.4(2y ago)545.8k↓50%3MITPHP

Since May 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jcergolj/extra-checks-for-spatie-laravel-server-monitor)[ Packagist](https://packagist.org/packages/jcergolj/extra-checks-for-spatie-laravel-server-monitor)[ RSS](/packages/jcergolj-extra-checks-for-spatie-laravel-server-monitor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (5)Used By (0)

Extra Checks For Spatie Laravel Server Monitor package
------------------------------------------------------

[](#extra-checks-for-spatie-laravel-server-monitor-package)

First you need to install [Spatie Server Monitor Package](https://github.com/spatie/laravel-server-monitor).

Then you need to install this package

```
composer require jcergolj/extra-checks-for-spatie-laravel-server-monitor
```

Finally add the following checks to `config\server-monitor.php` file

```
'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,
],
```

### Custom check overview

[](#custom-check-overview)

#### CpuLoadCheck

[](#cpuloadcheck)

It checks server loads in last 1, 5 and 15 minutes

It executes this command on the server: `uptime`.

You can specify cpu load threshold in `server-monitor.php` config file. If it isn't provided the default values are 1.3.

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

#### RedisCheck

[](#redischeck)

It checks if Redis is running.

It executes this command on the server: `redis-cli ping`.

#### RedisMemoryCheck

[](#redismemorycheck)

It checks the current redis memory consumption.

It executes this command on the server: `redis-cli info memory`.

You can specify redis memory threshold in `server-monitor.php` config file. Default value is 5MB.

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

#### HorizonArtisanCommandCheck

[](#horizonartisancommandcheck)

It checks if horizon artisan process is running.

It executes this command on the server: `ps aux | grep -E ".*php([0-9]\.[0-9])? .*artisan horizon$" | grep -v grep`.

You can specify the number of horizon processes that should run on the server in `server-monitor.php` config file. The default value is 1.

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

#### HorizonSupervisorCheck

[](#horizonsupervisorcheck)

It checks if horizon supervisor process is running.

It executes this command on the server: `ps aux | grep -E ".*php([0-9]\.[0-9])? .*artisan horizon:supervisor" | grep -v grep`.

You can specify the number of horizon supervisor processes that should run on the server in `server-monitor.php` config file. Default value is 1.

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

#### HorizonWorkerCheck

[](#horizonworkercheck)

It checks if horizon worker process is running.

It executes this command on the server: `ps aux | grep -E ".*php([0-9]\.[0-9])? .*artisan horizon:work" | grep -v grep`.

You can specify the number of min and max horizon worker processes that should run on the server in `server-monitor.php` config file. The default value is 1 for both min and max.

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

#### QueueWorkerCheck

[](#queueworkercheck)

It checks if queue worker process is running.

It executes this command on the server: `ps aux | grep -E ".*php([0-9]\.[0-9])? .*artisan queue:work" | grep -v grep`.

You can specify the number of queue worker processes that should run on the server in `server-monitor.php` config file. The default value is 1.

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

#### DbConnectionCountCheck

[](#dbconnectioncountcheck)

It checks if the number of mysql connections.

It executes this command on the server: `netstat -an | grep 3306 | grep ESTABLISHED`.

You can specify the db connection threshold in `server-monitor.php` config file. The default value is 40.

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

#### Extended server-monitor.php config file

[](#extended-server-monitorphp-config-file)

```
