]> granicus.if.org Git - icinga2/commitdiff
Make status.dat/objects.cache interval configurable.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 5 Dec 2013 09:00:20 +0000 (10:00 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 5 Dec 2013 09:04:49 +0000 (10:04 +0100)
Fixes #5262

components/compat/compat-type.conf
components/compat/statusdatawriter.cpp
components/compat/statusdatawriter.ti
doc/4.3-object-types.md

index 9fe7ef823d29e9e1aa110954096cdbe286c6b85e..e268aa25da8bcb06f2cc5b4496583245bcde6601 100644 (file)
@@ -19,7 +19,8 @@
 
 type StatusDataWriter {
        %attribute string "status_path",
-       %attribute string "objects_path"
+       %attribute string "objects_path",
+       %attribute number "update_interval"
 }
 
 type ExternalCommandListener {
index 2440b662c11849100df4109ec83aa91bda42aa4b..5bc6c54aa4c2429fb8d29687ca0ee0bf730bf91d 100644 (file)
@@ -56,7 +56,7 @@ void StatusDataWriter::Start(void)
        DynamicObject::Start();
 
        m_StatusTimer = make_shared<Timer>();
-       m_StatusTimer->SetInterval(15);
+       m_StatusTimer->SetInterval(GetUpdateInterval());
        m_StatusTimer->OnTimerExpired.connect(boost::bind(&StatusDataWriter::StatusTimerHandler, this));
        m_StatusTimer->Start();
        m_StatusTimer->Reschedule(0);
index ff6efb24d5fe5a56771adfd11d1f6cdeab3d7ff3..2feee09ebd7beda8ae57e6fda0ff50a3fba27dc0 100644 (file)
@@ -12,6 +12,9 @@ class StatusDataWriter : DynamicObject
        [config] String objects_path {
                default {{{ return Application::GetLocalStateDir() + "/cache/icinga2/objects.cache"; }}}
        };
+       [config] double update_interval {
+               default {{{ return 15; }}}
+       };
 };
 
 }
index d2965b92d5086fd6454df0f4901820bc0fa18bd3..cc9641d2dd110f2574554bb0f700f72e5b71bef9 100644 (file)
@@ -719,7 +719,8 @@ Example:
 
     object StatusDataWriter "status" {
         status\_path = "/var/cache/icinga2/status.dat",
-        objects\_path = "/var/cache/icinga2/objects.path"
+        objects\_path = "/var/cache/icinga2/objects.path",
+        update\_interval = 30s
     }
 
 Attributes:
@@ -728,6 +729,7 @@ Attributes:
   ----------------|----------------
   status\_path    |**Optional.** Path to the status.dat file. Defaults to IcingaLocalStateDir + "/cache/icinga2/status.dat".
   objects\_path   |**Optional.** Path to the objects.cache file. Defaults to IcingaLocalStateDir + "/cache/icinga2/objects.cache".
+  update\_interval|**Optional.** The interval in which the status files are updated. Defaults to 15 seconds.
 
 ### <a id="objecttype-externalcommandlistener"></a> ExternalCommandListener