MCPcopy Create free account
hub / github.com/Icinga/icinga2 / EventCommandHandler

Method EventCommandHandler

lib/compat/compatlogger.cpp:405–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
406{
407 Host::Ptr host;
408 Service::Ptr service;
409 tie(host, service) = GetHostService(checkable);
410
411 EventCommand::Ptr event_command = checkable->GetEventCommand();
412 String event_command_name = event_command->GetName();
413 long current_attempt = checkable->GetCheckAttempt();
414
415 std::ostringstream msgbuf;
416
417 if (service) {
418 msgbuf << "SERVICE EVENT HANDLER: "
419 << host->GetName() << ";"
420 << service->GetShortName() << ";"
421 << Service::StateToString(service->GetState()) << ";"
422 << Checkable::StateTypeToString(service->GetStateType()) << ";"
423 << current_attempt << ";"
424 << event_command_name;
425 } else {
426 msgbuf << "HOST EVENT HANDLER: "
427 << host->GetName() << ";"
428 << GetHostStateString(host) << ";"
429 << Checkable::StateTypeToString(host->GetStateType()) << ";"
430 << current_attempt << ";"
431 << event_command_name;
432 }
433
434 {
435 ObjectLock oLock(this);
436 WriteLine(msgbuf.str());
437 Flush();
438 }
439}
440
441String CompatLogger::GetHostStateString(const Host::Ptr& host)
442{

Callers

nothing calls this directly

Calls 3

GetEventCommandMethod · 0.80
GetNameMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected