From: Gunnar Beutner Date: Thu, 21 Nov 2013 06:17:34 +0000 (+0100) Subject: Create temporary files for PerfdataWriter in a separate directory. X-Git-Tag: v0.0.5~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27e9cd71e73ae3575b40e64e60cece71526b05d5;p=icinga2 Create temporary files for PerfdataWriter in a separate directory. Fixes #5105 --- diff --git a/components/perfdata/CMakeLists.txt b/components/perfdata/CMakeLists.txt index a5bf05b10..6f71a1700 100644 --- a/components/perfdata/CMakeLists.txt +++ b/components/perfdata/CMakeLists.txt @@ -37,3 +37,4 @@ install( ) install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/spool/icinga2/perfdata\")") +install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/spool/icinga2/tmp\")") diff --git a/components/perfdata/perfdatawriter.cpp b/components/perfdata/perfdatawriter.cpp index ea7323e0d..b2cf76a70 100644 --- a/components/perfdata/perfdatawriter.cpp +++ b/components/perfdata/perfdatawriter.cpp @@ -74,7 +74,7 @@ void PerfdataWriter::RotateFile(void) { ObjectLock olock(this); - String tempFile = GetPerfdataPath(); + String tempFile = GetTempPath(); if (m_OutputFile.good()) { m_OutputFile.close(); diff --git a/components/perfdata/perfdatawriter.ti b/components/perfdata/perfdatawriter.ti index bb7dcd719..cea802274 100644 --- a/components/perfdata/perfdatawriter.ti +++ b/components/perfdata/perfdatawriter.ti @@ -9,6 +9,9 @@ class PerfdataWriter : DynamicObject [config] String perfdata_path { default {{{ return Application::GetLocalStateDir() + "/spool/icinga2/perfdata/perfdata"; }}} }; + [config] String temp_path { + default {{{ return Application::GetLocalStateDir() + "/spool/icinga2/tmp/perfdata"; }}} + }; [config] String format_template { default {{{ return "DATATYPE::SERVICEPERFDATA\t" diff --git a/doc/4.3-object-types.md b/doc/4.3-object-types.md index 1e03e9076..e980de29a 100644 --- a/doc/4.3-object-types.md +++ b/doc/4.3-object-types.md @@ -473,6 +473,7 @@ Attributes: Name |Description ----------------|---------------- perfdata\_path |**Optional.** Path to the service performance data file. Defaults to IcingaLocalStateDir + "/spool/icinga2/perfdata/perfdata". + temp\_path |**Optional.** Path to the temporary file. Defaults to IcingaLocalStateDir + "/spool/icinga2/tmp/perfdata". format\_template|**Optional.** Format template for the performance data file. Defaults to a template that's suitable for use with PNP4Nagios. rotation\_interval|**Optional.** Rotation interval for the file specified in `perfdata\_path`. Defaults to 30 seconds. diff --git a/icinga2.spec b/icinga2.spec index 14e113e72..b773a9046 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -332,6 +332,7 @@ fi %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata +%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl %{_datadir}/%{name}/itl