spatie/laravel-server-monitor

Failed to run run-checks

Closed this issue · 3 comments

Hey!

I encountered a problem when trying to handle the plugin.
I have configured the server-monitor.php file. I set the project locally on a wamp.

server-monitor.php:

return [
'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,
],
'concurrent_ssh_connections' => 5,
'ssh_command_prefix' => '',
'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'],
    ],
    'throttle_failing_notifications_for_minutes' => 60,
    'mail' => [
        'to' => 'my_email_address',
    ],
    'slack' => [
        'webhook_url' => env('SERVER_MONITOR_SLACK_WEBHOOK_URL'),
    ],
    'notifiable' => \Spatie\ServerMonitor\Notifications\Notifiable::class,
    'date_format' => 'd/m/Y',
],

'host_model' => Spatie\ServerMonitor\Models\Host::class,
'check_model' => Spatie\ServerMonitor\Models\Check::class,
'process_manipulator' => Spatie\ServerMonitor\Manipulators\Passthrough::class,

space_percentage_threshold' => [
    'warning' => 80,
    'fail' => 90,
],

];

console:

$ php artisan server-monitor:run-checks
Start running 4 checks...
http://www.example-address.pl: performing check diskspace...
http://www.example-address.pl: performing check elasticsearch...
http://www.example-address.pl: check diskspace failed
http://www.example-address.pl: performing check memcached...
http://www.example-address.pl: check elasticsearch failed
http://www.example-address.pl: performing check mysql...
http://www.example-address.pl: check memcached failed
http://www.example-address.pl: check mysql failed
All done!

In the "hosts" table, I have completed the "name" field with the website address. "ssh-user", "ip" and "custom_properties" are set to "null".

Do you know why I get "failed"?

Table "checks":
diskspace -> last_run_message -> "Exception occurred: Pattern /(\d?\d)%/ with subject `` didn't capture a group named 1"
all in last_run_output -> "{"output": "", "exit_code": 1, "error_output": "", "exit_code_text": "General error"}"

"Exception occurred: Pattern /(\d?\d)%/ with subject `` didn't capture a group named 1"

Probably the command the checks diskspace could not get the expected output. This could be caused by the package not being able to connect to the server.

Do you know what can be a problem?
I tried to monitor different addresses on different servers. I'm getting the same errors.

I'm sorry, but I can't help you with this as your problem is caused by something environment specific. When I got this error there was a problem with logging into the server.

Good luck! If you find the cause, feel free to post it below to help other users.