Move retry_interval setting to evenstream namespace

This commit is contained in:
Blerim Sheqa 2017-01-18 16:54:49 +01:00
parent 92fe7baaa2
commit 02d6e58153
7 changed files with 20 additions and 24 deletions

View File

@ -67,10 +67,6 @@ object ApiUser "icinga" {
#### `password` #### `password`
Defaults to `icinga` 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_ssl_verify`
Skip verification of SSL certificates. Defaults to `false` 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)' 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 ### Statuspoller
These settings are specific to the statuspoller mode. These settings are specific to the statuspoller mode.

View File

@ -16,9 +16,6 @@ icingabeat:
# Password of the user # Password of the user
password: "icinga" password: "icinga"
# Defines how fast to reconnect to the API after a connection loss
retry_interval: 10s
# Skip SSL verification # Skip SSL verification
skip_ssl_verify: false skip_ssl_verify: false
@ -58,6 +55,9 @@ icingabeat:
# To disable filtering set an empty string or comment out the filter option # To disable filtering set an empty string or comment out the filter option
filter: "" filter: ""
# Defines how fast to reconnect to the API on connection loss
retry_interval: 10s
statuspoller: statuspoller:
# Interval at which the status API is called. Set to 0 to disable polling. # Interval at which the status API is called. Set to 0 to disable polling.
interval: 60s interval: 60s

View File

@ -63,7 +63,7 @@ func (es *Eventstream) Run() error {
for { for {
ticker := time.NewTicker(es.config.RetryInterval) ticker := time.NewTicker(es.config.Eventstream.RetryInterval)
response, responseErr := requestURL(es.icingabeat, "POST", URL) response, responseErr := requestURL(es.icingabeat, "POST", URL)
if responseErr == nil { if responseErr == nil {

View File

@ -2,7 +2,6 @@ package beater
import ( import (
"encoding/json" "encoding/json"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"net/url" "net/url"
@ -70,8 +69,6 @@ func (sp *Statuspoller) Run() error {
case []interface{}: case []interface{}:
for _, status := range statustype { for _, status := range statustype {
fmt.Println(status)
statusevent := common.MapStr{ statusevent := common.MapStr{
"@timestamp": common.Time(time.Now()), "@timestamp": common.Time(time.Now()),
"type": "icingabeat.status", "type": "icingabeat.status",
@ -101,7 +98,7 @@ func (sp *Statuspoller) Run() error {
return nil return nil
} }
// Stop eventstream receiver // Stop statuspoller
func (sp *Statuspoller) Stop() { func (sp *Statuspoller) Stop() {
close(sp.done) close(sp.done)
} }

View File

@ -11,7 +11,6 @@ type Config struct {
Port int `config:"port"` Port int `config:"port"`
User string `config:"user"` User string `config:"user"`
Password string `config:"password"` Password string `config:"password"`
RetryInterval time.Duration `config:"retry_interval"`
SkipSSLVerify bool `config:"skip_ssl_verify"` SkipSSLVerify bool `config:"skip_ssl_verify"`
Eventstream EventstreamConfig `config:"eventstream"` Eventstream EventstreamConfig `config:"eventstream"`
Statuspoller StatuspollerConfig `config:"statuspoller"` Statuspoller StatuspollerConfig `config:"statuspoller"`
@ -19,8 +18,9 @@ type Config struct {
// EventstreamConfig optoins // EventstreamConfig optoins
type EventstreamConfig struct { type EventstreamConfig struct {
Types []string `config:"types"` Types []string `config:"types"`
Filter string `config:"filter"` Filter string `config:"filter"`
RetryInterval time.Duration `config:"retry_interval"`
} }
// StatuspollerConfig options // StatuspollerConfig options
@ -30,7 +30,6 @@ type StatuspollerConfig struct {
// DefaultConfig values // DefaultConfig values
var DefaultConfig = Config{ var DefaultConfig = Config{
RetryInterval: 1 * time.Second, Host: "localhost",
Host: "localhost", Port: 5665,
Port: 5665,
} }

View File

@ -16,9 +16,6 @@ icingabeat:
# Password of the user # Password of the user
password: "icinga" password: "icinga"
# Defines how fast to reconnect to the API after a connection loss
retry_interval: 10s
# Skip SSL verification # Skip SSL verification
skip_ssl_verify: false skip_ssl_verify: false
@ -58,6 +55,9 @@ icingabeat:
# To disable filtering set an empty string or comment out the filter option # To disable filtering set an empty string or comment out the filter option
filter: "" filter: ""
# Defines how fast to reconnect to the API on connection loss
retry_interval: 10s
statuspoller: statuspoller:
# Interval at which the status API is called. Set to 0 to disable polling. # Interval at which the status API is called. Set to 0 to disable polling.
interval: 60s interval: 60s

View File

@ -16,9 +16,6 @@ icingabeat:
# Password of the user # Password of the user
password: "icinga" password: "icinga"
# Defines how fast to reconnect to the API after a connection loss
retry_interval: 10s
# Skip SSL verification # Skip SSL verification
skip_ssl_verify: false skip_ssl_verify: false
@ -58,6 +55,9 @@ icingabeat:
# To disable filtering set an empty string or comment out the filter option # To disable filtering set an empty string or comment out the filter option
filter: "" filter: ""
# Defines how fast to reconnect to the API on connection loss
retry_interval: 10s
statuspoller: statuspoller:
# Interval at which the status API is called. Set to 0 to disable polling. # Interval at which the status API is called. Set to 0 to disable polling.
interval: 60s interval: 60s