diff --git a/README.md b/README.md index ee221773..a39c8004 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,6 @@ object ApiUser "icinga" { #### `password` Defaults to `icinga` -#### `retry_interval` -Instead of stopping on connection loss, Icingabeat will try to reconnect to the -API periodically. Defaults to `10s` - #### `skip_ssl_verify` Skip verification of SSL certificates. Defaults to `false` @@ -110,6 +106,10 @@ Example for the CheckResult type with the service matching the string pattern filter: 'match("mysql*", event.service)' ``` +#### `retry_interval` +Instead of stopping on connection loss, Icingabeat will try to reconnect to the +API periodically. Defaults to `10s` + ### Statuspoller These settings are specific to the statuspoller mode. diff --git a/_meta/beat.yml b/_meta/beat.yml index 1384b4dd..143e2e72 100644 --- a/_meta/beat.yml +++ b/_meta/beat.yml @@ -16,9 +16,6 @@ icingabeat: # Password of the user password: "icinga" - # Defines how fast to reconnect to the API after a connection loss - retry_interval: 10s - # Skip SSL verification skip_ssl_verify: false @@ -58,6 +55,9 @@ icingabeat: # To disable filtering set an empty string or comment out the filter option filter: "" + # Defines how fast to reconnect to the API on connection loss + retry_interval: 10s + statuspoller: # Interval at which the status API is called. Set to 0 to disable polling. interval: 60s diff --git a/beater/eventstream.go b/beater/eventstream.go index d64adcac..73428cd3 100644 --- a/beater/eventstream.go +++ b/beater/eventstream.go @@ -63,7 +63,7 @@ func (es *Eventstream) Run() error { for { - ticker := time.NewTicker(es.config.RetryInterval) + ticker := time.NewTicker(es.config.Eventstream.RetryInterval) response, responseErr := requestURL(es.icingabeat, "POST", URL) if responseErr == nil { diff --git a/beater/statuspoller.go b/beater/statuspoller.go index 0580e990..5ee75b69 100644 --- a/beater/statuspoller.go +++ b/beater/statuspoller.go @@ -2,7 +2,6 @@ package beater import ( "encoding/json" - "fmt" "io" "io/ioutil" "net/url" @@ -70,8 +69,6 @@ func (sp *Statuspoller) Run() error { case []interface{}: for _, status := range statustype { - fmt.Println(status) - statusevent := common.MapStr{ "@timestamp": common.Time(time.Now()), "type": "icingabeat.status", @@ -101,7 +98,7 @@ func (sp *Statuspoller) Run() error { return nil } -// Stop eventstream receiver +// Stop statuspoller func (sp *Statuspoller) Stop() { close(sp.done) } diff --git a/config/config.go b/config/config.go index 432bc7c0..8aba3bd9 100644 --- a/config/config.go +++ b/config/config.go @@ -11,7 +11,6 @@ type Config struct { Port int `config:"port"` User string `config:"user"` Password string `config:"password"` - RetryInterval time.Duration `config:"retry_interval"` SkipSSLVerify bool `config:"skip_ssl_verify"` Eventstream EventstreamConfig `config:"eventstream"` Statuspoller StatuspollerConfig `config:"statuspoller"` @@ -19,8 +18,9 @@ type Config struct { // EventstreamConfig optoins type EventstreamConfig struct { - Types []string `config:"types"` - Filter string `config:"filter"` + Types []string `config:"types"` + Filter string `config:"filter"` + RetryInterval time.Duration `config:"retry_interval"` } // StatuspollerConfig options @@ -30,7 +30,6 @@ type StatuspollerConfig struct { // DefaultConfig values var DefaultConfig = Config{ - RetryInterval: 1 * time.Second, - Host: "localhost", - Port: 5665, + Host: "localhost", + Port: 5665, } diff --git a/icingabeat.full.yml b/icingabeat.full.yml index b564ed87..a732f84a 100644 --- a/icingabeat.full.yml +++ b/icingabeat.full.yml @@ -16,9 +16,6 @@ icingabeat: # Password of the user password: "icinga" - # Defines how fast to reconnect to the API after a connection loss - retry_interval: 10s - # Skip SSL verification skip_ssl_verify: false @@ -58,6 +55,9 @@ icingabeat: # To disable filtering set an empty string or comment out the filter option filter: "" + # Defines how fast to reconnect to the API on connection loss + retry_interval: 10s + statuspoller: # Interval at which the status API is called. Set to 0 to disable polling. interval: 60s diff --git a/icingabeat.yml b/icingabeat.yml index 6e401c00..bf3b6561 100644 --- a/icingabeat.yml +++ b/icingabeat.yml @@ -16,9 +16,6 @@ icingabeat: # Password of the user password: "icinga" - # Defines how fast to reconnect to the API after a connection loss - retry_interval: 10s - # Skip SSL verification skip_ssl_verify: false @@ -58,6 +55,9 @@ icingabeat: # To disable filtering set an empty string or comment out the filter option filter: "" + # Defines how fast to reconnect to the API on connection loss + retry_interval: 10s + statuspoller: # Interval at which the status API is called. Set to 0 to disable polling. interval: 60s