Documentation ¶
Index ¶
- func PluginNfqueueHandler(mess dispatch.NfqueueMessage, ctid uint32, newSession bool) dispatch.NfqueueResult
- func PluginShutdown()
- func PluginStartup()
- func WriteStatsJSON(p ParentJSON)
- type Collector
- type ExponentialAverage
- type InterfaceStatsJSON
- type MetricJSON
- type ParentJSON
- type RunningVariance
- type StatisticJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PluginNfqueueHandler ¶
func PluginNfqueueHandler(mess dispatch.NfqueueMessage, ctid uint32, newSession bool) dispatch.NfqueueResult
PluginNfqueueHandler is called to handle nfqueue packet data.
func PluginShutdown ¶
func PluginShutdown()
PluginShutdown function called when the daemon is shutting down.
func PluginStartup ¶
func PluginStartup()
PluginStartup function is called to allow plugin specific initialization.
func WriteStatsJSON ¶
func WriteStatsJSON(p ParentJSON)
WriteStatsJSON writes the json object to /tmp/stats.json
Types ¶
type Collector ¶
type Collector struct { Latency1Min ExponentialAverage Latency5Min ExponentialAverage Latency15Min ExponentialAverage LatencyVariance RunningVariance }
Collector collects all the stats for a given interface
func (*Collector) AddDataPoint ¶
AddDataPoint adds a new datapoint to a collector if it falls within the std deviation limit
func (*Collector) AddDataPointLimited ¶
AddDataPointLimited adds a new datapoint to a collector if it falls within the std deviation limit
type ExponentialAverage ¶
type ExponentialAverage struct { TimeframeMilliSeconds float64 Value float64 LastDatapointTimestamp time.Time CreationTime time.Time }
ExponentialAverage tallies an running exponential average
func (*ExponentialAverage) AdjustExpAvg ¶
func (ea *ExponentialAverage) AdjustExpAvg(value float64)
AdjustExpAvg adjust the exponential running average with the new datapoint
func (*ExponentialAverage) String ¶
func (ea *ExponentialAverage) String() string
type InterfaceStatsJSON ¶
type InterfaceStatsJSON struct { InterfaceID int `json:"interfaceId"` Stats []StatisticJSON `json:"stats"` }
InterfaceStatsJSON stores all stats for an interface
func MakeInterfaceStatsJSON ¶
func MakeInterfaceStatsJSON(interfaceID int, latency1 float64, latency5 float64, latency15 float64) InterfaceStatsJSON
MakeInterfaceStatsJSON makes an InterfaceStatsJSON
type MetricJSON ¶
MetricJSON stores an individual metric for a stat
type ParentJSON ¶
type ParentJSON struct { Version int `json:"version"` Interfaces []InterfaceStatsJSON `json:"interfaces"` }
ParentJSON stores all stats written to file
func MakeStatsJSON ¶
func MakeStatsJSON(interfaceStats []InterfaceStatsJSON) ParentJSON
MakeStatsJSON makes a ParentJSON object
type RunningVariance ¶
type RunningVariance struct { Alpha float64 // 0.0 -> 1.0 Mean float64 Variance float64 StdDeviation float64 }
RunningVariance tallies an running variance
func (*RunningVariance) AdjustVariance ¶
func (rv *RunningVariance) AdjustVariance(value float64)
AdjustVariance adjust the variance with a new datapoint Adjust the variance with a new datapoint http://people.ds.cam.ac.uk/fanf2/hermes/doc/antiforgery/stats.pdf
func (*RunningVariance) String ¶
func (rv *RunningVariance) String() string
type StatisticJSON ¶
type StatisticJSON struct { Name string `json:"name"` Unit string `json:"unit"` Metrics []MetricJSON `json:"metrics"` }
StatisticJSON stores an individual stat
func MakeStatisticJSON ¶
func MakeStatisticJSON(name string, unit string, metrics []MetricJSON) StatisticJSON
MakeStatisticJSON makes a StatisticJSON