-/******************************************************************************
- * Icinga 2 *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License *
- * as published by the Free Software Foundation; either version 2 *
- * of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software Foundation *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
- ******************************************************************************/
+/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#include "methods/icingachecktask.hpp"
#include "icinga/cib.hpp"
#include "icinga/icingaapplication.hpp"
#include "icinga/clusterevents.hpp"
#include "icinga/checkable.hpp"
+#include "remote/apilistener.hpp"
#include "base/application.hpp"
#include "base/objectlock.hpp"
#include "base/utility.hpp"
REQUIRE_NOT_NULL(checkable);
REQUIRE_NOT_NULL(cr);
- CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
Host::Ptr host;
Service::Ptr service;
if (service)
resolvers.emplace_back("service", service);
resolvers.emplace_back("host", host);
- resolvers.emplace_back("command", commandObj);
+ resolvers.emplace_back("command", command);
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
String missingIcingaMinVersion;
perfdata->Add(new PerfdataValue("active_service_checks_15min", CIB::GetActiveServiceChecksStatistics(60 * 15)));
perfdata->Add(new PerfdataValue("passive_service_checks_15min", CIB::GetPassiveServiceChecksStatistics(60 * 15)));
- perfdata->Add(new PerfdataValue("current_concurrent_checks", Checkable::GetPendingChecks()));
+ perfdata->Add(new PerfdataValue("current_pending_callbacks", Application::GetTP().GetPending()));
+ perfdata->Add(new PerfdataValue("current_concurrent_checks", Checkable::CurrentConcurrentChecks.load()));
perfdata->Add(new PerfdataValue("remote_check_queue", ClusterEvents::GetCheckRequestQueueSize()));
CheckableCheckStatistics scs = CIB::CalculateServiceCheckStats();
cr->SetState(ServiceWarning);
}
- /* Return an error if the version is less than specified (optional). */
- String parsedAppVersion = appVersion.SubStr(1,5);
+ /* Indicate a warning when the last synced config caused a stage validation error. */
+ ApiListener::Ptr listener = ApiListener::GetInstance();
+
+ if (listener) {
+ Dictionary::Ptr validationResult = listener->GetLastFailedZonesStageValidation();
+ if (validationResult) {
+ output += "; Last zone sync stage validation failed at "
+ + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", validationResult->Get("ts"));
+
+ cr->SetState(ServiceWarning);
+ }
+ }
+
+ String parsedAppVersion = Utility::ParseVersion(appVersion);
+
+ /* Return an error if the version is less than specified (optional). */
if (missingIcingaMinVersion.IsEmpty() && !icingaMinVersion.IsEmpty() && Utility::CompareVersion(icingaMinVersion, parsedAppVersion) < 0) {
output += "; Minimum version " + icingaMinVersion + " is not installed.";
cr->SetState(ServiceCritical);
}
cr->SetOutput(output);
+ cr->SetCommand(command->GetName());
checkable->ProcessCheckResult(cr);
}