Configuration: use underscore in attributes, document all using new locations

... from #3228

fixes #3222
This commit is contained in:
Michael Friedrich 2012-10-02 14:44:57 +02:00
parent 4609f7d980
commit c2bad406ef
4 changed files with 36 additions and 48 deletions

View File

@ -36,7 +36,7 @@ const String CompatComponent::DefaultObjectsPath = Application::GetLocalStateDir
*/ */
String CompatComponent::GetStatusPath(void) const String CompatComponent::GetStatusPath(void) const
{ {
Value statuspath = GetConfig()->Get("statuspath"); Value statuspath = GetConfig()->Get("status_path");
if(statuspath.IsEmpty()) if(statuspath.IsEmpty())
return DefaultStatusPath; return DefaultStatusPath;
else else
@ -49,7 +49,7 @@ String CompatComponent::GetStatusPath(void) const
*/ */
String CompatComponent::GetObjectsPath(void) const String CompatComponent::GetObjectsPath(void) const
{ {
Value objectspath = GetConfig()->Get("objectspath"); Value objectspath = GetConfig()->Get("objects_path");
if(objectspath.IsEmpty()) if(objectspath.IsEmpty())
return DefaultObjectsPath; return DefaultObjectsPath;
else else

View File

@ -332,9 +332,9 @@ local object IcingaApplication "icinga" {
node = "192.168.0.1", node = "192.168.0.1",
service = 7777, service = 7777,
pidpath = "/var/run/icinga2.pid", pid_path = "./var/run/icinga2.pid",
logpath = "/var/log/icinga2.log", log_path = "./var/log/icinga2.log",
statepath = "/var/lib/icinga2.state", state_path = "./var/lib/icinga2.state",
macros = { macros = {
plugindir = "/usr/local/icinga/libexec" plugindir = "/usr/local/icinga/libexec"
@ -371,23 +371,23 @@ Attribute: service
The port this Icinga 2 instance should listen on. This property is optional The port this Icinga 2 instance should listen on. This property is optional
when you're setting up a non-networked Icinga 2 instance. when you're setting up a non-networked Icinga 2 instance.
Attribute: pidpath Attribute: pid_path
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
Optional. The path to the PID file. Defaults to "icinga.pid" in the current Optional. The path to the PID file. Defaults to "icinga.pid" in the current
working directory. working directory.
Attribute: logpath Attribute: log_path
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
Optional. The path to the logfile. This is a shortcut for creating a Logger Optional. The path to the logfile. This is a shortcut for creating a Logger
object of type "file" with the specified log path. object of type "file" with the specified log path.
Attribute: statepath Attribute: state_path
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
Optional. The path of the state file. This is the file Icinga 2 uses to persist Optional. The path of the state file. This is the file Icinga 2 uses to persist
objects between program runs. Defaults to "icinga.state" in the current working objects between program runs. Defaults to "icinga2.state" in the current working
directory. directory.
Attribute: macros Attribute: macros
@ -399,8 +399,10 @@ Optional. Global macros that are used for service checks and notifications.
Type: Component Type: Component
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
The "Component" type is used to specify independent tasks which can be loaded on Icinga 2 uses a number of components to implement its feature-set. The
demand at runtime. The typical components to be loaded in the default configuration "Component" configuration object is used to load these components and specify
additional parameters for them. "Component" objects must have the "local"
specifier. The typical components to be loaded in the default configuration
would be "checker", "delegation" and more. would be "checker", "delegation" and more.
There are optional components which may not run on every operating system, such as There are optional components which may not run on every operating system, such as
"compat" or "compatido". "compat" or "compatido".
@ -409,20 +411,20 @@ Example:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
local object Component "compat" { local object Component "compat" {
statuspath = "status.dat", status_path = "./var/cache/icinga2/status.dat",
objectspath = "objects.cache", objects_path = "./var/cache/icinga2/objects.cache",
} }
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Attribute: statuspath Attribute: status_path
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
Specifies where Icinga 2 Compat component will put the status.dat file, which can Specifies where Icinga 2 Compat component will put the status.dat file, which can
be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the
localstatedir location. localstatedir location.
Attribute: objectspath Attribute: objects_path
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
Specifies where Icinga 2 Compat component will put the objects.cache file, which can Specifies where Icinga 2 Compat component will put the objects.cache file, which can
be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the
@ -471,7 +473,7 @@ Example:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
local object Logger "my-debug-log" { local object Logger "my-debug-log" {
type = "file", type = "file",
path = "/var/log/icinga2.log", path = "./var/log/icinga2/icinga2.log",
severity = "debug" severity = "debug"
} }
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -492,22 +494,6 @@ Attribute: severity
The minimum severity for this log. Can be "debug", "information", "warning" or The minimum severity for this log. Can be "debug", "information", "warning" or
"critical". Defaults to "information". "critical". Defaults to "information".
Type: Component
~~~~~~~~~~~~~~~
Icinga 2 uses a number of components to implement its feature-set. The
"Component" configuration object is used to load these components and specify
additional parameters for them. "component" objects must have the "local"
specifier.
Example:
-------------------------------------------------------------------------------
local object Component "discovery" {
broker = 1
}
-------------------------------------------------------------------------------
Type: Endpoint Type: Endpoint
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

View File

@ -11,8 +11,12 @@
* Global configuration settings * Global configuration settings
*/ */
local object IcingaApplication "icinga" { local object IcingaApplication "icinga" {
pid_path = "./var/run/icinga2.pid",
log_path = "./var/log/icinga2/icinga2.log",
state_path = "./var/lib/icinga2/icinga2.state",
macros = { macros = {
plugindir = "/usr/lib/nagios/plugins" plugindir = "/usr/local/icinga/libexec"
} }
} }
@ -37,10 +41,8 @@ local object Component "delegation" {
* hosts and services. * hosts and services.
*/ */
local object Component "compat" { local object Component "compat" {
/* status_path = "./var/cache/icinga2/status.dat",
statuspath = "/var/icinga2/status.dat", objects_path = "./var/cache/icinga2/objects.cache",
objectspath = "/var/icinga2/objects.cache",
*/
} }
/** /**
@ -50,9 +52,9 @@ local object Component "compat" {
*/ */
/* /*
local object Component "compatido" { local object Component "compatido" {
socket_address = "127.0.0.1", socket_address = "127.0.0.1",
socket_port = "5668", socket_port = "5668",
instance_name = "i2-default", instance_name = "i2-default",
} }
*/ */

View File

@ -95,17 +95,17 @@ int IcingaApplication::Main(const vector<String>& args)
m_Node = Get("node"); m_Node = Get("node");
m_Service = Get("service"); m_Service = Get("service");
m_PidPath = Get("pidpath"); m_PidPath = Get("pid_path");
if (m_PidPath.IsEmpty()) if (m_PidPath.IsEmpty())
m_PidPath = DefaultPidPath; m_PidPath = DefaultPidPath;
m_StatePath = Get("statepath"); m_StatePath = Get("state_path");
if (m_StatePath.IsEmpty()) if (m_StatePath.IsEmpty())
m_StatePath = DefaultStatePath; m_StatePath = DefaultStatePath;
m_Macros = Get("macros"); m_Macros = Get("macros");
String logpath = Get("logpath"); String logpath = Get("log_path");
if (!logpath.IsEmpty()) { if (!logpath.IsEmpty()) {
ConfigItemBuilder::Ptr fileLogConfig = boost::make_shared<ConfigItemBuilder>(); ConfigItemBuilder::Ptr fileLogConfig = boost::make_shared<ConfigItemBuilder>();
fileLogConfig->SetType("Logger"); fileLogConfig->SetType("Logger");