sflow

package
v0.0.0-...-1d39891 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAgentAlreadyAllocated error agent already allocated for this uuid
	ErrAgentAlreadyAllocated = errors.New("agent already allocated for this uuid")
)

Functions

func SFMetadataDecoder

func SFMetadataDecoder(raw json.RawMessage) (common.Getter, error)

SFMetadataDecoder implements a json message raw decoder

Types

type Agent

type Agent struct {
	common.RWMutex
	UUID       string
	FlowTable  *flow.Table
	Conn       *net.UDPConn
	Addr       string
	Port       int
	BPFFilter  string
	HeaderSize uint32
	Graph      *graph.Graph
	Node       *graph.Node
}

Agent describes SFlow agent probe

func NewAgent

func NewAgent(u string, conn *net.UDPConn, addr string, port int, ft *flow.Table, bpfFilter string, headerSize uint32, n *graph.Node, g *graph.Graph) *Agent

NewAgent creates a new sFlow agent which will populate the given flowtable

func (*Agent) GetTarget

func (sfa *Agent) GetTarget() string

GetTarget returns the current used connection

func (*Agent) Start

func (sfa *Agent) Start()

Start the SFlow probe agent

func (*Agent) Stop

func (sfa *Agent) Stop()

Stop the SFlow probe agent

type AgentAllocator

type AgentAllocator struct {
	common.RWMutex
	// contains filtered or unexported fields
}

AgentAllocator describes an SFlow agent allocator to manage multiple SFlow agent probe

func NewAgentAllocator

func NewAgentAllocator() (*AgentAllocator, error)

NewAgentAllocator creates a new sFlow agent allocator

func (*AgentAllocator) Alloc

func (a *AgentAllocator) Alloc(uuid string, ft *flow.Table, bpfFilter string, headerSize uint32, addr *common.ServiceAddress, n *graph.Node, g *graph.Graph) (*Agent, error)

Alloc allocates a new sFlow agent

func (*AgentAllocator) Release

func (a *AgentAllocator) Release(uuid string)

Release a sFlow agent

func (*AgentAllocator) ReleaseAll

func (a *AgentAllocator) ReleaseAll()

ReleaseAll sFlow agents

type EthMetric

type EthMetric struct {
	EthAlignmentErrors           int64 `json:"EthAlignmentErrors,omitempty"`
	EthFCSErrors                 int64 `json:"EthFCSErrors,omitempty"`
	EthSingleCollisionFrames     int64 `json:"EthSingleCollisionFrames,omitempty"`
	EthMultipleCollisionFrames   int64 `json:"EthMultipleCollisionFrames,omitempty"`
	EthSQETestErrors             int64 `json:"EthSQETestErrors,omitempty"`
	EthDeferredTransmissions     int64 `json:"EthDeferredTransmissions,omitempty"`
	EthLateCollisions            int64 `json:"EthLateCollisions,omitempty"`
	EthExcessiveCollisions       int64 `json:"EthExcessiveCollisions,omitempty"`
	EthInternalMacReceiveErrors  int64 `json:"EthInternalMacReceiveErrors,omitempty"`
	EthInternalMacTransmitErrors int64 `json:"EthInternalMacTransmitErrors,omitempty"`
	EthCarrierSenseErrors        int64 `json:"EthCarrierSenseErrors,omitempty"`
	EthFrameTooLongs             int64 `json:"EthFrameTooLongs,omitempty"`
	EthSymbolErrors              int64 `json:"EthSymbolErrors,omitempty"`
}

EthMetric the SFlow ethernet counters easyjson:json gendecoder

type IfMetric

