Documentation
¶
Overview ¶
Package sflow decodes sFlow packets
Index ¶
- Constants
- type Counter
- type CounterSample
- type EthernetInterfaceCounters
- type ExtRouterData
- type ExtSwitchData
- type FlowSample
- type GenericInterfaceCounters
- type ProcessorCounters
- type Record
- type SFDatagram
- type SFDecoder
- type SFSampledHeader
- type Sample
- type SampledHeader
- type TokenRingCounters
- type VGCounters
- type VlanCounters
Constants ¶
const ( // DataFlowSample defines packet flow sampling DataFlowSample = 1 // DataCounterSample defines counter sampling DataCounterSample = 2 )
const ( // SFGenericInterfaceCounters is Generic interface counters - see RFC 2233 SFGenericInterfaceCounters = 1 // SFEthernetInterfaceCounters is Ethernet interface counters - see RFC 2358 SFEthernetInterfaceCounters = 2 // SFTokenRingInterfaceCounters is Token ring counters - see RFC 1748 SFTokenRingInterfaceCounters = 3 // SF100BaseVGInterfaceCounters is 100 BaseVG interface counters - see RFC 2020 SF100BaseVGInterfaceCounters = 4 // SFVLANCounters is VLAN counters SFVLANCounters = 5 // SFProcessorCounters is processor counters SFProcessorCounters = 1001 )
const ( // SFDataRawHeader is sFlow Raw Packet Header number SFDataRawHeader = 1 // SFDataExtSwitch is sFlow Extended Switch Data number SFDataExtSwitch = 1001 // SFDataExtRouter is sFlow Extended Router Data number SFDataExtRouter = 1002 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CounterSample ¶ added in v0.6.5
type CounterSample struct {
SequenceNo uint32
SourceIDType byte
SourceIDIdx uint32
RecordsNo uint32
Records map[string]Record
}
CounterSample represents the periodic sampling or polling of counters associated with a Data Source
type EthernetInterfaceCounters ¶ added in v0.6.5
type EthernetInterfaceCounters struct {
AlignmentErrors uint32
FCSErrors uint32
SingleCollisionFrames uint32
MultipleCollisionFrames uint32
SQETestErrors uint32
DeferredTransmissions uint32
LateCollisions uint32
ExcessiveCollisions uint32
InternalMACTransmitErrors uint32
CarrierSenseErrors uint32
FrameTooLongs uint32
InternalMACReceiveErrors uint32
SymbolErrors uint32
}
EthernetInterfaceCounters represents Ethernet Interface Counters RFC2358
type ExtRouterData ¶ added in v0.6.5
ExtRouterData represents extended router data
type ExtSwitchData ¶
type ExtSwitchData struct {
SrcVlan uint32 // The 802.1Q VLAN id of incoming frame
SrcPriority uint32 // The 802.1p priority of incoming frame
DstVlan uint32 // The 802.1Q VLAN id of outgoing frame
DstPriority uint32 // The 802.1p priority of outgoing frame
}
ExtSwitchData represents Extended Switch Data
type FlowSample ¶
type FlowSample struct {
SequenceNo uint32 // Incremented with each flow sample
SourceID byte // sfSourceID
SamplingRate uint32 // sfPacketSamplingRate
SamplePool uint32 // Total number of packets that could have been sampled
Drops uint32 // Number of times a packet was dropped due to lack of resources
Input uint32 // SNMP ifIndex of input interface
Output uint32 // SNMP ifIndex of input interface
RecordsNo uint32 // Number of records to follow
Records map[string]Record
}
FlowSample represents single flow sample
type GenericInterfaceCounters ¶ added in v0.6.5
type GenericInterfaceCounters struct {
Index uint32
Type uint32
Speed uint64
Direction uint32
Status uint32
InOctets uint64
InUnicastPackets uint32
InMulticastPackets uint32
InBroadcastPackets uint32
InDiscards uint32
InErrors uint32
InUnknownProtocols uint32
OutOctets uint64
OutUnicastPackets uint32
OutMulticastPackets uint32
OutBroadcastPackets uint32
OutDiscards uint32
OutErrors uint32
PromiscuousMode uint32
}
GenericInterfaceCounters represents Generic Interface Counters RFC2233
type ProcessorCounters ¶ added in v0.6.5
type ProcessorCounters struct {
CPU5s uint32
CPU1m uint32
CPU5m uint32
TotalMemory uint64
FreeMemory uint64
}
ProcessorCounters represents Processor Information
type SFDatagram ¶
type SFDatagram struct {
Version uint32 // Datagram version
IPVersion uint32 // Data gram sFlow version
AgentSubID uint32 // Identifies a source of sFlow data
SequenceNo uint32 // Sequence of sFlow Datagrams
SysUpTime uint32 // Current time (in milliseconds since device last booted
SamplesNo uint32 // Number of samples
Samples []Sample
Counters []Counter
IPAddress net.IP // Agent IP address
ColTime int64 // Collected time
}
SFDatagram represents sFlow datagram
type SFDecoder ¶
type SFDecoder struct {
// contains filtered or unexported fields
}
SFDecoder represents sFlow decoder
func NewSFDecoder ¶
func NewSFDecoder(r io.ReadSeeker, f []uint32) SFDecoder
NewSFDecoder constructs new sflow decoder
func (*SFDecoder) SFDecode ¶
func (d *SFDecoder) SFDecode() (*SFDatagram, error)
SFDecode decodes sFlow data
type SFSampledHeader ¶
type SFSampledHeader struct {
HeaderProtocol uint32 // (enum SFHeaderProtocol)
FrameLength uint32 // Original length of packet before sampling
Stripped uint32 // Header/trailer bytes stripped by sender
HeaderLength uint32 // Length of sampled header bytes to follow
HeaderBytes []byte // Header bytes
}
SFSampledHeader represents sFlow sample header
type SampledHeader ¶
type SampledHeader struct {
Protocol uint32 // (enum SFLHeader_protocol)
FrameLength uint32 // Original length of packet before sampling
Stripped uint32 // Header/trailer bytes stripped by sender
HeaderLength uint32 // Length of sampled header bytes to follow
Header []byte // Header bytes
}
SampledHeader represents sampled header
type TokenRingCounters ¶ added in v0.6.5
type TokenRingCounters struct {
LineErrors uint32
BurstErrors uint32
ACErrors uint32
AbortTransErrors uint32
InternalErrors uint32
LostFrameErrors uint32
ReceiveCongestions uint32
FrameCopiedErrors uint32
TokenErrors uint32
SoftErrors uint32
HardErrors uint32
SignalLoss uint32
TransmitBeacons uint32
Recoverys uint32
LobeWires uint32
Removes uint32
Singles uint32
FreqErrors uint32
}
TokenRingCounters represents Token Ring Counters - see RFC 1748
type VGCounters ¶ added in v0.6.5
type VGCounters struct {
InHighPriorityFrames uint32
InHighPriorityOctets uint64
InNormPriorityFrames uint32
InNormPriorityOctets uint64
InIPMErrors uint32
InOversizeFrameErrors uint32
InDataErrors uint32
InNullAddressedFrames uint32
OutHighPriorityFrames uint32
OutHighPriorityOctets uint64
TransitionIntoTrainings uint32
HCInHighPriorityOctets uint64
HCInNormPriorityOctets uint64
HCOutHighPriorityOctets uint64
}
VGCounters represents 100 BaseVG interface counters - see RFC 2020