When something goes wrong it can notify you via Slack or mail. This is what a Slack notification looks like:
Under the hood the server-monitor-app is a vanilla Laravel 5.4 application with the laravel-server-monitor installed into it. If you know your way around Laravel, it's recommended that you use laravel-server-monitor instead of this app.
You can install the application by issuing this command:
composer create-project spatie/server-monitor-app <name of install directory>
To complete your installation these steps must be performed:
First you should add the following command to your cron table. It should run
php <installation path>/artisan schedule:run
Secondly, specify a Slack webhook url in the SERVER_MONITOR_SLACK_WEBHOOK_URL key
in the .env file found in the installation directory.
You can create a new webhook url on the Slack website.
Optionally you can configure e-mail notifications by filling in the MAIL_ keys in the .env file located in the
installation directory and adding mail to the notifications array in the configuration.php file.
The configuration file configuration.php is located inside the installation directory.
Reading it is a good way to quickly get a feel of what server-monitor-app can do. Here's the content of the config file:
return [/* * These are the checks that can be performed on your servers. You can add your own * checks. The only requirement is that they should extend the * `Spatie\ServerMonitor\Checks\CheckDefinitions\CheckDefinition` class.*/'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, ],/* * 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 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,'mail'=> ['to'=>'firstname.lastname@example.org', ],'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 `Check` model you can specify your * own model here. The only requirement is that they should * extend the `Check` model provided by this package.*/'check_model'=>Spatie\ServerMonitor\Models\Check::class,/* * Right before running a check it's process will be given to this class. Here you * can perform some last minute manipulations on it before it will * actually be run. * * This class should implement Spatie\ServerMonitor\Manipulators\Manipulator*/'process_manipulator'=>Spatie\ServerMonitor\Manipulators\Passthrough::class,];
Find yourself stuck using this app or the underlying package? Found a bug? Do you have general questions or suggestions for improving the uptime monitor? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
The best postcards will get published on the open source page on our website.
Please see CHANGELOG for more information what has changed recently.