|
| 1 | +# Server monitoring for Laravel apps |
| 2 | + |
| 3 | +[](https://github.com/ericmakesstuff/laravel-server-monitor/releases) |
| 4 | +[](LICENSE.md) |
| 5 | +[](https://travis-ci.org/ericmakesstuff/laravel-server-monitor) |
| 6 | +[](https://scrutinizer-ci.com/g/ericmakesstuff/laravel-server-monitor) |
| 7 | +[](https://packagist.org/packages/ericmakesstuff/laravel-server-monitor) |
| 8 | + |
| 9 | +This Laravel 5 package will periodically monitor the health of your server. Currently, it provides healthy/alarm status notifications for Disk Usage. |
| 10 | + |
| 11 | +Once installed, monitoring your server is very easy. Just issue this artisan command: |
| 12 | + |
| 13 | +``` bash |
| 14 | +php artisan monitor:run |
| 15 | +``` |
| 16 | + |
| 17 | +## Installation and usage |
| 18 | + |
| 19 | +You can install this package via composer using: |
| 20 | + |
| 21 | +`composer require ericmakesstuff/laravel-server-monitor` |
| 22 | + |
| 23 | +You'll need to register the ServiceProvider: |
| 24 | + |
| 25 | +```php |
| 26 | +// config/app.php |
| 27 | + |
| 28 | +'providers' => [ |
| 29 | + // ... |
| 30 | + EricMakesStuff\ServerMonitor\ServerMonitorServiceProvider::class, |
| 31 | +]; |
| 32 | +``` |
| 33 | + |
| 34 | +To publish the config file to app/config/laravel-backup.php run: |
| 35 | + |
| 36 | +`php artisan vendor:publish --provider="EricMakesStuff\ServerMonitor\ServerMonitorServiceProvider"` |
| 37 | + |
| 38 | +## Scheduling |
| 39 | + |
| 40 | +After you have performed the basic installation you can start using the monitor:run command. In most cases you'll want to schedule this command so you don't have to manually run monitor:run every time you want to know the health of your server. |
| 41 | + |
| 42 | +The commands can, like an other command, be scheduled in Laravel's console kernel. |
| 43 | + |
| 44 | +```php |
| 45 | +// app/Console/Kernel.php |
| 46 | + |
| 47 | +protected function schedule(Schedule $schedule) |
| 48 | +{ |
| 49 | + $schedule->command('monitor:run')->daily()->at('10:00'); |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +Of course, the hour used in the code above is just an example. Adjust it to your own preferences. |
| 54 | + |
| 55 | +## Testing |
| 56 | + |
| 57 | +Run the tests with: |
| 58 | + |
| 59 | +``` bash |
| 60 | +vendor/bin/phpunit |
| 61 | +``` |
| 62 | + |
| 63 | +## Contributing |
| 64 | + |
| 65 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 66 | + |
| 67 | +## Security |
| 68 | + |
| 69 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 70 | + |
| 71 | +## Credits |
| 72 | + |
| 73 | +- [Eric Blount](https://github.com/ericmakesstuff) |
| 74 | +- [Freek Van der Herten](https://github.com/freekmurze) |
| 75 | + |
| 76 | +## License |
| 77 | + |
| 78 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments