README.md

@cutticat/payload-monitor

Live host metrics in the Payload CMS 3 admin panel: memory, CPU, disk, and uptime. Each request is a fresh snapshot — nothing is stored.

Contents

Overview

The plugin adds a Monitor page to the admin sidebar (/admin/monitor) and a GET endpoint at /api/cutticat-monitor (logged-in users only). Numbers come from Node (os, fs.statfs, process, perf_hooks). No extra mount, sidecar, or npm metrics package.

On a typical Linux Docker host those calls already describe the machine: /proc is the kernel, statfs on a volume is the backing disk. The first CPU sample has no interval yet, so cpu.percent is omitted until the next poll (every 5 seconds in the UI).

Installation

pnpm add @cutticat/payload-monitor

Peers: payload, @payloadcms/next, @payloadcms/ui, react, react-dom (Payload 3.62–3.x).

After adding the plugin, regenerate the admin import map:

pnpm payload generate:importmap

Quick start

import { buildConfig } from "payload"
import { payloadMonitorPlugin } from "@cutticat/payload-monitor"

export default buildConfig({
  // ...
  plugins: [
    payloadMonitorPlugin({
      disks: ["./data"],
    }),
  ],
})

disks defaults to [process.cwd()]. Point it at the directory that actually holds uploads or the database files.

API

import {
  collectMonitorSnapshot,
  payloadMonitorPlugin,
} from "@cutticat/payload-monitor"
import type { MonitorSnapshot, PayloadMonitorPluginOptions } from "@cutticat/payload-monitor"
Export Role
payloadMonitorPlugin(options?) Payload plugin: endpoint, view, nav link, en/ru labels
collectMonitorSnapshot(options?) Same snapshot the endpoint returns, without HTTP
PayloadMonitorPluginOptions { disks?: string[] }
MonitorSnapshot JSON body of GET /api/cutticat-monitor

Admin components live at @cutticat/payload-monitor/rsc (view and nav) and @cutticat/payload-monitor/client (dashboard). The plugin registers them; do not import them from application code.

Documentation

Requirements

  • Node.js >= 22.0.0
  • pnpm >= 10.17.0
  • Payload CMS 3.62 or later (3.x)
Описание
Payload CMS admin plugin that shows live host memory, CPU, disk and uptime
Конвейеры
6 успешных
2 с ошибкой
Разработчики