add monitoring

This commit is contained in:
ludo
2024-02-22 19:33:56 +01:00
parent 927be4ea77
commit 7a33245c1e
61 changed files with 1666 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command(\Spatie\Health\Commands\RunHealthChecksCommand::class)->everyMinute();
} }
protected function commands() protected function commands()

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Spatie\Health\Checks\Checks\CacheCheck;
use Spatie\Health\Checks\Checks\DatabaseCheck;
use Spatie\Health\Checks\Checks\HorizonCheck;
use Spatie\Health\Checks\Checks\QueueCheck;
use Spatie\Health\Checks\Checks\RedisCheck;
use Spatie\Health\Checks\Checks\ScheduleCheck;
use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;
use Spatie\Health\Facades\Health;
use Spatie\SecurityAdvisoriesHealthCheck\SecurityAdvisoriesCheck;
class HealthServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
Health::checks([
CacheCheck::new(),
UsedDiskSpaceCheck::new(),
DatabaseCheck::new(),
HorizonCheck::new(),
QueueCheck::new(),
RedisCheck::new(),
ScheduleCheck::new(),
SecurityAdvisoriesCheck::new(),
]);
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
}
}

View File

@@ -93,6 +93,7 @@
"spatie/laravel-mail-preview": "^6.0", "spatie/laravel-mail-preview": "^6.0",
"spatie/laravel-medialibrary": "^10.15", "spatie/laravel-medialibrary": "^10.15",
"spatie/laravel-stats": "^2.1", "spatie/laravel-stats": "^2.1",
"spatie/security-advisories-health-check": "^1.1",
"staudenmeir/belongs-to-through": "^2.12", "staudenmeir/belongs-to-through": "^2.12",
"staudenmeir/eloquent-has-many-deep": "^1.17", "staudenmeir/eloquent-has-many-deep": "^1.17",
"stillat/numeral.php": "^2.0", "stillat/numeral.php": "^2.0",

View File

@@ -176,6 +176,7 @@ return [
// App\Providers\BroadcastServiceProvider::class, // App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
App\Providers\HealthServiceProvider::class,
], ],

View File

