Skip to content

Filament Storage Monitor: Track Disk Usage From Your Filament Dashboard

Filament Storage Monitor is a Filament plugin that adds a dashboard widget for tracking server disk usage. It uses native PHP filesystem functions and supports multiple partitions, custom labels, per-disk authorization, and compact mode.

Published · Updated · 3 min read

Filament Storage Monitor: Track Disk Usage From Your Filament Dashboard

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 in 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 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 returns false.
  • An isVisible closure 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 Disk DTO 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.


Source: Laravel News — Filament Storage Monitor

Frequently asked questions

Can I monitor multiple disks or partitions with Filament Storage Monitor?

Yes. You can chain multiple `addDisk()` or `laravelDisk()` calls, or use the `Disk` DTO with `add()`, to register as many paths as you need. Note that two paths on the same partition will report the same total and free space because the plugin reads partition-level stats.

How do I restrict who can see disk usage data in the Filament widget?

Use the `visible()` closure on the plugin to hide the entire widget based on any condition, and the `isVisible` closure on an individual disk entry to hide just that row. Both closures receive the standard Laravel auth context, so you can check roles or permissions as usual.

What happens if a registered path does not exist or cannot be read?

By default the plugin catches the error silently and continues rendering the rest of the widget. You can call `throwException()` (optionally with a closure scoped to local environments) to re-enable exceptions when you want failures to surface during development.

Mohamed Said

About the author

Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

About GitHub LinkedIn WhatsApp Email Address My CV

Have a technical challenge?

Tell me what you’re building. I reply within two working days.

Discuss your project