]> granicus.if.org Git - icinga2/commitdiff
Configuration: use underscore in attributes, document all using new locations
authorMichael Friedrich <michael.friedrich@gmail.com>
Tue, 2 Oct 2012 12:44:57 +0000 (14:44 +0200)
committerMichael Friedrich <michael.friedrich@gmail.com>
Tue, 2 Oct 2012 12:44:57 +0000 (14:44 +0200)
... from #3228

fixes #3222

components/compat/compatcomponent.cpp
docs/icinga2-config.txt
icinga-app/config/icinga2.conf.dist
lib/icinga/icingaapplication.cpp

index 39bbea762553faffd15ac9fb66351d3189ca9a91..38ec74fe31f4a92cdb41afa60a7efca264b95cf5 100644 (file)
@@ -36,7 +36,7 @@ const String CompatComponent::DefaultObjectsPath = Application::GetLocalStateDir
  */
 String CompatComponent::GetStatusPath(void) const
 {
-       Value statuspath = GetConfig()->Get("statuspath");
+       Value statuspath = GetConfig()->Get("status_path");
        if(statuspath.IsEmpty())
                return DefaultStatusPath;
        else
@@ -49,7 +49,7 @@ String CompatComponent::GetStatusPath(void) const
  */
 String CompatComponent::GetObjectsPath(void) const
 {
-        Value objectspath = GetConfig()->Get("objectspath");
+        Value objectspath = GetConfig()->Get("objects_path");
         if(objectspath.IsEmpty())
                 return DefaultObjectsPath;
         else
index 55e5d0746c9c87ed01abdc22011e9bef3868680a..36d041b0a0c4b887da5813c990f3a7b259925da9 100644 (file)
@@ -332,9 +332,9 @@ local object IcingaApplication "icinga" {
   node = "192.168.0.1",
   service = 7777,
 
-  pidpath = "/var/run/icinga2.pid",
-  logpath = "/var/log/icinga2.log",
-  statepath = "/var/lib/icinga2.state",
+  pid_path = "./var/run/icinga2.pid",
+  log_path = "./var/log/icinga2.log",
+  state_path = "./var/lib/icinga2.state",
 
   macros = {
     plugindir = "/usr/local/icinga/libexec"
@@ -371,23 +371,23 @@ Attribute: service
 The port this Icinga 2 instance should listen on. This property is optional
 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
 working directory.
 
-Attribute: logpath
-^^^^^^^^^^^^^^^^^^
+Attribute: log_path
+^^^^^^^^^^^^^^^^^^^
 
 Optional. The path to the logfile. This is a shortcut for creating a Logger
 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
-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.
 
 Attribute: macros
@@ -399,8 +399,10 @@ Optional. Global macros that are used for service checks and notifications.
 Type: Component
 ~~~~~~~~~~~~~~~
 
-The "Component" type is used to specify independent tasks which can be loaded on
-demand at runtime. The typical components to be loaded in the default configuration
+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. The typical components to be loaded in the default configuration
 would be "checker", "delegation" and more.
 There are optional components which may not run on every operating system, such as
 "compat" or "compatido".
@@ -409,20 +411,20 @@ Example:
 
 -------------------------------------------------------------------------------
 local object Component "compat" {
-  statuspath = "status.dat",
-  objectspath = "objects.cache",
+  status_path = "./var/cache/icinga2/status.dat",
+  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
 be read by Icinga 1.x Classic UI and other addons. If not set, it defaults to the
 localstatedir location.
 
-Attribute: objectspath
-^^^^^^^^^^^^^^^^^^^^^^
+Attribute: objects_path
+^^^^^^^^^^^^^^^^^^^^^^^
 
 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
@@ -471,7 +473,7 @@ Example:
 -------------------------------------------------------------------------------
 local object Logger "my-debug-log" {
   type = "file",
-  path = "/var/log/icinga2.log",
+  path = "./var/log/icinga2/icinga2.log",
   severity = "debug"
 }
 -------------------------------------------------------------------------------
@@ -492,22 +494,6 @@ Attribute: severity
 The minimum severity for this log. Can be "debug", "information", "warning" or
 "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
 ~~~~~~~~~~~~~~
 
index 768ea0f285b7ed51e1fabc27a716ca821379b7fe..9c066057feedd81c974effc0bb1af3f4a7301233 100644 (file)
  * Global configuration settings
  */
 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 = {
-    plugindir = "/usr/lib/nagios/plugins"
+    plugindir = "/usr/local/icinga/libexec"
   }
 }
 
@@ -37,10 +41,8 @@ local object Component "delegation" {
  * hosts and services.
  */
 local object Component "compat" {
-/*
-       statuspath = "/var/icinga2/status.dat",
-       objectspath = "/var/icinga2/objects.cache",
-*/
+  status_path = "./var/cache/icinga2/status.dat",
+  objects_path = "./var/cache/icinga2/objects.cache",
 }
 
 /**
@@ -50,9 +52,9 @@ local object Component "compat" {
  */
 /*
 local object Component "compatido" {
-        socket_address = "127.0.0.1",
-        socket_port = "5668",
-        instance_name = "i2-default",
+  socket_address = "127.0.0.1",
+  socket_port = "5668",
+  instance_name = "i2-default",
 }
 */
 
index f8969fa1a437ad35223dc5d98984df7d2fa17266..04218712178d7095d222fc91f9d8b054c38b6c60 100644 (file)
@@ -95,17 +95,17 @@ int IcingaApplication::Main(const vector<String>& args)
        m_Node = Get("node");
        m_Service = Get("service");
 
-       m_PidPath = Get("pidpath");
+       m_PidPath = Get("pid_path");
        if (m_PidPath.IsEmpty())
                m_PidPath = DefaultPidPath;
 
-       m_StatePath = Get("statepath");
+       m_StatePath = Get("state_path");
        if (m_StatePath.IsEmpty())
                m_StatePath = DefaultStatePath;
 
        m_Macros = Get("macros");
 
-       String logpath = Get("logpath");
+       String logpath = Get("log_path");
        if (!logpath.IsEmpty()) {
                ConfigItemBuilder::Ptr fileLogConfig = boost::make_shared<ConfigItemBuilder>();
                fileLogConfig->SetType("Logger");