type IfMetric struct {
	IfInOctets         int64 `json:"IfInOctets,omitempty"`
	IfInUcastPkts      int64 `json:"IfInUcastPkts,omitempty"`
	IfInMulticastPkts  int64 `json:"IfInMulticastPkts,omitempty"`
	IfInBroadcastPkts  int64 `json:"IfInBroadcastPkts,omitempty"`
	IfInDiscards       int64 `json:"IfInDiscards,omitempty"`
	IfInErrors         int64 `json:"IfInErrors,omitempty"`
	IfInUnknownProtos  int64 `json:"IfInUnknownProtos,omitempty"`
	IfOutOctets        int64 `json:"IfOutOctets,omitempty"`
	IfOutUcastPkts     int64 `json:"IfOutUcastPkts,omitempty"`
	IfOutMulticastPkts int64 `json:"IfOutMulticastPkts,omitempty"`
	IfOutBroadcastPkts int64 `json:"IfOutBroadcastPkts,omitempty"`
	IfOutDiscards      int64 `json:"IfOutDiscards,omitempty"`
	IfOutErrors        int64 `json:"IfOutErrors,omitempty"`
}

IfMetric the SFlow Interface counters easyjson:json gendecoder

type OvsMetric

type OvsMetric struct {
	OvsDpNHit      int64 `json:"OvsDpNHit,omitempty"`
	OvsDpNMissed   int64 `json:"OvsDpNMissed,omitempty"`
	OvsDpNLost     int64 `json:"OvsDpNLost,omitempty"`
	OvsDpNMaskHit  int64 `json:"OvsDpNMaskHit,omitempty"`
	OvsDpNFlows    int64 `json:"OvsDpNFlows,omitempty"`
	OvsDpNMasks    int64 `json:"OvsDpNMasks,omitempty"`
	OvsAppFdOpen   int64 `json:"OvsAppFdOpen,omitempty"`
	OvsAppFdMax    int64 `json:"OvsAppFdMax,omitempty"`
	OvsAppConnOpen int64 `json:"OvsAppConnOpen,omitempty"`
	OvsAppConnMax  int64 `json:"OvsAppConnMax,omitempty"`
	OvsAppMemUsed  int64 `json:"OvsAppMemUsed,omitempty"`
	OvsAppMemMax   int64 `json:"OvsAppMemMax,omitempty"`
}

OvsMetric the SFlow ovs counters easyjson:json gendecoder

type SFMetric

type SFMetric struct {
	IfMetric
	OvsMetric
	VlanMetric
	EthMetric

	Start int64 `json:"Start,omitempty"`
	Last  int64 `json:"Last,omitempty"`
}

SFMetric the SFlow Counter Samples easyjson:json gendecoder

func (*SFMetric) Add

func (sm *SFMetric) Add(m common.Metric) common.Metric

Add sum two metrics and return a new Metrics object

func (*SFMetric) GetLast

func (sm *SFMetric) GetLast() int64

GetLast returns last time

func (*SFMetric) GetStart

func (sm *SFMetric) GetStart() int64

GetStart returns start time

func (*SFMetric) IsZero

func (sm *SFMetric) IsZero() bool

IsZero returns true if all the values are equal to zero

func (*SFMetric) SetLast

func (sm *SFMetric) SetLast(last int64)

SetLast set last tome

func (*SFMetric) SetStart

func (sm *SFMetric) SetStart(start int64)

SetStart set start time

func (*SFMetric) Split

func (sm *SFMetric) Split(cut int64) (common.Metric, common.Metric)

Split splits a metric into two parts

func (*SFMetric) Sub

func (sm *SFMetric) Sub(m common.Metric) common.Metric

Sub subtract two metrics and return a new Metrics object

type SFlow

type SFlow struct {
	IfMetrics        map[int64]*IfMetric `json:"IfMetrics,omitempty"`
	Metric           *SFMetric           `json:"Metric,omitempty"`
	LastUpdateMetric *SFMetric           `json:"LastUpdateMetric,omitempty"`
}

SFlow all sflow information easyjson:json gendecoder

type VlanMetric

type VlanMetric struct {
	VlanOctets        int64 `json:"VlanOctets,omitempty"`
	VlanUcastPkts     int64 `json:"VlanUcastPkts,omitempty"`
	VlanMulticastPkts int64 `json:"VlanMulticastPkts,omitempty"`
	VlanBroadcastPkts int64 `json:"VlanBroadcastPkts,omitempty"`
	VlanDiscards      int64 `json:"VlanDiscards,omitempty"`
}

VlanMetric the SFlow vlan counters easyjson:json gendecoder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL