All Projects β†’ antonioribeiro β†’ Health

antonioribeiro / Health

Licence: bsd-3-clause
Laravel Health Panel

Programming Languages

PHP
23972 projects - #3 most used programming language
Vue
7211 projects
Blade
752 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to Health

Servermonitor
πŸ’“ Laravel package to periodically monitor the health of your server and application.
Stars: ✭ 148 (-91.66%)
Mutual labels:  health, laravel, server, monitor
Laravel Server Monitor
Don't let your servers just melt down
Stars: ✭ 595 (-66.46%)
Mutual labels:  laravel, notifications, server, monitor
Facebook
πŸ“¨ Facebook Notifications Channel for Laravel
Stars: ✭ 120 (-93.24%)
Mutual labels:  hacktoberfest, laravel, notifications
Nebula
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.
Stars: ✭ 190 (-89.29%)
Mutual labels:  hacktoberfest, laravel, panel
Laravel Failed Job Monitor
Get notified when a queued job fails
Stars: ✭ 582 (-67.19%)
Mutual labels:  laravel, notifications, monitor
Laravel Api Boilerplate
A Boilerplate Project For Laravel API's (NOT MAINTAINED)
Stars: ✭ 113 (-93.63%)
Mutual labels:  hacktoberfest, laravel
Collector Intellij
A PhpStorm plugin for refactoring to collections
Stars: ✭ 114 (-93.57%)
Mutual labels:  hacktoberfest, laravel
Goodwork
Self hosted project management and collaboration tool powered by TALL stack
Stars: ✭ 1,730 (-2.48%)
Mutual labels:  hacktoberfest, laravel
Laravel Mail Editor
MailEclipse ⚑ Laravel Mailable Editor!
Stars: ✭ 1,714 (-3.38%)
Mutual labels:  hacktoberfest, laravel
Collect
A Collections-only split from Laravel's Illuminate Support
Stars: ✭ 1,433 (-19.22%)
Mutual labels:  hacktoberfest, laravel
Laravel Parse
A Parse SDK bridge for Laravel 5
Stars: ✭ 116 (-93.46%)
Mutual labels:  laravel, server
Onramp
Easing the onramp for new or non-PHP developers to become Laravel devs.
Stars: ✭ 123 (-93.07%)
Mutual labels:  hacktoberfest, laravel
Laravel Translations Loader
Webpack loader to import Laravel translation files (PHP or JSON) into your JS bundle as JSON.
Stars: ✭ 109 (-93.86%)
Mutual labels:  hacktoberfest, laravel
Laracom
Laravel FREE E-Commerce Software
Stars: ✭ 1,570 (-11.5%)
Mutual labels:  hacktoberfest, laravel
Statusok
Monitor your Website and APIs from your Computer. Get Notified through Slack, E-mail when your server is down or response time is more than expected.
Stars: ✭ 1,522 (-14.21%)
Mutual labels:  notifications, monitor
Panels
Panels is a framework to easily add sliding panels to your application
Stars: ✭ 1,457 (-17.87%)
Mutual labels:  notifications, panel
Http Server
a simple zero-configuration command-line http server
Stars: ✭ 11,280 (+535.85%)
Mutual labels:  hacktoberfest, server
Voyager
Voyager - The Missing Laravel Admin
Stars: ✭ 10,801 (+508.85%)
Mutual labels:  hacktoberfest, laravel
Hydra
OpenID Certifiedβ„’ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+569.9%)
Mutual labels:  hacktoberfest, server
Oc Mall Plugin
πŸͺ E-commerce solution for October CMS
Stars: ✭ 128 (-92.78%)
Mutual labels:  hacktoberfest, laravel

Health Monitor

Laravel Server & App Health Monitor and Notifier

Latest Stable Version License Code Quality

Build Downloads Coverage PHP

This package checks if the application resources are running as they should and creates a service status panel. It has the following main points:

  • Highly extensible and configurable: you can create new checkers and notifiers very easily, and you can virtually change everything on it.
  • Easy configuration: uses YAML as configuration files
  • Resilient resource checker: if the framework is working and at least one notification channel, you should receive notification messages.
  • Built-in notification system: get notifications via mail, slack, telegram or anything else you need.
  • Routes for: panel, json result, string result and resource.
  • Configurable panel design.
  • Cache.
  • Schedule checks to automatically receive notifications when a service fails.
  • View app error messages right in the panel.
  • Http response codes 200 and 500, on error, for services like Envoyer to keep track of your app health.

