All Projects → ericmakesstuff → Laravel Server Monitor

ericmakesstuff / Laravel Server Monitor

Licence: mit
Server Monitoring Command for Laravel Applications

Projects that are alternatives of or similar to Laravel Server Monitor

Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+421.7%)
Mutual labels:  laravel, laravel-package, laravel-5-package, composer, composer-packages
Jwt Auth Guard
JWT Auth Guard for Laravel and Lumen Frameworks.
Stars: ✭ 319 (-24.76%)
Mutual labels:  laravel, laravel-package, laravel-5-package, composer, composer-packages
video-downloader
Video Downloader for Facebook.
Stars: ✭ 63 (-85.14%)
Mutual labels:  composer, laravel-package, laravel-5-package, composer-packages
Hooks
Hooks is a extension system for your Laravel application.
Stars: ✭ 202 (-52.36%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (-53.3%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Voyager Hooks
Hooks system integrated into Voyager.
Stars: ✭ 200 (-52.83%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Sneaker
An easy way to send emails whenever an exception occurs on server.
Stars: ✭ 223 (-47.41%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (-45.75%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Generator
Laravel 5.3+ Scaffold Generator, Support both bootstrap and Semantic UI
Stars: ✭ 327 (-22.88%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Laravel Gitscrum
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
Stars: ✭ 2,686 (+533.49%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Base62
PHP Base62 encoder and decoder for integers and big integers with Laravel 5 support.
Stars: ✭ 16 (-96.23%)
Mutual labels:  composer, laravel-package, laravel-5-package
Laravel Messenger
Simple user messaging package for Laravel
Stars: ✭ 2,140 (+404.72%)
Mutual labels:  laravel, composer, composer-packages
Laravel Page Speed
Package to optimize your site automatically which results in a 35%+ optimization
Stars: ✭ 2,097 (+394.58%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Voyager Frontend
The Missing Front-end for The Missing Laravel Admin 🔥
Stars: ✭ 200 (-52.83%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Laravel Achievements
Achievements for Laravel 5.3+
Stars: ✭ 279 (-34.2%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Laravel Auto Translate
Automatically translate your language files using a translator service
Stars: ✭ 153 (-63.92%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Pagination
🎁 Laravel 5 Custom Pagination Presenter
Stars: ✭ 119 (-71.93%)
Mutual labels:  laravel, laravel-package, laravel-5-package
Eloquent Tree
Eloquent Tree is a tree model for Laravel Eloquent ORM.
Stars: ✭ 131 (-69.1%)
Mutual labels:  laravel, laravel-package, composer
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (-43.87%)
Mutual labels:  laravel, laravel-5-package, composer
Laravel Gamp
📊 Laravel Google Analytics Measurement Protocol Package
Stars: ✭ 271 (-36.08%)
Mutual labels:  laravel, laravel-package, laravel-5-package

Server monitoring for Laravel apps

Latest Version Software License Build Status Quality Score Total Downloads

This Laravel 5 package will periodically monitor the health of your server and website. Currently, it provides healthy/alarm status notifications for Disk Usage, an HTTP Ping function to monitor the health of external services, and a validation/expiration monitor for SSL Certificates.

Once installed, monitoring your server is very easy. Just issue this artisan command:

php artisan monitor:run

You can run only certain monitors at a time:

php artisan monitor:run HttpPing
php artisan monitor:run SSLCertificate,DiskUsage

How It Works

Using the configuration file in your project, any number of monitors can be configured to check for problems with your server setup.

When the monitor:run artisan command is executed, either from the command line or using the Laravel command scheduler, the monitors run and alert if there is an issue. The alarm state is configurable, and alerts can be sent to the log, or via email, Pushover, and Slack.

Disk Usage Monitors

Disk usage monitors check the percentage of the storage space that is used on the given partition, and alert if the percentage exceeds the configurable alarm percentage.

HTTP Ping Monitors

HTTP Ping monitors perform a simple page request and alert if the HTTP status code is not 200. They can optionally check that a certain phrase is included in the source of the page.

SSL Certificate Monitors

SSL Certificate monitors pull the SSL certificate for the configured URL and make sure it is valid for that URL. Wildcard and multi-domain certificates are supported.

The monitor will alert if the certificate is invalid or expired, and will also alert when the expiration date is approaching. The days on which to alert prior to expiration is also configurable.

Installation and usage

You can install this package via composer using:

composer require ericmakesstuff/laravel-server-monitor

You'll need to register the ServiceProvider:

// config/app.php

'providers' => [
    // ...
    EricMakesStuff\ServerMonitor\ServerMonitorServiceProvider::class,
];

To publish the config file to app/config/server-monitor.php run:

php artisan vendor:publish --provider="EricMakesStuff\ServerMonitor\ServerMonitorServiceProvider"

Monitor Configuration

After publishing the configuration file, you can edit the 'monitors' section of app/config/server-monitor.php.

The default monitor configurations are:

'monitors' => [
    /*
     * DiskUsage will alert when the free space on the device exceeds the alarmPercentage.
     * path is any valid file path, and the monitor will look at the usage of that disk partition.
     *
     * You may add as many DiskUsage monitors as you require.
     */
    'DiskUsage' => [
        [
            'path' => base_path(),
            'alarmPercentage' => 75,
        ],
    ],
    /*
     * HttpPing will perform an HTTP request to the configured URL and alert if the response code
     * is not 200, or if the optional checkPhrase is not found in the response.
     */
    'HttpPing' => [
        [
            'url' => 'http://www.example.com/',
        ],
        [
            'url' => 'http://www.example.com/',
            'checkPhrase' => 'Example Domain',
            'timeout' => 10,
            'allowRedirects' => false,
        ],
    ],
    /*
     * SSLCertificate will download the SSL Certificate for the URL and validate that the domain
     * is covered and that it is not expired. Additionally, it can warn when the certificate is
     * approaching expiration.
     */
    'SSLCertificate' => [
        [
            'url' => 'https://www.example.com/',
        ],
        [
            'url' => 'https://www.example.com/',
            'alarmDaysBeforeExpiration' => [14, 7],
        ],
    ],

Alert Configuration

Alerts can be logged to the default log handler, or sent via email, Pushover, or Slack. Allowed values are log, mail, pushover, and slack.

The default alert configurations are:

'events' => [
    'whenDiskUsageHealthy'       => ['log'],
    'whenDiskUsageAlarm'         => ['log', 'mail'],
    'whenHttpPingUp'             => ['log'],
    'whenHttpPingDown'           => ['log', 'mail'],
    'whenSSLCertificateValid'    => ['log'],
    'whenSSLCertificateInvalid'  => ['log', 'mail'],
    'whenSSLCertificateExpiring' => ['log', 'mail'],
],

Scheduling

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.

The commands can, like an other command, be scheduled in Laravel's console kernel.

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
   $schedule->command('monitor:run')->daily()->at('10:00');
   $schedule->command('monitor:run HttpPing')->hourly();
}

Of course, the schedules used in the code above are just an example. Adjust them to your own preferences.

Testing

Run the tests with:

vendor/bin/phpunit

Next Steps

More monitoring metrics. Feel free to submit ideas via issues or pull requests!

Ideas
  • Remote server disk space usage (over SSH)
  • NTP Offset in seconds

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].