mirror of https://github.com/Icinga/icinga2.git
parent
95f7de123e
commit
42f664e4c6
|
@ -48,6 +48,14 @@ type Endpoint {
|
|||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "config_files_recursive" {
|
||||
%attribute string "*",
|
||||
%attribute dictionary "*" {
|
||||
%attribute string "path",
|
||||
%attribute string "pattern"
|
||||
}
|
||||
},
|
||||
|
||||
%attribute array "accept_config" {
|
||||
%attribute name(Endpoint) "*"
|
||||
}
|
||||
|
|
|
@ -538,6 +538,23 @@ void ClusterListener::NewClientHandler(const Socket::Ptr& client, TlsRole role)
|
|||
}
|
||||
}
|
||||
|
||||
Array::Ptr configFilesRecursive = endpoint->GetConfigFilesRecursive();
|
||||
|
||||
if (configFilesRecursive) {
|
||||
ObjectLock olock(configFilesRecursive);
|
||||
BOOST_FOREACH(const Value& configFile, configFilesRecursive) {
|
||||
if (configFile.IsObjectType<Dictionary>()) {
|
||||
Dictionary::Ptr configFileDict = configFile;
|
||||
String path = configFileDict->Get("path");
|
||||
String pattern = configFileDict->Get("pattern");
|
||||
Utility::GlobRecursive(path, pattern, boost::bind(&ClusterListener::ConfigGlobHandler, boost::cref(config), _1, false), GlobFile);
|
||||
} else {
|
||||
String configFilePath = configFile;
|
||||
Utility::GlobRecursive(configFilePath, "*.conf", boost::bind(&ClusterListener::ConfigGlobHandler, boost::cref(config), _1, false), GlobFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log(LogInformation, "cluster", "Sending " + Convert::ToString(static_cast<long>(config->GetLength())) + " config files to endpoint '" + endpoint->GetName() + "'.");
|
||||
|
||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||
|
|
|
@ -8,6 +8,7 @@ class Endpoint : DynamicObject
|
|||
[config] String host;
|
||||
[config] String port;
|
||||
[config] Array::Ptr config_files;
|
||||
[config] Array::Ptr config_files_recursive;
|
||||
[config] Array::Ptr accept_config;
|
||||
|
||||
[state] double seen;
|
||||
|
|
|
@ -873,6 +873,13 @@ Example:
|
|||
object Endpoint "icinga-c2" {
|
||||
host = "192.168.5.46",
|
||||
port = 7777,
|
||||
|
||||
config_files = [ "/etc/icinga2/cluster.d/*" ],
|
||||
|
||||
config_files_recursive = [
|
||||
"/etc/icinga2/cluster2",
|
||||
{ path = "/etc/icinga2/cluster3", pattern = "*.myconf" }
|
||||
]
|
||||
}
|
||||
|
||||
Attributes:
|
||||
|
@ -882,6 +889,7 @@ Attributes:
|
|||
host |**Required.** The hostname/IP address of the remote Icinga 2 instance.
|
||||
port |**Required.** The service name/port of the remote Icinga 2 instance.
|
||||
config\_files |**Optional.** A list of configuration files sent to remote peers (wildcards possible).
|
||||
config_files_recursive |**Optional.** A list of configuration files sent to remote peers. Array elements can either be a string (in which case all files in that directory matching the pattern *.conf are included) or a dictionary with elements "path" and "pattern".
|
||||
accept\_config |**Optional.** A list of endpoint names from which this endpoint accepts configuration files.
|
||||
|
||||
### <a id="objecttype-domain"></a> Domain
|
||||
|
|
Loading…
Reference in New Issue