mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-30 09:04:35 +02:00
parent
721483e0b2
commit
3211756656
@ -40,7 +40,7 @@ void GelfWriter::Start(void)
|
|||||||
{
|
{
|
||||||
DynamicObject::Start();
|
DynamicObject::Start();
|
||||||
|
|
||||||
m_ReconnectTimer = make_shared<Timer>();
|
m_ReconnectTimer = new Timer();
|
||||||
m_ReconnectTimer->SetInterval(10);
|
m_ReconnectTimer->SetInterval(10);
|
||||||
m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&GelfWriter::ReconnectTimerHandler, this));
|
m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&GelfWriter::ReconnectTimerHandler, this));
|
||||||
m_ReconnectTimer->Start();
|
m_ReconnectTimer->Start();
|
||||||
@ -59,7 +59,7 @@ void GelfWriter::ReconnectTimerHandler(void)
|
|||||||
if (m_Stream)
|
if (m_Stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TcpSocket::Ptr socket = make_shared<TcpSocket>();
|
TcpSocket::Ptr socket = new TcpSocket();
|
||||||
|
|
||||||
Log(LogNotice, "GelfWriter")
|
Log(LogNotice, "GelfWriter")
|
||||||
<< "Reconnecting to GELF endpoint '" << GetHost() << "' port '" << GetPort() << "'.";
|
<< "Reconnecting to GELF endpoint '" << GetHost() << "' port '" << GetPort() << "'.";
|
||||||
@ -72,14 +72,14 @@ void GelfWriter::ReconnectTimerHandler(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Stream = make_shared<NetworkStream>(socket);
|
m_Stream = new NetworkStream(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GelfWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr)
|
void GelfWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr)
|
||||||
{
|
{
|
||||||
CONTEXT("GELF Processing check result for '" + checkable->GetName() + "'");
|
CONTEXT("GELF Processing check result for '" + checkable->GetName() + "'");
|
||||||
|
|
||||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
Dictionary::Ptr fields = new Dictionary();
|
||||||
Service::Ptr service = dynamic_pointer_cast<Service>(checkable);
|
Service::Ptr service = dynamic_pointer_cast<Service>(checkable);
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ void GelfWriter::NotificationToUserHandler(const Notification::Ptr& notification
|
|||||||
if (cr)
|
if (cr)
|
||||||
output = CompatUtility::GetCheckResultOutput(cr);
|
output = CompatUtility::GetCheckResultOutput(cr);
|
||||||
|
|
||||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
Dictionary::Ptr fields = new Dictionary();
|
||||||
if (service) {
|
if (service) {
|
||||||
host = service->GetHost();
|
host = service->GetHost();
|
||||||
fields->Set("_type", "SERVICE NOTIFICATION");
|
fields->Set("_type", "SERVICE NOTIFICATION");
|
||||||
@ -145,7 +145,7 @@ void GelfWriter::StateChangeHandler(const Checkable::Ptr& checkable, const Check
|
|||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
Dictionary::Ptr fields = new Dictionary();
|
||||||
fields->Set("_state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
|
fields->Set("_state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
|
||||||
fields->Set("_type", "STATE CHANGE");
|
fields->Set("_type", "STATE CHANGE");
|
||||||
fields->Set("_current_check_attempt", checkable->GetCheckAttempt());
|
fields->Set("_current_check_attempt", checkable->GetCheckAttempt());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user