Commit graph

282 commits

Author SHA1 Message Date
Alexander A. Klimov
56933b8877 Perfdata writers: disconnect handlers from signals in Pause()
as they would be re-connected in Resume() (HA).

Before they were still connected during pause and connected X+1 times
after X split-brains (the same data was written X+1 times).
2022-04-06 13:09:26 +02:00
Yonas Habteab
a0607aceff Fix compiler warnings don't move local variables 2022-02-22 17:51:43 +01:00
Julian Brost
33781496da InfluxdbCommonWriter: use atomic_size_t to data buffer size from stats function
m_DataBuffer may be modified concurrently while StatsFunc() is called, thus
it's unsafe to call size() on it. As write access to m_DataBuffer is already
synchronized by only modifying it from the single work queue thread, instead of
adding a mutex, this commit adds a new std::atomic_size_t which is additionally
updated when modifying m_DataBuffer and can safely be accessed in StatsFunc().
2022-01-03 12:24:26 +01:00
Julian Brost
e6300aacf9 InfluxdbCommonWriter: only flush from work queue
There is no explicit synchronization of access to m_DataBuffer which is fine if
it is only accessed from the single-threaded work queue. However, Stop() also
called Flush() in another thread, leading to concurrent write access to
m_DataBuffer which can result in a crash due to use after free/double free.

Changes in this commit:
* Flush() is renamed to FlushWQ() to show that it should only be called from
  the work queue. Additionally, it now asserts that it is running on the work
  queue.
* Visibility of some data members is changed from protected to private. No
  other classes have to access these at the moment. By this change, accidental
  concurrent access from derived classes in the future is prevented.
* Stop() now flushes by posting FlushWQ() to the work queue and joining it.
2022-01-03 12:24:26 +01:00
Alexander Aleksandrovič Klimov
99c5c24a17
InfluxdbCommonWriter#Flush(): fix log message
s/InfluxdbWriter/Influxdb2Writer/

fixes #9035
2021-10-14 12:03:45 +02:00
Julian Brost
3ab347bfd4 GelfWriter: show error message of exceptions 2021-08-13 17:24:24 +02:00
Julian Brost
8f3f692ecf InfluxdbCommonWriter: actually verify TLS server certificates
And add a new option ssl_insecure_noverify to explicitly disable it if desired.
2021-08-13 17:24:24 +02:00
Julian Brost
29e9df938c GelfWriter: actually verify TLS server certificates
And add a new option insecure_noverify to explicitly disable it if desired.
2021-08-13 17:24:24 +02:00
Julian Brost
5cada85e54 ElasticsearchWriter: actually verify TLS server certificates
And add a new option insecure_noverify to explicitly disable it if desired.
2021-08-13 17:24:24 +02:00
Alexander A. Klimov
9d4b0f1268 Introduce Influxdb2Writer
refs #8711
2021-07-20 16:21:36 +02:00
Alexander A. Klimov
d26aa9fb34 InfluxdbCommonWriter: abstract InfluxdbWriter
refs #8711
2021-07-20 16:21:36 +02:00
Julian Brost
401d3cdc9e Remove passwords from API
IdoMysqlConnection, IdoPgsqlConnection, IcingaDB, and ElasticsearchWriter
require passwords in their configuration to authenticate against external
services. This commit ensures that these can no longer be accessed using the
API.
2021-07-05 15:09:54 +02:00
Alexander Aleksandrovič Klimov
ef8619f76b
Merge pull request #8601 from Icinga/feature/replace-std-boost-bind-with-lambdas-7006
Feature: Replace std/boost::bind() with lambdas
2021-03-18 17:56:13 +01:00
Yonas Habteab
43ba2da39c Replace std/boost::bind() function with lambda expression 2021-03-10 16:29:40 +01:00
Alexander A. Klimov
c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Julian Brost
339b37a985 Use content_length method for setting the Content-Length header
Boost.Beast changed the signature of the previously used generic `set`
method so that it no longer accepts integer types, however there is
alreay a more specific method for setting the Content-Length header, so
use this one instead.
2020-12-22 16:27:38 +01:00
Alexander Aleksandrovič Klimov
6f33c2f90c
Merge pull request #8314 from Icinga/feature/add-support-influxdb-basic-auth-7644
Add support Influxdb basic auth
2020-12-03 11:00:04 +01:00
Yonas Habteab
2ade57bcbb Add support influxdb basic auth
fixes #7644
2020-12-02 16:48:03 +01:00
Paul Denning
570a59a2f4 Fixed problem with opentsdb sending metrics
There is a double space between the value and the tags causing an error with missing tag when ingesting the data

