From 7a33245c1e1349dd5aaef9428278a177475d0b23 Mon Sep 17 00:00:00 2001 From: ludo Date: Thu, 22 Feb 2024 19:33:56 +0100 Subject: [PATCH] add monitoring --- app/Console/Kernel.php | 1 + app/Providers/HealthServiceProvider.php | 45 +++ composer.json | 1 + config/app.php | 1 + config/health.php | 6 +- config/health/config.php | 340 ++++++++++++++++++ config/health/health.php | 334 +++++++++++++++++ config/health/resources/API.yml | 17 + config/health/resources/Adyen.yml | 23 ++ config/health/resources/AppKey.yml | 11 + config/health/resources/Broadcasting.yml | 19 + config/health/resources/Cache.yml | 10 + config/health/resources/Certificate.yml | 22 ++ config/health/resources/CheckoutCom.yml | 16 + .../health/resources/ConfigurationCached.yml | 10 + config/health/resources/Database.yml | 16 + config/health/resources/DebugMode.yml | 10 + .../health/resources/DirectoryPermissions.yml | 12 + config/health/resources/DiskSpace.yml | 12 + config/health/resources/DocuSign.yml | 15 + config/health/resources/Dynamics.yml | 22 ++ .../resources/ElasticsearchConnectable.yml | 11 + config/health/resources/EnvExists.yml | 13 + config/health/resources/Extensions.yml | 76 ++++ config/health/resources/Filesystem.yml | 8 + config/health/resources/Framework.yml | 5 + config/health/resources/Horizon.yml | 7 + config/health/resources/Http.yml | 13 + config/health/resources/Https.yml | 37 ++ config/health/resources/LaravelServices.yml | 13 + config/health/resources/Latency.yml | 21 ++ config/health/resources/LocalStorage.yml | 11 + config/health/resources/Mail.yml | 21 ++ .../health/resources/MailgunConnectable.yml | 19 + .../health/resources/MemcachedConnectable.yml | 11 + .../health/resources/MigrationsUpToDate.yml | 14 + config/health/resources/MixManifest.yml | 16 + config/health/resources/MySql.yml | 23 ++ config/health/resources/MySqlConnectable.yml | 12 + config/health/resources/NewrelicDeamon.yml | 23 ++ config/health/resources/NginxServer.yml | 23 ++ config/health/resources/PackagesUpToDate.yml | 15 + config/health/resources/Php.yml | 23 ++ .../resources/PostgreSqlConnectable.yml | 11 + config/health/resources/PostgreSqlServer.yml | 23 ++ config/health/resources/Queue.yml | 11 + config/health/resources/QueueWorkers.yml | 23 ++ config/health/resources/RebootRequired.yml | 13 + config/health/resources/Redis.yml | 10 + config/health/resources/RedisConnectable.yml | 11 + config/health/resources/RedisServer.yml | 23 ++ config/health/resources/RoutesCached.yml | 10 + config/health/resources/S3.yml | 11 + config/health/resources/SecurityChecker.yml | 7 + config/health/resources/SeeTickets.yml | 18 + config/health/resources/Sendinblue.yml | 15 + config/health/resources/ServerLoad.yml | 17 + config/health/resources/ServerUptime.yml | 14 + config/health/resources/ServerVars.yml | 48 +++ config/health/resources/Sshd.yml | 23 ++ config/health/resources/Supervisor.yml | 23 ++ 61 files changed, 1666 insertions(+), 3 deletions(-) create mode 100644 app/Providers/HealthServiceProvider.php create mode 100644 config/health/config.php create mode 100644 config/health/health.php create mode 100644 config/health/resources/API.yml create mode 100644 config/health/resources/Adyen.yml create mode 100644 config/health/resources/AppKey.yml create mode 100644 config/health/resources/Broadcasting.yml create mode 100644 config/health/resources/Cache.yml create mode 100644 config/health/resources/Certificate.yml create mode 100644 config/health/resources/CheckoutCom.yml create mode 100644 config/health/resources/ConfigurationCached.yml create mode 100644 config/health/resources/Database.yml create mode 100644 config/health/resources/DebugMode.yml create mode 100644 config/health/resources/DirectoryPermissions.yml create mode 100644 config/health/resources/DiskSpace.yml create mode 100644 config/health/resources/DocuSign.yml create mode 100644 config/health/resources/Dynamics.yml create mode 100644 config/health/resources/ElasticsearchConnectable.yml create mode 100644 config/health/resources/EnvExists.yml create mode 100644 config/health/resources/Extensions.yml create mode 100644 config/health/resources/Filesystem.yml create mode 100644 config/health/resources/Framework.yml create mode 100644 config/health/resources/Horizon.yml create mode 100644 config/health/resources/Http.yml create mode 100644 config/health/resources/Https.yml create mode 100644 config/health/resources/LaravelServices.yml create mode 100644 config/health/resources/Latency.yml create mode 100644 config/health/resources/LocalStorage.yml create mode 100644 config/health/resources/Mail.yml create mode 100644 config/health/resources/MailgunConnectable.yml create mode 100644 config/health/resources/MemcachedConnectable.yml create mode 100644 config/health/resources/MigrationsUpToDate.yml create mode 100644 config/health/resources/MixManifest.yml create mode 100644 config/health/resources/MySql.yml create mode 100644 config/health/resources/MySqlConnectable.yml create mode 100644 config/health/resources/NewrelicDeamon.yml create mode 100644 config/health/resources/NginxServer.yml create mode 100644 config/health/resources/PackagesUpToDate.yml create mode 100644 config/health/resources/Php.yml create mode 100644 config/health/resources/PostgreSqlConnectable.yml create mode 100644 config/health/resources/PostgreSqlServer.yml create mode 100644 config/health/resources/Queue.yml create mode 100644 config/health/resources/QueueWorkers.yml create mode 100644 config/health/resources/RebootRequired.yml create mode 100644 config/health/resources/Redis.yml create mode 100644 config/health/resources/RedisConnectable.yml create mode 100644 config/health/resources/RedisServer.yml create mode 100644 config/health/resources/RoutesCached.yml create mode 100644 config/health/resources/S3.yml create mode 100644 config/health/resources/SecurityChecker.yml create mode 100644 config/health/resources/SeeTickets.yml create mode 100644 config/health/resources/Sendinblue.yml create mode 100644 config/health/resources/ServerLoad.yml create mode 100644 config/health/resources/ServerUptime.yml create mode 100644 config/health/resources/ServerVars.yml create mode 100644 config/health/resources/Sshd.yml create mode 100644 config/health/resources/Supervisor.yml diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 7d190b50..a35682d5 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -12,6 +12,7 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule) { + $schedule->command(\Spatie\Health\Commands\RunHealthChecksCommand::class)->everyMinute(); } protected function commands() diff --git a/app/Providers/HealthServiceProvider.php b/app/Providers/HealthServiceProvider.php new file mode 100644 index 00000000..facd5f46 --- /dev/null +++ b/app/Providers/HealthServiceProvider.php @@ -0,0 +1,45 @@ + [ Spatie\Health\ResultStores\EloquentHealthResultStore::class => [ - 'connection' => env('HEALTH_DB_CONNECTION', env('DB_CONNECTION')), 'model' => Spatie\Health\Models\HealthCheckResultHistoryItem::class, 'keep_history_for_days' => 5, ], @@ -58,10 +58,10 @@ return [ 'throttle_notifications_key' => 'health:latestNotificationSentAt:', 'mail' => [ - 'to' => 'your@example.com', + 'to' => 'ludovic.candellier@fundglobam.org', 'from' => [ - 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'address' => env('MAIL_FROM_ADDRESS', 'no-reply@fundglobam.org'), 'name' => env('MAIL_FROM_NAME', 'Example'), ], ], diff --git a/config/health/config.php b/config/health/config.php new file mode 100644 index 00000000..e91e4974 --- /dev/null +++ b/config/health/config.php @@ -0,0 +1,340 @@ + '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', + ], +]; diff --git a/config/health/health.php b/config/health/health.php new file mode 100644 index 00000000..2c0b8297 --- /dev/null +++ b/config/health/health.php @@ -0,0 +1,334 @@ + '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', + ], +]; diff --git a/config/health/resources/API.yml b/config/health/resources/API.yml new file mode 100644 index 00000000..54b16720 --- /dev/null +++ b/config/health/resources/API.yml @@ -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 diff --git a/config/health/resources/Adyen.yml b/config/health/resources/Adyen.yml new file mode 100644 index 00000000..98997269 --- /dev/null +++ b/config/health/resources/Adyen.yml @@ -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') }}" + + + diff --git a/config/health/resources/AppKey.yml b/config/health/resources/AppKey.yml new file mode 100644 index 00000000..17107aba --- /dev/null +++ b/config/health/resources/AppKey.yml @@ -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 diff --git a/config/health/resources/Broadcasting.yml b/config/health/resources/Broadcasting.yml new file mode 100644 index 00000000..84f52cac --- /dev/null +++ b/config/health/resources/Broadcasting.yml @@ -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" diff --git a/config/health/resources/Cache.yml b/config/health/resources/Cache.yml new file mode 100644 index 00000000..bcba93ee --- /dev/null +++ b/config/health/resources/Cache.yml @@ -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 diff --git a/config/health/resources/Certificate.yml b/config/health/resources/Certificate.yml new file mode 100644 index 00000000..b233c4ce --- /dev/null +++ b/config/health/resources/Certificate.yml @@ -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 diff --git a/config/health/resources/CheckoutCom.yml b/config/health/resources/CheckoutCom.yml new file mode 100644 index 00000000..ee7b679a --- /dev/null +++ b/config/health/resources/CheckoutCom.yml @@ -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') }}" diff --git a/config/health/resources/ConfigurationCached.yml b/config/health/resources/ConfigurationCached.yml new file mode 100644 index 00000000..504bb13f --- /dev/null +++ b/config/health/resources/ConfigurationCached.yml @@ -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 diff --git a/config/health/resources/Database.yml b/config/health/resources/Database.yml new file mode 100644 index 00000000..d11aaabb --- /dev/null +++ b/config/health/resources/Database.yml @@ -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" diff --git a/config/health/resources/DebugMode.yml b/config/health/resources/DebugMode.yml new file mode 100644 index 00000000..3b8abd26 --- /dev/null +++ b/config/health/resources/DebugMode.yml @@ -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 diff --git a/config/health/resources/DirectoryPermissions.yml b/config/health/resources/DirectoryPermissions.yml new file mode 100644 index 00000000..36a8a19d --- /dev/null +++ b/config/health/resources/DirectoryPermissions.yml @@ -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') }}" diff --git a/config/health/resources/DiskSpace.yml b/config/health/resources/DiskSpace.yml new file mode 100644 index 00000000..72063884 --- /dev/null +++ b/config/health/resources/DiskSpace.yml @@ -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." diff --git a/config/health/resources/DocuSign.yml b/config/health/resources/DocuSign.yml new file mode 100644 index 00000000..ba4fc37d --- /dev/null +++ b/config/health/resources/DocuSign.yml @@ -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." diff --git a/config/health/resources/Dynamics.yml b/config/health/resources/Dynamics.yml new file mode 100644 index 00000000..f6ddf05b --- /dev/null +++ b/config/health/resources/Dynamics.yml @@ -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') }}" diff --git a/config/health/resources/ElasticsearchConnectable.yml b/config/health/resources/ElasticsearchConnectable.yml new file mode 100644 index 00000000..362a7ca4 --- /dev/null +++ b/config/health/resources/ElasticsearchConnectable.yml @@ -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 diff --git a/config/health/resources/EnvExists.yml b/config/health/resources/EnvExists.yml new file mode 100644 index 00000000..52f03b6a --- /dev/null +++ b/config/health/resources/EnvExists.yml @@ -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: diff --git a/config/health/resources/Extensions.yml b/config/health/resources/Extensions.yml new file mode 100644 index 00000000..8b633523 --- /dev/null +++ b/config/health/resources/Extensions.yml @@ -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 diff --git a/config/health/resources/Filesystem.yml b/config/health/resources/Filesystem.yml new file mode 100644 index 00000000..a50c9259 --- /dev/null +++ b/config/health/resources/Filesystem.yml @@ -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." diff --git a/config/health/resources/Framework.yml b/config/health/resources/Framework.yml new file mode 100644 index 00000000..b49d861f --- /dev/null +++ b/config/health/resources/Framework.yml @@ -0,0 +1,5 @@ +name: Framework +abbreviation: frmwrk +checker: PragmaRX\Health\Checkers\Framework +notify: true +column_size: 3 diff --git a/config/health/resources/Horizon.yml b/config/health/resources/Horizon.yml new file mode 100644 index 00000000..76b54816 --- /dev/null +++ b/config/health/resources/Horizon.yml @@ -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 diff --git a/config/health/resources/Http.yml b/config/health/resources/Http.yml new file mode 100644 index 00000000..5fe4de82 --- /dev/null +++ b/config/health/resources/Http.yml @@ -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 diff --git a/config/health/resources/Https.yml b/config/health/resources/Https.yml new file mode 100644 index 00000000..837d96bf --- /dev/null +++ b/config/health/resources/Https.yml @@ -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') }}" diff --git a/config/health/resources/LaravelServices.yml b/config/health/resources/LaravelServices.yml new file mode 100644 index 00000000..6062d5e9 --- /dev/null +++ b/config/health/resources/LaravelServices.yml @@ -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" diff --git a/config/health/resources/Latency.yml b/config/health/resources/Latency.yml new file mode 100644 index 00000000..83cb2401 --- /dev/null +++ b/config/health/resources/Latency.yml @@ -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 diff --git a/config/health/resources/LocalStorage.yml b/config/health/resources/LocalStorage.yml new file mode 100644 index 00000000..7ee8d4bb --- /dev/null +++ b/config/health/resources/LocalStorage.yml @@ -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) }}" diff --git a/config/health/resources/Mail.yml b/config/health/resources/Mail.yml new file mode 100644 index 00000000..2e7c42f5 --- /dev/null +++ b/config/health/resources/Mail.yml @@ -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" diff --git a/config/health/resources/MailgunConnectable.yml b/config/health/resources/MailgunConnectable.yml new file mode 100644 index 00000000..9177c14b --- /dev/null +++ b/config/health/resources/MailgunConnectable.yml @@ -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 diff --git a/config/health/resources/MemcachedConnectable.yml b/config/health/resources/MemcachedConnectable.yml new file mode 100644 index 00000000..2d2a32cf --- /dev/null +++ b/config/health/resources/MemcachedConnectable.yml @@ -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 diff --git a/config/health/resources/MigrationsUpToDate.yml b/config/health/resources/MigrationsUpToDate.yml new file mode 100644 index 00000000..0c8b6b1c --- /dev/null +++ b/config/health/resources/MigrationsUpToDate.yml @@ -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" diff --git a/config/health/resources/MixManifest.yml b/config/health/resources/MixManifest.yml new file mode 100644 index 00000000..f1541ccf --- /dev/null +++ b/config/health/resources/MixManifest.yml @@ -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 diff --git a/config/health/resources/MySql.yml b/config/health/resources/MySql.yml new file mode 100644 index 00000000..5798b91a --- /dev/null +++ b/config/health/resources/MySql.yml @@ -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." diff --git a/config/health/resources/MySqlConnectable.yml b/config/health/resources/MySqlConnectable.yml new file mode 100644 index 00000000..9ab48371 --- /dev/null +++ b/config/health/resources/MySqlConnectable.yml @@ -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 diff --git a/config/health/resources/NewrelicDeamon.yml b/config/health/resources/NewrelicDeamon.yml new file mode 100644 index 00000000..1290a407 --- /dev/null +++ b/config/health/resources/NewrelicDeamon.yml @@ -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." diff --git a/config/health/resources/NginxServer.yml b/config/health/resources/NginxServer.yml new file mode 100644 index 00000000..92a7e08e --- /dev/null +++ b/config/health/resources/NginxServer.yml @@ -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." diff --git a/config/health/resources/PackagesUpToDate.yml b/config/health/resources/PackagesUpToDate.yml new file mode 100644 index 00000000..d7439da2 --- /dev/null +++ b/config/health/resources/PackagesUpToDate.yml @@ -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() }}" diff --git a/config/health/resources/Php.yml b/config/health/resources/Php.yml new file mode 100644 index 00000000..45ec10d6 --- /dev/null +++ b/config/health/resources/Php.yml @@ -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." diff --git a/config/health/resources/PostgreSqlConnectable.yml b/config/health/resources/PostgreSqlConnectable.yml new file mode 100644 index 00000000..ca241e34 --- /dev/null +++ b/config/health/resources/PostgreSqlConnectable.yml @@ -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 diff --git a/config/health/resources/PostgreSqlServer.yml b/config/health/resources/PostgreSqlServer.yml new file mode 100644 index 00000000..e16a003c --- /dev/null +++ b/config/health/resources/PostgreSqlServer.yml @@ -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." diff --git a/config/health/resources/Queue.yml b/config/health/resources/Queue.yml new file mode 100644 index 00000000..35fd9375 --- /dev/null +++ b/config/health/resources/Queue.yml @@ -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: "" diff --git a/config/health/resources/QueueWorkers.yml b/config/health/resources/QueueWorkers.yml new file mode 100644 index 00000000..58c38829 --- /dev/null +++ b/config/health/resources/QueueWorkers.yml @@ -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." diff --git a/config/health/resources/RebootRequired.yml b/config/health/resources/RebootRequired.yml new file mode 100644 index 00000000..6d5abda1 --- /dev/null +++ b/config/health/resources/RebootRequired.yml @@ -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: diff --git a/config/health/resources/Redis.yml b/config/health/resources/Redis.yml new file mode 100644 index 00000000..014ef6a3 --- /dev/null +++ b/config/health/resources/Redis.yml @@ -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: "" diff --git a/config/health/resources/RedisConnectable.yml b/config/health/resources/RedisConnectable.yml new file mode 100644 index 00000000..f1e0323c --- /dev/null +++ b/config/health/resources/RedisConnectable.yml @@ -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 diff --git a/config/health/resources/RedisServer.yml b/config/health/resources/RedisServer.yml new file mode 100644 index 00000000..cb711f65 --- /dev/null +++ b/config/health/resources/RedisServer.yml @@ -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." diff --git a/config/health/resources/RoutesCached.yml b/config/health/resources/RoutesCached.yml new file mode 100644 index 00000000..5d9a5a75 --- /dev/null +++ b/config/health/resources/RoutesCached.yml @@ -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 diff --git a/config/health/resources/S3.yml b/config/health/resources/S3.yml new file mode 100644 index 00000000..ba24443b --- /dev/null +++ b/config/health/resources/S3.yml @@ -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) }}" diff --git a/config/health/resources/SecurityChecker.yml b/config/health/resources/SecurityChecker.yml new file mode 100644 index 00000000..6a0a21ec --- /dev/null +++ b/config/health/resources/SecurityChecker.yml @@ -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" diff --git a/config/health/resources/SeeTickets.yml b/config/health/resources/SeeTickets.yml new file mode 100644 index 00000000..e834df60 --- /dev/null +++ b/config/health/resources/SeeTickets.yml @@ -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 diff --git a/config/health/resources/Sendinblue.yml b/config/health/resources/Sendinblue.yml new file mode 100644 index 00000000..9a1c520c --- /dev/null +++ b/config/health/resources/Sendinblue.yml @@ -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 diff --git a/config/health/resources/ServerLoad.yml b/config/health/resources/ServerLoad.yml new file mode 100644 index 00000000..9b2eb9b0 --- /dev/null +++ b/config/health/resources/ServerLoad.yml @@ -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: + '~(?\d{1,2}):(?\d{2})(?::(?\d{2}))?\s+up\s+(?:(?\d+)\s+days?,\s+)?\b(?:(?\d+):)?(?\d+)(?:\s+(?:minute|minutes|min)?)?,\s+(?\d+).+?(?\d+.\d+),?\s+(?\d+.\d+),?\s+(?\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)" diff --git a/config/health/resources/ServerUptime.yml b/config/health/resources/ServerUptime.yml new file mode 100644 index 00000000..16d86b45 --- /dev/null +++ b/config/health/resources/ServerUptime.yml @@ -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: + '~(?\d{1,2}):(?\d{2})(?::(?\d{2}))?\s+up\s+(?:(?\d+)\s+days?,\s+)?\b(?:(?\d+):)?(?\d+)(?:\s+(?:minute|minutes|min)?)?,\s+(?\d+)?.+?(?\d+.\d+),?\s+(?\d+.\d+),?\s+(?\d+.\d+)~' + command: "uptime 2>&1" + save_to: "{{ storage_path('app') }}/uptime.json" + action_message: "Your server was rebooted (Uptime Checker)" diff --git a/config/health/resources/ServerVars.yml b/config/health/resources/ServerVars.yml new file mode 100644 index 00000000..10528f07 --- /dev/null +++ b/config/health/resources/ServerVars.yml @@ -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 diff --git a/config/health/resources/Sshd.yml b/config/health/resources/Sshd.yml new file mode 100644 index 00000000..e8d7c161 --- /dev/null +++ b/config/health/resources/Sshd.yml @@ -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." diff --git a/config/health/resources/Supervisor.yml b/config/health/resources/Supervisor.yml new file mode 100644 index 00000000..e967913a --- /dev/null +++ b/config/health/resources/Supervisor.yml @@ -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."