Built-in Resources

Heath has pre-configured resource checkers for the following services:

  • Adyen
  • AppKey
  • APIs
  • Broadcasting
  • Cache
  • ConfigurationCached
  • Certificate
  • Checkout.com
  • Database
  • DebugMode
  • DirectoryPermissions
  • DiskSpace
  • DocuSign
  • ElasticsearchConnectable
  • EnvExists
  • Filesystem
  • Framework
  • Horizon
  • Http
  • Https
  • LaravelServices
  • Latency
  • LocalStorage
  • Mail
  • MailgunConnectable
  • MemcachedConnectable
  • MigrationsUpToDate
  • MixManifest
  • MySql
  • MySqlConnectable
  • NewrelicDeamon
  • NginxServer
  • PackagesUpToDate
  • Php
  • PostgreSqlConnectable
  • PostgreSqlServer
  • Queue
  • QueueWorkers
  • RebootRequired
  • Redis
  • RedisConnectable
  • RedisServer
  • RoutesCached
  • S3
  • SecurityChecker
  • SeeTickets
  • Sendinblue
  • ServerLoad
  • ServerVars
  • ServerUptime
  • Sshd
  • Supervisor

But you can add anything else you need, you just have to find the right checker to use or just create a new checker for your resource.

Easy Configuration

Creating new resources monitors is easy, just create a new YAML file in app's config/health folder and it's done. Here's some examples:

Amazon S3

name: S3
abbreviation: s3
checker: PragmaRX\Health\Checkers\CloudStorageChecker
notify: true
driver: s3
file: pragmarx-health-s3-testfile.txt
contents: {{ str_random(32) }}
error_message: 'Amazon S3 connection is failing.'
column_size: 4

Nginx

name: NginxServer
abbreviation: ngnxsrvr
checker: PragmaRX\Health\Checkers\ProcessChecker
command: 'pgrep %s'
method: process_count
process_name: nginx
instances:
    minimum:
        count: 4
        message: 'Process "%s" has not enough instances running: it has %s, when should have at least %s'
    maximum:
        count: 8
        message: 'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
notify: true
pid_file_missing_error_message: 'Process ID file is missing: %s.'
pid_file_missing_not_locked: 'Process ID file is not being used by any process: %s.'
column_size: 4

Screenshots

Panel

default panel

Panel alternate design

If you have lots of services to check, you may change the default panel design to use less space:

default panel

Panel in 4 columns layout

default panel

Error Messages

Mouse over a failing resource and get instant access to the error message:

default panel

Click the resource button and you'll get an alert showing the error message:

default panel

Slack Notification

Here's an example of notification sent via Slack:

default panel

Artisan Console Commands

The health check commands below also return an exit code in a standard format:

Numeric Value Service Status Status Description
0 OK Service and appears to be functioning properly
1 Warning Check ran okay, but was above some "warning" threshold
2 Critical The check detected service is not running or is above a "critical" threshold
3 Unknown Settings for the service check may be misconfigured and is preventing the check for being performed

health:panel

Use the command health:panel to view the status of your services in console.

health:check

Use the command health:check to check all your resources and send notifications on failures.

default panel

Routes

After installing you will have access to the following routes:

/health/panel

The main panel route.

/health/check

Returns a json with everything the package knows about your services:

default panel

/health/string

Returns a string with status on all your services, useful when using other monitoring services:

hlthFAIL-dbFAIL-filesystemOK-frmwrkOK-httpOK-httpsOK-mailOK

/health/resource/{name}

Returns a json with information about a particular service:

default panel

Requirements

  • PHP 7.1+
  • Laravel 5.6+

Installing

Use Composer to install it:

composer require pragmarx/health

Installing on Laravel

Add the Service Provider to your config/app.php:

PragmaRX\Health\ServiceProvider::class,

Publish config and views

php artisan vendor:publish --provider="PragmaRX\Health\ServiceProvider"