@@ -1,6 +1,7 @@
<?php <?php
return [ return [
/* /*
* A result store is responsible for saving the results of the checks. The * A result store is responsible for saving the results of the checks. The
* `EloquentHealthResultStore` will save results in the database. You * `EloquentHealthResultStore` will save results in the database. You
@@ -8,7 +9,6 @@ return [
*/ */
'result_stores' => [ 'result_stores' => [
Spatie\Health\ResultStores\EloquentHealthResultStore::class => [ Spatie\Health\ResultStores\EloquentHealthResultStore::class => [
'connection' => env('HEALTH_DB_CONNECTION', env('DB_CONNECTION')),
'model' => Spatie\Health\Models\HealthCheckResultHistoryItem::class, 'model' => Spatie\Health\Models\HealthCheckResultHistoryItem::class,
'keep_history_for_days' => 5, 'keep_history_for_days' => 5,
], ],
@@ -58,10 +58,10 @@ return [
'throttle_notifications_key' => 'health:latestNotificationSentAt:', 'throttle_notifications_key' => 'health:latestNotificationSentAt:',
'mail' => [ 'mail' => [
'to' => 'your@example.com', 'to' => 'ludovic.candellier@fundglobam.org',
'from' => [ 'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'address' => env('MAIL_FROM_ADDRESS', 'no-reply@fundglobam.org'),
'name' => env('MAIL_FROM_NAME', 'Example'), 'name' => env('MAIL_FROM_NAME', 'Example'),
], ],
], ],

340
config/health/config.php Normal file
View File

@@ -0,0 +1,340 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Health Monitor Title
|--------------------------------------------------------------------------
|
| This is the title of the health check panel, that shows up at the top-left
| corner of the window. Feel free to edit this value to suit your needs.
|
*/
'title' => 'FgDigital Monitoring checking',
/*
|--------------------------------------------------------------------------
| Health Monitor Resources
|--------------------------------------------------------------------------
|
| Below is the list of resources the health checker will look into.
| And the path to where the resources yaml files are located.
|
*/
'resources' => [
/*
|--------------------------------------------------------------------------
| Health Monitor Resources Path
|--------------------------------------------------------------------------
|
| This value determines the path to where the resources yaml files are
| located. By default, all resources are in config/health/resources
|
*/
'path' => config_path('health/resources'),
/*
|--------------------------------------------------------------------------
| Health Monitor Enabled Resources
|--------------------------------------------------------------------------
|
| Below is the list of resources currently enabled for your laravel application.
| The default enabled resources are picked for the common use-case. However,
| you are free to uncomment certain resource or add your own as you wish.
|
*/
'enabled' => [
// 'API',
'AppKey',
// 'Adyen',
// 'Broadcasting',
'Cache',
// 'Certificate',
'ConfigurationCached',
'Database',
'DebugMode',
'DirectoryPermissions',
'DiskSpace',
// 'Dynamics',
// 'DocuSign',
// 'ElasticsearchConnectable',
'EnvExists',
'Filesystem',
'Framework',
// 'Horizon',
// 'Http',
// 'Https',
'LaravelServices',
// 'Latency',
'LocalStorage',
'Mail',
// 'MailgunConnectable',
// 'MemcachedConnectable',
'MigrationsUpToDate',
// 'MySql',
'MySqlConnectable',
// 'NewrelicDeamon',
// 'NginxServer',
// 'PackagesUpToDate',
// 'Php',
// 'PostgreSqlConnectable',
// 'PostgreSqlServer',
'Queue',
// 'QueueWorkers',
// 'RebootRequired',
'Redis',
'RedisConnectable',
// 'RedisServer',
'RoutesCached',
// 'S3',
// 'SecurityChecker',
// 'SeeTickets',
// 'Sendinblue',
// 'ServerLoad',
// 'ServerUptime',
// 'Sshd',
// 'Supervisor',
],
],
/*
|--------------------------------------------------------------------------
| Health Monitor Sort Key
|--------------------------------------------------------------------------
|
| This value determines how the resources cards in your panel is sorted. By
| default, we sort by slug, but you may use other supported values below
|
| Options: 'abbreviation', 'slug', 'name'
*/
'sort_by' => 'slug',
/*
|--------------------------------------------------------------------------
| Health Monitor Caching
|--------------------------------------------------------------------------
|
| Below is the list of configurations for health monitor caching mechanism
|
*/
'cache' => [
/*
|--------------------------------------------------------------------------
| Health Monitor Caching Key
|--------------------------------------------------------------------------
|
| This value determines the key to use for caching the results of health
| monitor. Please feel free to update this to suit your own convention
|
*/
'key' => 'health-resources',
/*
|--------------------------------------------------------------------------
| Health Monitor Caching Duration
|--------------------------------------------------------------------------
|
| This determines how long the results of each check should stay cached in
| your application. When your application is in "debug" mode caching is
| automatically disabled, otherwise we default to caching every minute
|
| Options:
| 0 = Cache Forever
| false = Disables caching
| 30 = (integer) Minutes to cache
*/
'minutes' => config('app.debug') === true ? false : 1,
],
'database' => [
'enabled' => true,
'graphs' => [
'enabled' => true,
'height' => 90,
],
'max_records' => 30,
'model' => PragmaRX\Health\Data\Models\HealthCheck::class,
],
'services' => [
'ping' => [
'bin' => env('HEALTH_PING_BIN', '/sbin/ping'),
],
'composer' => [
'bin' => env('HEALTH_COMPOSER_BIN', 'composer'),
],
],
'assets' => [
'css' => base_path(
'vendor/pragmarx/health/src/resources/dist/css/app.css'
),
'js' => base_path(
'vendor/pragmarx/health/src/resources/dist/js/app.js'
),
],
'cache_files_base_path' => $path = 'app/pragmarx/health',
'notifications' => [
'enabled' => false,
'notify_on' => [
'panel' => false,
'check' => true,
'string' => true,
'resource' => false,
],
'subject' => 'Health Status',
'action-title' => 'View App Health',
'action_message' => "The '%s' service is in trouble and needs attention%s",
'from' => [
'name' => 'Laravel Health Checker',
'address' => 'healthchecker@mydomain.com',
'icon_emoji' => ':anger:',
],
'scheduler' => [
'enabled' => false,
'frequency' => 'everyFiveMinutes', // most methods on -- https://laravel.com/docs/8.x/scheduling#schedule-frequency-options
],
'users' => [
'model' => App\User::class,
'emails' => ['admin@mydomain.com'],
],
'channels' => ['mail', 'slack'], // mail, slack
'notifier' => 'PragmaRX\Health\Notifications\HealthStatus',
],
'alert' => [
'success' => [
'type' => 'success',
'message' => 'Everything is fine with this resource',
],
'error' => [
'type' => 'error',
'message' => 'We are having trouble with this resource',
],
],
'style' => [
'columnSize' => 2,
'button_lines' => 'multi', // multi or single
'multiplier' => 0.4,
'opacity' => [
'healthy' => '0.4',
'failing' => '1',
],
],
'views' => [
'panel' => 'pragmarx/health::default.panel',
'empty-panel' => 'pragmarx/health::default.empty-panel',
'partials' => [
'well' => 'pragmarx/health::default.partials.well',
],
],
'string' => [
'glue' => '-',
'ok' => 'OK',
'fail' => 'FAIL',
],
'routes' => [
'prefix' => $route_prefix = '/health',
'namespace' => $namespace = 'PragmaRX\Health\Http\Controllers\Health',
'notification' => 'pragmarx.health.panel',
'list' => [
[
'uri' => "{$route_prefix}/panel",
'name' => 'pragmarx.health.panel',
'action' => "{$namespace}@panel",
'middleware' => [
/*'auth.basic'*/
],
],
[
'uri' => "{$route_prefix}/check",
'name' => 'pragmarx.health.check',
'action' => "{$namespace}@check",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/string",
'name' => 'pragmarx.health.string',
'action' => "{$namespace}@string",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/resources",
'name' => 'pragmarx.health.resources.all',
'action' => "{$namespace}@allResources",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/resources/{slug}",
'name' => 'pragmarx.health.resources.get',
'action' => "{$namespace}@getResource",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/assets/css/app.css",
'name' => 'pragmarx.health.assets.css',
'action' => "{$namespace}@assetAppCss",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/assets/js/app.js",
'name' => 'pragmarx.health.assets.js',
'action' => "{$namespace}@assetAppJs",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/config",
'name' => 'pragmarx.health.config',
'action' => "{$namespace}@config",
'middleware' => [],
],
],
],
'urls' => [
'panel' => '/health/panel',
],
];

334
config/health/health.php Normal file
View File

@@ -0,0 +1,334 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Health Monitor Title
|--------------------------------------------------------------------------
|
| This is the title of the health check panel, that shows up at the top-left
| corner of the window. Feel free to edit this value to suit your needs.
|
*/
'title' => 'Laravel Health Check Panel',
/*
|--------------------------------------------------------------------------
| Health Monitor Resources
|--------------------------------------------------------------------------
|
| Below is the list of resources the health checker will look into.
| And the path to where the resources yaml files are located.
|
*/
'resources' => [
/*
|--------------------------------------------------------------------------
| Health Monitor Resources Path
|--------------------------------------------------------------------------
|
| This value determines the path to where the resources yaml files are
| located. By default, all resources are in config/health/resources
|
*/
'path' => config_path('health/resources'),
/*
|--------------------------------------------------------------------------
| Health Monitor Enabled Resources
|--------------------------------------------------------------------------
|
| Below is the list of resources currently enabled for your laravel application.
| The default enabled resources are picked for the common use-case. However,
| you are free to uncomment certain resource or add your own as you wish.
|
*/
'enabled' => [
'AppKey',
// 'Broadcasting',
'Cache',
'ConfigurationCached',
'Database',
'DebugMode',
'DirectoryPermissions',
'DiskSpace',
// 'DocuSign',
// 'ElasticsearchConnectable',
'EnvExists',
'Filesystem',
'Framework',
// 'Horizon',
// 'Http',
'Https',
'LaravelServices',
'Latency',
'LocalStorage',
'Mail',
// 'MailgunConnectable',
// 'MemcachedConnectable',
'MigrationsUpToDate',
'MySql',
'MySqlConnectable',
// 'NewrelicDeamon',
'NginxServer',
// 'PackagesUpToDate',
'Php',
// 'PostgreSqlConnectable',
// 'PostgreSqlServer',
'Queue',
'QueueWorkers',
'RebootRequired',
'Redis',
'RedisConnectable',
'RedisServer',
'RoutesCached',
// 'S3',
'SecurityChecker',
'ServerLoad',
'ServerUptime',
// 'Sshd',
'Supervisor',
],
],
/*
|--------------------------------------------------------------------------
| Health Monitor Sort Key
|--------------------------------------------------------------------------
|
| This value determines how the resources cards in your panel is sorted. By
| default, we sort by slug, but you may use other supported values below
|
| Options: 'abbreviation', 'slug', 'name'
*/
'sort_by' => 'slug',
/*
|--------------------------------------------------------------------------
| Health Monitor Caching
|--------------------------------------------------------------------------
|
| Below is the list of configurations for health monitor caching mechanism
|
*/
'cache' => [
/*
|--------------------------------------------------------------------------
| Health Monitor Caching Key
|--------------------------------------------------------------------------
|
| This value determines the key to use for caching the results of health
| monitor. Please feel free to update this to suit your own convention
|
*/
'key' => 'health-resources',
/*
|--------------------------------------------------------------------------
| Health Monitor Caching Duration
|--------------------------------------------------------------------------
|
| This determines how long the results of each check should stay cached in
| your application. When your application is in "debug" mode caching is
| automatically disabled, otherwise we default to caching every minute
|
| Options:
| 0 = Cache Forever
| false = Disables caching
| 30 = (integer) Minutes to cache
*/
'minutes' => config('app.debug') === true ? false : 1,
],
'database' => [
'enabled' => false,
'graphs' => [
'enabled' => true,
'height' => 90,
],
'max_records' => 30,
'model' => PragmaRX\Health\Data\Models\HealthCheck::class,
],
'services' => [
'ping' => [
'bin' => env('HEALTH_PING_BIN', '/sbin/ping'),
],
'composer' => [
'bin' => env('HEALTH_COMPOSER_BIN', 'composer'),
],
],
'assets' => [
'css' => base_path(
'vendor/pragmarx/health/src/resources/dist/css/app.css'
),
'js' => base_path(
'vendor/pragmarx/health/src/resources/dist/js/app.js'
),
],
'cache_files_base_path' => $path = 'app/pragmarx/health',
'notifications' => [
'enabled' => false,
'notify_on' => [
'panel' => false,
'check' => true,
'string' => true,
'resource' => false,
],
'subject' => 'Health Status',
'action-title' => 'View App Health',
'action_message' => "The '%s' service is in trouble and needs attention%s",
'from' => [
'name' => 'Laravel Health Checker',
'address' => 'healthchecker@mydomain.com',
'icon_emoji' => ':anger:',
],
'scheduler' => [
'enabled' => true,
'frequency' => 'everyMinute', // most methods on -- https://laravel.com/docs/5.3/scheduling#defining-schedules
],
'users' => [
'model' => App\User::class,
'emails' => ['admin@mydomain.com'],
],
'channels' => ['mail', 'slack'], // mail, slack
'notifier' => 'PragmaRX\Health\Notifications',
],
'alert' => [
'success' => [
'type' => 'success',
'message' => 'Everything is fine with this resource',
],
'error' => [
'type' => 'error',
'message' => 'We are having trouble with this resource',
],
],
'style' => [
'columnSize' => 2,
'button_lines' => 'multi', // multi or single
'multiplier' => 0.4,
'opacity' => [
'healthy' => '0.4',
'failing' => '1',
],
],
'views' => [
'panel' => 'pragmarx/health::default.panel',
'empty-panel' => 'pragmarx/health::default.empty-panel',
'partials' => [
'well' => 'pragmarx/health::default.partials.well',
],
],
'string' => [
'glue' => '-',
'ok' => 'OK',
'fail' => 'FAIL',
],
'routes' => [
'prefix' => $route_prefix = '/health',
'namespace' => $namespace = 'PragmaRX\Health\Http\Controllers\Health',
'notification' => 'pragmarx.health.panel',
'list' => [
[
'uri' => "{$route_prefix}/panel",
'name' => 'pragmarx.health.panel',
'action' => "{$namespace}@panel",
'middleware' => [
/*'auth.basic'*/
],
],
[
'uri' => "{$route_prefix}/check",
'name' => 'pragmarx.health.check',
'action' => "{$namespace}@check",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/string",
'name' => 'pragmarx.health.string',
'action' => "{$namespace}@string",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/resources",
'name' => 'pragmarx.health.resources.all',
'action' => "{$namespace}@allResources",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/resources/{slug}",
'name' => 'pragmarx.health.resources.get',
'action' => "{$namespace}@getResource",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/assets/css/app.css",
'name' => 'pragmarx.health.assets.css',
'action' => "{$namespace}@assetAppCss",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/assets/js/app.js",
'name' => 'pragmarx.health.assets.js',
'action' => "{$namespace}@assetAppJs",
'middleware' => [],
],
[
'uri' => "{$route_prefix}/config",
'name' => 'pragmarx.health.config',
'action' => "{$namespace}@config",
'middleware' => [],
],
],
],
'urls' => [
'panel' => '/health/panel',
],
];

View File

@@ -0,0 +1,17 @@
name: API Checker
abbreviation: apichecker
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 5
roundtrip_timeout: 10
targets:
- default:
urls:
- https://api.whatever.com/v1.1/authorization/token:
method: POST
auth:
- "{{ config('services.whatever.api.username') }}"
- "{{ config('services.whatever.api.password') }}"
- basic

View File

@@ -0,0 +1,23 @@
name: Adyen
abbreviation: adyen
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 20
roundtrip_timeout: 30
targets:
- default:
urls:
- url1:
url: "{{ config('services.adyen.api_base_url') }}"
method: POST
debug: false
headers:
x-api-key: "{{ config('services.adyen.backend.api_key') }}"
content-type: application/json
form_params:
merchantAccount: "{{ config('services.adyen.merchant_account') }}"

View File

@@ -0,0 +1,11 @@
name: App Key
abbreviation: appkey
checker: PragmaRX\Health\Checkers\Expression
notify: true
column_size: 3
error_message: "There is no app key defined"
graph_enabled: false
targets:
- default:
expression_value: "config('app.key') !== null"
should_return: true

View File

@@ -0,0 +1,19 @@
name: Broadcasting
abbreviation: brdc
checker: PragmaRX\Health\Checkers\Broadcasting
notify: true
column_size: 3
error_message:
"The broadcasting service did not respond in time, it may be in trouble."
targets:
- default:
channel: pragmarx-health-broadcasting-channel
route_name: pragmarx.health.broadcasting.callback
secret: "{{ \\Illuminate\\Support\\Str::random(32) }}"
timeout: 30
routes:
pragmarx.health.broadcasting.callback:
uri: "/health/broadcasting/callback/{secret}"
controller: PragmaRX\Health\Http\Controllers\Broadcasting
action: callback
save_to: "{{ storage_path('app') }}/broadcasting.json"

View File

@@ -0,0 +1,10 @@
name: Cache
abbreviation: csh
checker: PragmaRX\Health\Checkers\Cache
notify: true
error_message: "Cache is not returning cached values."
column_size: 3
targets:
- default:
minutes: 1
key: health-cache-test

View File

@@ -0,0 +1,22 @@
name: Certificate
abbreviation: ccert
checker: PragmaRX\Health\Checkers\Certificate
notify: true
error_message: "Invalid certificate for domain: %s"
column_size: 3
command: "openssl s_client {$options} -connect {$host}:443 2>&1"
verify_string: "Verify return code"
success_string: "Verify return code: 0 (ok)"
targets:
- host1:
options: -tls1
urls:
- laravel.com
- wwwprd:
options: -tls1_1
urls:
- google.com
- revoked:
options: -tls1_2
urls:
- revoked-rsa-dv.ssl.com

View File

@@ -0,0 +1,16 @@
name: Checkout.com API
abbreviation: https
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 30
roundtrip_timeout: 30
targets:
- default:
urls:
- checkout-com:
url: "https://{{ config('services.checkout_com.api.host') }}/event-types"
method: GET
headers:
Authorization: "{{ config('services.checkout_com.api.keys.secret') }}"

View File

@@ -0,0 +1,10 @@
name: Configuration Cached
abbreviation: cfgcch
checker: PragmaRX\Health\Checkers\Expression
notify: true
column_size: 3
error_message: "Configuration is not cached"
targets:
- default:
expression_value: "app()->configurationIsCached()"
should_return: true

View File

@@ -0,0 +1,16 @@
name: Database
abbreviation: db
checker: PragmaRX\Health\Checkers\Database
notify: true
column_size: 3
targets:
- users:
type: "find_first_model"
models:
- "{{ config('auth.providers.users.model') }}"
- "query speed":
type: "raw_query"
connection: "default"
query: "select * from users u join password_resets pr on pr.email = u.email order by u.created_at desc"
maximum_time: 0.05
error_message: "Query took %sms when it should have last at most %sms"

View File

@@ -0,0 +1,10 @@
name: Debug Mode
abbreviation: debug
checker: PragmaRX\Health\Checkers\Expression
notify: true
column_size: 3
error_message: "Application is in debug mode"
targets:
- default:
expression_value: "app('config')->get('app.debug')"
should_return: false

View File

@@ -0,0 +1,12 @@
name: Directory Permissions
abbreviation: dirperm
checker: PragmaRX\Health\Checkers\Writable
notify: true
column_size: 3
error_message: "%s is not writable"
targets:
- default:
paths:
- "{{ storage_path() }}"
- "{{ storage_path('logs/laravel.log') }}"
- "{{ base_path('bootstrap/cache') }}"

View File

@@ -0,0 +1,12 @@
name: Disk Space
abbreviation: dskspc
checker: PragmaRX\Health\Checkers\DiskSpace
notify: true
column_size: 3
targets:
- default:
name: root
path: "/"
minimum: 1GB
message:
"Volume %s is getting out of space. It has %s when it should have at least %s."

View File

@@ -0,0 +1,15 @@
name: DocuSign
abbreviation: dcsgn
checker: PragmaRX\Health\Checkers\Docusign
column_size: 3
notify: true
error_message: "A reboot is required in this server (Uptime Checker)"
targets:
- default:
username: "{{ docusign.username }}"
password: "{{ docusign.password }}"
integrator_key: "{{ docusign.integrator_key }}"
debug: "{{ docusign.debug }}"
debug_file: storage/logs/docusign.log
api_host: "{{ docusign.host }}"
not_installed_message: "Docusign is not installed."

View File

@@ -0,0 +1,22 @@
name: Dynamics 365
abbreviation: dynamics
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 5
roundtrip_timeout: 10
targets:
- default:
urls:
- url-from-config:
url: "{{ config('services.newsletter.login_url') }}"
headers:
api-key: "{{ config('services.sendinblue.api_key') }}"
method: POST
form_params:
username: "{{ config('services.newsletter.username') }}"
resource: "{{ config('services.newsletter.api_endpoint') }}"
grant_type: password
password: "{{ config('services.newsletter.password') }}"
client_id: "{{ config('services.newsletter.client_id') }}"

View File

@@ -0,0 +1,11 @@
name: Elasticsearch Connectable
abbreviation: redisconn
checker: PragmaRX\Health\Checkers\PortCheck
notify: true
column_size: 3
error_message: "Could not connect to %s on port %s"
targets:
- localhost:
hostname: localhost
port: 9200
timeout: 2

View File

@@ -0,0 +1,13 @@
name: .env Exists
abbreviation: envexists
checker: PragmaRX\Health\Checkers\DirectoryAndFilePresence
notify: true
error_message: "The .env file does not exists"
column_size: 3
targets:
- default:
file_exists:
- "{{ base_path('.env') }}"
file_do_not_exists:
directory_exists:
directory_do_not_exists:

View File

@@ -0,0 +1,76 @@
name: Extensions are installed
abbreviation: extensions-installed
checker: PragmaRX\Health\Checkers\Extensions
notify: true
error_message:
"The following extensions are not installed or enabled: %s"
column_size: 3
targets:
default:
- items:
- Core
- phpdbg_webhelper
- date
- libxml
- openssl
- pcre
- sqlite3
- zlib
- bcmath
- bz2
- calendar
- ctype
- curl
- dba
- dom
- hash
- FFI
- fileinfo
- filter
- ftp
- gd
- gettext
- gmp
- SPL
- iconv
- intl
- json
- ldap
- mbstring
- session
- standard
- odbc
- pcntl
- mysqlnd
- PDO
- pdo_dblib
- pdo_mysql
- PDO_ODBC
- pdo_pgsql
- pdo_sqlite
- pgsql
- Phar
- posix
- pspell
- readline
- Reflection
- mysqli
- shmop
- SimpleXML
- soap
- sockets
- sodium
- exif
- sysvmsg
- sysvsem
- sysvshm
- tidy
- tokenizer
- xml
- xmlreader
- xmlwriter
- xsl
- zip
- redis
- Zend OPcache
- xdebug

View File

@@ -0,0 +1,8 @@
name: Filesystem
abbreviation: flstm
checker: PragmaRX\Health\Checkers\Filesystem
notify: true
column_size: 3
targets:
- default:
error_message: "Unable to create temp file: %s."

View File

@@ -0,0 +1,5 @@
name: Framework
abbreviation: frmwrk
checker: PragmaRX\Health\Checkers\Framework
notify: true
column_size: 3

View File

@@ -0,0 +1,7 @@
name: Horizon
abbreviation: horizon
checker: PragmaRX\Health\Checkers\Horizon
notify: true
column_size: 3
error_message: "Laravel Horizon workers are not running"
graph_enabled: true

View File

@@ -0,0 +1,13 @@
name: Http
abbreviation: http
checker: PragmaRX\Health\Checkers\Http
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 30
roundtrip_timeout: 30
targets:
- default:
urls:
- '{{ config("app.url") }}'
- http://google.com

View File

@@ -0,0 +1,37 @@
name: Https
abbreviation: https
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 30
roundtrip_timeout: 30
targets:
- default:
urls:
- '{{ config("app.url") }}'
- https://google.com
- https://yahoo.com:
headers:
Authorization: Basic zzz0czBmz2zkzXRpb25sbzVpzzZ1zXRzz2zuZzz6z29hzC1zZWzkzQ==
- https://api.sendinblue.com/v3/account:
headers:
api-key: "{{ config('services.sendinblue.api_key') }}"
method: GET
- url-via-config-1:
url: "{{ config('services.see_tickets.api.endpoint') }}"
method: POST
auth:
- "{{ config('services.see_tickets.api.username') }}"
- "{{ config('services.see_tickets.api.password') }}"
- basic
- url-via-config-2:
url: "{{ config('services.whatever.url') }}"
method: POST
debug: false
form_params:
username: "{{ config('services.whatever.username') }}"
resource: "{{ config('services.whatever.api_endpoint') }}"
grant_type: password
password: "{{ config('services.whatever.password') }}"
client_id: "{{ config('services.whatever.client_id') }}"

View File

@@ -0,0 +1,13 @@
name: LaravelServices
abbreviation: lvs
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
connection_timeout: 2
roundtrip_timeout: 4
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s."
targets:
- default:
urls:
- "https://forge.laravel.com"
- "https://envoyer.io"

View File

@@ -0,0 +1,21 @@
name: Latency
abbreviation: latency
checker: PragmaRX\Health\Checkers\Ping
notify: true
binary: "{{ config('health.services.ping.bin') }}"
error_message:
'The host "%s" exceeded the maximum accepted latency on ping: last ping was %s, accepted is %s'
column_size: 3
targets:
- server:
name: rio de janeiro servers
hostname: google.com
accepted_latency: 15
- server:
name: south america servers
hostname: globo.com
accepted_latency: 20
- server:
name: europe servers
hostname: ovh.fr
accepted_latency: 2

View File

@@ -0,0 +1,11 @@
name: LocalStorage
abbreviation: lclstrg
checker: PragmaRX\Health\Checkers\CloudStorage
notify: true
error_message: "Cloud storage is not retrieving files correctly."
column_size: 3
targets:
- default:
driver: local
file: pragmarx-health-storage-testfile.txt
contents: "{{ \\Illuminate\\Support\\Str::random(32) }}"

View File

@@ -0,0 +1,21 @@
name: Mail
abbreviation: ml
checker: PragmaRX\Health\Checkers\Mail
notify: true
column_size: 3
targets:
- default:
view: "pragmarx/health::default.email"
config:
driver: log
host: mailtrap.io
port: "2525"
from:
address: no-reply@digital.fundglobam.com
name: "Health Checker"
encryption: null
username: "{{ mail.username }}"
password: "{{ mail.password }}"
sendmail: "/usr/sbin/sendmail -bs"
to: ludovic.candellier@fundglobam.com
subject: "Health Test mail"

View File

@@ -0,0 +1,19 @@
name: Mailgun Connectable
abbreviation: redisconn
checker: PragmaRX\Health\Checkers\PortCheck
notify: true
column_size: 3
error_message: "Could not connect to %s on port %s"
targets:
- mailgun1:
hostname: api.mailgun.net
port: 443
timeout: 2
- mailgun2:
hostname: smtp.mailgun.org
port: 465
timeout: 2
- mailgun3:
hostname: smtp.mailgun.org
port: 587
timeout: 2

View File

@@ -0,0 +1,11 @@
name: Memcached Connectable
abbreviation: redisconn
checker: PragmaRX\Health\Checkers\PortCheck
notify: true
column_size: 3
error_message: "Could not connect to %s on port %s"
targets:
- default:
hostname: localhost
port: 11211
timeout: 2

View File

@@ -0,0 +1,14 @@
name: Migrations Up to Date
abbreviation: debug
checker: PragmaRX\Health\Checkers\Artisan
notify: true
column_size: 3
error_message: "Not all migrations were migrated"
targets:
- default:
command:
name: "migrate"
options:
"--pretend": true
"--force": true
should_return: "Nothing to migrate"

View File

@@ -0,0 +1,16 @@
name: Mix Manifest
abbreviation: mix-manifest
checker: PragmaRX\Health\Checkers\MixManifest
notify: true
column_size: 3
targets:
- laravel:
file: "public/mix-manifest.json"
assets_root: "public"
- twill:
file: "public/assets/admin/twill-manifest.json"
assets_root: "public"
ignore_items:
- icons-files.php
- icons-wysiwyg.php
- icons.php

View File

@@ -0,0 +1,23 @@
name: MySql
abbreviation: msql
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: mysqld
pid_file: ""
instances:
minimum:
count: 1
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 20
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."

View File

@@ -0,0 +1,12 @@
name: MySQL Connectable
abbreviation: mysqlgrsqlsrvrconn
checker: PragmaRX\Health\Checkers\PortCheck
notify: true
column_size: 3
error_message: "Could not connect to %s on port %s"
targets:
- default:
name: mysql
hostname: mysql
port: 3306
timeout: 2

View File

@@ -0,0 +1,23 @@
name: NewrelicDeamon
abbreviation: nwrlcdmn
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: newrelic-daemon
pid_file: ""
instances:
minimum:
count: 1
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 4
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."

View File

@@ -0,0 +1,23 @@
name: NginxServer
abbreviation: ngnxsrvr
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: nginx
pid_file: ""
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'
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."

View File

@@ -0,0 +1,15 @@
name: Packages up to date
abbreviation: pkgupdtd
checker: PragmaRX\Health\Checkers\Composer
notify: true
binary: "{{ config('health.services.composer.bin') }}"
command: "outdated --format=json --minor-only"
should_count_at_most: 0
json_result: true
root_item: "installed"
error_message:
'There are %s outdated packages, please run composer outdated to see the full list'
column_size: 3
targets:
- default:
working_dir: "{{ base_path() }}"

View File

@@ -0,0 +1,23 @@
name: Php
abbreviation: php
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: php-fpm
pid_file: /tmp/php7.1-fpm.pid
instances:
minimum:
count: 2
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 20
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."

View File

@@ -0,0 +1,11 @@
name: PostgreSQL Connectable
abbreviation: pstgrsqlsrvrconn
checker: PragmaRX\Health\Checkers\PortCheck
notify: true
column_size: 3
error_message: "Could not connect to %s on port %s"
targets:
- default:
hostname: localhost
port: 5432
timeout: 2

View File

@@ -0,0 +1,23 @@
name: PostgreSqlServer
abbreviation: pstgrsqlsrvr
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: postgres
pid_file: ""
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'
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."

View File

@@ -0,0 +1,11 @@
name: Queue
abbreviation: queue
checker: PragmaRX\Health\Checkers\Queue
error_message: "Queue system is not working properly."
column_size: 3
targets:
- default:
test_job: PragmaRX\Health\Support\Jobs\TestJob
cache_instance: cache
notify: true
connection: ""

View File

@@ -0,0 +1,23 @@
name: QueueWorkers
abbreviation: qwrkrs
checker: PragmaRX\Health\Checkers\Process
notify: true
column_size: 3
targets:
- default:
command: "ps aux | grep php | grep queue:work"
method: process_count
process_name: php
pid_file: ""
instances:
minimum:
count: 1
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 3
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."

View File

@@ -0,0 +1,13 @@
name: RebootRequired
abbreviation: rbtrqrd
checker: PragmaRX\Health\Checkers\DirectoryAndFilePresence
notify: true
error_message: "A reboot is required in this server (Uptime Checker)"
column_size: 3
targets:
- default:
file_exists:
file_do_not_exists:
- /var/run/reboot-required
directory_exists:
directory_do_not_exists:

View File

@@ -0,0 +1,10 @@
name: Redis
abbreviation: rds
checker: PragmaRX\Health\Checkers\Redis
column_size: 3
notify: true
error_message: "Got a wrong value back from Redis."
targets:
- default:
key: "health:redis:key"
connection: ""

View File

@@ -0,0 +1,11 @@
name: Redis Connectable
abbreviation: redisconn
checker: PragmaRX\Health\Checkers\PortCheck
notify: true
column_size: 3
error_message: "Could not connect to %s on port %s"
targets:
- default:
hostname: redis
port: 6379
timeout: 2

View File

@@ -0,0 +1,23 @@
name: RedisServer
abbreviation: rdssrvr
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: redis-server
pid_file: ""
instances:
minimum:
count: 1
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 20
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."

View File

@@ -0,0 +1,10 @@
name: Routes Cached
abbreviation: rtcch
checker: PragmaRX\Health\Checkers\Expression
notify: true
column_size: 3
error_message: "Routes are not cached"
targets:
- default:
expression_value: "app()->routesAreCached()"
should_return: true

View File

@@ -0,0 +1,11 @@
name: S3
abbreviation: s3
checker: PragmaRX\Health\Checkers\CloudStorage
notify: true
column_size: 3
error_message: "Amazon S3 connection is failing."
targets:
- default:
driver: s3
file: pragmarx-health-s3-testfile.txt
contents: "{{ \\Illuminate\\Support\\Str::random(32) }}"

View File

@@ -0,0 +1,7 @@
name: Packages Security Checker
abbreviation: debug
checker: PragmaRX\Health\Checkers\SecurityChecker
notify: true
column_size: 3
error_message:
"The following packages have vulnerabilities referenced in the SensioLabs security advisories database: %s"

View File

@@ -0,0 +1,18 @@
name: See Tickets API
abbreviation: seetickets
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 5
roundtrip_timeout: 10
targets:
- default:
urls:
- url1:
url: "{{ config('services.see_tickets.api.endpoint') }}"
method: POST
auth:
- "{{ config('services.see_tickets.api.username') }}"
- "{{ config('services.see_tickets.api.password') }}"
- basic

View File

@@ -0,0 +1,15 @@
name: Sendinblue API
abbreviation: sendinblue
checker: PragmaRX\Health\Checkers\Https
notify: true
column_size: 3
timeout_message: "[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds."
connection_timeout: 5
roundtrip_timeout: 10
targets:
- default:
urls:
- https://api.sendinblue.com/v3/account:
headers:
api-key: "{{ config('services.sendinblue.api_key') }}"
method: GET

View File

@@ -0,0 +1,17 @@
name: ServerLoad
abbreviation: load
checker: PragmaRX\Health\Checkers\ServerLoad
error_message:
'Your server might be overloaded, current server load values are "%s, %s and %s", which are above the threshold values: "%s, %s and %s".'
column_size: 3
notify: true
targets:
- default:
regex:
'~(?<time_hour>\d{1,2}):(?<time_minute>\d{2})(?::(?<time_second>\d{2}))?\s+up\s+(?:(?<up_days>\d+)\s+days?,\s+)?\b(?:(?<up_hours>\d+):)?(?<up_minutes>\d+)(?:\s+(?:minute|minutes|min)?)?,\s+(?<users>\d+).+?(?<load_1>\d+.\d+),?\s+(?<load_5>\d+.\d+),?\s+(?<load_15>\d+.\d+)~'
command: "uptime 2>&1"
max_load:
load_1: 2
load_5: 1.5
load_15: 1
action_message: "Too much load! (Server Load Checker)"

View File

@@ -0,0 +1,14 @@
name: ServerUptime
abbreviation: uptm
checker: PragmaRX\Health\Checkers\ServerUptime
column_size: 3
notify: true
error_message:
'Looks like your server was recently rebooted, current uptime is now "%s" and it was "%s" before restart.'
targets:
- default:
regex:
'~(?<time_hour>\d{1,2}):(?<time_minute>\d{2})(?::(?<time_second>\d{2}))?\s+up\s+(?:(?<up_days>\d+)\s+days?,\s+)?\b(?:(?<up_hours>\d+):)?(?<up_minutes>\d+)(?:\s+(?:minute|minutes|min)?)?,\s+(?<users>\d+)?.+?(?<load_1>\d+.\d+),?\s+(?<load_5>\d+.\d+),?\s+(?<load_15>\d+.\d+)~'
command: "uptime 2>&1"
save_to: "{{ storage_path('app') }}/uptime.json"
action_message: "Your server was rebooted (Uptime Checker)"

View File

@@ -0,0 +1,48 @@
name: ServerVars
abbreviation: server-vars
checker: PragmaRX\Health\Checkers\ServerVars
error_message: "These $_SERVER vars doesn't match the expected value: %s"
notify: true
column_size: 3
targets:
- default:
config:
route: pragmarx.health.server-vars
cache_timeout: 5
query_string: "query=testing-cdn-enabled-query-strings"
auth:
username: "{{ config('auth.http.user') }}"
password: "{{ config('auth.http.password') }}"
vars:
server_port:
name: SERVER_PORT
operator: equals
value: 443
strict: false
mandatory: true
server_software:
name: SERVER_SOFTWARE
operator: contains
value: "nginx/1.20"
mandatory: true
query_string:
name: QUERY_STRING
operator: contains
value: "query=testing-cdn-enabled-query-strings"
mandatory: true
http_x_forwarded_proto:
name: HTTP_X_FORWARDED_PROTO
operator: equals
value: https
mandatory: false
http_cloudfront_forwarded_proto:
name: HTTP_CLOUDFRONT_FORWARDED_PROTO
operator: equals
value: https
mandatory: false
http_x_forwarded_port:
name: HTTP_X_FORWARDED_PORT
operator: equals
value: 443
strict: false
mandatory: false

View File

@@ -0,0 +1,23 @@
name: Sshd
abbreviation: sshd
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "pgrep %s"
method: process_count
process_name: sshd
pid_file: ""
instances:
minimum:
count: 1
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 15
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."

View File

@@ -0,0 +1,23 @@
name: Supervisor
abbreviation: sprvsr
checker: PragmaRX\Health\Checkers\Process
column_size: 3
notify: true
targets:
- default:
command: "ps aux | grep python | grep supervisord"
method: process_count
process_name: supervisor
pid_file: ""
instances:
minimum:
count: 1
message:
'Process "%s" has not enough instances running: it has %s, when should have at least %s'
maximum:
count: 3
message:
'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
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."