mrgrg / disk-metrics

A Laravel Pulse package that adds metrics for your Local and S3 storage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disk Metrics for Laravel Pulse

Disk Metrics for Laravel Pulse

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

Credits to Aaron Francis for his Pulse tutorial.

This is a Laravel Pulse package that adds metrics for your Local and S3 storage.

  • Total Size
  • Total Files
  • Total Directories (only for local driver)

Installation

You can install the package via composer:

composer require geowrgetudor/disk-metrics

You can publish the config file with:

php artisan vendor:publish --tag="disk-metrics-config"

This is the contents of the published config file:

return [
    /**
     * Track disks defined in filesystems.php config file.
     * Support only 'local' or 's3' driver.
     *
     * You can pass an array ['directories', 'files'] ONLY to a local disk
     * which will determine what to be counted. To count both,
     * you can pass an empty array.
     */
    'disks' => [
        'local' => [],
        // 'public' => [],
        // 's3' => []
    ],

    /**
     * How often (in minutes) should the Laravel Pulse capture data?
     * The value should be greated than 1!
     * Default: 10
     */
    'record_interval' => 10
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="disk-metrics-views"

Usage

Register the recorder inside config/pulse.php. (If you don't have this file make sure you have published the config file of Larave Pulse using php artisan vendor:publish --tag=pulse-config)

return [
    // ...

    'recorders' => [
        // Existing recorders...

        \Geow\DiskMetrics\Recorders\DiskRecorder::class => [
            'enabled' => env('GEOW_DISK_METRICS', true),
        ]
    ]
]

Publish Laravel Pulse dashboard.blade.php view using php artisan vendor:publish --tag=pulse-dashboard

Then you can modify the file and add the disk-metrics livewire template.

<livewire:disk-metrics cols="4" rows="2" />

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.

About

A Laravel Pulse package that adds metrics for your Local and S3 storage.

License:MIT License


Languages

Language:PHP 74.5%Language:Blade 25.5%