{"id":14974466,"url":"https://github.com/brightmachine/scrutiny","last_synced_at":"2025-10-27T09:30:32.994Z","repository":{"id":62497301,"uuid":"110882163","full_name":"brightmachine/scrutiny","owner":"brightmachine","description":"Ensure your laravel-based project is running in the correct server environment","archived":false,"fork":false,"pushed_at":"2021-05-13T12:35:36.000Z","size":93,"stargazers_count":34,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-01T04:31:40.844Z","etag":null,"topics":["laravel","laravel5","pingdom","probe","scrutiny","uptime"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brightmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-15T20:20:07.000Z","updated_at":"2023-05-12T16:49:19.000Z","dependencies_parsed_at":"2022-11-02T11:45:46.129Z","dependency_job_id":null,"html_url":"https://github.com/brightmachine/scrutiny","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightmachine%2Fscrutiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightmachine%2Fscrutiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightmachine%2Fscrutiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightmachine%2Fscrutiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brightmachine","download_url":"https://codeload.github.com/brightmachine/scrutiny/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238471954,"owners_count":19478134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel5","pingdom","probe","scrutiny","uptime"],"created_at":"2024-09-24T13:50:36.280Z","updated_at":"2025-10-27T09:30:27.692Z","avatar_url":"https://github.com/brightmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scrutiny\n\nScrutiny helps your Laravel 8 project ensure that its current server environment is configured and running as planned.\n\n[![Latest Stable Version](https://poser.pugx.org/brightmachine/scrutiny/v/stable)](https://packagist.org/packages/brightmachine/scrutiny)\n[![Total Downloads](https://poser.pugx.org/brightmachine/scrutiny/downloads)](https://packagist.org/packages/brightmachine/scrutiny)\n[![License](https://poser.pugx.org/brightmachine/scrutiny/license)](https://github.com/brightmachine/scrutiny/blob/master/LICENSE)\n\n## Problem\n\nHave you ever been in the situation where you've moved servers and forgotten to:\n\n1. Get your queue running?\n2. Add the cron job to run your schedule?\n3. Install an obscure program that your reporting uses once a month?\n4. Enable a PHP extension that you need for an API?\n\nThis is the scenario Scrutiny was built to address – use the availability monitor you already use \n(like [Oh Dear](https://ohdear.app/) or Pingdom) to also monitor other important aspects of your environment.\n\nThis means your availability monitor notifies you of any problems with your server environment setup\ninstead of waiting for your clients or customers to tell you something is wrong.\n\n## Installation\n\nTo install through composer, add the following to your `composer.json` file:\n\n```json\n{\n    \"require\": {\n        \"brightmachine/scrutiny\": \"~2.0\"\n    }\n}\n```\n\nThen run `composer install` from the terminal.\n\n### Quick Installation\n\nThe installation instructions can be simplified using the following:\n\n    composer require \"brightmachine/scrutiny=~2.0\"\n\nYou are all setup – next step it to add your probes!\n\n## How it works\n\n1. In `AppServiceProvider::boot()`, configure the probes to check for all the things your environment needs in order to run \n2. Set up an `uptime check` in [Oh Dear](https://ohdear.app/) or Pingdom to alert you if any of the probes fail to pass \n\n----\n\n## How to configure the different probes\n\n```php\n\u003c?php\nnamespace App\\Providers;\n\nuse Illuminate\\Support\\ServiceProvider;\n\nclass AppServiceProvider extends ServiceProvider \n{\n    public function boot()\n    {\n        // …\n        $this-\u003econfigureScrutinyProbes();\n    }\n    \n    public function register()\n    {\n    }\n    \n    protected function configureScrutinyProbes()\n    {\n        \\Scrutiny\\ProbeManager::configure()\n            -\u003econnectsToDatabase()\n            -\u003eexecutableIsInstalled('composer.phar')\n            -\u003equeueIsRunning(30, 'high')\n            -\u003equeueIsRunning(60, 'low')\n            ;\n    }\n}\n\n```\n\n----\n\n## What probes are available\n\nAll probes are added through `\\Scrutiny\\ProbeManager` and calls can be chained:\n\n```php\n\\Scrutiny\\ProbeManager::configure()-\u003escheduleIsRunning()-\u003equeueIsRunning();\n```\n\nThe following probes are available via `\\Scrutiny\\ProbeManager::configure()`:\n\n### `availableDiskSpace()`\n\nEnsure that you always have space available.\n\nIt works by finding the disk related to a given folder and checking its usage. \n\n```php\npublic availableDiskSpace( number $minPercentage [, string $diskFolder = null ] )\n```\n\n- `$minPercentage` is the minimum amount of disk space that should be available \n- `$diskFolder` the folder used to find the disk. Defaults to the disk storing your laravel app.\n\n### `callback()`\n\nIf your use-case isn't supported out-of-the-box you can write your own custom probe.\n\nWhen a probe is checked, 3 outcomes are possible:\n\n1. **Skipped** – if a `\\Scrutiny\\ProbeSkippedException` exception is thrown\n2. **Failed** – if any other exception is thrown\n3. **Passed** – if no exception is thrown\n\n```php\npublic callback( string $probeName , callable $callback )\n```\n\n- `$probeName` the name of the probe used to report the results of the check \n- `$callback` the callback that runs your custom check \n\n### `connectsToDatabase()`\n\nCheck that you're able to connect to one of your databases configured on `config/database.php`. \n\n```php\npublic connectsToDatabase([ string $connectionName = null ])\n```\n\n- `$connectionName` is the name of your database connection from `config/database.php`\n\n### `connectsToHttp()`\n\nThis probe checks that a given URL will return a 2xx response.\n\n_NB: Redirects will not be followed – only the first response will be considered._ \n\n```php\npublic connectsToHttp( string $url [, array $params = array(), string $verb = 'GET' ] )\n```\n\n- `$url` the URL to check, which can contain a username and password, e.g. `https://user@pass:example.com` \n- `$params` an array of URL parameters to add to the request\n- `$verb` either `GET` or `POST`\n\n\n### `executableIsInstalled()`\n\nThis probe will search your path, and your current `vendor/bin` looking for a particular executable. \n\n```php\npublic executableIsInstalled( string $executableName )\n```\n\n- `$executableName` the name of the executable to find \n\n### `phpExtensionLoaded()`\n\nCheck that a particular PHP extension is loaded.\n\n```php\npublic phpExtensionLoaded( string $extensionName )\n```\n\n- `$extensionName` the name of the PHP extension to check \n\n### `queueIsRunning()`\n\nThis probe checks that your laravel queue is running.\n\n```php\npublic queueIsRunning( [ int $maxHandleTime = 300, $queue = null, $connection = null ] )\n```\n\n- `$maxHandleTime` the maximum time in seconds that you give a job to run on the given queue \n- `$queue` if you run multiple queues on the same connection, this is the name of the queue to check\n- `$connection` if you run multiple connections, this is the one to check as configured in `config/queue.php`\n\n### `scheduleIsRunning()`\n\nMake sure that the artisan schedule is being run. \n\n```php\npublic scheduleIsRunning()\n```\n\n----\n\n## Customising the name of your probe\n\nBy default, when scrutiny outputs details of your probe (e.g. if it fails, or in the history)\nit guesses a name based on the configuration setting.\n\nIf this default name would output sensitive information, such as API keys, then\nyou'll want to set the name of the probe.\n\n```php\npublic named( string $identifier )\n```\n\nYou override the name by calling `-\u003enamed()` after you set the probe:\n\n```php\n\\Scrutiny\\ProbeManager::configure()\n    -\u003econnectsToHttp('https://api.example.com/me?api_key=12345678900987654321')\n    -\u003enamed('example.com API');\n```\n\n----\n\n## Customising the executable search path\n\nCertain probes will need to search for a certain executable on disk.\n\nBy default, scrutiny will search directories in your `$PATH` environment variable\nas well as your `base_path()` and your `vendor/bin`.\n\n_But this isn't always enough._\n\nYou can add directories to the path when you configure your probes: \n\n```php\n\\Scrutiny\\ProbeManager::extraDirs([\n    '/usr/local/bin/',\n    '/var/www/bin',\n]);\n```\n\n----\n\n## Debugging locally\n\nYour configured probes are rate-limited to 1 check every minute.\n\nThis isn't what you want when first setting up your probes, so\nto bypass this locally set `DEBUG=true` in your `.env` file.\n\n----\n\n## Artisan command\n\nRun `php artisan scrutiny:check-probes` to check if your probes are passing.\n\nThis command is not rate-limited, so it's a good way to test immediately after making a change,\nor even as part of a deployment process.\n\nThe command will return `0` on success and `1` on failure.\n\n----\n\n## How to configure Oh Dear\n\nConfigure a new site in [Oh Dear](https://ohdear.app/) with the following setting:\n\n1. In `Settings` (the `General` tab), point to the scrutiny URL for your domain `yourdomain.com/~scrutiny/check-probes` where yourdomain.com is your production domain\n2. Scrutiny will return an HTTP status of `590 Some Tests Failed` when something is awry – this is a custom code \n\n----\n\n## How to configure pingdom\n\nConfigure a new check in pingdom with the following setting:\n\n1. Add an `uptime check` in pingdom to hit `https://yourdomain.com/~scrutiny/check-probes` where yourdomain.com is your production domain\n2. Scrutiny will return an HTTP status of `590 Some Tests Failed` when something is awry – this is a custom code \n\n----\n\n## Contributing\n\nAny contribution is received with humility and gratitude.\n\nThank you if you're considering contributing an improvement to this project.\n\n**Process**:\n\n1. Fork, change, create pull-request\n2. Tell us why/how your PR will benefit the project \n3. We may ask you for clarification, but we'll quickly let you know whether or not it's likely your change will be merged\n\n😘 Xx","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrightmachine%2Fscrutiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrightmachine%2Fscrutiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrightmachine%2Fscrutiny/lists"}