Monitor Server Disk Usage Directly in Your Filament Panel
Filament Storage Monitor is a community plugin that embeds a disk-usage widget into any Filament admin panel. Rather than reaching for an external monitoring tool, you can surface storage stats—powered by native PHP filesystem functions—right alongside the rest of your dashboard.
Registering Disks
You register the plugin inside your panel's ->plugins() call. Two convenience methods cover the most common cases:
addDisk(path, label)— watches any absolute filesystem path.laravelDisk(name, label)— resolves a disk defined inconfig/filesystems.php.
use AchyutN\FilamentStorageMonitor\FilamentStorageMonitor;
return $panel
->plugins([
FilamentStorageMonitor::make()
->addDisk('/mnt/data', label: 'Data Partition')
->laravelDisk(name: 'public', label: 'Media Storage'),
]);
For richer customization, the add() method accepts a Disk DTO where you can attach a Filament color and a Heroicon to each entry:
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 data can be sensitive, so the plugin provides two authorization layers:
- A
visible()closure on the plugin hides the entire widget when it returnsfalse. - An
isVisibleclosure on an individual disk hides only that entry.
FilamentStorageMonitor::make()
->visible(fn () => auth()->user()->is_admin)
->addDisk(
path: '/var/www/html',
label: 'App Files',
isVisible: fn () => auth()->user()->can('view_server_stats')
);
Compact Mode
If dashboard real estate is tight, compact mode strips each disk entry down to its label and remaining free space:
FilamentStorageMonitor::make()
->compact();
The widget also respects the standard Filament layout helpers—columnSpan(), columnStart(), sort(), and lazy()—so it slots cleanly into any grid arrangement.
Error Handling
By default, an unresolvable path (a missing mount point, for example) is caught silently and the widget continues to render. During development you may want exceptions to surface instead:
FilamentStorageMonitor::make()
->throwException(fn () => app()->isLocal());
Passing a closure lets you enable strict behavior only in local environments without touching production.
Known Limitation
Because the plugin reads partition-level stats via PHP's filesystem functions, two paths that live on the same partition will report identical total and free space figures. Per-directory size calculation is on the roadmap for a future release.
Key Takeaways
- Register any filesystem path or Laravel disk with
addDisk()/laravelDisk(). - Use the
DiskDTO for per-disk colors and Heroicons. - Gate visibility at the widget level or per individual disk with closures.
- Compact mode reduces each entry to label + free space.
- Silent error handling by default; opt into exceptions per environment.
- Partition-level stats mean two paths on the same partition share the same numbers.
The source code, documentation, and contribution guidelines are available on GitHub.