Skip to content

Commit

Permalink
IcingaDB: Log if both instances are responsible
Browse files Browse the repository at this point in the history
First, this scenario should not happen. However, if it may have occurred
due to whatever reasons, Icinga 2 should at least acknowledge it. The
current code simply ignores the possibility that invalid data may be
available in "icingadb:telemetry:heartbeat".
  • Loading branch information
oxzi committed Oct 11, 2024
1 parent 5e9e0bb commit 0e45b0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/icingadb/icingadbchecktask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,17 @@ void IcingadbCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckR
perfdata->Add(new PerfdataValue("icinga2_heartbeat_age", heartbeatLag, false, "seconds", heartbeatLagWarning, Empty, 0));
}

if (weResponsible) {
if (weResponsible && otherResponsible) {
critmsgs << " Both this instance and another instance is responsible!";
} else if (weResponsible) {
idbokmsgs << "\n* Responsible";
} else if (otherResponsible) {
idbokmsgs << "\n* Not responsible, but another instance is";
} else {
critmsgs << " No instance is responsible!";
}

perfdata->Add(new PerfdataValue("icingadb_responsible_instances", int(weResponsible || otherResponsible), false, "", Empty, Empty, 0, 1));
perfdata->Add(new PerfdataValue("icingadb_responsible_instances", int(weResponsible) + int(otherResponsible), false, "", Empty, Empty, 0, 1));

const auto clockDriftWarning (5);
const auto clockDriftCritical (30);
Expand Down

0 comments on commit 0e45b0c

Please sign in to comment.