Documentation ¶
Index ¶
Constants ¶
const (
// DefaultRPCAddress is the default Linux socket for the RPC monitor
DefaultRPCAddress = "/var/run/trireme.sock"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventInfo ¶
type EventInfo struct { // EventType refers to one of the standard events that Trireme handles. EventType monitor.Event // PUType is the the type of the PU PUType constants.PUType // The PUID is a unique value for the Processing Unit. Ideally this should be the UUID. PUID string // The Name is a user-friendly name for the Processing Unit. Name string // Tags represents the set of MetadataTags associated with this PUID. Tags map[string]string // The PID is the PID on the system where this Processing Unit is running. PID string // The path for the Network Namespace. NS string // IPs is a map of all the IPs that fully belong to this processing Unit. IPs map[string]string // Services is a list of services of interest - for host control Services []policy.Service // ControlApplicationTraffic indicates that traffic from the applications must be controlled. ControlApplicationTraffic bool // ControlNetworkTraffic indicates that traffic towards the applications must be controlled. ControlNetworkTraffic bool }
EventInfo is a generic structure that defines all the information related to a PU event. EventInfo should be used as a normalized struct container that
type MonitorProcessor ¶
type MonitorProcessor interface { // Start processes PU start events Start(eventInfo *EventInfo) error // Event processes PU stop events Stop(eventInfo *EventInfo) error // Create process a PU create event Create(eventInfo *EventInfo) error // Event process a PU destroy event Destroy(eventInfo *EventInfo) error // Event processes a pause event Pause(eventInfo *EventInfo) error // ReSync resyncs all PUs handled by this processor ReSync(EventInfo *EventInfo) error }
MonitorProcessor is a generic interface that processes monitor events using a normalized event structure.
type RPCEventHandler ¶
A RPCEventHandler is type of event handler functions.
type RPCMetadataExtractor ¶
RPCMetadataExtractor is a function used to extract a *policy.PURuntime from a given EventInfo.
type RPCMonitor ¶
type RPCMonitor struct {
// contains filtered or unexported fields
}
RPCMonitor implements the RPC connection
func NewRPCMonitor ¶
func NewRPCMonitor(rpcAddress string, collector collector.EventCollector) (*RPCMonitor, error)
NewRPCMonitor returns a base RPC monitor. Processors must be registered externally
func (*RPCMonitor) RegisterProcessor ¶
func (r *RPCMonitor) RegisterProcessor(puType constants.PUType, processor MonitorProcessor) error
RegisterProcessor registers an event processor for a given PUTYpe. Only one processor is allowed for a given PU Type.
type RPCResponse ¶
type RPCResponse struct {
Error string
}
RPCResponse encapsulate the error response if any.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the Monitor RPC Server implementation
func (*Server) HandleEvent ¶
func (s *Server) HandleEvent(eventInfo *EventInfo, result *RPCResponse) error
HandleEvent Gets called when clients generate events.