mirror of
https://github.com/Icinga/icingabeat.git
synced 2025-04-08 17:15:05 +02:00
Update config format
This commit is contained in:
parent
18b5d87dc6
commit
ae66968b98
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,3 +6,5 @@
|
||||
/icingabeat.test
|
||||
*.pyc
|
||||
logs/
|
||||
|
||||
icingabeat.test.yml
|
||||
|
@ -19,19 +19,26 @@ icingabeat:
|
||||
# Defines how fast to reconnect to the API after a connection loss
|
||||
retry_interval: 10s
|
||||
|
||||
# Decide which events to receive from the event stream.
|
||||
# The following event stream types are available, at least one must be set:
|
||||
# * CheckResult
|
||||
# * StateChange
|
||||
# * Notification
|
||||
# * AcknowledgementSet
|
||||
# * AcknowledgementCleared
|
||||
# * CommentAdded
|
||||
# * CommentRemoved
|
||||
# * DowntimeAdded
|
||||
# * DowntimeRemoved
|
||||
# * DowntimeStarted
|
||||
# * DowntimeTriggered
|
||||
event_types:
|
||||
- CheckResult
|
||||
- StateChange
|
||||
# Icingabeat supports capturing of an evenstream and periodical polling of the
|
||||
# Icinga status data.
|
||||
#
|
||||
# To disable the eventstream, comment out the whole section
|
||||
eventstream:
|
||||
# Decide which events to receive from the event stream.
|
||||
# The following event stream types are available:
|
||||
# * CheckResult
|
||||
# * StateChange
|
||||
# * Notification
|
||||
# * AcknowledgementSet
|
||||
# * AcknowledgementCleared
|
||||
# * CommentAdded
|
||||
# * CommentRemoved
|
||||
# * DowntimeAdded
|
||||
# * DowntimeRemoved
|
||||
# * DowntimeStarted
|
||||
# * DowntimeTriggered
|
||||
#
|
||||
# At least one type must be set
|
||||
types:
|
||||
- CheckResult
|
||||
- StateChange
|
||||
|
@ -36,8 +36,8 @@ func NewEventstream(bt *Icingabeat, cfg config.Config) *Eventstream {
|
||||
|
||||
// Run evenstream receiver
|
||||
func (es *Eventstream) Run() error {
|
||||
types := strings.Join(es.icingabeat.config.EventTypes, "&types=")
|
||||
|
||||
types := strings.Join(es.config.Eventstream.Types, "&types=")
|
||||
logp.Info(types)
|
||||
for {
|
||||
|
||||
ticker := time.NewTicker(es.config.RetryInterval)
|
||||
|
@ -18,7 +18,11 @@ func requestURL(bt *Icingabeat, method, path string) (*http.Response, error) {
|
||||
Transport: transport,
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("https://%s:%v%s", bt.config.Host, bt.config.Port, path)
|
||||
url := fmt.Sprintf(
|
||||
"https://%s:%v%s",
|
||||
bt.config.Host,
|
||||
bt.config.Port,
|
||||
path)
|
||||
request, err := http.NewRequest(method, url, nil)
|
||||
|
||||
if err != nil {
|
||||
|
@ -40,6 +40,7 @@ func (bt *Icingabeat) Run(b *beat.Beat) error {
|
||||
bt.client = b.Publisher.Connect()
|
||||
|
||||
eventstream = NewEventstream(bt, bt.config)
|
||||
logp.Info("hostname: %v", bt.config.Host)
|
||||
go eventstream.Run()
|
||||
|
||||
for {
|
||||
|
@ -7,12 +7,17 @@ import "time"
|
||||
|
||||
// Config options
|
||||
type Config struct {
|
||||
Host string `config:"host"`
|
||||
Port int `config:"port"`
|
||||
User string `config:"user"`
|
||||
Password string `config:"password"`
|
||||
RetryInterval time.Duration `config:"retry_interval"`
|
||||
EventTypes []string `config:"event_types"`
|
||||
Host string `config:"host"`
|
||||
Port int `config:"port"`
|
||||
User string `config:"user"`
|
||||
Password string `config:"password"`
|
||||
RetryInterval time.Duration `config:"retry_interval"`
|
||||
Eventstream EventstreamConfig `config:"eventstream"`
|
||||
}
|
||||
|
||||
// EventstreamConfig optoins
|
||||
type EventstreamConfig struct {
|
||||
Types []string `config:"types"`
|
||||
}
|
||||
|
||||
// DefaultConfig values
|
||||
|
@ -19,22 +19,29 @@ icingabeat:
|
||||
# Defines how fast to reconnect to the API after a connection loss
|
||||
retry_interval: 10s
|
||||
|
||||
# Decide which events to receive from the event stream.
|
||||
# The following event stream types are available, at least one must be set:
|
||||
# * CheckResult
|
||||
# * StateChange
|
||||
# * Notification
|
||||
# * AcknowledgementSet
|
||||
# * AcknowledgementCleared
|
||||
# * CommentAdded
|
||||
# * CommentRemoved
|
||||
# * DowntimeAdded
|
||||
# * DowntimeRemoved
|
||||
# * DowntimeStarted
|
||||
# * DowntimeTriggered
|
||||
event_types:
|
||||
- CheckResult
|
||||
- StateChange
|
||||
# Icingabeat supports capturing of an evenstream and periodical polling of the
|
||||
# Icinga status data.
|
||||
#
|
||||
# To disable the eventstream, comment out the whole section
|
||||
eventstream:
|
||||
# Decide which events to receive from the event stream.
|
||||
# The following event stream types are available:
|
||||
# * CheckResult
|
||||
# * StateChange
|
||||
# * Notification
|
||||
# * AcknowledgementSet
|
||||
# * AcknowledgementCleared
|
||||
# * CommentAdded
|
||||
# * CommentRemoved
|
||||
# * DowntimeAdded
|
||||
# * DowntimeRemoved
|
||||
# * DowntimeStarted
|
||||
# * DowntimeTriggered
|
||||
#
|
||||
# At least one type must be set
|
||||
types:
|
||||
- CheckResult
|
||||
- StateChange
|
||||
|
||||
#================================ General ======================================
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
icingabeat:
|
||||
|
||||
# Defines the Icina API endpoint
|
||||
host: "demo"
|
||||
host: "localhost"
|
||||
|
||||
# Defines the port of the API endpoint
|
||||
port: 5665
|
||||
|
||||
# A user with sufficient permissions
|
||||
user: "rooto"
|
||||
user: "icinga"
|
||||
|
||||
# Password of the user
|
||||
password: "icinga"
|
||||
@ -19,22 +19,29 @@ icingabeat:
|
||||
# Defines how fast to reconnect to the API after a connection loss
|
||||
retry_interval: 10s
|
||||
|
||||
# Decide which events to receive from the event stream.
|
||||
# The following event stream types are available, at least one must be set:
|
||||
# * CheckResult
|
||||
# * StateChange
|
||||
# * Notification
|
||||
# * AcknowledgementSet
|
||||
# * AcknowledgementCleared
|
||||
# * CommentAdded
|
||||
# * CommentRemoved
|
||||
# * DowntimeAdded
|
||||
# * DowntimeRemoved
|
||||
# * DowntimeStarted
|
||||
# * DowntimeTriggered
|
||||
event_types:
|
||||
- CheckResult
|
||||
- StateChange
|
||||
# Icingabeat supports capturing of an evenstream and periodical polling of the
|
||||
# Icinga status data.
|
||||
#
|
||||
# To disable the eventstream, comment out the whole section
|
||||
eventstream:
|
||||
# Decide which events to receive from the event stream.
|
||||
# The following event stream types are available:
|
||||
# * CheckResult
|
||||
# * StateChange
|
||||
# * Notification
|
||||
# * AcknowledgementSet
|
||||
# * AcknowledgementCleared
|
||||
# * CommentAdded
|
||||
# * CommentRemoved
|
||||
# * DowntimeAdded
|
||||
# * DowntimeRemoved
|
||||
# * DowntimeStarted
|
||||
# * DowntimeTriggered
|
||||
#
|
||||
# At least one type must be set
|
||||
types:
|
||||
- CheckResult
|
||||
- StateChange
|
||||
|
||||
#================================ General =====================================
|
||||
|
||||
@ -59,7 +66,7 @@ icingabeat:
|
||||
#-------------------------- Elasticsearch output ------------------------------
|
||||
output.elasticsearch:
|
||||
# Array of hosts to connect to.
|
||||
hosts: ["demo:9200"]
|
||||
hosts: ["localhost:9200"]
|
||||
|
||||
# Optional protocol and basic auth credentials.
|
||||
#protocol: "https"
|
||||
|
Loading…
x
Reference in New Issue
Block a user