Laravel Packages

Filament Storage Monitor: Track Disk Usage From Your Filament Dashboard

Published
Filament Storage Monitor: Track Disk Usage From Your Filament Dashboard image

Filament Storage Monitor is a plugin that adds a dashboard widget to your Filament panel for watching server disk usage. It reads storage stats with native PHP filesystem functions and renders them as a widget that fits in with the rest of your panel, with support for multiple partitions, custom labels, and more.

Registering Disks

You register the plugin in your panel and tell it which paths to watch. The addDisk() method takes a path and label directly, while laravelDisk() resolves a disk from your config/filesystems.php:

use AchyutN\FilamentStorageMonitor\FilamentStorageMonitor;

return $panel
    ->plugins([
        FilamentStorageMonitor::make()
            ->addDisk('/mnt/data', label: 'Data Partition')
            ->laravelDisk(name: 'public', label: 'Media Storage'),
    ]);

For more control over a single disk, the add() method accepts a Disk DTO where you can set a color and a Heroicon alongside the path and label:

use AchyutN\FilamentStorageMonitor\DTO\Disk;
use AchyutN\FilamentStorageMonitor\FilamentStorageMonitor;
use Filament\Support\Colors\Color;
use Filament\Support\Icons\Heroicon;

FilamentStorageMonitor::make()
    ->add(
        Disk::make('web-root')
            ->path('/var/www/html')
            ->label('Web Root')
            ->color(Color::Green)
            ->icon(Heroicon::ComputerDesktop),
    )
    ->addDisk(
        path: '/mnt/backup',
        label: 'Backups',
        color: Color::Blue,
        icon: Heroicon::ArchiveBox,
    );

Per-Disk Authorization

Disk usage can be sensitive server information, so the plugin lets you gate visibility at two levels. A visible() closure on the widget controls whether the whole widget renders, and an isVisible closure on an individual disk hides just that entry:

FilamentStorageMonitor::make()
    ->visible(fn () => auth()->user()->is_admin) // Hide entire widget
    ->addDisk(
        path: '/var/www/html',
        label: 'App Files',
        isVisible: fn () => auth()->user()->can('view_server_stats') // Hide specific disk
    );

Compact Mode

For a smaller footprint on the dashboard, compact mode reduces each disk to its label and free space:

FilamentStorageMonitor::make()
    ->compact();

The widget also exposes the usual layout controls, columnSpan(), columnStart(), sort(), and lazy(), for placing it on the dashboard.

Error Handling

By default, a path that can't be resolved (a missing mount, for example) won't crash your panel, the widget catches the error and keeps rendering. If you'd rather surface those problems during development, throwException() re-enables exceptions, and it accepts a closure so you can scope strict behavior to local environments:

FilamentStorageMonitor::make()
    ->throwException(fn () => app()->isLocal());

One limitation worth noting: because the package reads partition-level stats, two paths on the same partition will report the same total and free space. Directory-specific size calculation is planned for a future release.

You can find the source, documentation, and contribution guidelines on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Real-Time Inertia Props With Laravel Reverb image

Real-Time Inertia Props With Laravel Reverb

Read article
PhpStorm 2026.3 Adds an Agent Workspace and PHP 8.6 Support image

PhpStorm 2026.3 Adds an Agent Workspace and PHP 8.6 Support

Read article
Insert Middleware Before or After Existing Laravel Middleware image

Insert Middleware Before or After Existing Laravel Middleware

Read article
Laravel Herd 2: Coding Agents, Workspaces, and Cloud Deploys image

Laravel Herd 2: Coding Agents, Workspaces, and Cloud Deploys

Read article
Strict Request Input Casting in Laravel image

Strict Request Input Casting in Laravel

Read article
Prevent Duplicate File Uploads With Laravel Storage Dedupler image

Prevent Duplicate File Uploads With Laravel Storage Dedupler

Read article