using namespace icinga;
const String IcingaApplication::DefaultPidPath = "icinga.pid";
+const String IcingaApplication::DefaultStatePath = "icinga.state";
IcingaApplication::IcingaApplication(void)
{ }
m_CAFile = icingaConfig->Get("ca");
m_Node = icingaConfig->Get("node");
m_Service = icingaConfig->Get("service");
- m_PidPath = icingaConfig->Get("pidpath");
+ m_PidPath = icingaConfig->Get("pidpath");
if (m_PidPath.IsEmpty())
m_PidPath = DefaultPidPath;
+ m_StatePath = icingaConfig->Get("statepath");
+ if (m_StatePath.IsEmpty())
+ m_StatePath = DefaultStatePath;
+
m_Macros = icingaConfig->Get("macros");
String logpath = icingaConfig->Get("logpath");
}
/* restore the previous program state */
- DynamicObject::RestoreObjects("retention.dat");
+ DynamicObject::RestoreObjects(GetStatePath());
/* periodically dump the program state */
m_RetentionTimer = boost::make_shared<Timer>();
}
void IcingaApplication::DumpProgramState(void) {
- DynamicObject::DumpObjects("retention.dat.tmp");
- rename("retention.dat.tmp", "retention.dat");
+ String temp = GetStatePath() + ".tmp";
+ DynamicObject::DumpObjects(temp);
+ rename(temp.CStr(), GetStatePath().CStr());
}
IcingaApplication::Ptr IcingaApplication::GetInstance(void)
return m_PidPath;
}
+String IcingaApplication::GetStatePath(void) const
+{
+ return m_StatePath;
+}
+
Dictionary::Ptr IcingaApplication::GetMacros(void) const
{
return m_Macros;
String GetNode(void) const;
String GetService(void) const;
String GetPidPath(void) const;
+ String GetStatePath(void) const;
Dictionary::Ptr GetMacros(void) const;
double GetStartTime(void) const;
static const String DefaultPidPath;
+ static const String DefaultStatePath;
private:
String m_CertificateFile;
String m_Node;
String m_Service;
String m_PidPath;
+ String m_StatePath;
Dictionary::Ptr m_Macros;
double m_StartTime;