From 02e0933e7c71047dbdbcae2c44cf7f64352ed525 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 5 Dec 2013 10:00:20 +0100 Subject: [PATCH] Make status.dat/objects.cache interval configurable. Fixes #5262 --- components/compat/compat-type.conf | 3 ++- components/compat/statusdatawriter.cpp | 2 +- components/compat/statusdatawriter.ti | 3 +++ doc/4.3-object-types.md | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/compat/compat-type.conf b/components/compat/compat-type.conf index 9fe7ef823..e268aa25d 100644 --- a/components/compat/compat-type.conf +++ b/components/compat/compat-type.conf @@ -19,7 +19,8 @@ type StatusDataWriter { %attribute string "status_path", - %attribute string "objects_path" + %attribute string "objects_path", + %attribute number "update_interval" } type ExternalCommandListener { diff --git a/components/compat/statusdatawriter.cpp b/components/compat/statusdatawriter.cpp index 2440b662c..5bc6c54aa 100644 --- a/components/compat/statusdatawriter.cpp +++ b/components/compat/statusdatawriter.cpp @@ -56,7 +56,7 @@ void StatusDataWriter::Start(void) DynamicObject::Start(); m_StatusTimer = make_shared(); - m_StatusTimer->SetInterval(15); + m_StatusTimer->SetInterval(GetUpdateInterval()); m_StatusTimer->OnTimerExpired.connect(boost::bind(&StatusDataWriter::StatusTimerHandler, this)); m_StatusTimer->Start(); m_StatusTimer->Reschedule(0); diff --git a/components/compat/statusdatawriter.ti b/components/compat/statusdatawriter.ti index ff6efb24d..2feee09eb 100644 --- a/components/compat/statusdatawriter.ti +++ b/components/compat/statusdatawriter.ti @@ -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; }}} + }; }; } diff --git a/doc/4.3-object-types.md b/doc/4.3-object-types.md index d2965b92d..cc9641d2d 100644 --- a/doc/4.3-object-types.md +++ b/doc/4.3-object-types.md @@ -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. ### ExternalCommandListener -- 2.40.0