-
Notifications
You must be signed in to change notification settings - Fork 598
Create a new ElasticsearchDatastreamWriter to more efficiently store data in elasticsearch. #10577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
w1ll-i-code
wants to merge
14
commits into
Icinga:master
Choose a base branch
from
WuerthPhoenix:wp_elasticsearchdatastreamwriter
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c773e10
Create base structure for datastreamwriter
w1ll-i-code cb7656a
Restructure the document for elasticsearch.
w1ll-i-code 84f6214
Improve handling of the elasticsearch connection
w1ll-i-code 03134c9
Allow for user defined tags and labels.
w1ll-i-code b77b322
Add filter option to the config.
w1ll-i-code 3145d81
Add elastic authentication via ApiKey
w1ll-i-code 363a6e9
Allow icinga2 to manage the index template
w1ll-i-code 99bd122
Add a feature config for the datastream writer
w1ll-i-code b932d00
Update documentation and syntax highlighting
w1ll-i-code da47e62
Drop documents on shutdown when connection fails
w1ll-i-code 6e88164
Allow templates in the datastream namespace.
w1ll-i-code 3b3af02
Remove the build flag for the ElasticsearchDatastreamWriter
w1ll-i-code 431c014
Cleanup code after the first round of comments.
w1ll-i-code d39b63b
chore: Address comments from second review round
w1ll-i-code File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
etc/icinga2/features-available/elasticsearchdatastream.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| * The ElasticsearchDatastreamWriter feature writes Icinga 2 events to an Elasticsearch datastream. | ||
| * This feature requires Elasticsearch 8.12 or later. | ||
| */ | ||
|
|
||
| object ElasticsearchDatastreamWriter "elasticsearch" { | ||
| host = "127.0.0.1" | ||
| port = 9200 | ||
|
|
||
| /* To enable a https connection, set enable_tls to true. */ | ||
| // enable_tls = false | ||
|
|
||
| /* The datastream namespace to use. This can be used to separate different | ||
| * Icinga instances or let multiple Writers write to different | ||
| * datastreams in the same Elasticsearch cluster by using the filter option. | ||
| * The Elasticsearch datastream name will be | ||
| * "metrics-icinga2.{check}-{datastream_namespace}". | ||
| */ | ||
| // datastream_namespace = "default" | ||
|
|
||
| /* You can authorize icinga2 through three different methods. | ||
| * 1. Basic authentication with username and password. | ||
| * 2. Bearer token authentication with api_token. | ||
| * 3. Client certificate authentication with cert_path and key_path. | ||
| */ | ||
| // username = "icinga2" | ||
| // password = "changeme" | ||
|
|
||
| // api_token = "" | ||
|
|
||
| // cert_path = "/path/to/cert.pem" | ||
| // key_path = "/path/to/key.pem" | ||
| // ca_path = "/path/to/ca.pem" | ||
|
|
||
| /* Enable sending the threshold values as additional fields | ||
| * with the service check metrics. If set to true, it will | ||
| * send warn and crit for every performance data item. | ||
| */ | ||
| // enable_send_thresholds = false | ||
|
|
||
| /* The flush settings control how often data is sent to Elasticsearch. | ||
| * You can either flush based on a time interval or the number of | ||
| * events in the buffer. Whichever comes first will trigger a flush. | ||
| */ | ||
| // flush_threshold = 1024 | ||
| // flush_interval = 10s | ||
|
|
||
| /* By default, all endpoints in a zone will activate the feature and start | ||
| * writing events to the Elasticsearch HTTP API. In HA enabled scenarios, | ||
| * it is possible to set `enable_ha = true` in all feature configuration | ||
| * files. This allows each endpoint to calculate the feature authority, | ||
| * and only one endpoint actively writes events, the other endpoints | ||
| * pause the feature. | ||
| */ | ||
| // enable_ha = false | ||
|
|
||
| /* By default, the feature will create an index template in Elasticsearch | ||
| * for the datastreams. If you want to manage the index template yourself, | ||
| * set manage_index_template to false. | ||
| */ | ||
| // manage_index_template = true | ||
|
|
||
| /* Additional tags and labels can be added to the host and service | ||
| * documents by using the host_tags_template, service_tags_template, | ||
| * host_labels_template and service_labels_template options. | ||
| * The tags and labels are static and will be added to every document. | ||
| */ | ||
| // host_tags_template = [ "icinga", "$host.vars.os$" ] | ||
| // service_tags_template = [ "icinga", "$service.vars.id$" ] | ||
| // host_labels_template = { "env" = "production", "os" = "$host.vars.os$" } | ||
| // service_labels_template = { "env" = "production", "id" = "$host.vars.id$" } | ||
|
|
||
| /* The filter option can be used to filter which events are sent to | ||
| * Elasticsearch. The filter is a regular Icinga 2 filter expression. | ||
| * The filter is applied to both host and service events. | ||
| * If the filter evaluates to true, the event is sent to Elasticsearch. | ||
| * If the filter is not set, all events are sent to Elasticsearch. | ||
| * You can use any attribute of the host, service, checkable or | ||
| * checkresult (cr) objects in the filter expression. | ||
| */ | ||
| // filter = {{ host.name == "myhost" || service.name == "myservice" }} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalization doesn't seem to work or maybe I'm doing something wrong? I just tested with commit
b732f4723.I still see:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested
309088156, looks good now: