sflow

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 14 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 added in v0.22.0

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

SFMetadataDecoder implements a json message raw decoder

Types

type Agent added in v0.22.0

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

Agent describes SFlow agent probe

func NewAgent added in v0.22.0

func NewAgent(u string, a *common.ServiceAddress, 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 added in v0.22.0

func (sfa *Agent) GetTarget() string

GetTarget returns the current used connection

func (*Agent) Start added in v0.22.0

func (sfa *Agent) Start()

Start the SFlow probe agent

func (*Agent) Stop added in v0.22.0

func (sfa *Agent) Stop()

Stop the SFlow probe agent

type AgentAllocator added in v0.22.0

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

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

func NewAgentAllocator added in v0.22.0

func NewAgentAllocator() (*AgentAllocator, error)

NewAgentAllocator creates a new sFlow agent allocator

func (*AgentAllocator) Alloc added in v0.22.0

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

Alloc allocates a new sFlow agent

func (*AgentAllocator) Release added in v0.22.0

func (a *AgentAllocator) Release(uuid string)

Release a sFlow agent

func (*AgentAllocator) ReleaseAll added in v0.22.0

func (a *AgentAllocator) ReleaseAll()

ReleaseAll sFlow agents

type SFMetric added in v0.22.0

type SFMetric struct {
	Start              int64 `json:"Start,omitempty"`
	Last               int64 `json:"Last,omitempty"`
	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"`
	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"`
	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"`
}

SFMetric the SFlow Counter Samples easyjson:json

func (*SFMetric) Add added in v0.22.0

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

Add sum two metrics and return a new Metrics object

func (*SFMetric) GetField added in v0.22.0

func (sm *SFMetric) GetField(key string) (interface{}, error)

GetField implements Getter interface

func (*SFMetric) GetFieldInt64 added in v0.22.0

func (sm *SFMetric) GetFieldInt64(field string) (int64, error)

GetFieldInt64 implements Getter and Metrics interfaces

func (*SFMetric) GetFieldKeys added in v0.22.0

func (sm *SFMetric) GetFieldKeys() []string

GetFieldKeys implements Getter and Metrics interfaces

func (*SFMetric) GetFieldString added in v0.22.0

func (sm *SFMetric) GetFieldString(key string) (string, error)

GetFieldString implements Getter interface

func (*SFMetric) GetLast added in v0.22.0

func (sm *SFMetric) GetLast() int64

GetLast returns last time

func (*SFMetric) GetStart added in v0.22.0

func (sm *SFMetric) GetStart() int64

GetStart returns start time

func (*SFMetric) IsZero added in v0.22.0

func (sm *SFMetric) IsZero() bool

IsZero returns true if all the values are equal to zero

func (*SFMetric) SetLast added in v0.22.0

func (sm *SFMetric) SetLast(last int64)

SetLast set last tome

func (*SFMetric) SetStart added in v0.22.0

func (sm *SFMetric) SetStart(start int64)

SetStart set start time

func (*SFMetric) Split added in v0.22.0

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

Split splits a metric into two parts

func (*SFMetric) Sub added in v0.22.0

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

Sub subtract two metrics and return a new Metrics object

type SFlow added in v0.22.0

type SFlow struct {
	Counters         []layers.SFlowCounterSample `json:"Counters,omitempty"`
	Metric           *SFMetric                   `json:"Metric,omitempty"`
	LastUpdateMetric *SFMetric                   `json:"LastUpdateMetric,omitempty"`
}

SFlow all sflow information

func (*SFlow) GetField added in v0.22.0

func (sf *SFlow) GetField(key string) (interface{}, error)

GetField implements Getter interface

func (*SFlow) GetFieldInt64 added in v0.22.0

func (sf *SFlow) GetFieldInt64(key string) (int64, error)

GetFieldInt64 implements Getter interface

func (*SFlow) GetFieldKeys added in v0.22.0

func (sf *SFlow) GetFieldKeys() []string

GetFieldKeys implements Getter interface

func (*SFlow) GetFieldString added in v0.22.0

func (sf *SFlow) GetFieldString(key string) (string, error)

GetFieldString implements Getter interface

Source Files

  • agent.go
  • sflowmetric.go

Jump to

Keyboard shortcuts

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