* - only icinga idoutils 1.8
* - only "retained" config
* - instance_name is i2-default
- * TODO
- * we should have configs for
- * - data_processing_options
- * - config_output_options - 0..orig, 1..retained (chose retained for icinga-web preferred)
- * - INSTANCE_NAME ?
- * - update interval ?
- * - tcp socket+port
*/
m_StatusTimer = boost::make_shared<Timer>();
m_StatusTimer->SetInterval(StatusTimerInterval);
m_ProgramStatusTimer->Reschedule(0);
/*
- * open ido socket once, send the updates via timer then
+ * open ido socket once
*/
OpenSink("127.0.0.1", "5668");
SendHello("i2-default");
*/
void CompatIdoComponent::Stop(void)
{
-
- //FIXME cleanly close ido socket
GoodByeSink();
CloseSink();
}
/* TODO
* subscribe to all status updates and checkresults and dump them
* should remove the periodic statusdata dump
+ * subscribe to config update events, and send insert/update/delete for configs to ido2db
*/
/**
* Periodically dumps status information
- *
- * @param - Event arguments for the timer.
*/
void CompatIdoComponent::StatusTimerHandler(void)
{
Logger::Write(LogInformation, "compatido", "Writing compat ido status information");
- /*
- * TODO
- * - fetch status data, dump it periodically
- * - subscribe to check events and status updates, dump it
- */
+
DumpStatusData();
}
/**
* Periodically dumps config information
- *
- * @param - Event arguments for the timer.
*/
void CompatIdoComponent::ConfigTimerHandler(void)
{
Logger::Write(LogInformation, "compatido", "Writing compat ido config information");
- /*
- * TODO
- * - fetch config, dump it
- * - subscribe to config update events, and send insert/update/delete for configs to ido2db
- */
DumpConfigObjects();
}
/**
* Periodically dumps program status information
- *
- * @param - Event arguments for the timer.
*/
void CompatIdoComponent::ProgramStatusTimerHandler(void)
{
}
-
/**
- * opens a tcp connection to the socket
+ * opens a tcp connection to the ido socket
*/
void CompatIdoComponent::OpenSink(String node, String service)
{
}
/**
- * sends hello msg to ido
+ * sends hello msg to ido2b
*/
void CompatIdoComponent::SendHello(String instancename)
{
/**
* sends goodbye msg to ido
*/
-void CompatIdoComponent::GoodByeSink()
+void CompatIdoComponent::GoodByeSink(void)
{
time_t now;
time(&now);
}
/**
- * closes sink
+ * closes ido socket
*/
-void CompatIdoComponent::CloseSink()
+void CompatIdoComponent::CloseSink(void)
{
m_IdoSocket->Close();
}
/**
* sends config dump start signal to ido
*/
-void CompatIdoComponent::StartConfigDump()
+void CompatIdoComponent::StartConfigDump(void)
{
struct timeval now;
gettimeofday(&now, NULL);
/**
* sends config dump end signal to ido
*/
-void CompatIdoComponent::EndConfigDump()
+void CompatIdoComponent::EndConfigDump(void)
{
struct timeval now;
gettimeofday(&now, NULL);
/**
* dump host config to ido
+ *
+ * @param host Pointer to the Host object
*/
void CompatIdoComponent::DumpHostObject(const Host::Ptr& host)
{
<< 262 << "=" << "i2_customvar" << ":" << 1 << ":" << "i2_custom_var_mod" << "\n" /* customvariable */
<< 999 << "\n\n"; /* enddata */
-
-
m_IdoSocket->SendMessage(message.str());
}
/**
* dump host status to ido
+ *
+ * @param host Pointer to Host object
*/
void CompatIdoComponent::DumpHostStatus(const Host::Ptr& host)
{
/**
* dump service config to ido
+ *
+ * @param service Pointer to Service object
*/
void CompatIdoComponent::DumpServiceObject(const Service::Ptr& service)
{
/**
* dump service status to ido
+ *
+ * @param service Pointer to Service object
*/
void CompatIdoComponent::DumpServiceStatus(const Service::Ptr& service)
{
double execution_start = -1, execution_end = -1;
Dictionary::Ptr cr = service->GetLastCheckResult();
+
if (cr) {
output = cr->Get("output");
schedule_start = cr->Get("schedule_start");
Timer::Ptr m_ProgramStatusTimer;
IdoSocket::Ptr m_IdoSocket;
+ void ConfigTimerHandler(void);
+ void StatusTimerHandler(void);
+ void ProgramStatusTimerHandler(void);
+
void OpenSink(String node, String service );
void SendHello(String instancename);
- void GoodByeSink();
- void CloseSink();
- void StartConfigDump();
- void EndConfigDump();
+ void GoodByeSink(void);
+ void CloseSink(void);
+ void StartConfigDump(void);
+ void EndConfigDump(void);
void DumpConfigObjects(void);
void DumpHostObject(const Host::Ptr& host);
msg << type << "=" << *it << "\n";
}
}
-
- //void DemoTimerHandler(void);
- //void HelloWorldRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
-
- void ConfigTimerHandler(void);
- void StatusTimerHandler(void);
- void ProgramStatusTimerHandler(void);
};
}