[Pkg-nagios-changes] [pkg-icinga2] 01/03: Imported Upstream version 2.3.10
Alexander Wirt
formorer at debian.org
Sun Sep 6 08:51:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
formorer pushed a commit to branch master
in repository pkg-icinga2.
commit 129f6ea6579d1498b20ded503c160f474f122bdc
Author: Alexander Wirt <formorer at debian.org>
Date: Sun Sep 6 10:30:00 2015 +0200
Imported Upstream version 2.3.10
---
CMakeLists.txt | 1 -
ChangeLog | 14 ++++++++
RELEASE.md | 6 ++--
doc/1-about.md | 14 ++++++++
doc/2-getting-started.md | 3 +-
icinga-app/icinga.cpp | 60 +++++++++++++++++++++++++++++----
icinga2.nuspec | 2 +-
icinga2.spec | 2 +-
lib/base/application.cpp | 18 +++++++++-
lib/base/tlsutility.cpp | 2 +-
lib/compat/compatlogger.cpp | 19 +++++------
lib/compat/statusdatawriter.cpp | 2 +-
lib/db_ido/dbevents.cpp | 13 +++----
lib/db_ido/hostdbobject.cpp | 2 +-
lib/db_ido_pgsql/idopgsqlconnection.cpp | 10 +++++-
lib/icinga/checkable-check.cpp | 18 ++++++++--
lib/icinga/checkable-dependency.cpp | 4 +--
lib/icinga/compatutility.cpp | 16 +++++++++
lib/icinga/compatutility.hpp | 2 ++
lib/icinga/dependency.cpp | 26 +++++++-------
lib/icinga/macroprocessor.cpp | 18 +++++-----
lib/icinga/macroprocessor.hpp | 10 +++---
lib/perfdata/gelfwriter.cpp | 2 +-
tools/chocolateyInstall.ps1 | 2 +-
24 files changed, 194 insertions(+), 72 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2723c43..1f0e6c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -228,7 +228,6 @@ set(CPACK_NSIS_EXECUTABLES_DIRECTORY "sbin")
set(CPACK_PACKAGE_EXECUTABLES "Icinga2SetupAgent;Icinga 2 Agent Wizard")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Icinga2SetupAgent")
set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "nsExec::Exec 'net stop icinga2'")
-set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS}\nSleep 10000")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'icacls \\\"$INSTDIR\\\" /grant NetworkService:(oi)(ci)m'")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'icacls \\\"$INSTDIR\\\\etc\\\" /inheritance:r /grant:r NetworkService:(oi)(ci)m /grant:r Administrators:(oi)(ci)f'")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\etc\\\\icinga2\\\\pki'")
diff --git a/ChangeLog b/ChangeLog
index b106903..07ea8a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,20 @@ Please check [doc/1-about.md].
## What's New
+### What's New in Version 2.3.10
+
+#### Features
+
+* Feature 9218: Use the command_endpoint name as check_source value if defined
+
+#### Bugfixes
+
+* Bug 9244: String escape problem with PostgreSQL >= 9.1 and standard_conforming_strings=on
+* Bug 10003: Nested "outer" macro calls fails on (handled) missing "inner" values
+* Bug 10051: Missing fix for reload on Windows in 2.3.9
+* Bug 10058: Wrong calculation for host compat state "UNREACHABLE" in DB IDO
+* Bug 10074: Missing zero padding for generated CA serial.txt
+
### What's New in Version 2.3.9
#### Changes
diff --git a/RELEASE.md b/RELEASE.md
index 7fd89a0..41cde43 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -26,15 +26,15 @@ the changelog.py script. Also generate HTML for the wordpress release announceme
Changelog:
- $ ./changelog.py --version 2.3.9 --project i2
+ $ ./changelog.py --version 2.3.10 --project i2
Docs:
- $ ./changelog.py --version 2.3.9 --project i2 --links
+ $ ./changelog.py --version 2.3.10 --project i2 --links
Wordpress:
- $ ./changelog.py --version 2.3.9 --project i2 --html --links
+ $ ./changelog.py --version 2.3.10 --project i2 --html --links
## Git Tag
diff --git a/doc/1-about.md b/doc/1-about.md
index bbe6ca9..899aaf8 100644
--- a/doc/1-about.md
+++ b/doc/1-about.md
@@ -54,6 +54,20 @@ More details in the [Icinga FAQ](https://www.icinga.org/icinga/faq/).
## <a id="whats-new"></a> What's New
+### What's New in Version 2.3.10
+
+#### Features
+
+* Feature [9218](https://dev.icinga.org/issues/9218 "Feature 9218"): Use the command_endpoint name as check_source value if defined
+
+#### Bugfixes
+
+* Bug [9244](https://dev.icinga.org/issues/9244 "Bug 9244"): String escape problem with PostgreSQL >= 9.1 and standard_conforming_strings=on
+* Bug [10003](https://dev.icinga.org/issues/10003 "Bug 10003"): Nested "outer" macro calls fails on (handled) missing "inner" values
+* Bug [10051](https://dev.icinga.org/issues/10051 "Bug 10051"): Missing fix for reload on Windows in 2.3.9
+* Bug [10058](https://dev.icinga.org/issues/10058 "Bug 10058"): Wrong calculation for host compat state "UNREACHABLE" in DB IDO
+* Bug [10074](https://dev.icinga.org/issues/10074 "Bug 10074"): Missing zero padding for generated CA serial.txt
+
### What's New in Version 2.3.9
#### Changes
diff --git a/doc/2-getting-started.md b/doc/2-getting-started.md
index 0faaf49..02f7664 100644
--- a/doc/2-getting-started.md
+++ b/doc/2-getting-started.md
@@ -408,6 +408,7 @@ RHEL/CentOS 5/6:
RHEL/CentOS 7:
# yum install postgresql-server postgresql
+ # postgresql-setup --initdb
# systemctl enable postgresql
# systemctl start postgresql
@@ -471,7 +472,7 @@ authentication method and restart the postgresql server.
# IPv6 local connections:
host all all ::1/128 ident
- # /etc/init.d/postgresql restart
+ # service postgresql restart
After creating the database and permissions you can import the Icinga 2 IDO
diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp
index 52bba47..c82a517 100644
--- a/icinga-app/icinga.cpp
+++ b/icinga-app/icinga.cpp
@@ -45,8 +45,9 @@ using namespace icinga;
namespace po = boost::program_options;
#ifdef _WIN32
-SERVICE_STATUS l_SvcStatus;
-SERVICE_STATUS_HANDLE l_SvcStatusHandle;
+static SERVICE_STATUS l_SvcStatus;
+static SERVICE_STATUS_HANDLE l_SvcStatusHandle;
+static HANDLE l_Job;
#endif /* _WIN32 */
static std::vector<String> GetLogLevelCompletionSuggestions(const String& arg)
@@ -606,7 +607,7 @@ VOID WINAPI ServiceControlHandler(DWORD dwCtrl)
{
if (dwCtrl == SERVICE_CONTROL_STOP) {
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
- Application::RequestShutdown();
+ TerminateJobObject(l_Job, 0);
}
}
@@ -621,11 +622,58 @@ VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
- int rc = Main();
+ l_Job = CreateJobObject(NULL, NULL);
- ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, rc);
+ for (;;) {
+ LPSTR arg = argv[0];
+ String args;
+ int uargc = Application::GetArgC();
+ char **uargv = Application::GetArgV();
- Application::Exit(rc);
+ args += Utility::EscapeShellArg(Application::GetExePath(uargv[0]));
+
+ for (int i = 2; i < uargc && uargv[i]; i++) {
+ if (args != "")
+ args += " ";
+
+ args += Utility::EscapeShellArg(uargv[i]);
+ }
+
+ STARTUPINFO si = { sizeof(si) };
+ PROCESS_INFORMATION pi;
+
+ char *uargs = strdup(args.CStr());
+
+ BOOL res = CreateProcess(NULL, uargs, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+
+ free(uargs);
+
+ if (!res)
+ break;
+
+ CloseHandle(pi.hThread);
+
+ AssignProcessToJobObject(l_Job, pi.hProcess);
+
+ if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_OBJECT_0)
+ break;
+
+ DWORD exitStatus;
+
+ if (!GetExitCodeProcess(pi.hProcess, &exitStatus))
+ break;
+
+ if (exitStatus != 7)
+ break;
+ }
+
+ TerminateJobObject(l_Job, 0);
+
+ CloseHandle(l_Job);
+
+ ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
+
+ Application::Exit(0);
}
#endif /* _WIN32 */
diff --git a/icinga2.nuspec b/icinga2.nuspec
index 833f3df..8d1ebe8 100755
--- a/icinga2.nuspec
+++ b/icinga2.nuspec
@@ -6,7 +6,7 @@
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>icinga2</id>
<title>Icinga2</title>
- <version>2.3.9</version>
+ <version>2.3.10</version>
<authors>2015 - The Icinga Project</authors>
<owners>Icinga Development Team</owners>
<summary>icinga2 - Monitoring Agent for Windows</summary>
diff --git a/icinga2.spec b/icinga2.spec
index 9f85a1b..5c3846a 100644
--- a/icinga2.spec
+++ b/icinga2.spec
@@ -66,7 +66,7 @@
Summary: Network monitoring application
Name: icinga2
-Version: 2.3.9
+Version: 2.3.10
Release: %{revision}%{?dist}
License: GPL-2.0+
Group: Applications/System
diff --git a/lib/base/application.cpp b/lib/base/application.cpp
index 81c8efa..84a5616 100644
--- a/lib/base/application.cpp
+++ b/lib/base/application.cpp
@@ -327,11 +327,22 @@ void Application::OnShutdown(void)
/* Nothing to do here. */
}
-static void ReloadProcessCallback(const ProcessResult& pr)
+static void ReloadProcessCallbackInternal(const ProcessResult& pr)
{
if (pr.ExitStatus != 0)
Log(LogCritical, "Application", "Found error in config: reloading aborted");
+#ifdef _WIN32
+ else
+ Application::Exit(7); /* keep this exit code in sync with icinga-app */
+#endif /* _WIN32 */
+}
+
+static void ReloadProcessCallback(const ProcessResult& pr)
+{
l_Restarting = false;
+
+ boost::thread t(boost::bind(&ReloadProcessCallbackInternal, pr));
+ t.detach();
}
pid_t Application::StartReloadProcess(void)
@@ -348,8 +359,13 @@ pid_t Application::StartReloadProcess(void)
else
i++; // the next parameter after --reload-internal is the pid, remove that too
}
+
+#ifndef _WIN32
args->Add("--reload-internal");
args->Add(Convert::ToString(Utility::GetPid()));
+#else /* _WIN32 */
+ args->Add("--validate");
+#endif /* _WIN32 */
Process::Ptr process = new Process(Process::PrepareCommand(args));
process->SetTimeout(300);
diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp
index 81ce1f5..1f40bda 100644
--- a/lib/base/tlsutility.cpp
+++ b/lib/base/tlsutility.cpp
@@ -394,7 +394,7 @@ boost::shared_ptr<X509> CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NA
std::ofstream ofp;
ofp.open(serialfile.CStr());
- ofp << std::hex << serial + 1;
+ ofp << std::hex << std::setw(2) << std::setfill('0') << serial + 1;
ofp.close();
if (ofp.fail())
diff --git a/lib/compat/compatlogger.cpp b/lib/compat/compatlogger.cpp
index 4d88edb..92c0e21 100644
--- a/lib/compat/compatlogger.cpp
+++ b/lib/compat/compatlogger.cpp
@@ -117,21 +117,18 @@ void CompatLogger::CheckResultHandler(const Checkable::Ptr& checkable, const Che
msgbuf << "SERVICE ALERT: "
<< host->GetName() << ";"
<< service->GetShortName() << ";"
- << Service::StateToString(static_cast<ServiceState>(state_after)) << ";"
- << Service::StateTypeToString(static_cast<StateType>(stateType_after)) << ";"
+ << Service::StateToString(service->GetState()) << ";"
+ << Service::StateTypeToString(service->GetStateType()) << ";"
<< attempt_after << ";"
<< output << ""
<< "";
} else {
String state = Host::StateToString(Host::CalculateState(static_cast<ServiceState>(state_after)));
- if (!reachable_after)
- state = "UNREACHABLE";
-
msgbuf << "HOST ALERT: "
<< host->GetName() << ";"
- << state << ";"
- << Host::StateTypeToString(static_cast<StateType>(stateType_after)) << ";"
+ << CompatUtility::GetHostStateString(host) << ";"
+ << Host::StateTypeToString(host->GetStateType()) << ";"
<< attempt_after << ";"
<< output << ""
<< "";
@@ -246,7 +243,7 @@ void CompatLogger::NotificationSentHandler(const Notification::Ptr& notification
if (service)
notification_type_str = Service::StateToString(service->GetState());
else
- notification_type_str = host->IsReachable() ? Host::StateToString(host->GetState()) : "UNREACHABLE";
+ notification_type_str = CompatUtility::GetHostStateString(host);
}
String author_comment = "";
@@ -278,7 +275,7 @@ void CompatLogger::NotificationSentHandler(const Notification::Ptr& notification
<< user->GetName() << ";"
<< host->GetName() << ";"
<< notification_type_str << " "
- << "(" << (host->IsReachable() ? Host::StateToString(host->GetState()) : "UNREACHABLE") << ");"
+ << "(" << CompatUtility::GetHostStateString(host) << ");"
<< command_name << ";"
<< output << ";"
<< author_comment
@@ -385,7 +382,7 @@ void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
} else {
msgbuf << "HOST EVENT HANDLER: "
<< host->GetName() << ";"
- << (host->IsReachable() ? Host::StateToString(host->GetState()) : "UNREACHABLE") << ";"
+ << CompatUtility::GetHostStateString(host) << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< current_attempt << ";"
<< event_command_name;
@@ -462,7 +459,7 @@ void CompatLogger::ReopenFile(bool rotate)
std::ostringstream msgbuf;
msgbuf << "CURRENT HOST STATE: "
<< host->GetName() << ";"
- << (host->IsReachable() ? Host::StateToString(host->GetState()) : "UNREACHABLE") << ";"
+ << CompatUtility::GetHostStateString(host) << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< host->GetCheckAttempt() << ";"
<< output << "";
diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp
index 2e33380..4f1e77b 100644
--- a/lib/compat/statusdatawriter.cpp
+++ b/lib/compat/statusdatawriter.cpp
@@ -355,7 +355,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
fp << "\t" << "current_state=" << service->GetState() << "\n"
<< "\t" << "last_hard_state=" << service->GetLastHardState() << "\n";
} else {
- fp << "\t" << "current_state=" << (host->IsReachable() ? host->GetState() : 2) << "\n"
+ fp << "\t" << "current_state=" << CompatUtility::GetHostCurrentState(host) << "\n"
<< "\t" << "last_hard_state=" << host->GetLastHardState() << "\n";
}
diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp
index 3453ac6..4af8828 100644
--- a/lib/db_ido/dbevents.cpp
+++ b/lib/db_ido/dbevents.cpp
@@ -992,8 +992,8 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
msgbuf << "SERVICE ALERT: "
<< host->GetName() << ";"
<< service->GetShortName() << ";"
- << Service::StateToString(static_cast<ServiceState>(state_after)) << ";"
- << Service::StateTypeToString(static_cast<StateType>(stateType_after)) << ";"
+ << Service::StateToString(service->GetState()) << ";"
+ << Service::StateTypeToString(service->GetStateType()) << ";"
<< attempt_after << ";"
<< output << ""
<< "";
@@ -1017,15 +1017,10 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
return;
}
} else {
- String state = Host::StateToString(Host::CalculateState(static_cast<ServiceState>(state_after)));
-
- if (!reachable_after)
- state = "UNREACHABLE";
-
msgbuf << "HOST ALERT: "
<< host->GetName() << ";"
- << state << ";"
- << Service::StateTypeToString(static_cast<StateType>(stateType_after)) << ";"
+ << CompatUtility::GetHostStateString(host) << ";"
+ << Host::StateTypeToString(host->GetStateType()) << ";"
<< attempt_after << ";"
<< output << ""
<< "";
diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp
index 3210c30..919061c 100644
--- a/lib/db_ido/hostdbobject.cpp
+++ b/lib/db_ido/hostdbobject.cpp
@@ -122,7 +122,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const
fields->Set("check_source", cr->GetCheckSource());
}
- fields->Set("current_state", host->IsReachable() ? host->GetState() : 2);
+ fields->Set("current_state", CompatUtility::GetHostCurrentState(host));
fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(host));
fields->Set("should_be_scheduled", host->GetEnableActiveChecks());
fields->Set("current_check_attempt", host->GetCheckAttempt());
diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp
index fca4e8f..2908ca8 100644
--- a/lib/db_ido_pgsql/idopgsqlconnection.cpp
+++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp
@@ -217,8 +217,16 @@ void IdoPgsqlConnection::Reconnect(void)
BOOST_THROW_EXCEPTION(std::runtime_error(message));
}
+ IdoPgsqlResult result;
+
+ /* explicitely require legacy mode for string escaping in PostgreSQL >= 9.1
+ * changing standard_conforming_strings to on by default
+ */
+ if (PQserverVersion(m_Connection) >= 90100)
+ result = Query("SET standard_conforming_strings TO off");
+
String dbVersionName = "idoutils";
- IdoPgsqlResult result = Query("SELECT version FROM " + GetTablePrefix() + "dbversion WHERE name=E'" + Escape(dbVersionName) + "'");
+ result = Query("SELECT version FROM " + GetTablePrefix() + "dbversion WHERE name=E'" + Escape(dbVersionName) + "'");
Dictionary::Ptr row = FetchRow(result, 0);
diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp
index 13f0b28..f2b1e75 100644
--- a/lib/icinga/checkable-check.cpp
+++ b/lib/icinga/checkable-check.cpp
@@ -255,13 +255,27 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (cr->GetExecutionEnd() == 0)
cr->SetExecutionEnd(now);
- if (origin.IsLocal())
+ if (origin.IsLocal()) {
+ Log(LogDebug, "Checkable")
+ << "No origin or local origin for object '" << GetName()
+ << "', setting " << IcingaApplication::GetInstance()->GetNodeName()
+ << " as check_source.";
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
+ }
Endpoint::Ptr command_endpoint = GetCommandEndpoint();
+ /* override check source if command_endpoint was defined */
+ if (command_endpoint && !GetExtension("agent_check")) {
+ Log(LogDebug, "Checkable")
+ << "command_endpoint found for object '" << GetName()
+ << "', setting " << command_endpoint->GetName()
+ << " as check_source.";
+ cr->SetCheckSource(command_endpoint->GetName());
+ }
+
+ /* agent checks go through the api */
if (command_endpoint && GetExtension("agent_check")) {
- /* agent checks go through the api */
ApiListener::Ptr listener = ApiListener::GetInstance();
if (listener) {
diff --git a/lib/icinga/checkable-dependency.cpp b/lib/icinga/checkable-dependency.cpp
index 89f2a96..f3769fa 100644
--- a/lib/icinga/checkable-dependency.cpp
+++ b/lib/icinga/checkable-dependency.cpp
@@ -69,8 +69,8 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
return false;
}
- BOOST_FOREACH(const Checkable::Ptr& service, GetParents()) {
- if (!service->IsReachable(dt, failedDependency, rstack + 1))
+ BOOST_FOREACH(const Checkable::Ptr& checkable, GetParents()) {
+ if (!checkable->IsReachable(dt, failedDependency, rstack + 1))
return false;
}
diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp
index b88aafe..d30a289 100644
--- a/lib/icinga/compatutility.cpp
+++ b/lib/icinga/compatutility.cpp
@@ -81,6 +81,22 @@ String CompatUtility::GetCommandName(const Command::Ptr command)
}
/* host */
+int CompatUtility::GetHostCurrentState(const Host::Ptr& host)
+{
+ if (host->GetState() != HostUp && !host->IsReachable())
+ return 2; /* hardcoded compat state */
+
+ return host->GetState();
+}
+
+String CompatUtility::GetHostStateString(const Host::Ptr& host)
+{
+ if (host->GetState() != HostUp && !host->IsReachable())
+ return "UNREACHABLE"; /* hardcoded compat state */
+
+ return Host::StateToString(host->GetState());
+}
+
String CompatUtility::GetHostAlias(const Host::Ptr& host)
{
if (!host->GetDisplayName().IsEmpty())
diff --git a/lib/icinga/compatutility.hpp b/lib/icinga/compatutility.hpp
index 5ee326c..d97b467 100644
--- a/lib/icinga/compatutility.hpp
+++ b/lib/icinga/compatutility.hpp
@@ -44,6 +44,8 @@ public:
static String GetCommandName(const Command::Ptr command);
/* host */
+ static int GetHostCurrentState(const Host::Ptr& host);
+ static String GetHostStateString(const Host::Ptr& host);
static String GetHostAlias(const Host::Ptr& host);
static int GetHostNotifyOnDown(const Host::Ptr& host);
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
diff --git a/lib/icinga/dependency.cpp b/lib/icinga/dependency.cpp
index 214b16d..bd203ac 100644
--- a/lib/icinga/dependency.cpp
+++ b/lib/icinga/dependency.cpp
@@ -113,21 +113,21 @@ bool Dependency::IsAvailable(DependencyType dt) const
{
Checkable::Ptr parent = GetParent();
- Host::Ptr host;
- Service::Ptr service;
- tie(host, service) = GetHostService(parent);
+ Host::Ptr parentHost;
+ Service::Ptr parentService;
+ tie(parentHost, parentService) = GetHostService(parent);
/* ignore if it's the same checkable object */
if (parent == GetChild()) {
Log(LogNotice, "Dependency")
- << "Dependency '" << GetName() << "' passed: Parent and child " << (service ? "service" : "host") << " are identical.";
+ << "Dependency '" << GetName() << "' passed: Parent and child " << (parentService ? "service" : "host") << " are identical.";
return true;
}
/* ignore pending */
if (!parent->GetLastCheckResult()) {
Log(LogNotice, "Dependency")
- << "Dependency '" << GetName() << "' passed: " << (service ? "Service" : "Host") << " '" << parent->GetName() << "' hasn't been checked yet.";
+ << "Dependency '" << GetName() << "' passed: Parent " << (parentService ? "service" : "host") << " '" << parent->GetName() << "' hasn't been checked yet.";
return true;
}
@@ -135,25 +135,25 @@ bool Dependency::IsAvailable(DependencyType dt) const
/* ignore soft states */
if (parent->GetStateType() == StateTypeSoft) {
Log(LogNotice, "Dependency")
- << "Dependency '" << GetName() << "' passed: " << (service ? "Service" : "Host") << " '" << parent->GetName() << "' is in a soft state.";
+ << "Dependency '" << GetName() << "' passed: Parent " << (parentService ? "service" : "host") << " '" << parent->GetName() << "' is in a soft state.";
return true;
}
} else {
Log(LogNotice, "Dependency")
- << "Dependency '" << GetName() << "' failed: " << (service ? "Service" : "Host") << " '" << parent->GetName() << "' is in a soft state.";
+ << "Dependency '" << GetName() << "' failed: Parent " << (parentService ? "service" : "host") << " '" << parent->GetName() << "' is in a soft state.";
}
int state;
- if (service)
- state = ServiceStateToFilter(service->GetState());
+ if (parentService)
+ state = ServiceStateToFilter(parentService->GetState());
else
- state = HostStateToFilter(host->GetState());
+ state = HostStateToFilter(parentHost->GetState());
/* check state */
if (state & GetStateFilter()) {
Log(LogNotice, "Dependency")
- << "Dependency '" << GetName() << "' passed: " << (service ? "Service" : "Host") << " '" << parent->GetName() << "' matches state filter.";
+ << "Dependency '" << GetName() << "' passed: Parent " << (parentService ? "service" : "host") << " '" << parent->GetName() << "' matches state filter.";
return true;
}
@@ -177,8 +177,8 @@ bool Dependency::IsAvailable(DependencyType dt) const
Log(LogNotice, "Dependency")
<< "Dependency '" << GetName() << "' failed. Parent "
- << (service ? "service" : "host") << " '" << parent->GetName() << "' is "
- << (service ? Service::StateToString(service->GetState()) : Host::StateToString(host->GetState()));
+ << (parentService ? "service" : "host") << " '" << parent->GetName() << "' is "
+ << (parentService ? Service::StateToString(parentService->GetState()) : Host::StateToString(parentHost->GetState()));
return false;
}
diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp
index e6a7225..0cf7c92 100644
--- a/lib/icinga/macroprocessor.cpp
+++ b/lib/icinga/macroprocessor.cpp
@@ -78,7 +78,7 @@ Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolv
result = resultDict;
} else if (str.IsObjectType<Function>()) {
- result = EvaluateFunction(str, resolvers, cr, missingMacro, escapeFn, resolvedMacros, useResolvedMacros, 0);
+ result = EvaluateFunction(str, resolvers, cr, escapeFn, resolvedMacros, useResolvedMacros, 0);
} else {
BOOST_THROW_EXCEPTION(std::invalid_argument("Macro is not a string or array."));
}
@@ -175,21 +175,21 @@ bool MacroProcessor::ResolveMacro(const String& macro, const ResolverList& resol
}
Value MacroProcessor::InternalResolveMacrosShim(const std::vector<Value>& args, const ResolverList& resolvers,
- const CheckResult::Ptr& cr, String *missingMacro,
- const MacroProcessor::EscapeCallback& escapeFn, const Dictionary::Ptr& resolvedMacros,
+ const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn, const Dictionary::Ptr& resolvedMacros,
bool useResolvedMacros, int recursionLevel)
{
if (args.size() < 1)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function"));
- return MacroProcessor::InternalResolveMacros(args[0], resolvers, cr, missingMacro, escapeFn,
+ String missingMacro;
+
+ return MacroProcessor::InternalResolveMacros(args[0], resolvers, cr, &missingMacro, escapeFn,
resolvedMacros, useResolvedMacros, recursionLevel);
}
Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const ResolverList& resolvers,
- const CheckResult::Ptr& cr, String *missingMacro,
- const MacroProcessor::EscapeCallback& escapeFn, const Dictionary::Ptr& resolvedMacros,
- bool useResolvedMacros, int recursionLevel)
+ const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn,
+ const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel)
{
Dictionary::Ptr resolvers_this = new Dictionary();
@@ -198,7 +198,7 @@ Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const Resolver
}
resolvers_this->Set("macro", new Function(boost::bind(&MacroProcessor::InternalResolveMacrosShim,
- _1, boost::cref(resolvers), cr, missingMacro, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros,
+ _1, boost::cref(resolvers), cr, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros,
recursionLevel + 1)));
ScriptFrame frame(resolvers_this);
@@ -249,7 +249,7 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis
}
if (resolved_macro.IsObjectType<Function>()) {
- resolved_macro = EvaluateFunction(resolved_macro, resolvers, cr, missingMacro, escapeFn,
+ resolved_macro = EvaluateFunction(resolved_macro, resolvers, cr, escapeFn,
resolvedMacros, useResolvedMacros, recursionLevel);
}
diff --git a/lib/icinga/macroprocessor.hpp b/lib/icinga/macroprocessor.hpp
index a603fca..54a0824 100644
--- a/lib/icinga/macroprocessor.hpp
+++ b/lib/icinga/macroprocessor.hpp
@@ -60,13 +60,11 @@ private:
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros,
int recursionLevel = 0);
static Value InternalResolveMacrosShim(const std::vector<Value>& args, const ResolverList& resolvers,
- const CheckResult::Ptr& cr, String *missingMacro,
- const MacroProcessor::EscapeCallback& escapeFn, const Dictionary::Ptr& resolvedMacros,
- bool useResolvedMacros, int recursionLevel);
+ const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn,
+ const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel);
static Value EvaluateFunction(const Function::Ptr& func, const ResolverList& resolvers,
- const CheckResult::Ptr& cr, String *missingMacro,
- const MacroProcessor::EscapeCallback& escapeFn, const Dictionary::Ptr& resolvedMacros,
- bool useResolvedMacros, int recursionLevel);
+ const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn,
+ const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel);
};
diff --git a/lib/perfdata/gelfwriter.cpp b/lib/perfdata/gelfwriter.cpp
index f05af55..f6c6772 100644
--- a/lib/perfdata/gelfwriter.cpp
+++ b/lib/perfdata/gelfwriter.cpp
@@ -149,7 +149,7 @@ void GelfWriter::NotificationToUserHandler(const Notification::Ptr& notification
fields->Set("short_message", output);
} else {
fields->Set("_type", "HOST NOTIFICATION");
- fields->Set("short_message", "(" + (host->IsReachable() ? Host::StateToString(host->GetState()) : String("UNREACHABLE")) + ")");
+ fields->Set("short_message", "(" + CompatUtility::GetHostStateString(host) + ")");
}
fields->Set("_state", service ? Service::StateToString(service->GetState()) : Host::StateToString(host->GetState()));
diff --git a/tools/chocolateyInstall.ps1 b/tools/chocolateyInstall.ps1
index ef36b6f..be4e5de 100755
--- a/tools/chocolateyInstall.ps1
+++ b/tools/chocolateyInstall.ps1
@@ -1,6 +1,6 @@
$packageName = 'icinga2'
$installerType = 'exe'
-$url = 'http://packages.icinga.org/windows/Icinga2-v2.3.8.exe'
+$url = 'http://packages.icinga.org/windows/Icinga2-v2.3.10.exe'
$silentArgs = '/S'
$validExitCodes = @(0)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-icinga2.git
More information about the Pkg-nagios-changes
mailing list