mirror of https://github.com/Icinga/icinga2.git
parent
3473731034
commit
4aa0165701
|
@ -100,7 +100,7 @@ void EndpointDbObject::UpdateConnectedStatus(const Endpoint::Ptr& endpoint)
|
||||||
|
|
||||||
int EndpointDbObject::EndpointIsConnected(const Endpoint::Ptr& endpoint)
|
int EndpointDbObject::EndpointIsConnected(const Endpoint::Ptr& endpoint)
|
||||||
{
|
{
|
||||||
unsigned int is_connected = endpoint->IsConnected() ? 1 : 0;
|
unsigned int is_connected = endpoint->GetConnected() ? 1 : 0;
|
||||||
|
|
||||||
/* if identity is equal to node, fake is_connected */
|
/* if identity is equal to node, fake is_connected */
|
||||||
if (endpoint->GetName() == IcingaApplication::GetInstance()->GetNodeName())
|
if (endpoint->GetName() == IcingaApplication::GetInstance()->GetNodeName())
|
||||||
|
|
|
@ -436,7 +436,7 @@ void Checkable::ExecuteCheck()
|
||||||
Dictionary::Ptr macros = new Dictionary();
|
Dictionary::Ptr macros = new Dictionary();
|
||||||
GetCheckCommand()->Execute(this, cr, macros, false);
|
GetCheckCommand()->Execute(this, cr, macros, false);
|
||||||
|
|
||||||
if (endpoint->IsConnected()) {
|
if (endpoint->GetConnected()) {
|
||||||
/* perform check on remote endpoint */
|
/* perform check on remote endpoint */
|
||||||
Dictionary::Ptr message = new Dictionary();
|
Dictionary::Ptr message = new Dictionary();
|
||||||
message->Set("jsonrpc", "2.0");
|
message->Set("jsonrpc", "2.0");
|
||||||
|
|
|
@ -105,7 +105,7 @@ Value EndpointsTable::IsConnectedAccessor(const Value& row)
|
||||||
if (!endpoint)
|
if (!endpoint)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
unsigned int is_connected = endpoint->IsConnected() ? 1 : 0;
|
unsigned int is_connected = endpoint->GetConnected() ? 1 : 0;
|
||||||
|
|
||||||
/* if identity is equal to node, fake is_connected */
|
/* if identity is equal to node, fake is_connected */
|
||||||
if (endpoint->GetName() == IcingaApplication::GetInstance()->GetNodeName())
|
if (endpoint->GetName() == IcingaApplication::GetInstance()->GetNodeName())
|
||||||
|
|
|
@ -84,7 +84,7 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
||||||
double zoneLag = 0;
|
double zoneLag = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, zone->GetEndpoints()) {
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, zone->GetEndpoints()) {
|
||||||
if (endpoint->IsConnected())
|
if (endpoint->GetConnected())
|
||||||
connected = true;
|
connected = true;
|
||||||
|
|
||||||
double eplag = ApiListener::CalculateZoneLag(endpoint);
|
double eplag = ApiListener::CalculateZoneLag(endpoint);
|
||||||
|
|
|
@ -154,7 +154,7 @@ Endpoint::Ptr ApiListener::GetMaster(void) const
|
||||||
std::vector<String> names;
|
std::vector<String> names;
|
||||||
|
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, zone->GetEndpoints())
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, zone->GetEndpoints())
|
||||||
if (endpoint->IsConnected() || endpoint->GetName() == GetIdentity())
|
if (endpoint->GetConnected() || endpoint->GetName() == GetIdentity())
|
||||||
names.push_back(endpoint->GetName());
|
names.push_back(endpoint->GetName());
|
||||||
|
|
||||||
std::sort(names.begin(), names.end());
|
std::sort(names.begin(), names.end());
|
||||||
|
@ -337,7 +337,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
|
||||||
bool need_sync = false;
|
bool need_sync = false;
|
||||||
|
|
||||||
if (endpoint)
|
if (endpoint)
|
||||||
need_sync = !endpoint->IsConnected();
|
need_sync = !endpoint->GetConnected();
|
||||||
|
|
||||||
ClientType ctype;
|
ClientType ctype;
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ void ApiListener::ApiTimerHandler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't try to connect if we're already connected */
|
/* don't try to connect if we're already connected */
|
||||||
if (endpoint->IsConnected()) {
|
if (endpoint->GetConnected()) {
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Not connecting to Endpoint '" << endpoint->GetName()
|
<< "Not connecting to Endpoint '" << endpoint->GetName()
|
||||||
<< "' because we're already connected to it.";
|
<< "' because we're already connected to it.";
|
||||||
|
@ -490,7 +490,7 @@ void ApiListener::ApiTimerHandler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
|
||||||
if (!endpoint->IsConnected())
|
if (!endpoint->GetConnected())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double ts = endpoint->GetRemoteLogPosition();
|
double ts = endpoint->GetRemoteLogPosition();
|
||||||
|
@ -522,7 +522,7 @@ void ApiListener::ApiTimerHandler(void)
|
||||||
|
|
||||||
std::vector<String> names;
|
std::vector<String> names;
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>())
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>())
|
||||||
if (endpoint->IsConnected())
|
if (endpoint->GetConnected())
|
||||||
names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")");
|
names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")");
|
||||||
|
|
||||||
Log(LogNotice, "ApiListener")
|
Log(LogNotice, "ApiListener")
|
||||||
|
@ -615,7 +615,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't relay messages to disconnected endpoints */
|
/* don't relay messages to disconnected endpoints */
|
||||||
if (!endpoint->IsConnected()) {
|
if (!endpoint->GetConnected()) {
|
||||||
if (target_zone == my_zone)
|
if (target_zone == my_zone)
|
||||||
finishedLogZones.erase(target_zone);
|
finishedLogZones.erase(target_zone);
|
||||||
|
|
||||||
|
@ -930,7 +930,7 @@ std::pair<Dictionary::Ptr, Dictionary::Ptr> ApiListener::GetStatus(void)
|
||||||
allEndpoints++;
|
allEndpoints++;
|
||||||
countZoneEndpoints++;
|
countZoneEndpoints++;
|
||||||
|
|
||||||
if (!endpoint->IsConnected()) {
|
if (!endpoint->GetConnected()) {
|
||||||
allNotConnectedEndpoints->Add(endpoint->GetName());
|
allNotConnectedEndpoints->Add(endpoint->GetName());
|
||||||
} else {
|
} else {
|
||||||
allConnectedEndpoints->Add(endpoint->GetName());
|
allConnectedEndpoints->Add(endpoint->GetName());
|
||||||
|
@ -977,7 +977,7 @@ double ApiListener::CalculateZoneLag(const Endpoint::Ptr& endpoint)
|
||||||
double remoteLogPosition = endpoint->GetRemoteLogPosition();
|
double remoteLogPosition = endpoint->GetRemoteLogPosition();
|
||||||
double eplag = Utility::GetTime() - remoteLogPosition;
|
double eplag = Utility::GetTime() - remoteLogPosition;
|
||||||
|
|
||||||
if ((endpoint->GetSyncing() || !endpoint->IsConnected()) && remoteLogPosition != 0)
|
if ((endpoint->GetSyncing() || !endpoint->GetConnected()) && remoteLogPosition != 0)
|
||||||
return eplag;
|
return eplag;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -49,7 +49,7 @@ static void AuthorityTimerHandler(void)
|
||||||
|
|
||||||
std::vector<Endpoint::Ptr> endpoints;
|
std::vector<Endpoint::Ptr> endpoints;
|
||||||
BOOST_FOREACH(const Endpoint::Ptr& endpoint, my_zone->GetEndpoints()) {
|
BOOST_FOREACH(const Endpoint::Ptr& endpoint, my_zone->GetEndpoints()) {
|
||||||
if (!endpoint->IsConnected() && endpoint != my_endpoint)
|
if (!endpoint->GetConnected() && endpoint != my_endpoint)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
endpoints.push_back(endpoint);
|
endpoints.push_back(endpoint);
|
||||||
|
|
|
@ -109,7 +109,7 @@ Zone::Ptr Endpoint::GetZone(void) const
|
||||||
return m_Zone;
|
return m_Zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Endpoint::IsConnected(void) const
|
bool Endpoint::GetConnected(void) const
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_ClientsLock);
|
boost::mutex::scoped_lock lock(m_ClientsLock);
|
||||||
return !m_Clients.empty();
|
return !m_Clients.empty();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
intrusive_ptr<Zone> GetZone(void) const;
|
intrusive_ptr<Zone> GetZone(void) const;
|
||||||
|
|
||||||
bool IsConnected(void) const;
|
virtual bool GetConnected(void) const override;
|
||||||
|
|
||||||
static Endpoint::Ptr GetLocalEndpoint(void);
|
static Endpoint::Ptr GetLocalEndpoint(void);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@ class Endpoint : ConfigObject
|
||||||
|
|
||||||
[no_user_modify] bool connecting;
|
[no_user_modify] bool connecting;
|
||||||
[no_user_modify] bool syncing;
|
[no_user_modify] bool syncing;
|
||||||
|
|
||||||
|
[no_user_modify, no_storage] bool connected {
|
||||||
|
get;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue