Documentation
¶
Index ¶
Constants ¶
View Source
const Name = "metrics"
Name is the registry key for this scanner.
Variables ¶
This section is empty.
Functions ¶
func NewScanner ¶
NewScanner returns a scanner that collects node resource utilization from the metrics API. Returns Available=false with Forbidden=true on 403 so operators know whether to install metrics-server or fix RBAC.
Types ¶
type Data ¶
type Data struct {
// Available is false when metrics-server is not installed or not authorized.
Available bool `json:"available"`
// Forbidden is true when the API returned 403 (metrics-server installed but
// RBAC denied). Distinguishing this from "not installed" lets operators fix
// the right thing.
Forbidden bool `json:"forbidden,omitempty"`
// NodeCount is the number of nodes with metrics.
NodeCount int `json:"node_count"`
// AvgCPUPercent is the average CPU utilization across all nodes.
AvgCPUPercent float64 `json:"avg_cpu_percent"`
// AvgMemoryPercent is the average memory utilization across all nodes.
AvgMemoryPercent float64 `json:"avg_memory_percent"`
// MaxCPUPercent is the highest CPU utilization on any single node.
MaxCPUPercent float64 `json:"max_cpu_percent"`
// MaxMemoryPercent is the highest memory utilization on any single node.
MaxMemoryPercent float64 `json:"max_memory_percent"`
// MaxCPUNode is the name of the node with the highest CPU usage.
MaxCPUNode string `json:"max_cpu_node,omitempty"`
// MaxMemoryNode is the name of the node with the highest memory usage.
MaxMemoryNode string `json:"max_memory_node,omitempty"`
// Nodes lists per-node utilization metrics.
Nodes []NodeMetrics `json:"nodes"`
}
Data holds cluster-wide resource utilization metrics.
type NodeMetrics ¶
type NodeMetrics struct {
// Name is the node name.
Name string `json:"name"`
// CPUUsage is the current CPU usage (for example "250m").
CPUUsage string `json:"cpu_usage"`
// MemoryUsage is the current memory usage (for example "1.2Gi").
MemoryUsage string `json:"memory_usage"`
// CPUPercent is usage as a percentage of allocatable CPU (-1 if unknown).
CPUPercent float64 `json:"cpu_percent"`
// MemoryPercent is usage as a percentage of allocatable memory (-1 if unknown).
MemoryPercent float64 `json:"memory_percent"`
}
NodeMetrics describes resource utilization for a single node.
Click to show internal directories.
Click to hide internal directories.