Create temporary files for PerfdataWriter in a separate directory.

Fixes #5105
This commit is contained in:
Gunnar Beutner 2013-11-21 07:17:34 +01:00
parent 39dcf20a89
commit 27e9cd71e7
5 changed files with 7 additions and 1 deletions

View File

@ -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\")")

View File

@ -74,7 +74,7 @@ void PerfdataWriter::RotateFile(void)
{
ObjectLock olock(this);
String tempFile = GetPerfdataPath();
String tempFile = GetTempPath();
if (m_OutputFile.good()) {
m_OutputFile.close();

View File

@ -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"

View File

@ -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.

View File

@ -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