]> granicus.if.org Git - icinga2/commitdiff
Use script variables for global options.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 8 Oct 2013 10:22:16 +0000 (12:22 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 8 Oct 2013 10:22:16 +0000 (12:22 +0200)
doc/4.2-global-variables.md
lib/icinga/icingaapplication.cpp

index a160635a44209a617e4a9ea6be5d93546b36c149..081a30781df3facd4727ed23cf3f2f1968c9bfed 100644 (file)
@@ -2,13 +2,18 @@
 
 Icinga 2 provides a number of special global variables:
 
-Variable           |Description
--------------------|-------------------
-IcingaPrefixDir    |**Read-only.** Contains the installation prefix that was specified with ./configure --prefix. Defaults to /usr/local
-IcingaLocalStateDir|**Read-only.** Contains the path of the local state directory. Defaults to IcingaPrefixDir + "/var".
-IcingaPkgLibDir    |**Read-only.** Contains the path of the package lib directory. Defaults to IcingaPrefixDir + "/lib/icinga2".
-IcingaPkgDataDir   |**Read-only.** Contains the path of the package data directory. Defaults to IcingaPrefixDir + "/share/icinga2".
-IcingaStatePath    |**Read-write.** Contains the path of the Icinga 2 state file. Defaults to IcingaLocalStateDir + "/lib/icinga2/icinga2.state".
-IcingaPidPath      |**Read-write.** Contains the path of the Icinga 2 PID file. Defaults to IcingaLocalStateDir + "/run/icinga2/icinga2.pid".
-IcingaMacros       |**Read-write.** Contains a dictionary with global macros. Not set by default.
-ApplicationType    |**Read-write.** Contains the name of the Application type. Defaults to "IcingaApplication".
+Variable                  |Description
+--------------------------|-------------------
+IcingaPrefixDir           |**Read-only.** Contains the installation prefix that was specified with ./configure --prefix. Defaults to /usr/local
+IcingaLocalStateDir       |**Read-only.** Contains the path of the local state directory. Defaults to IcingaPrefixDir + "/var".
+IcingaPkgLibDir           |**Read-only.** Contains the path of the package lib directory. Defaults to IcingaPrefixDir + "/lib/icinga2".
+IcingaPkgDataDir          |**Read-only.** Contains the path of the package data directory. Defaults to IcingaPrefixDir + "/share/icinga2".
+IcingaStatePath           |**Read-write.** Contains the path of the Icinga 2 state file. Defaults to IcingaLocalStateDir + "/lib/icinga2/icinga2.state".
+IcingaPidPath             |**Read-write.** Contains the path of the Icinga 2 PID file. Defaults to IcingaLocalStateDir + "/run/icinga2/icinga2.pid".
+IcingaMacros              |**Read-write.** Contains a dictionary with global macros. Not set by default.
+ApplicationType           |**Read-write.** Contains the name of the Application type. Defaults to "IcingaApplication".
+IcingaEnableNotifications |**Read-write.** Whether notifications are globally enabled. Defaults to true.
+IcingaEnableEventHandlers |**Read-write.** Whether event handlers are globally enabled. Defaults to true.
+IcingaEnableFlapping      |**Read-write.** Whether flap detection is globally enabled. Defaults to true.
+IcingaEnableChecks        |**Read-write.** Whether active checks are globally enabled. Defaults to true.
+IcingaEnablePerfdata      |**Read-write.** Whether performance data processing is globally enabled. Defaults to true.
index f68c40a008719ac95f48ca58693a47f89f97397d..ec9407af2413aa95ad5f47cf85048c6b84cacac7 100644 (file)
@@ -141,10 +141,8 @@ bool IcingaApplication::GetEnableNotifications(void) const
 {
        if (!m_OverrideEnableNotifications.IsEmpty())
                return m_OverrideEnableNotifications;
-       else if (!m_EnableNotifications.IsEmpty())
-               return m_EnableNotifications;
        else
-               return true;
+               return ScriptVariable::Get("IcingaEnableNotifications");
 }
 
 void IcingaApplication::SetEnableNotifications(bool enabled)
@@ -161,10 +159,8 @@ bool IcingaApplication::GetEnableEventHandlers(void) const
 {
        if (!m_OverrideEnableEventHandlers.IsEmpty())
                return m_OverrideEnableEventHandlers;
-       else if (!m_EnableEventHandlers.IsEmpty())
-               return m_EnableEventHandlers;
        else
-               return true;
+               return ScriptVariable::Get("IcingaEnableEventHandlers");
 }
 
 void IcingaApplication::SetEnableEventHandlers(bool enabled)
@@ -181,10 +177,8 @@ bool IcingaApplication::GetEnableFlapping(void) const
 {
        if (!m_OverrideEnableFlapping.IsEmpty())
                return m_OverrideEnableFlapping;
-       else if (!m_EnableFlapping.IsEmpty())
-               return m_EnableFlapping;
        else
-               return true;
+               return ScriptVariable::Get("IcingaEnableFlapping");
 }
 
 void IcingaApplication::SetEnableFlapping(bool enabled)
@@ -201,10 +195,8 @@ bool IcingaApplication::GetEnableChecks(void) const
 {
        if (!m_OverrideEnableChecks.IsEmpty())
                return m_OverrideEnableChecks;
-       else if (!m_EnableChecks.IsEmpty())
-               return m_EnableChecks;
        else
-               return true;
+               return ScriptVariable::Get("IcingaEnableChecks");
 }
 
 void IcingaApplication::SetEnableChecks(bool enabled)
@@ -221,10 +213,8 @@ bool IcingaApplication::GetEnablePerfdata(void) const
 {
        if (!m_OverrideEnablePerfdata.IsEmpty())
                return m_OverrideEnablePerfdata;
-       else if (!m_EnablePerfdata.IsEmpty())
-               return m_EnablePerfdata;
        else
-               return true;
+               return ScriptVariable::Get("IcingaEnablePerfdata");
 }
 
 void IcingaApplication::SetEnablePerfdata(bool enabled)