mirror of https://github.com/Icinga/icinga2.git
parent
f72d73f719
commit
5167626c92
|
@ -41,7 +41,7 @@ LivestatusComponent::LivestatusComponent(const Dictionary::Ptr& serializedUpdate
|
||||||
{
|
{
|
||||||
RegisterAttribute("socket_type", Attribute_Config, &m_SocketType);
|
RegisterAttribute("socket_type", Attribute_Config, &m_SocketType);
|
||||||
RegisterAttribute("socket_path", Attribute_Config, &m_SocketPath);
|
RegisterAttribute("socket_path", Attribute_Config, &m_SocketPath);
|
||||||
RegisterAttribute("address", Attribute_Config, &m_Address);
|
RegisterAttribute("host", Attribute_Config, &m_Host);
|
||||||
RegisterAttribute("port", Attribute_Config, &m_Port);
|
RegisterAttribute("port", Attribute_Config, &m_Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ void LivestatusComponent::Start(void)
|
||||||
{
|
{
|
||||||
if (GetSocketType() == "tcp") {
|
if (GetSocketType() == "tcp") {
|
||||||
TcpSocket::Ptr socket = boost::make_shared<TcpSocket>();
|
TcpSocket::Ptr socket = boost::make_shared<TcpSocket>();
|
||||||
socket->Bind(GetAddress(), GetPort(), AF_INET);
|
socket->Bind(GetHost(), GetPort(), AF_INET);
|
||||||
|
|
||||||
boost::thread thread(boost::bind(&LivestatusComponent::ServerThreadProc, this, socket));
|
boost::thread thread(boost::bind(&LivestatusComponent::ServerThreadProc, this, socket));
|
||||||
thread.detach();
|
thread.detach();
|
||||||
|
@ -90,9 +90,9 @@ String LivestatusComponent::GetSocketPath(void) const
|
||||||
return socketPath;
|
return socketPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
String LivestatusComponent::GetAddress(void) const
|
String LivestatusComponent::GetHost(void) const
|
||||||
{
|
{
|
||||||
Value node = m_Address;
|
Value node = m_Host;
|
||||||
if (node.IsEmpty())
|
if (node.IsEmpty())
|
||||||
return "127.0.0.1";
|
return "127.0.0.1";
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
String GetSocketType(void) const;
|
String GetSocketType(void) const;
|
||||||
String GetSocketPath(void) const;
|
String GetSocketPath(void) const;
|
||||||
String GetAddress(void) const;
|
String GetHost(void) const;
|
||||||
String GetPort(void) const;
|
String GetPort(void) const;
|
||||||
|
|
||||||
static int GetClientsConnected(void);
|
static int GetClientsConnected(void);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Attribute<String> m_SocketType;
|
Attribute<String> m_SocketType;
|
||||||
Attribute<String> m_SocketPath;
|
Attribute<String> m_SocketPath;
|
||||||
Attribute<String> m_Address;
|
Attribute<String> m_Host;
|
||||||
Attribute<String> m_Port;
|
Attribute<String> m_Port;
|
||||||
|
|
||||||
void ServerThreadProc(const Socket::Ptr& server);
|
void ServerThreadProc(const Socket::Ptr& server);
|
||||||
|
|
|
@ -21,6 +21,6 @@ type LivestatusComponent {
|
||||||
%attribute string "socket_type",
|
%attribute string "socket_type",
|
||||||
|
|
||||||
%attribute string "socket_path",
|
%attribute string "socket_path",
|
||||||
%attribute string "address",
|
%attribute string "host",
|
||||||
%attribute string "port",
|
%attribute string "port",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue