So we can run unit tests that expect a certain behavior based on time.
When Icinga 2 is compiled with I2_DEBUG one can use Utility::SetTime to
override the current system time, and lock it to this value.
fixes#11875
Adds a new configuration variable in keeping with the graphite writer
which defaults to false to save network bandwidth. All metrics currently
supported by graphite are now available to InfluxDB. I added in some
formatting functions, to handle integers and booleans as we know and
control their types, and the supporting regexes in the sanity checker.
Updating to InfluxDB 0.13.X started giving 400 errors due to the missing
Host header in HTTP/1.1 requests. HttpRequest has been updated to auto-
magically add the host and port to these requests if not explicitly
stated by the client code.
The exception code has been cleaned up to break out of the function
early if such a condition is raised, this avoids unnecessarily executing
code which will ultimately fail.
fixes#11912
Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
Fixes a couple issues to do with line formatting of influx DB data points. All
keys and values need commas and white space escaping. Values are also checked
for type. If a numeric or scientific value is detected this is output as an
Influx floating point/scientific number. Booleans are detected and output in
a canonical format. All other values are strings, which have double quotes
escaped and the entire string is wrapped in double quotes. The handling of
thresholds has changed before this becomes officially released. These values
if available are passed to the accumulation function in a dictionary, said
dictionary builds a single data point with multiple fields, rather than the
existing 5 data points, thus saving bandwidth costs.
fixes#11904
Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
This feature allows to exclude and include specific time period
objects and their time ranges from an existing time period object.
This comes in handy when e.g. excluding holidays.
fixes#7355
Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
Adds an Icinga2 object to directly interface with InfluxDB's native HTTP API.
This supports optional basic authorization, and TLS transport. InfluxDB didn't
appear to like having the TLS stream kept open, so instead this object buffers
data points which are then flushed to InfluxDB as a batch write, either driven
by a configurable timeout or threshold.
As InfluxDB is a schema-less database the host and service templates are user
configurable allowing both the measurement field and tags to be set by the
end user via macro expansion. This allows access to tag fields from arbitrary
data associated with host.vars or service.vars. If a particular value is
unable to be resolved, the tag will be dropped and not transmitted to InfluxDB.
Also alters URL handling to omit array brackets when only a single value is
attached to a key, otherwise InfluxDB has a strop with non-standard syntax.
fixes#10480
Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
We cannot add the notification insert id directly
to the following contactnotifications queries. Instead
we need to pass a DbValue reference which gets set after
the notification insert id is calculated.
The contactnotifications insert queries are fired as query
group calling CanExecuteQuery() and FieldToEscapedString().
If the notification id does not exist yet, the queries are
moved to the end of the queue.
Once the contactnotifications queries are fired the DbValue
reference is destroyed.
This patch also removes the old notification insert id cache
which was broken in many ways.
fixes#11387
This has been changed when moving comments/downtimes to config objects
in 050c520b2a
It may cause trouble with DB IDO DELETE and UPDATE statements
depending on the old value.
refs #11382
This patch also moves the next check updates for passive
check results into ProcessCheckResult(). That way the
next check status updates for DB IDO work in a sane way
again.
refs #11336
Only valid for active check results. The API actions were
missing that marker similar to the external command processor.
The initial OK -> NOT-OK transition should use the retry_interval
but nothing else.
fixes#11336
The RegisterCommand call for DEL_DOWNTIME_BY_HOST_NAME was missing the
max args parameter. This prevented the optional service name, start time
and comment arguments to be passed.
Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
fixes#11240
This reverts commit a51e647cc7.
This patch causes trouble with check results received
1) passively 2) throughout the cluster. A proper patch
for setting the retry_interval on NOT-OK state changes
is required.
refs #11248
refs #11257
refs #11273
(the old issue)
refs #7287