Hit The Health Panel

http://yourdomain.com/health/panel

Configure All The Things

Almost everything is easily configurable in this package:

  • Panel name
  • Title and messages
  • Resource checkers
  • Slack icon
  • Notification channels
  • Template location
  • Routes and prefixes
  • Mail server
  • Cache
  • Scheduler

Configure binaries

Some of the checkers need you to configure the proper binary path for the checker to work:

'services' => [
    'ping' => [
        'bin' => env('HEALTH_PING_BIN', '/sbin/ping'),
    ],

    'composer' => [
        'bin' => env('HEALTH_COMPOSER_BIN', 'composer'),
    ],
],

Allowing Slack Notifications

To receive notifications via Slack, you'll have to setup Incoming Webhooks and add this method to your User model with your webhook:

/**
 * Route notifications for the Slack channel.
 *
 * @return string
 */
public function routeNotificationForSlack()
{
    return config('services.slack.webhook_url');
}

Cache

When Health result is cached, you can flush the cache to make it process all resources again by adding ?flush=true to the url:

http://yourdomain.com/health/panel?flush=true

Events

If you prefer to build you own notifications systems, you can disable it and listen for the following event

PragmaRX\Health\Events\RaiseHealthIssue::class

Broadcasting Checker

Broadcasting checker is done via ping and pong system. The broadcast checker will ping your service, and it must pong back. Basically what you need to do is to call back a url with some data:

Redis + Socket.io

var request = require('request');
var server = require('http').Server();
var io = require('socket.io')(server);
var Redis = require('ioredis');
var redis = new Redis();

redis.subscribe('pragmarx-health-broadcasting-channel');

redis.on('message', function (channel, message) {
    message = JSON.parse(message);

    if (message.event == 'PragmaRX\\Health\\Events\\HealthPing') {
        request.get(message.data.callbackUrl + '?data=' + JSON.stringify(message.data));
    }
});

server.listen(3000);

Pusher

<!DOCTYPE html>
<html>
    <head>
        <title>Pusher Test</title>
        <script src="https://js.pusher.com/3.2/pusher.min.js"></script>
        <script>
            var pusher = new Pusher('YOUR-PUSHER-KEY', {
                encrypted: true
            });

            var channel = pusher.subscribe('pragmarx-health-broadcasting-channel');

            channel.bind('PragmaRX\\Health\\Events\\HealthPing', function(data) {
                var request = (new XMLHttpRequest());

                request.open("GET", data.callbackUrl + '?data=' + JSON.stringify(data));

                request.send();
            });
        </script>
    </head>

    <body>
        Pusher waiting for events...
    </body>
</html>

Programatically checking resources

$generalHealthState = app('pragmarx.health')->checkResources();

// or

$databaseHealthy = app('pragmarx.health')->checkResource('database')->isHealthy();

Checking in artisan commands example:

Artisan::command('database:health', function () {
    app('pragmarx.health')->checkResource('database')->isHealthy()
        ? $this->info('database is healthy')
        : $this->info('database is in trouble')
    ;
})->describe('Check database health');

SecurityChecker

As the SensioLabs Security Checker package was abandoned, this checker now depends on local-php-security-checker. You need to compile or install it on your server or container in order to use this checker, and update the config/resources/SecurityChecker.yml file accordingly.

Lumen

To use it on Lumen, you'll probably need to do something like this on your bootstrap/app.php:

$app->instance('path.config', app()->basePath() . DIRECTORY_SEPARATOR . 'config');
$app->instance('path.storage', app()->basePath() . DIRECTORY_SEPARATOR . 'storage');

$app->withFacades();

$app->singleton('Illuminate\Contracts\Routing\ResponseFactory', function ($app) {
    return new \Illuminate\Routing\ResponseFactory(
        $app['Illuminate\Contracts\View\Factory'],
        $app['Illuminate\Routing\Redirector']
    );
});

$app->register(PragmaRX\Health\ServiceProvider::class);

Testing

$ composer test

Author

Antonio Carlos Ribeiro

License

Health is licensed under the BSD 3-Clause License - see the LICENSE file for details

Contributing

Pull requests and issues are more than welcome.

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].