refs #8244
2020-09-18 19:41:48 +10:00
Michael Friedrich
3533ddd010 Graphite/OpenTSDB: Ensure that Reconnect failure is detected
fixes #7729
2020-01-18 17:09:09 +01:00
Michael Friedrich
d242b41704 Revert "Make NotificationResult available for events: Cluster and Features"
This reverts commit 566e59bbfa.
2020-01-07 14:20:59 +01:00
Michael Friedrich
ee72791f25 Metrics: Always send '0' as value for thresholds
fixes #7666
2019-12-05 13:05:59 +01:00
Ant1x
166e79fee1 Added OpenTSDB Metric prefix naming support
Added OpenTSDB Generic Metric functionality
2019-10-24 00:04:12 +11:00
Ant1x
0b8fdfd7f2 Removed dictionary cloning behaviour.
Added configuration caching on instantiation.
2019-10-24 00:04:12 +11:00
Ant1x
c2c4b97ea5 Adjusted explicit String cast 2019-10-24 00:04:12 +11:00
Ant1x
619a487733 Added validation function comments 2019-10-24 00:04:12 +11:00
Ant1x
90c42e1bbc Re-worded debug log message 2019-10-24 00:04:12 +11:00
Ant1x
3cd6b66cd4 Initial commit, add custom tag functionality 2019-10-24 00:04:12 +11:00
Alexander A. Klimov
ba1ce9c853 Replace std::shared_ptr<boost::asio::ssl::context> with Shared<boost::asio::ssl::context>::Ptr 2019-10-21 16:12:46 +02:00
Alexander A. Klimov
26ce2cfb73 Replace std::shared_ptr<AsioTcpStream> with Shared<AsioTcpStream>::Ptr 2019-10-21 16:12:46 +02:00
Alexander A. Klimov
a1683568a1 Replace std::shared_ptr<AsioTlsStream> with Shared<AsioTlsStream>::Ptr 2019-10-21 16:12:35 +02:00
Michael Friedrich
5fa7331cc9 Quality: Replace deprecated Boost IO service code
https://github.com/boostorg/asio/issues/110
https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/example/cpp03/services/logger_service.hpp
2019-09-09 15:27:57 +02:00
Alexander A. Klimov
2acdbd81ff InfluxdbWriter: clone less 2019-07-24 10:43:45 +02:00
Alexander A. Klimov
d7b1127730 InfluxdbWriter: skip non-resolvable tags
refs #7341
2019-07-23 18:21:38 +02:00
Michael Friedrich
8098f4d54d Improve type logging for notifications 2019-07-16 13:46:16 +02:00
Michael Friedrich
99bb7fa99c
Merge pull request #7196 from Icinga/feature/network-cleanup
Cleanup old code (HTTP, Cluster)
2019-05-29 14:50:40 +02:00
Michael Friedrich
efd4e8ad40 Quality: Use Boost ASIO/IO engine in Graphite feature
This commit changes the reconnect priority to high.

Also add function docs.
2019-05-27 16:49:51 +02:00
Michael Friedrich
0466316019 Quality: Rewrite OpenTSDB to use Boost ASIO and I/O engine
The connection handling and code isn't really good, but not
really actively maintained either.

Besides that, the "telnet" method doesn't allow for TLS,
this needs a general rewrite against their HTTP API.

