Documentation ¶
Index ¶
- func StartForwarders(wg *sync.WaitGroup, c []Config, messageChan <-chan *snmp.Message)
- type Base
- type Cmd
- type Config
- type File
- type FileConfig
- type Forwarder
- func NewFile(c Config, idx int) Forwarder
- func NewHTTP(c Config, idx int) Forwarder
- func NewKafka(c Config, idx int) Forwarder
- func NewMQTT(c Config, idx int) Forwarder
- func NewMock(c Config, idx int) Forwarder
- func NewSNMPTrap(c Config, idx int) Forwarder
- func NewZabbixTrapper(c Config, idx int) Forwarder
- type HTTP
- type HTTPBasicAuth
- type HTTPConfig
- type HTTPMethod
- type Kafka
- type KafkaConfig
- type KafkaSasl
- type KafkaSaslMechanism
- type LookupResult
- type LookupStrategy
- type MQTT
- type MQTTConfig
- type Mock
- type MockConfig
- type ProxyConf
- type QueryResult
- type SNMPTrap
- type SNMPTrapConfig
- type Tls
- type TlsConfig
- type ZSAdvancedConfig
- type ZabbixLookup
- type ZabbixTrapper
- type ZabbixTrapperConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Base ¶
type Base struct { CompilerConf snmp.MessageCompiler // contains filtered or unexported fields }
func (*Base) ReceiveChannel ¶ added in v0.6.0
type Config ¶
type Config struct { // ID identifies forwarder name, also used for prometheus labelling ID string // QueueSize defines the size of queue of each forwarder, when queue is full (might be caused // by slow forwarder) the message is dropped QueueSize int `mapstructure:"queue_size"` // TimeFormat specifies golang time format for casting time related fields to string TimeFormat string `mapstructure:"time_format"` // TimeAsTimezone will cast any time field to specified timezone TimeAsTimezone string `mapstructure:"time_as_timezone"` ShutdownWaitTime helper.Duration `mapstructure:"shutdown_wait_time"` // Filter, JSONFormat utilizes antonmedv/expr expressions Filter string JSONFormat string `mapstructure:"json_format"` AutoRetry helper.AutoRetry `mapstructure:"auto_retry"` Mock *MockConfig File *FileConfig Kafka *KafkaConfig MQTT *MQTTConfig Trap *SNMPTrapConfig HTTP *HTTPConfig ZabbixTrapper *ZabbixTrapperConfig `mapstructure:"zabbix_trapper"` }
type FileConfig ¶
type FileConfig struct { // Path for json log. Make sure the user has sufficient permission to write Path string }
type Forwarder ¶
type Forwarder interface { // Send will send the trap message to its corresponding forwarder. // Does nothing if the queue buffer is full or forwarder is already closed Send(*snmp.Message) // ReceiveChannel is used inside the forwarder to receive data // from SendChannel ReceiveChannel() <-chan *snmp.Message // Close informs the forwarder to stop processing any new messages Close() // Done informs the caller if forwarder is done processing Done() <-chan struct{} // Config returns the forwarder config Config() Config }
func NewSNMPTrap ¶
func NewZabbixTrapper ¶
type HTTPBasicAuth ¶ added in v0.5.0
type HTTPConfig ¶ added in v0.5.0
type HTTPConfig struct { URL string `mapstructure:"url"` Method HTTPMethod Headers map[string][]string BasicAuth *HTTPBasicAuth `mapstructure:"basic_auth"` Tls *Tls Proxy string Timeout helper.Duration }
type HTTPMethod ¶ added in v0.5.0
type HTTPMethod int
const ( HTTPMethodPost HTTPMethod = iota HTTPMethodGet HTTPMethodPut )
func (*HTTPMethod) String ¶ added in v0.5.0
func (h *HTTPMethod) String() string
func (*HTTPMethod) UnmarshalText ¶ added in v0.5.0
func (h *HTTPMethod) UnmarshalText(text []byte) error
type KafkaConfig ¶
type KafkaSasl ¶ added in v0.4.8
type KafkaSasl struct { Username string Password string Mechanism KafkaSaslMechanism }
type KafkaSaslMechanism ¶ added in v0.4.8
type KafkaSaslMechanism int
const ( KafkaSaslPlain KafkaSaslMechanism = iota KafkaSaslSha256 KafkaSaslSha512 )
func (*KafkaSaslMechanism) String ¶ added in v0.4.8
func (k *KafkaSaslMechanism) String() string
func (*KafkaSaslMechanism) UnmarshalText ¶ added in v0.4.8
func (k *KafkaSaslMechanism) UnmarshalText(text []byte) error
type LookupResult ¶
type LookupStrategy ¶
type LookupStrategy int8
const ( // LookupFromAgentAddress will use the agent address as hostname, or search for interface // ip/dns if db_url config is specified LookupFromAgentAddress LookupStrategy = iota // LookupFromSourceAddress will use the source address as hostname, or search for interface // ip/dns if db_url config is specified LookupFromSourceAddress // LookupFromOID will use the value of a given OID as the hostname. If db_url config is specified, // this will check for host existence before sending, and send it using default_hostname if it's not found LookupFromOID )
func (*LookupStrategy) String ¶
func (l *LookupStrategy) String() string
func (*LookupStrategy) UnmarshalText ¶
func (l *LookupStrategy) UnmarshalText(text []byte) error
type MQTTConfig ¶
type MockConfig ¶ added in v0.2.0
type ProxyConf ¶
ProxyConf is the list of available proxies in a zabbix system. In case of HA zabbix server, you need to include it here with its HANodeName
type QueryResult ¶
type QueryResult struct { IPOrDNS string `db:"ip_or_dns"` Hostname string `db:"hostname"` ProxyHostname sql.NullString `db:"proxy_hostname"` }
type SNMPTrapConfig ¶
type TlsConfig ¶
type TlsConfig struct {
InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
}
type ZSAdvancedConfig ¶
type ZSAdvancedConfig struct { Proxies []ProxyConf // for example: // - postgres://user:pass@127.0.0.1:5432/dbname?param1=value1¶m2=value2 // - mysql://user:pass@127.0.0.1:3306/dbname?param1=value1¶m2=value2 DBUrl string `mapstructure:"db_url"` DBRefreshInterval helper.Duration `mapstructure:"db_refresh_interval"` DBQueryTimeout helper.Duration `mapstructure:"db_query_timeout"` // contains filtered or unexported fields }
type ZabbixLookup ¶
type ZabbixLookup struct {
// contains filtered or unexported fields
}
func NewZabbixLookup ¶
func NewZabbixLookup( c *ZabbixTrapperConfig, logger zerolog.Logger, ctx context.Context, ) *ZabbixLookup
func (*ZabbixLookup) Lookup ¶
func (z *ZabbixLookup) Lookup(m *snmp.Message, strategy LookupStrategy) (LookupResult, error)
func (*ZabbixLookup) Refresh ¶
func (z *ZabbixLookup) Refresh()
type ZabbixTrapper ¶
type ZabbixTrapper struct { Base // contains filtered or unexported fields }
func (*ZabbixTrapper) Run ¶
func (z *ZabbixTrapper) Run()
type ZabbixTrapperConfig ¶
type ZabbixTrapperConfig struct { // default_* is used whenever host lookup fails: // - no advanced config defined // - proxy is defined in zabbix, but not defined in configuration // - can't find monitored hostname // - lookup strategy fails // DefaultAddress and DefaultPort are also used in case the host // is monitored directly with zabbix server and zabbix server // is not configured as HA DefaultAddress string `mapstructure:"default_address"` DefaultPort int `mapstructure:"default_port"` DefaultHostname string `mapstructure:"default_hostname"` ItemKey string `mapstructure:"item_key"` HostnameLookupStrategy LookupStrategy `mapstructure:"hostname_lookup_strategy"` OIDLookup string `mapstructure:"oid_lookup"` // Advanced config is for systems with proxies setup Advanced *ZSAdvancedConfig }
Click to show internal directories.
Click to hide internal directories.