34 Commits

Author SHA1 Message Date
bc2dda2147 docs: update README, CLAUDE.md, backlog, and .env.example
- README: add all features, correct tech stack (axios/setInterval), add IP addresses section, fix API routes
- CLAUDE.md: fix architecture, remove SWR references, fix env var names, add IP address patterns
- backlog: remove ip6= mention, clean duplicate entries, mark done
- .env.example: remove unused PROXMOX_CONSOLE_TOKEN

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 14:22:57 +01:00
8f317641ec fix IP addresses: parse from config/agent endpoints instead of guest agent
- LXCs: use /interfaces endpoint first, fallback to net0-net7 config parsing
- QEMU: use /agent/network-get-interfaces with correct result nesting
- IPv4 only filtering (ip-address-type check)
- Drop ip6= and nameserver from config fallback

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 11:36:05 +01:00
15d0ea37f0 feat: display per-VM/LXC guest IPs in table rows
- Fetch IPs from /status/guest API for running VMs/LXCs (requires guest agent)
- IPs displayed below the name column in the table
- Gracefully handles missing guest agent (quietly skips)
- Backlog: mark Per-VM IP Addresses as done

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 16:35:29 +01:00
1a0d46a848 fix: parens around ?? in mixed || expression to fix operator precedence
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 13:57:18 +01:00
37efe83e88 docs: mark Search/Filter as done in backlog
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 13:53:00 +01:00
a4bf56bdd0 feat: auto-expand single node and filter-matched nodes
- When only one node exists, expand its list by default
- When filtering, auto-expand all nodes with matching results
- Use useMemo for filter/grouping performance