I've also added function documentation where applicable.
2019-05-27 15:09:26 +02:00
Michael Insel
a6a0631e99 Unify copyright headers
Update (left over) copyright headers to generic copyright headers.
2019-05-24 16:25:32 +02:00
Michael Friedrich
f933aafd29 Quality: Purge old HTTP code in lib/remote 2019-05-24 15:50:43 +02:00
Michael Friedrich
5d0af5c879
Merge pull request #6813 from Icinga/feature/gelfwriter-tls-support
Implement TLS support for the GelfWriter feature
2019-05-24 15:50:18 +02:00
Michael Insel
bb70613ed1 Fix wrong facility in GelfWriter log message
This fixes a wrong facility in GelfWriter log message (paused message).
2019-05-16 19:50:40 +02:00
Michael Insel
bc0ab93e44 Use new I/O engine in GelfWriter 2019-05-16 19:39:06 +02:00
Michael Insel
90bb423226 Implement TLS support for the GelfWriter
This implements TLS support for the GelfWriter.
2019-05-16 17:48:47 +02:00
Michael Friedrich
a630d0185f
Merge pull request #6722 from Icinga/feature/notification-result
Add notification result store/sync
2019-04-25 15:56:14 +02:00
Alexander A. Klimov
5a17722c1f Replace _unlink() + rename() with boost::filesystem::rename()
refs #7101
2019-04-25 09:53:02 +02:00
Alexander A. Klimov
3f0066e33b Use new I/O engine in ElasticsearchWriter 2019-04-23 14:33:19 +02:00
Alexander A. Klimov
14fdfff770 Use new I/O engine in InfluxdbWriter 2019-04-23 11:59:37 +02:00
Michael Friedrich
566e59bbfa Make NotificationResult available for events: Cluster and Features 2019-03-28 11:42:28 +01:00
Michael Friedrich
c2bf4cca9f Disable feature HA by default (InfluxDB, Graphite, Gelf, Elasticsearch, OpenTSDB, Perfdata) 2019-03-27 15:29:47 +01:00
Michael Friedrich
06eacd13ab Also apply buffer flush fix for Elasticsearch feature 2019-03-27 11:35:41 +01:00
Michael Friedrich
cb3729bc6a InfluxDB: Flush only if there's data in the buffer
Regression from 2.10.4
2019-03-27 11:26:00 +01:00
Michael Friedrich
27a41804fc Elasticsearch: Change Content-Type header to 'application/x-ndjson' for bulk streams
fixes #6609
2019-03-20 10:13:38 +01:00
Michael Friedrich
424929e66a Improve logging of OpenTsdbWriter 2019-03-19 09:39:14 +01:00
Michael Friedrich
acf62d487e Improve logging of GelfWriter 2019-03-19 09:39:14 +01:00
Michael Friedrich
783a4c832c Improve logging of ElasticsearchWriter 2019-03-19 09:39:14 +01:00
Michael Friedrich
aa93c382e1 Improve logging of InfluxdbWriter 2019-03-19 09:39:14 +01:00
Michael Friedrich
82dcb3965b Improve logging of GraphiteWriter 2019-03-19 09:39:09 +01:00
Michael Friedrich
816a935b3d Elasticsearch: Improve error handling/logging
- Missing content-type
- Wrong content-type shouldn't hide the error message
- Error message should include more details (request URL, etc.)
2019-03-18 16:41:01 +01:00
Alexander A. Klimov
b2e2b587da ElasticsearchWriter: don't leak sockets
refs #7018
2019-03-18 15:09:07 +01:00
Alexander A. Klimov
2a6b122413 InfluxdbWriter: don't leak sockets
refs #6989
2019-03-01 14:30:49 +01:00
Michael Friedrich
e2df11520e
Merge pull request #6970 from Icinga/bugfix/perfdata-gaps
Improve reload handling for features (metric & queue flush, activation priority)
2019-02-26 15:38:15 +01:00
Michael Friedrich
458f997a18 Replace Copyright header with a short version, part II 2019-02-25 15:09:36 +01:00
Michael Friedrich
d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
53acb8f2db PerfdataWriter: Reset the rotation timer on Pause() 2019-02-22 09:34:16 +01:00
Michael Friedrich
68e7027c93 GelfWriter: Ensure to join queue and execute queries on Pause/Shutdown/Reload 2019-02-20 17:18:24 +01:00
Michael Friedrich
24c3572b03 OpenTsdbWriter: Ensure to reset reconnect timer on Pause() 2019-02-20 17:17:45 +01:00
Michael Friedrich
301c48e9bc ElasticWriter: Ensure to flush buffers on Pause/Shutdown/Reload 2019-02-20 17:11:39 +01:00
Michael Friedrich
d4bdebc795 InfluxdbWriter: Ensure to flush buffers after emptying the metrics queue on Pause/Shutdown/Reload
Patch taken from @al2klimov but moved into Pause()
2019-02-20 16:30:13 +01:00
Michael Friedrich
d79390083d GraphiteWriter: Improve Pause/Shutdown/Reload handling for metrics 2019-02-20 14:54:23 +01:00
Michael Friedrich
388999a86f PerfdataWriter: Rotate and close files on Pause/Shutdown/Reload
Refactored the code into a local mutex and added
some more debug logging while at it.
2019-02-20 14:20:53 +01:00
Michael Friedrich
7b2b45b503 Revert "InfluxdbWriter#Stop(): flush buffer"
This reverts commit 8470facfe2.
2019-02-19 14:54:28 +01:00
Michael Friedrich
4edd3ece66 Revert "Deactivate perfdata writers after checker"
This reverts commit f0e12ff63c.
2019-02-19 14:06:15 +01:00
Michael Friedrich
845c72f656
Merge pull request #6882 from Icinga/bugfix/influxdb-gaps-6841
InfluxdbWriter#Stop(): flush buffer
2019-02-11 17:32:05 +01:00
Alexander A. Klimov
f0e12ff63c Deactivate perfdata writers after checker 2019-01-24 13:50:26 +01:00
Alexander A. Klimov
8470facfe2 InfluxdbWriter#Stop(): flush buffer
refs #6841
2019-01-08 18:15:32 +01:00
Michael Insel
b0cf92fd17 Fix deadlock in GraphiteWriter
This fixes a deadlock in the GraphiteWriter feature, which is visible
during the reload process. The reload thread waits for the
GraphiteWriter to finish, but the GraphiteWriter can't finish because
it's stuck in `SendMetric()` waiting for a lock which is hold by the
reload thread.
2018-11-12 20:12:40 +01:00
Michael Friedrich
028946a1cc Implement HA functionality for Perfdata feature 2018-10-24 14:42:52 +02:00
Michael Friedrich
97c1296e99 Implement HA functionality for OpenTsdb feature 2018-10-24 14:42:46 +02:00
Michael Friedrich
b905999f4b Implement HA functionality for Gelf feature 2018-10-24 13:50:10 +02:00
Michael Friedrich
5e241dc815 Implement HA functionality for InfluxDB feature 2018-10-24 13:44:56 +02:00
Michael Friedrich
37ccffc7e5 Implement HA functionality for Graphite feature 2018-10-24 13:44:52 +02:00
Michael Friedrich
59389f564c Implement HA functionality for Elasticsearch feature 2018-10-24 13:20:03 +02:00
Michael Friedrich
001ffda61c Revert code from icinga.com update 2018-10-24 12:34:23 +02:00
Michael Friedrich
dea5ec614e icinga.com: Update CMakeLists.txt 2018-10-18 09:35:18 +02:00
Michael Friedrich
44c3b83769 icinga.com: Update '*.ti' 2018-10-18 09:30:00 +02:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Noah Hilverling
3854ed683b Improve TLS handshake exception logging 2018-09-06 15:58:42 +02:00
Gunnar Beutner
e678fa1aa5 Refactor Application::*Const() 2018-08-13 15:27:05 +02:00
Markus Frosch
9fbc40615a Improve path handling in cmake and daemon 2018-08-07 14:10:26 +02:00
Michael Friedrich
9ea0650edc Fix connection error handling in Elasticsearch and InfluxDB features
Previously this would just throw the entire exception stack trace
which is not needed here.

