mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 10:46:16 +01:00
expand container monitoring functionality (#928)
- Add new /containers route with virtualized table showing all containers across systems - Implement container stats collection (CPU, memory, network usage) with health status tracking - Add container logs and info API endpoints with syntax highlighting using Shiki - Create detailed container views with fullscreen logs/info dialogs and refresh functionality - Add container table to individual system pages with lazy loading - Implement container record storage with automatic cleanup and historical averaging - Update navbar with container navigation icon - Extract reusable ActiveAlerts component from home page - Add FooterRepoLink component for consistent GitHub/version display - Enhance filtering and search capabilities across container tables
This commit is contained in:
@@ -8,6 +8,7 @@ type ApiInfo struct {
|
||||
IdShort string
|
||||
Names []string
|
||||
Status string
|
||||
State string
|
||||
// Image string
|
||||
// ImageID string
|
||||
// Command string
|
||||
@@ -16,7 +17,6 @@ type ApiInfo struct {
|
||||
// SizeRw int64 `json:",omitempty"`
|
||||
// SizeRootFs int64 `json:",omitempty"`
|
||||
// Labels map[string]string
|
||||
// State string
|
||||
// HostConfig struct {
|
||||
// NetworkMode string `json:",omitempty"`
|
||||
// Annotations map[string]string `json:",omitempty"`
|
||||
@@ -103,6 +103,22 @@ type prevNetStats struct {
|
||||
Recv uint64
|
||||
}
|
||||
|
||||
type DockerHealth = uint8
|
||||
|
||||
const (
|
||||
DockerHealthNone DockerHealth = iota
|
||||
DockerHealthStarting
|
||||
DockerHealthHealthy
|
||||
DockerHealthUnhealthy
|
||||
)
|
||||
|
||||
var DockerHealthStrings = map[string]DockerHealth{
|
||||
"none": DockerHealthNone,
|
||||
"starting": DockerHealthStarting,
|
||||
"healthy": DockerHealthHealthy,
|
||||
"unhealthy": DockerHealthUnhealthy,
|
||||
}
|
||||
|
||||
// Docker container stats
|
||||
type Stats struct {
|
||||
Name string `json:"n" cbor:"0,keyasint"`
|
||||
@@ -110,6 +126,10 @@ type Stats struct {
|
||||
Mem float64 `json:"m" cbor:"2,keyasint"`
|
||||
NetworkSent float64 `json:"ns" cbor:"3,keyasint"`
|
||||
NetworkRecv float64 `json:"nr" cbor:"4,keyasint"`
|
||||
|
||||
Health DockerHealth `json:"-" cbor:"5,keyasint"`
|
||||
Status string `json:"-" cbor:"6,keyasint"`
|
||||
Id string `json:"-" cbor:"7,keyasint"`
|
||||
// PrevCpu [2]uint64 `json:"-"`
|
||||
CpuSystem uint64 `json:"-"`
|
||||
CpuContainer uint64 `json:"-"`
|
||||
|
||||
Reference in New Issue
Block a user