Backlog: mark Search/Filter as done

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 13:50:18 +01:00
04ebe2d8ce feat: add search filter to VM and LXC lists
- Case-insensitive filter by name, node, or status
- Shows running/stopped counts and total matches when filtering
- "No matches" message when filter returns empty
- Backlog: mark Search/Filter as done

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 13:19:24 +01:00
8ebf100667 docs: reorganize backlog with all done items under Completed section
- Move all completed items (Power Control, Console Link, Manual Refresh, Custom Poll Interval, Group by Node, Uptime Duration) under Completed
- Remove "Status: done" lines from individual items
- Keep only Search/Filter under Quick Wins

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 12:35:12 +01:00
528c8f54e6 feat: enhance formatUptime to include minutes
- Now formats as "Xd Yh Zm", "Yh Zm", or "Zm" depending on value size
- Backlog: mark Uptime Duration as done

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 12:26:33 +01:00
7495e27288 docs: mark Group by Node as done in backlog
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:55:24 +01:00
efb27113e2 feat: group VMs and LXCs by node with collapse/expand toggle
- Each node shows a collapsible card with running/stopped counts
- Items grouped by node (using Object.groupBy), sorted alphabetically
- Both VMList and LXCList use the same pattern

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:53:40 +01:00
6b18c507dc docs: mark Custom Poll Interval as done in backlog
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:23:05 +01:00
8cb83d3dd7 feat: custom poll interval input in dashboard header
- Replace SWR polling with a manual setInterval that responds to interval changes
- Add number input in header (milliseconds) that updates polling in real-time
- Move error state to a single error variable shared by the poll effect
- Remove SWR dependency from Dashboard (still used by API routes for internal fetching)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:16:03 +01:00
da258e9d4c docs: mark Manual Refresh as done in backlog
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 10:20:27 +01:00
0f2f9f0333 feat: add manual refresh button to dashboard header
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 10:18:58 +01:00
fc8648f907 docs: update backlog.md with full current state
- Move power control and console link to Completed section
- Add notes about disk.total not being populated (Storage/Resource items)
- Clarify which items exist in code vs still pending

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:56:24 +01:00
6696db82e9 docs: update backlog and CLAUDE.md for console and power control
- backlog: mark Console Link as done (merged to main)
- CLAUDE.md: remove ConsolePanel and /api/vnc from architecture
- CLAUDE.md: note console URL format and new-tab behavior
- CLAUDE.md: remove PROXMOX_CONSOLE_TOKEN env var

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:18:10 +01:00
9cfcfd9971 feat: open console in new tab instead of iframe panel
- Remove ConsolePanel and /api/vnc route (iframe session auth won't work cross-origin)
- VMList/LXCList console buttons now open Proxmox web UI console in new tab
- Use web UI console URL format so browser session cookies handle auth automatically
- Add resize=scale and xtermjs=1 for better terminal UX

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:05:41 +01:00
d69e72c3eb docs: add CLAUDE.md with project guidance for Claude Code
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:46:35 +01:00
28235f4ac9 feat: merge power control fixes into main
- Fix 502 errors on power operations (switch to /api2/extjs endpoint)
- Instant UI refresh after power actions via direct state sync
- Status feedback messages (Stopping..., successful) with rAF flush
- Add fallbackData to SWR hooks to prevent empty lists

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:44:59 +01:00
2cc51146fc fix: force paint before API call so status feedback is visible
- requestAnimationFrame flush lets React paint the "Stopping..."
  message before the async API call begins
- Lists never go empty thanks to fallbackData on all SWR hooks
- State synced on success to keep summary counts in sync

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 20:15:41 +01:00
ccef63f66d fix: rewrite power action handler — instant status feedback + reliable state
- Status message always shows immediately on click (pending -> success/error)
- Auto-dismiss after 3 seconds on success
- Use fallbackData to prevent lists going empty during fetch
- Direct state sync on success to keep summary counts in sync

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 19:49:40 +01:00
bfc6bf8526 fix: instant power action refresh with optimistic UI update
Update VM/LXC cards immediately on click instead of waiting for
API response or polling interval. On failure, revert the optimistic
update. Background polling reconciles after 5 seconds.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 19:18:35 +01:00
175beae735 fix: power control 502 error and add instant refresh
- Power operations use /api2/extjs endpoint (not /api2/json)
- Remove unprivileged parameter that causes 400 validation error
- Refetch VM/LXC/node/status after successful power action via SWR mutate

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 18:56:29 +01:00
1f6a594872 feat: merge power control and console link into main
- Start/stop/restart buttons for VMs and LXCs
- Console link using /vncproxy endpoint
- Various fixes to get console working
2026-05-10 17:49:30 +01:00
52850c4e15 fix: use /vncproxy endpoint with websocket:0 parameter
The /vncproxy endpoint requires websocket: 0 (not -1) in the POST body.
Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 18:44:13 +01:00
461f1d55e4 fix: use correct Proxmox console URL format from docs
Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 11:38:46 +01:00
aa5a3d637b update: mark console link as done in backlog
Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 10:38:31 +01:00
c12090b3f4 fix: use correct Proxmox console URL path (/pve/console.html)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 10:31:53 +01:00
7baf6a50fa feat: add console link next to VM/LXC names
Clicking the name opens the Proxmox web console in a new tab.
URLs are constructed in the API routes using the configured PROXMOX_API_URL.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 10:22:29 +01:00
d5e85ce3c1 fix: restore broken getSummary function declaration
Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 09:07:55 +01:00
e8b9aee4cb feat: add start/stop/restart buttons for VMs and LXCs
- New POST /api/power route for Proxmox power operations
- powerControl() method in proxmox.js library
- Start/Stop/Restart action buttons in VMList and LXCList tables
- Status feedback banner in Dashboard on power action

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-07 08:07:38 +01:00
4c32eebb0d Merge branch 'main' of https://gitea.rdbcloud.co.uk/robbond/proxmox-monitor 2026-05-07 07:19:10 +01:00
49dd3554f1 initial commit 2026-05-07 06:41:36 +01:00
4 changed files with 47 additions and 32 deletions

View File

@@ -3,7 +3,6 @@
PROXMOX_API_URL=http://proxmox.lan:8006/api2/json
PROXMOX_WEB_URL=http://proxmox.lan:8006
PROXMOX_CONSOLE_TOKEN=root@pam!monitorapp
PROXMOX_TOKEN_ID=root@pam!monitorapp
PROXMOX_TOKEN_SECRET=103d622c-05a3-4002-9356-f67691e10d40
PROXMOX_TOKEN_SECRET=<your-token-secret>
API_POLL_INTERVAL=30000

View File

@@ -27,22 +27,23 @@ src/
│ ├── layout.js # Root layout (Inter font, metadata)
│ └── page.js # Entry — renders <Dashboard />
├── components/
│ ├── Dashboard.js # Main UI: tabs, summary cards, power action handler
│ ├── NodeList.js / NodeCard.js # Node overview
│ ├── VMList.js / LXCList.js # VM/LXC list views (each row has Console/Start/Stop buttons)
│ ├── Dashboard.js # Main UI: tabs, summary cards, polling, power action handler
│ ├── NodeList.js / NodeCard.js # Node overview (collapsible cards with subtotals)
│ ├── VMList.js / LXCList.js # VM/LXC lists grouped by node with search, power actions, console links, IPs
│ └── StatusBadge.js # Status indicator
└── lib/
└── proxmox.js # Proxmox API client — getNodes, getVMs, getLXC, getSummary, powerControl
└── proxmox.js # Proxmox API client — getNodes, getVMs, getLXC, getSummary, powerControl, getConfigIPs
```
## Key Patterns
- **Dual API endpoints**: Queries use `/api2/json`, power operations use `/api2/extjs`. Power actions send empty body `{}`.
- **API routes** aggregate data across all Proxmox nodes before returning to the client. They are thin wrappers around `lib/proxmox.js`.
- **Dashboard** uses direct React state + manual `axios.get()` calls for power actions (instant UI sync), and SWR with `refreshInterval` for periodic polling of the same endpoints.
- **Dashboard** uses direct React state + manual `setInterval` polling (not SWR) for periodic data fetching. Power actions use direct `axios.get()` calls for instant UI sync.
- **Power action flow**: `handlePowerAction` in Dashboard.js fires `POST /api/power`, then immediately re-fetches all four caches (`/api/nodes`, `/api/vms`, `/api/lxc`, `/api/status`) and sets state directly. Use `requestAnimationFrame` flush before the API call so status messages paint.
- **Auth**: PVEAPIToken header: `Authorization: PVEAPIToken=${TOKEN_ID}=${TOKEN_SECRET}`.
- **Console**: VMList/LXCList build `consoleUrl` from `PROXMOX_WEB_URL` with `?console={qemu|lxc}&vmid={id}&node={node}` params. Dashboard opens it via `window.open()` in a new tab so browser session cookies handle Proxmox auth.
- **Console**: VMList/LXCList build `consoleUrl` from `PROXMOX_WEB_URL` with `?console={qemu|lxc}&vmid={id}&node={node}&resize=scale` params. Dashboard opens it via `window.open()` in a new tab so browser session cookies handle Proxmox auth. LXC console uses `xtermjs=1`, QEMU uses `novnc=1`.
- **Per-VM/LXC IPs**: `getConfigIPs()` in proxmox.js fetches QEMU IPs from `/agent/network-get-interfaces`, LXC IPs from `/interfaces` endpoint (fallback to `/config` `net0`-`net7` parsing). IPv4 only.
- **TLS**: `NODE_TLS_REJECT_UNAUTHORIZED=0` in `.env.local` for self-signed certs. Shows a console warning — acceptable for internal lab use.
- **Tailwind CSS 4**: Uses `@tailwindcss/postcss` config. CSS vars in `globals.css` for theming.
- **All API routes return 502 on Proxmox failures** with `{ error, data: null }`.
@@ -55,7 +56,7 @@ src/
| `PROXMOX_TOKEN_ID` | Yes | API token ID |
| `PROXMOX_TOKEN_SECRET` | Yes | API token secret |
| `PROXMOX_WEB_URL` | No | Web UI URL (defaults from PROXMOX_API_URL) |
| `NEXT_PUBLIC_API_POLL_INTERVAL` | No | Poll interval ms (default 30000) |
| `API_POLL_INTERVAL` | No | Poll interval ms (default 30000) |
| `NODE_TLS_REJECT_UNAUTHORIZED` | No | `0` for self-signed certs |
## Git Workflow

View File

@@ -4,17 +4,24 @@ A real-time dashboard for monitoring Proxmox VE nodes, VMs, and LXC containers.
## Features
- **Node overview** — CPU, memory, uptime, and load for each Proxmox node
- **Node overview** — CPU, memory, uptime, and load for each Proxmox node, grouped into collapsible cards
- **VM & LXC tracking** — status, resource usage across all nodes
- **Summary cards** — total nodes, running/stopped VMs, aggregate memory
- **Auto-refresh** — polling every 30s (configurable)
- **Tabbed navigation** — switch between Nodes, VMs, and LXCs
- **Per-VM/LXC IP addresses** — IPv4 from guest agent (QEMU) or network config (LXC), displayed below VM/LXC name
- **Power control** — Start/stop/restart buttons per row
- **Console links** — Opens Proxmox web UI console in a new tab
- **Search / filter** — Client-side filtering by name, node, or status with auto-expand
- **Group by node** — Collapsible node cards with running/stopped subtotals
- **Manual refresh** — Button in header to refresh all data
- **Custom poll interval** — Adjustable polling interval (default 30s) via header input
- **Uptime display** — Formatted as "Xd Yh Zm"
- **Auto-refresh** — Manual `setInterval` polling every 30s (configurable)
## Tech Stack
- **Framework** — Next.js 15 (App Router)
- **UI** — React 19, Tailwind CSS 4
- **Data fetching** — SWR (auto-refresh), Axios
- **Data fetching** — Axios with manual `setInterval` polling
- **Proxmox** — API2 Token-based auth
## Getting Started
@@ -32,7 +39,7 @@ cp .env.example .env.local
```
PROXMOX_API_URL=https://your-proxmox-host:8006/api2/json
PROXMOX_TOKEN_ID=root@pam!token-name
PROXMOX_TOKEN_SECRET=your-secret-uuid
PROXMOX_TOKEN_SECRET=<your-token-secret>
API_POLL_INTERVAL=30000
NODE_TLS_REJECT_UNAUTHORIZED=0
```
@@ -69,27 +76,30 @@ src/
│ │ ├── nodes/route.js # Proxmox node stats
│ │ ├── vms/route.js # QEMU VMs across all nodes
│ │ ├── lxc/route.js # LXC containers across all nodes
│ │ ── status/route.js # Aggregated summary
│ │ ── status/route.js # Aggregated summary
│ │ ├── power/route.js # Power control endpoint
│ │ └── proxy/[...]/ # Reverse proxy to Proxmox web UI
│ ├── layout.js
│ └── page.js
├── components/
│ ├── Dashboard.js # Main dashboard with tabs & summary
│ ├── NodeList.js # Node cards
│ ├── NodeCard.js # Single node display
│ ├── VMList.js # VM list view
│ ├── LXCList.js # LXC list view
│ └── StatusBadge.js # Online/good/warn/error/dead
│ ├── Dashboard.js # Main dashboard with tabs, summary, polling
│ ├── NodeList.js # Node overview
│ ├── NodeCard.js # Single node card
│ ├── VMList.js # VM list with group by node, filter, power actions
│ ├── LXCList.js # LXC list with group by node, filter, power actions
│ └── StatusBadge.js # Status indicator
└── lib/
└── proxmox.js # Proxmox API client & data mappers
└── proxmox.js # Proxmox API client — nodes, VMs, LXC, IPs, power control
```
## Environment Variables
| Variable | Required | Description |
|---|---|---|
| `PROXMOX_API_URL` | Yes | Base URL of the Proxmox API |
| `PROXMOX_API_URL` | Yes | Base URL of the Proxmox API (e.g. `https://host:8006/api2/json`) |
| `PROXMOX_TOKEN_ID` | Yes | API token ID (e.g. `root@pam!monitorapp`) |
| `PROXMOX_TOKEN_SECRET` | Yes | API token secret |
| `PROXMOX_WEB_URL` | No | Web UI URL (defaults from `PROXMOX_API_URL`). Used for console links. |
| `API_POLL_INTERVAL` | No | Refresh interval in ms (default: `30000`) |
| `NODE_TLS_REJECT_UNAUTHORIZED` | No | Set to `0` for self-signed certs |
@@ -98,6 +108,14 @@ src/
| Route | Method | Description |
|---|---|---|
| `/api/nodes` | GET | All Proxmox nodes |
| `/api/vms` | GET | All QEMU VMs |
| `/api/lxc` | GET | All LXC containers |
| `/api/vms` | GET | All QEMU VMs (with IPv4 from guest agent) |
| `/api/lxc` | GET | All LXC containers (with IPv4 from interfaces/config) |
| `/api/status` | GET | Aggregated summary stats |
| `/api/power` | POST | Power control (start/stop/restart) |
| `/api/proxy/*` | GET | Reverse proxy to Proxmox web UI |
## Per-VM/LXC IP Addresses
- **QEMU VMs**: fetched from `/nodes/<node>/qemu/<id>/agent/network-get-interfaces` (requires QEMU guest agent installed)
- **LXC**: fetched from `/nodes/<node>/lxc/<id>/interfaces` (preferred) or parsed from `/config` `net0`-`net7` fields (fallback)
- IPv4 only — IPv6 addresses are excluded

View File

@@ -28,15 +28,15 @@
## Quick Wins (low effort, high value)
### Per-VM/LXC IP Addresses
- LXCs: parses `ip=` and `ip6=` from `net0`, `net1`, etc. fields in `/nodes/<node>/lxc/<id>/config`.
- VMs: fetches from `/nodes/<node>/qemu/<id>/agent/network-get-interfaces` and reads `ipaddresses`.
- Displays IPs below the name in the table.
- LXCs: fetches from `/interfaces` endpoint; falls back to `ip=` parsing from `net0`-`net7` in `/config`.
- VMs: fetches from `/agent/network-get-interfaces` (requires QEMU guest agent).
- IPv4 only. Displays IPs below the name in the table.
- **Status: done**
### Search / Filter
- Client-side text input filtering table rows by name/node/status
- Uses `useMemo` for performant filtering, auto-expands single node and filter-matched nodes
- **Status: done (merged to main)**
- **Status: done**
## Medium Effort
@@ -51,9 +51,6 @@
- Show vCPU count, total disk size alongside usage stats
- Note: disk.total is not populated by Proxmox API — only disk.used is available
### Per-VM IP Addresses
- Done — uses `/nodes/<node>/qemu/<id>/agent/network-get-interfaces` for VMs and config `net0`/`net1` parsing for LXCs.
### Per-VM CPU/Memory Trend
- Periodic polling to build a small trend chart