Documentation
¶
Index ¶
- Variables
- func AllowType(t string) bool
- func GetAllowedTypes() []string
- func GetSensorID() (string, error)
- func ParseJSON(json []byte) (e types.Entry, parseerr error)
- func PrepareEventFilter(list []string, forwardall bool)
- func RandStringBytesMaskImprSrc(n int) string
- type AMQPBaseSubmitter
- type AMQPSubmitter
- type Consumer
- type DummySubmitter
- type HostNamer
- type PerformanceStatsEncoder
- type StatsSubmitter
Constants ¶
This section is empty.
Variables ¶
var ForwardAllEvents bool
ForwardAllEvents is set to true if the user has selected to skip event type filtering.
var ToolName = "fever"
ToolName is a string containing the name of this software, lowercase.
var ToolNameUpper = "FEVER"
ToolNameUpper is a string containing the name of this software, uppercase.
Functions ¶
func AllowType ¶
AllowType returns true if the event type indicated by the string t is allowed to be forwarded.
func GetAllowedTypes ¶
func GetAllowedTypes() []string
GetAllowedTypes returns a slice of strings with all forwarded types.
func GetSensorID ¶
GetSensorID returns the machine ID of the system it is being run on, or the string "<no_machine_id>"" if the ID cannot be determined.
func PrepareEventFilter ¶
PrepareEventFilter registers the passed string array slice into the list of event types to be forwarded to the secondary processor.
func RandStringBytesMaskImprSrc ¶
RandStringBytesMaskImprSrc returns a random string of a given length.
Types ¶
type AMQPBaseSubmitter ¶ added in v1.0.6
type AMQPBaseSubmitter struct { URL string Verbose bool SensorID string Conn wabbit.Conn Channel wabbit.Channel StopReconnection chan bool ErrorChan chan wabbit.Error Logger *log.Entry ChanMutex sync.Mutex ConnMutex sync.Mutex Reconnector func(string) (wabbit.Conn, error) NofSubmitters uint }
AMQPBaseSubmitter is the base engine that sends reports to a RabbitMQ host and handles reconnection.
type AMQPSubmitter ¶
type AMQPSubmitter struct { Submitter *AMQPBaseSubmitter Target string Compress bool }
AMQPSubmitter is a StatsSubmitter that sends reports to a RabbitMQ exchange.
func MakeAMQPSubmitter ¶
func MakeAMQPSubmitter(url string, target string, verbose bool) (*AMQPSubmitter, error)
MakeAMQPSubmitter creates a new submitter connected to a RabbitMQ server at the given URL.
func MakeAMQPSubmitterWithReconnector ¶
func MakeAMQPSubmitterWithReconnector(url string, target string, verbose bool, reconnector func(string) (wabbit.Conn, error)) (*AMQPSubmitter, error)
MakeAMQPSubmitterWithReconnector creates a new submitter connected to a RabbitMQ server at the given URL, using the reconnector function as a means to Dial() in order to obtain a Connection object.
func (*AMQPSubmitter) Finish ¶
func (s *AMQPSubmitter) Finish()
Finish cleans up the AMQP connection (reference counted).
func (*AMQPSubmitter) Submit ¶
func (s *AMQPSubmitter) Submit(rawData []byte, key string, contentType string)
Submit sends the rawData payload via the registered RabbitMQ connection.
func (*AMQPSubmitter) SubmitWithHeaders ¶
func (s *AMQPSubmitter) SubmitWithHeaders(rawData []byte, key string, contentType string, myHeaders map[string]string)
SubmitWithHeaders sends the rawData payload via the registered RabbitMQ connection, adding some extra key-value pairs to the header.
func (*AMQPSubmitter) UseCompression ¶
func (s *AMQPSubmitter) UseCompression()
UseCompression enables gzip compression of submitted payloads.
type Consumer ¶
Consumer reads and processes messages from a fake RabbitMQ server.
type DummySubmitter ¶
DummySubmitter is a StatsSubmitter that just logs submissions without sending them over the network.
func MakeDummySubmitter ¶
func MakeDummySubmitter() (*DummySubmitter, error)
MakeDummySubmitter creates a new submitter just logging to the default log target.
func (*DummySubmitter) Finish ¶
func (s *DummySubmitter) Finish()
Finish is a no-op in this implementation.
func (*DummySubmitter) Submit ¶
func (s *DummySubmitter) Submit(rawData []byte, key string, contentType string)
Submit logs the rawData payload.
func (*DummySubmitter) SubmitWithHeaders ¶
func (s *DummySubmitter) SubmitWithHeaders(rawData []byte, key string, contentType string, myHeaders map[string]string)
SubmitWithHeaders logs rawData payload, adding some extra key-value pairs to the header.
func (*DummySubmitter) UseCompression ¶
func (s *DummySubmitter) UseCompression()
UseCompression enables gzip compression of submitted payloads (not applicable in this implementation).
type HostNamer ¶ added in v1.0.6
HostNamer is a component that provides cached hostnames for IP addresses passed as strings.
func NewHostNamer ¶ added in v1.0.6
NewHostNamer returns a new HostNamer with the given default expiration time. Data entries will be purged after each cleanupInterval.
type PerformanceStatsEncoder ¶
type PerformanceStatsEncoder struct { sync.RWMutex Encoder *fluxline.Encoder Buffer bytes.Buffer Logger *log.Entry Tags map[string]string Submitter StatsSubmitter SubmitPeriod time.Duration LastSubmitted time.Time DummyMode bool }
PerformanceStatsEncoder is a component to collect, encode and submit data to an InfluxDb via RabbitMQ.
func MakePerformanceStatsEncoder ¶
func MakePerformanceStatsEncoder(statsSubmitter StatsSubmitter, submitPeriod time.Duration, dummyMode bool) *PerformanceStatsEncoder
MakePerformanceStatsEncoder creates a new stats encoder, submitting via the given StatsSubmitter, with at least submitPeriod time between submissions. if dummyMode is set, then the result will be printed to stdout instead of submitting.
func (*PerformanceStatsEncoder) Submit ¶
func (a *PerformanceStatsEncoder) Submit(val interface{})
Submit encodes the data annotated with 'influx' tags in the passed struct and sends it to the configured submitter.
type StatsSubmitter ¶
type StatsSubmitter interface { Submit(rawData []byte, key string, contentType string) SubmitWithHeaders(rawData []byte, key string, contentType string, myHeaders map[string]string) UseCompression() Finish() }
StatsSubmitter is an interface for an entity that sends JSON data to an endpoint