Resource Types - antimetal/system-agent GitHub Wiki
Resource Types
⚠️ Work in Progress: This documentation is currently being developed and may be incomplete or subject to change.
Overview
The Antimetal System Agent collects and monitors various types of Kubernetes resources and system metrics. This page provides a comprehensive reference of all resource types, their schemas, and collection behaviors.
Kubernetes Resources
Core Resources
Nodes
- API Version: v1
- Kind: Node
- Collected Fields:
- Metadata (name, labels, annotations, UID)
- Status (conditions, capacity, allocatable)
- Node info (kernel version, OS, container runtime)
- Addresses (internal IP, hostname)
- Taints and unschedulable status
Pods
- API Version: v1
- Kind: Pod
- Collected Fields:
- Metadata (name, namespace, labels, annotations, UID)
- Spec (containers, volumes, node name)
- Status (phase, conditions, container statuses)
- QoS class and priority
- Resource requests and limits
- Owner references
Services
- API Version: v1
- Kind: Service
- Collected Fields:
- Metadata (name, namespace, labels, annotations)
- Spec (type, ports, selector)
- Status (load balancer info)
- Cluster IP and external IPs
- Session affinity
Endpoints
- API Version: v1
- Kind: Endpoints
- Collected Fields:
- Metadata (name, namespace)
- Subsets (addresses, ports)
- Ready and not-ready addresses
Namespaces
- API Version: v1
- Kind: Namespace
- Collected Fields:
- Metadata (name, labels, annotations)
- Status (phase)
Workload Resources
Deployments
- API Version: apps/v1
- Kind: Deployment
- Collected Fields:
- Metadata (name, namespace, labels, annotations)
- Spec (replicas, selector, strategy)
- Status (replicas, conditions)
- Revision history limit
StatefulSets
- API Version: apps/v1
- Kind: StatefulSet
- Collected Fields:
- Metadata (name, namespace, labels, annotations)
- Spec (replicas, selector, service name)
- Status (replicas, current revision)
- Update strategy and pod management policy
DaemonSets
- API Version: apps/v1
- Kind: DaemonSet
- Collected Fields:
- Metadata (name, namespace, labels, annotations)
- Spec (selector, update strategy)
- Status (desired/current/ready numbers)
- Node selector and tolerations
ReplicaSets
- API Version: apps/v1
- Kind: ReplicaSet
- Collected Fields:
- Metadata (name, namespace, labels, annotations)
- Spec (replicas, selector)
- Status (replicas, ready replicas)
- Owner references (usually Deployment)
Performance Metrics
System Metrics
CPU Metrics
- Type:
cpu
- Source:
/proc/stat
- Fields:
- User, system, idle, iowait times
- Per-core statistics
- CPU count and frequency
- Context switches and interrupts
Memory Metrics
- Type:
memory
- Source:
/proc/meminfo
- Fields:
- Total, free, available memory
- Buffers and cache
- Swap usage
- Memory pressure indicators
Disk Metrics
- Type:
disk
- Source:
/proc/diskstats
- Fields:
- Read/write operations and bytes
- I/O time and queue statistics
- Device utilization
- Per-device metrics
Network Metrics
- Type:
network
- Source:
/proc/net/dev
- Fields:
- Bytes/packets sent and received
- Errors and drops
- Per-interface statistics
- Network queue information
Process Metrics
Process Stats
- Type:
process
- Source:
/proc/[pid]/stat
- Fields:
- PID, PPID, process name
- CPU usage (user/system time)
- Memory usage (RSS, VSZ)
- State and priority
- Thread count
Hardware Information
CPU Info
- Type:
cpu_info
- Source:
/proc/cpuinfo
,/sys/devices/system/cpu
- Fields:
- Processor model and vendor
- Core count and topology
- Cache sizes
- CPU features and flags
Memory Info
- Type:
memory_info
- Source:
/proc/meminfo
,/sys/devices/system/node
- Fields:
- Total system memory
- NUMA topology
- Memory banks and channels
Disk Info
- Type:
disk_info
- Source:
/sys/block
- Fields:
- Device model and size
- Queue configuration
- Rotational status (SSD/HDD)
Data Formats
Kubernetes Resource Format
All Kubernetes resources follow this general structure:
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"name": "example-pod",
"namespace": "default",
"uid": "12345-67890",
"labels": {
"app": "example"
},
"annotations": {
"description": "Example pod"
}
},
"spec": {
// Resource-specific specification
},
"status": {
// Resource-specific status
}
}
Performance Metric Format
Performance metrics follow this structure:
{
"metric_type": "cpu",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
// Metric-specific data fields
}
}
Collection Behavior
Collection Modes
-
Continuous Collection
- Kubernetes resources (watch API)
- Performance metrics (polling)
- Real-time updates
-
One-Shot Collection
- Hardware information
- System configuration
- Collected once at startup
Collection Intervals
Resource Type | Default Interval | Configurable |
---|---|---|
Kubernetes Resources | Real-time (watch) | No |
CPU Metrics | 10 seconds | Yes |
Memory Metrics | 10 seconds | Yes |
Disk Metrics | 30 seconds | Yes |
Network Metrics | 10 seconds | Yes |
Process Metrics | 30 seconds | Yes |
Resource Filters
Resources can be filtered by:
- Namespace: Include/exclude specific namespaces
- Labels: Select resources with specific labels
- Annotations: Filter based on annotations
- Resource names: Include/exclude by name patterns
Example configuration:
filters:
namespaces:
include: ["production", "staging"]
exclude: ["kube-system"]
labels:
include:
monitored: "true"
exclude:
temporary: "true"
Resource Relationships
Parent-Child Relationships
- Deployment --> ReplicaSet --> Pod
- StatefulSet --> Pod
- DaemonSet --> Pod
- Service --> Endpoints
- Node --> Pod
Cross-References
Resources maintain references through:
- Owner references
- Label selectors
- Service endpoints
- Node assignments
API Integration
gRPC Message Types
Each resource type has corresponding Protocol Buffer definitions:
message Resource {
string api_version = 1;
string kind = 2;
ObjectMeta metadata = 3;
google.protobuf.Any spec = 4;
google.protobuf.Any status = 5;
}
message Metric {
string type = 1;
google.protobuf.Timestamp timestamp = 2;
google.protobuf.Any data = 3;
}
Batch Operations
Resources are sent in batches for efficiency:
- Maximum batch size: 1000 resources
- Compression: gzip
- Chunking for large resources
See Also
- Architecture Overview - System design
- gRPC API - API details
- Performance Collectors - Metric collectors
- Configuration Guide - Resource filtering