neoniche/laravel-app-monitor

A simple way to monitor laravel application disk usage and other resources.

0.4.1 2023-01-19 10:37 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package will help monitor a laravel application disk metrics.

Installation

You can install the package via composer:

composer require neoniche/laravel-app-monitor

You can publish and run the migrations with:

php artisan vendor:publish --tag="app-monitor-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="app-monitor-config"

This is the contents of the published config file:

return [
  /**
     * The name of the disk you want to monitor.
     * default: 'local'
     */
    'disk_names' => [
        'local',
    ],
];

You should set up a schedule to run the command app-monitor:log to record the disk metrics.

// app/Console/Kernel.php
use Neoniche\AppMonitor\Commands\AppMonitorCommand;

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule)
    {
        $schedule->command(AppMonitorCommand::class)->daily();
    }
}

Optionally, you can publish the views using

php artisan vendor:publish --tag="app-monitor-views"

Usage

If you wish to view the statistics that is logged to the database in a browser. You should add the macro below to your routes file.

```php

// in a routes files

Route::appMonitor('custom-monitor-url');

Now, you can see all statics when browsing /custom-monitor-url/disk-file-logs. You can change the custom-monitor-url to whatever suits you. We highly recommand using the auth middleware for this route, so guests can't see any data regarding your disks.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.