Make status.dat/objects.cache interval configurable.

Fixes #5262
This commit is contained in:
Gunnar Beutner 2013-12-05 10:00:20 +01:00
parent aa4c2b9542
commit 02e0933e7c
4 changed files with 9 additions and 3 deletions

View 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 {

View 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);

View 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; }}}
};
};
}

View 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