Documentation
¶
Index ¶
- func LoadMonito() (*ebpf.CollectionSpec, error)
- func LoadMonitoObjects(obj interface{}, opts *ebpf.CollectionOptions) error
- type BPFCollector
- type DiagnosticCounters
- type FlowDelta
- type MonitoFlowKey
- type MonitoFlowMetrics
- type MonitoMapSpecs
- type MonitoMaps
- type MonitoObjects
- type MonitoProcInfo
- type MonitoProgramSpecs
- type MonitoPrograms
- type MonitoSpecs
- type MonitoVariableSpecs
- type MonitoVariables
- type TrafficCategory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadMonito ¶
func LoadMonito() (*ebpf.CollectionSpec, error)
LoadMonito returns the embedded CollectionSpec for Monito.
func LoadMonitoObjects ¶
func LoadMonitoObjects(obj interface{}, opts *ebpf.CollectionOptions) error
LoadMonitoObjects loads Monito and converts it into a struct.
The following types are suitable as obj argument:
*MonitoObjects *MonitoPrograms *MonitoMaps
See ebpf.CollectionSpec.LoadAndAssign documentation for details.
Types ¶
type BPFCollector ¶
type BPFCollector struct {
// contains filtered or unexported fields
}
BPFCollector manages the eBPF programs, maps, and links
func NewBPFCollector ¶
func NewBPFCollector(cgroupPath string) (*BPFCollector, error)
NewBPFCollector initializes, loads, and attaches BPF programs to root cgroup
func (*BPFCollector) Close ¶
func (c *BPFCollector) Close() error
Close detaches links and releases all BPF resources
func (*BPFCollector) DrainDeltas ¶
func (c *BPFCollector) DrainDeltas() ([]FlowDelta, error)
DrainDeltas differences cumulative snapshots without deleting active counters.
func (*BPFCollector) LookupPIDMetadata ¶
func (c *BPFCollector) LookupPIDMetadata(pid uint32) (*MonitoProcInfo, bool)
LookupPIDMetadata checks if a PID's metadata is stored in the kernel LRU map
func (*BPFCollector) ReadCounters ¶
func (c *BPFCollector) ReadCounters() DiagnosticCounters
ReadCounters retrieves diagnostic and drop counters from BPF
func (*BPFCollector) StopAccounting ¶
func (c *BPFCollector) StopAccounting() error
StopAccounting detaches packet and creation hooks before the final snapshot. Map handles remain open until Close, allowing shutdown to persist that snapshot.
type DiagnosticCounters ¶
type DiagnosticCounters struct {
TotalIngressPackets uint64
TotalEgressPackets uint64
SocketsRegistered uint64
UnattributedIngress uint64
UnattributedEgress uint64
MapErrors uint64
RecoveredSockets uint64
RecoveryErrors uint64
}
DiagnosticCounters represents kernel BPF health and capacity metrics
type FlowDelta ¶
type FlowDelta struct {
PID uint32
Category TrafficCategory
RxBytes uint64
TxBytes uint64
RxPackets uint64
TxPackets uint64
}
FlowDelta represents accumulated network delta for a PID and category
type MonitoFlowKey ¶
type MonitoFlowMetrics ¶
type MonitoMapSpecs ¶
type MonitoMapSpecs struct {
Counters *ebpf.MapSpec `ebpf:"counters"`
FlowStats *ebpf.MapSpec `ebpf:"flow_stats"`
PidMetadata *ebpf.MapSpec `ebpf:"pid_metadata"`
SockOwners *ebpf.MapSpec `ebpf:"sock_owners"`
}
MonitoMapSpecs contains maps before they are loaded into the kernel.
It can be passed ebpf.CollectionSpec.Assign.
type MonitoMaps ¶
type MonitoMaps struct {
Counters *ebpf.Map `ebpf:"counters"`
FlowStats *ebpf.Map `ebpf:"flow_stats"`
PidMetadata *ebpf.Map `ebpf:"pid_metadata"`
SockOwners *ebpf.Map `ebpf:"sock_owners"`
}
MonitoMaps contains all maps after they have been loaded into the kernel.
It can be passed to LoadMonitoObjects or ebpf.CollectionSpec.LoadAndAssign.
func (*MonitoMaps) Close ¶
func (m *MonitoMaps) Close() error
type MonitoObjects ¶
type MonitoObjects struct {
MonitoPrograms
MonitoMaps
MonitoVariables
}
MonitoObjects contains all objects after they have been loaded into the kernel.
It can be passed to LoadMonitoObjects or ebpf.CollectionSpec.LoadAndAssign.
func (*MonitoObjects) Close ¶
func (o *MonitoObjects) Close() error
type MonitoProcInfo ¶
type MonitoProgramSpecs ¶
type MonitoProgramSpecs struct {
OnEgress *ebpf.ProgramSpec `ebpf:"on_egress"`
OnIngress *ebpf.ProgramSpec `ebpf:"on_ingress"`
OnSockCreate *ebpf.ProgramSpec `ebpf:"on_sock_create"`
OnSocketIo *ebpf.ProgramSpec `ebpf:"on_socket_io"`
OnSockops *ebpf.ProgramSpec `ebpf:"on_sockops"`
}
MonitoProgramSpecs contains programs before they are loaded into the kernel.
It can be passed ebpf.CollectionSpec.Assign.
type MonitoPrograms ¶
type MonitoPrograms struct {
OnEgress *ebpf.Program `ebpf:"on_egress"`
OnIngress *ebpf.Program `ebpf:"on_ingress"`
OnSockCreate *ebpf.Program `ebpf:"on_sock_create"`
OnSocketIo *ebpf.Program `ebpf:"on_socket_io"`
OnSockops *ebpf.Program `ebpf:"on_sockops"`
}
MonitoPrograms contains all programs after they have been loaded into the kernel.
It can be passed to LoadMonitoObjects or ebpf.CollectionSpec.LoadAndAssign.
func (*MonitoPrograms) Close ¶
func (p *MonitoPrograms) Close() error
type MonitoSpecs ¶
type MonitoSpecs struct {
MonitoProgramSpecs
MonitoMapSpecs
MonitoVariableSpecs
}
MonitoSpecs contains maps and programs before they are loaded into the kernel.
It can be passed ebpf.CollectionSpec.Assign.
type MonitoVariableSpecs ¶
type MonitoVariableSpecs struct {
}
MonitoVariableSpecs contains global variables before they are loaded into the kernel.
It can be passed ebpf.CollectionSpec.Assign.
type MonitoVariables ¶
type MonitoVariables struct {
}
MonitoVariables contains all global variables after they have been loaded into the kernel.
It can be passed to LoadMonitoObjects or ebpf.CollectionSpec.LoadAndAssign.
type TrafficCategory ¶
type TrafficCategory uint8
TrafficCategory represents the traffic destination / type
const ( CategoryLoopback TrafficCategory = 0 CategoryPrivate TrafficCategory = 1 CategoryExternal TrafficCategory = 2 CategoryUnknown TrafficCategory = 3 )
func (TrafficCategory) String ¶
func (c TrafficCategory) String() string