fixes #6394
2018-06-21 15:41:40 +02:00
jre3brg
2fd94073ba Fixed opentsdb metric name with colon chars 2018-05-08 09:40:13 +02:00
Jean Flach
c54e042942 Add activation priorities for config object types
This patch ensures that specific configuration types
are pre-activated and post-activated. In general,
logging is first, then common configuration objects
like host/service, downtimes, etc.
In the end, all features are activated after to ensure
that notifications are only sent once downtimes are applied.
A similar thing happens for starting with checks too early.
The ApiListener feature runs first to allow cluster connections
at first glance.

fixes #6057
fixes #6231
2018-05-04 11:25:47 +02:00
Jean Flach
1e0f67d778 Fix ES 5 support 2018-04-17 09:17:20 +02:00
Jean Flach
fd5d4c5974 Move _type into url 2018-04-17 09:17:20 +02:00
Michael Friedrich
975ac47f8e Fix Elastic 6 support
fixes #5905
2018-04-17 09:17:20 +02:00
Michael Friedrich
d398eca581
Merge pull request #6196 from Icinga/fix/influxdb-escaping
Fix InfluxDB backslash escaping
2018-04-05 15:27:06 +02:00
Noah Hilverling
0e17632bc4 Fix InfluxDB backslash escaping
fixes #6182
2018-04-04 13:02:48 +02:00
Michael Friedrich
ecbbc2fcc5
Merge pull request #6194 from Icinga/feature/metric-unit-elastic-gelf
Elasticsearch/GELF: Add metric unit to performance data fields
2018-04-03 17:12:29 +02:00
Michael Friedrich
d384dee204
Merge pull request #6193 from Icinga/fix/gelfwriter-invalid-perfdata-crash
GelfWriter: Fix crash on invalid performance data metrics
2018-04-03 14:52:12 +02:00