mirror of https://github.com/Icinga/icinga2.git
parent
338d0aaa8c
commit
2ade57bcbb
|
@ -1607,6 +1607,13 @@ object InfluxdbWriter "influxdb" {
|
|||
host = "127.0.0.1"
|
||||
port = 8086
|
||||
database = "icinga2"
|
||||
username = "icinga2"
|
||||
password = "icinga2"
|
||||
|
||||
basic_auth = {
|
||||
username = "icinga"
|
||||
password = "icinga"
|
||||
}
|
||||
|
||||
flush_threshold = 1024
|
||||
flush_interval = 10s
|
||||
|
@ -1636,6 +1643,7 @@ Configuration Attributes:
|
|||
database | String | **Required.** InfluxDB database name. Defaults to `icinga2`.
|
||||
username | String | **Optional.** InfluxDB user name. Defaults to `none`.
|
||||
password | String | **Optional.** InfluxDB user password. Defaults to `none`.
|
||||
basic\_auth | Dictionary | **Optional.** Username and password for HTTP basic authentication.
|
||||
ssl\_enable | Boolean | **Optional.** Whether to use a TLS stream. Defaults to `false`.
|
||||
ssl\_ca\_cert | String | **Optional.** Path to CA certificate to validate the remote host.
|
||||
ssl\_cert | String | **Optional.** Path to host certificate to present to the remote host for mutual verification.
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "base/perfdatavalue.hpp"
|
||||
#include "base/stream.hpp"
|
||||
#include "base/json.hpp"
|
||||
#include "base/base64.hpp"
|
||||
#include "base/networkstream.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/statsfunction.hpp"
|
||||
|
@ -504,6 +505,17 @@ void InfluxdbWriter::Flush()
|
|||
request.set(http::field::user_agent, "Icinga/" + Application::GetAppVersion());
|
||||
request.set(http::field::host, url->GetHost() + ":" + url->GetPort());
|
||||
|
||||
{
|
||||
Dictionary::Ptr basicAuth = GetBasicAuth();
|
||||
|
||||
if (basicAuth) {
|
||||
request.set(
|
||||
http::field::authorization,
|
||||
"Basic " + Base64::Encode(basicAuth->Get("username") + ":" + basicAuth->Get("password"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
request.body() = body;
|
||||
request.set(http::field::content_length, request.body().size());
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ class InfluxdbWriter : ConfigObject
|
|||
[config] String ssl_key{
|
||||
default {{{ return ""; }}}
|
||||
};
|
||||
[config, no_user_view] Dictionary::Ptr basic_auth;
|
||||
[config, required] Dictionary::Ptr host_template {
|
||||
default {{{
|
||||
return new Dictionary({
|
||||
|
@ -91,6 +92,12 @@ validator InfluxdbWriter {
|
|||
String "*";
|
||||
};
|
||||
};
|
||||
Dictionary basic_auth {
|
||||
required username;
|
||||
String username;
|
||||
required password;
|
||||
String password;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue