2012-09-15 12:51:40 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
|
|
|
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef COMPATIDOCOMPONENT_H
|
|
|
|
#define COMPATIDOCOMPONENT_H
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup compatido
|
|
|
|
*/
|
|
|
|
class CompatIdoComponent : public IComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void Start(void);
|
|
|
|
virtual void Stop(void);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Timer::Ptr m_StatusTimer;
|
2012-09-15 17:05:42 +02:00
|
|
|
Timer::Ptr m_ConfigTimer;
|
2012-09-15 20:17:37 +02:00
|
|
|
Timer::Ptr m_ProgramStatusTimer;
|
2012-10-07 21:47:50 +02:00
|
|
|
Timer::Ptr m_ReconnectTimer;
|
|
|
|
|
2012-11-22 12:04:32 +01:00
|
|
|
IdoConnection::Ptr m_IdoConnection;
|
2012-10-07 23:45:55 +02:00
|
|
|
|
2012-09-28 12:13:50 +02:00
|
|
|
String GetSocketAddress(void) const;
|
|
|
|
String GetSocketPort(void) const;
|
|
|
|
String GetInstanceName(void) const;
|
2012-11-22 12:04:32 +01:00
|
|
|
double GetReconnectInterval(void) const;
|
2012-09-28 12:13:50 +02:00
|
|
|
|
2012-11-22 12:04:32 +01:00
|
|
|
void SocketDisconnectHandler(void);
|
2012-10-07 23:45:55 +02:00
|
|
|
|
2012-09-27 18:39:13 +02:00
|
|
|
void ConfigTimerHandler(void);
|
|
|
|
void StatusTimerHandler(void);
|
|
|
|
void ProgramStatusTimerHandler(void);
|
2012-10-07 21:47:50 +02:00
|
|
|
void ReconnectTimerHandler(void);
|
|
|
|
|
2012-11-22 12:04:32 +01:00
|
|
|
void OpenIdoSocket(void);
|
2012-10-07 21:47:50 +02:00
|
|
|
void CloseIdoSocket(void);
|
2012-09-27 18:39:13 +02:00
|
|
|
|
2012-10-07 23:45:55 +02:00
|
|
|
void SendStartProcess(void);
|
2012-09-15 12:51:40 +02:00
|
|
|
|
2012-10-03 01:25:44 +02:00
|
|
|
void EnableHostObject(const Host::Ptr& host);
|
|
|
|
void EnableServiceObject(const Service::Ptr& service);
|
|
|
|
void DisableHostObject(const Host::Ptr& host);
|
|
|
|
void DisableServiceObject(const Service::Ptr& service);
|
|
|
|
|
2012-09-15 12:51:40 +02:00
|
|
|
void DumpConfigObjects(void);
|
|
|
|
void DumpHostObject(const Host::Ptr& host);
|
|
|
|
void DumpServiceObject(const Service::Ptr& service);
|
|
|
|
void DumpStatusData(void);
|
|
|
|
void DumpHostStatus(const Host::Ptr& host);
|
|
|
|
void DumpServiceStatus(const Service::Ptr& service);
|
2012-09-15 20:17:37 +02:00
|
|
|
void DumpProgramStatusData(void);
|
2012-09-15 12:51:40 +02:00
|
|
|
|
|
|
|
template<typename T>
|
2012-11-22 12:04:32 +01:00
|
|
|
void SendMessageList(stringstream& msg, const T& list, int type)
|
2012-09-15 12:51:40 +02:00
|
|
|
{
|
|
|
|
typename T::const_iterator it;
|
|
|
|
for (it = list.begin(); it != list.end(); it++) {
|
|
|
|
msg << type << "=" << *it << "\n";
|
|
|
|
}
|
|
|
|
}
|
2012-09-28 13:14:03 +02:00
|
|
|
|
|
|
|
static const String DefaultSocketAddress;
|
|
|
|
static const String DefaultSocketPort;
|
|
|
|
static const String DefaultInstanceName;
|
2012-10-07 21:47:50 +02:00
|
|
|
static const int DefaultReconnectInterval;
|
|
|
|
|
2012-09-15 12:51:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* COMPATIDOCOMPONENT_H */
|