From: Gunnar Beutner Date: Thu, 12 Mar 2015 10:51:02 +0000 (+0100) Subject: Improve output for the ido check task X-Git-Tag: v2.4.0~839 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52b33f560f69a85595146c0ba99e1eadefc675b2;p=icinga2 Improve output for the ido check task refs #8688 --- diff --git a/lib/db_ido/db_ido-check.conf b/lib/db_ido/db_ido-check.conf index 5994733d9..510c7a6e7 100644 --- a/lib/db_ido/db_ido-check.conf +++ b/lib/db_ido/db_ido-check.conf @@ -18,7 +18,7 @@ ******************************************************************************/ template CheckCommand "ido-check-command" { - execute = IdoCheck + execute = IdoCheck } object CheckCommand "ido" { diff --git a/lib/db_ido/idochecktask.cpp b/lib/db_ido/idochecktask.cpp index 5a077596c..b5d51c990 100644 --- a/lib/db_ido/idochecktask.cpp +++ b/lib/db_ido/idochecktask.cpp @@ -58,6 +58,13 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult if (resolvedMacros && !useResolvedMacros) return; + if (idoType.IsEmpty()) { + cr->SetOutput("Macro 'ido_type' must be set."); + cr->SetState(ServiceUnknown); + checkable->ProcessCheckResult(cr); + return; + } + String idoName = MacroProcessor::ResolveMacros("$ido_name$", resolvers, checkable->GetLastCheckResult(), NULL, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros); @@ -87,9 +94,14 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult double qps = conn->GetQueryCount(60) / 60.0; - if (!conn->GetConnected() && conn->GetShouldConnect()) { - cr->SetOutput("Could not connect to the database server."); - cr->SetState(ServiceCritical); + if (!conn->GetConnected()) { + if (conn->GetShouldConnect()) { + cr->SetOutput("Could not connect to the database server."); + cr->SetState(ServiceCritical); + } else { + cr->SetOutput("Not currently enabled: Another cluster instance is responsible for the IDO database."); + cr->SetState(ServciceOK); + } } else { String schema_version = conn->GetSchemaVersion();