LaravelPackages.net
Acme Inc.
Toggle sidebar
thecodingmachine/laravel-server-monitor-plugin-notification-by-host

Monitor servers plugin to send notification by host

21
0
0.2
About thecodingmachine/laravel-server-monitor-plugin-notification-by-host

thecodingmachine/laravel-server-monitor-plugin-notification-by-host is a Laravel package for monitor servers plugin to send notification by host. It currently has 0 GitHub stars and 21 downloads on Packagist (latest version 0.2). Install it with composer require thecodingmachine/laravel-server-monitor-plugin-notification-by-host. Discover more Laravel packages by thecodingmachine or browse all Laravel packages to compare alternatives.

Last updated

Scrutinizer Code Quality Build Status Coverage Status

Plugin to Laravel server Monitor

This plugin is to use a different notification way by host for the Laravel server monitor developed by spatie

Installation

You can install this package via composer using this command:

composer require spatie/laravel-server-monitor

Next, you must install the service provider:

// config/app.php
'providers' => [
    ...
    TheCodingMachine\ServerMonitorPluginNotificationbyHost\ServerMonitorPluginNotificationByHostServiceProvider::class,
];

You must publish the config-file with:

php artisan vendor:publish --provider="TheCodingMachine\ServerMonitorPluginNotificationbyHost\ServerMonitorPluginNotificationByHostServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    'notifications' => [
        /* List of each channel you can be used */
        /* This contain the detail of parameter mandatory to use it */
        'channels' => 
			['mail' => 
				['to' => 'array']],
			['slack' => 
				['webhook_url' => 'string']],
			
    ]
];

To use the plugin, you must change the server-monitor.php with the next values:

    ...

    'notifications' => [

        'notifications' => [
            TheCodingMachine\ServerMonitorPluginNotificationByHost\Notifications\Notifications\CheckSucceeded::class => [],
            TheCodingMachine\ServerMonitorPluginNotificationByHost\Notifications\Notifications\CheckRestored::class => ['slack'],
            TheCodingMachine\ServerMonitorPluginNotificationByHost\Notifications\Notifications\CheckWarning::class => ['slack'],
            TheCodingMachine\ServerMonitorPluginNotificationByHost\Notifications\Notifications\CheckFailed::class => ['slack'],
        ],
        ...
        'notifiable' => TheCodingMachine\ServerMonitorPluginNotificationByHost\Notifications\Notifiable::class,
        ...
    ]
    ...

Use it

By default, if no custom configuration was configured, this is the global parameters set in server-monitor.php which will used. You can change the configuration by host (mail receiver, slack channel ...), and the channel by error type by host.

To apply this, there is 2 new commands add to artisan:

  • Add notification for a specific host: php artisan server-monitor:add-notification-host
  • List all notification by host: php artisan server-monitor:list-notifications

Star History Chart