Documentation ¶
Index ¶
- Variables
- func ActivePlugin(name string, b ActiveBuilder) map[string][]interface{}
- func MakePingAllIPFactory(f func(*net.IPAddr) []func() (common.MapStr, error)) func(*net.IPAddr) TaskRunner
- func MakePingAllIPPortFactory(ports []uint16, f func(*net.IPAddr, uint16) (common.MapStr, error)) func(*net.IPAddr) TaskRunner
- func MakePingIPFactory(f func(*net.IPAddr) (common.MapStr, error)) func(*net.IPAddr) TaskRunner
- func RegisterActive(name string, builder ActiveBuilder)
- type ActiveBuilder
- type Factory
- type HostJobSettings
- type IPSettings
- type Info
- type Job
- func MakeByHostJob(settings HostJobSettings, pingFactory func(ip *net.IPAddr) TaskRunner) (Job, error)
- func MakeByIPJob(settings JobSettings, ip net.IP, pingFactory func(ip *net.IPAddr) TaskRunner) (Job, error)
- func MakeJob(settings JobSettings, f func() (common.MapStr, []TaskRunner, error)) Job
- func MakeSimpleJob(settings JobSettings, f func() (common.MapStr, error)) Job
- type JobRunner
- type JobSettings
- type PingMode
- type Registrar
- type TaskRunner
- type Type
Constants ¶
This section is empty.
Variables ¶
var DefaultIPSettings = IPSettings{ IPv4: true, IPv6: true, Mode: PingAny, }
DefaultIPSettings provides an instance of default IPSettings to be copied when unpacking settings from a common.Config object.
var Registry = newRegistrar()
Functions ¶
func ActivePlugin ¶
func ActivePlugin(name string, b ActiveBuilder) map[string][]interface{}
func MakePingAllIPFactory ¶
func MakePingAllIPFactory( f func(*net.IPAddr) []func() (common.MapStr, error), ) func(*net.IPAddr) TaskRunner
MakePingAllIPFactory wraps a function for building a recursive Task Runner from function callbacks.
func MakePingAllIPPortFactory ¶
func MakePingAllIPPortFactory( ports []uint16, f func(*net.IPAddr, uint16) (common.MapStr, error), ) func(*net.IPAddr) TaskRunner
MakePingAllIPPortFactory builds a set of TaskRunner supporting a set of IP/port-pairs.
func MakePingIPFactory ¶
MakePingIPFactory creates a factory for building a Task from a new IP address.
func RegisterActive ¶
func RegisterActive(name string, builder ActiveBuilder)
Types ¶
type HostJobSettings ¶
type HostJobSettings struct { Name string Host string IP IPSettings Fields common.MapStr }
HostJobSettings configures a Job including Host lookups and global fields to be added to every event.
func MakeHostJobSettings ¶
func MakeHostJobSettings(name, host string, ip IPSettings) HostJobSettings
MakeHostJobSettings creates a new HostJobSettings structure without any global event fields.
func (*HostJobSettings) AddFields ¶
func (s *HostJobSettings) AddFields(m common.MapStr)
AddFields adds new event fields to a Job. Existing fields will be overwritten.
func (HostJobSettings) WithFields ¶
func (s HostJobSettings) WithFields(m common.MapStr) HostJobSettings
WithFields adds new event fields to a Job. Existing fields will be overwritten. The fields map will be updated (no copy).
type IPSettings ¶
type IPSettings struct { IPv4 bool `config:"ipv4"` IPv6 bool `config:"ipv6"` Mode PingMode `config:"mode"` }
IPSettings provides common configuration settings for IP resolution and ping mode.
func (IPSettings) Network ¶
func (s IPSettings) Network() string
Network determines the Network type used for IP name resolution, based on the provided settings.
type Job ¶
func MakeByHostJob ¶
func MakeByHostJob( settings HostJobSettings, pingFactory func(ip *net.IPAddr) TaskRunner, ) (Job, error)
MakeByHostJob creates a new Job including host lookup. The pingFactory will be used to build one or multiple Tasks after name lookup according to settings.
A pingFactory instance is normally build with MakePingIPFactory, MakePingAllIPFactory or MakePingAllIPPortFactory.
func MakeByIPJob ¶
func MakeByIPJob( settings JobSettings, ip net.IP, pingFactory func(ip *net.IPAddr) TaskRunner, ) (Job, error)
MakeByIPJob builds a new Job based on already known IP. Similar to MakeByHostJob, the pingFactory will be used to build the tasks run by the job.
A pingFactory instance is normally build with MakePingIPFactory, MakePingAllIPFactory or MakePingAllIPPortFactory.
func MakeJob ¶
func MakeJob(settings JobSettings, f func() (common.MapStr, []TaskRunner, error)) Job
MakeJob create a new Job from a callback function. The callback can optionally return an event to be published and a set of derived sub-tasks to be scheduled. The sub-tasks will be run only once and removed from the scheduler after completion.
func MakeSimpleJob ¶
func MakeSimpleJob(settings JobSettings, f func() (common.MapStr, error)) Job
MakeSimpleJob creates a new Job from a callback function. The callback should return an valid event and can not create any sub-tasks to be executed after completion.
type JobSettings ¶
JobSettings configures a Job name and global fields to be added to every event.
func MakeJobSetting ¶
func MakeJobSetting(name string) JobSettings
MakeJobSetting creates a new JobSettings structure without any global event fields.
func (*JobSettings) AddFields ¶
func (s *JobSettings) AddFields(m common.MapStr)
AddFields adds new event fields to a Job. Existing fields will be overwritten.
func (JobSettings) WithFields ¶
func (s JobSettings) WithFields(m common.MapStr) JobSettings
WithFields adds new event fields to a Job. Existing fields will be overwritten. The fields map will be updated (no copy).
type PingMode ¶
type PingMode uint8
PingMode enumeration for configuring `any` or `all` IPs pinging.
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
func (*Registrar) AddActive ¶
func (r *Registrar) AddActive(name string, builder ActiveBuilder) error
func (*Registrar) GetFactory ¶
type TaskRunner ¶
type TaskRunner interface {
Run() (common.MapStr, []TaskRunner, error)
}
func MakeCont ¶
func MakeCont(f func() (common.MapStr, []TaskRunner, error)) TaskRunner
MakeCont wraps a function into an executable TaskRunner. The task being generated can optionally return an event and/or sub-tasks.
func MakeSimpleCont ¶
func MakeSimpleCont(f func() (common.MapStr, error)) TaskRunner
MakeSimpleCont wraps a function into an executable TaskRunner. The task bein generated should return an event to be reported.
func WithDuration ¶
func WithDuration(field string, r TaskRunner) TaskRunner
WithDuration wraps a TaskRunner, measuring the duration between creation and finish of the actual task and sub-tasks.
func WithFields ¶
func WithFields(fields common.MapStr, r TaskRunner) TaskRunner
WithFields wraps a TaskRunner, updating all events returned with the set of fields configured.