[Pkg-nagios-changes] [pkg-icinga2] 01/04: Imported Upstream version 2.3.1

Alexander Wirt formorer at debian.org
Thu Mar 12 14:05:14 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 730bfc722c4e9eaba1f356059f7881c6cf1a9732
Author: Alexander Wirt <formorer at debian.org>
Date:   Thu Mar 12 13:31:28 2015 +0100

    Imported Upstream version 2.3.1
---
 ChangeLog                               | 24 +++++++++++++++++++
 INSTALL.md                              | 22 ++++++++---------
 doc/1-about.md                          | 24 +++++++++++++++++++
 doc/12-distributed-monitoring-ha.md     | 13 +++++-----
 doc/2-getting-started.md                |  2 +-
 doc/20-library-reference.md             | 14 +++++++++++
 doc/3-monitoring-basics.md              | 42 +++++++++++++++++++++++++--------
 doc/7-icinga-template-library.md        |  9 +++++--
 icinga-app/icinga.cpp                   |  2 +-
 icinga2.spec                            |  2 +-
 itl/command-plugins.conf                |  6 +++--
 lib/base/application.cpp                | 28 +++++++++++++++-------
 lib/base/application.hpp                |  3 +--
 lib/base/process.cpp                    |  9 +++++--
 lib/base/string-script.cpp              |  8 +++++++
 lib/config/config_lexer.ll              |  4 +++-
 lib/config/config_parser.yy             |  4 ++--
 lib/db_ido_mysql/idomysqlconnection.cpp |  6 ++---
 lib/db_ido_pgsql/idopgsqlconnection.cpp |  6 ++---
 lib/remote/apiclient-heartbeat.cpp      |  6 +++--
 lib/remote/apiclient.cpp                |  5 +++-
 lib/remote/apiclient.hpp                |  1 +
 lib/remote/apilistener.cpp              |  2 +-
 test/config/8063.conf                   | 42 +++++++++++++++++++++++++--------
 24 files changed, 212 insertions(+), 72 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6cde915..a62ae0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,30 @@ Please check [doc/1-about.md].
 
 ## What's New
 
+### What's New in Version 2.3.1
+
+#### Changes
+
+* Bugfixes
+
+Please note that this version fixes the default thresholds for the disk check which were inadvertently broken in 2.3.0; if you're using percent-based custom thresholds you will need to add the '%' sign to your custom attributes
+
+#### Issues
+
+* Feature 8659: Implement String#contains
+
+* Bug 8540: Kill signal sent only to check process, not whole process group
+* Bug 8657: Missing program name in 'icinga2 --version'
+* Bug 8658: Fix check_disk thresholds: make sure partitions are the last arguments
+* Bug 8672: Api heartbeat message response time problem
+* Bug 8673: Fix check_disk default thresholds and document the change of unit
+* Bug 8679: Config validation fail because of unexpected new-line
+* Bug 8680: Update documentation for DB IDO HA Run-Once
+* Bug 8683: Make sure that the /var/log/icinga2/crash directory exists
+* Bug 8684: Fix formatting for the GDB stacktrace
+* Bug 8687: Crash in Dependency::Stop
+* Bug 8691: Debian packages do not create /var/log/icinga2/crash
+
 ### What's New in Version 2.3.0
 
 #### Changes
diff --git a/INSTALL.md b/INSTALL.md
index cb8743a..ff5f7e9 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -95,29 +95,29 @@ Push the tag.
 
     $ git push --tags
 
-Merge the "master" branch into the "support/2.2" branch (using --ff-only).
+Merge the "master" branch into the "support/2.3" branch (using --ff-only).
 
-    $ git checkout support/2.2
+    $ git checkout support/2.3
     $ git merge --ff-only master
-    $ git push origin support/2.2
+    $ git push origin support/2.3
 
 Note: CMake determines the Icinga 2 version number using `git describe` if the
 source directory is contained in a Git repository. Otherwise the version number
 is extracted from the [icinga2.spec](icinga2.spec) file. This behavior can be overridden by
 creating a file called `icinga-version.h.force` in the source directory.
-Alternatively the `-DICINGA2_GIT_VERSION_INFO=ON option` for CMake can be used to
+Alternatively the `-DICINGA2_GIT_VERSION_INFO=OFF` option for CMake can be used to
 disable the usage of `git describe`.
 
 ### Build Tarball
 
 Use `git archive` to build the release tarball:
 
-    $ VERSION=2.3.0
+    $ VERSION=2.3.1
     $ git archive --format=tar --prefix=icinga2-$VERSION/ tags/v$VERSION | gzip >icinga2-$VERSION.tar.gz
 
 Finally you should verify that the tarball only contains the files it should contain:
 
-    $ VERSION=2.3.0
+    $ VERSION=2.3.1
     $ tar ztf icinga2-$VERSION.tar.gz | less
 
 
@@ -186,11 +186,11 @@ Icinga 2 comes with a single binary that takes care of loading all the relevant
 components (e.g. for check execution, notifications, etc.):
 
     # /usr/sbin/icinga2 daemon
-    [2014-12-18 10:20:49 +0100] information/cli: Icinga application loader (version: v2.2.2)
-    [2014-12-18 10:20:49 +0100] information/cli: Loading application type: icinga/IcingaApplication
-    [2014-12-18 10:20:49 +0100] information/Utility: Loading library 'libicinga.so'
-    [2014-12-18 10:20:49 +0100] information/ConfigCompiler: Compiling config file: /home/gbeutner/i2/etc/icinga2/icinga2.conf
-    [2014-12-18 10:20:49 +0100] information/ConfigCompiler: Compiling config file: /home/gbeutner/i2/etc/icinga2/constants.conf
+    [2015-03-12 13:25:56 +0100] information/cli: Icinga application loader (version: v2.3.0-20-ga4d3713; debug)
+    [2015-03-12 13:25:56 +0100] information/cli: Loading application type: icinga/IcingaApplication
+    [2015-03-12 13:25:56 +0100] information/Utility: Loading library 'libicinga.dylib'
+    [2015-03-12 13:25:56 +0100] information/ConfigCompiler: Compiling config file: /Users/gunnar/i2/etc/icinga2/icinga2.conf
+    [2015-03-12 13:25:56 +0100] information/ConfigCompiler: Compiling config file: /Users/gunnar/i2/etc/icinga2/constants.conf
     ...
 
 Icinga 2 can be started as daemon using the provided init script:
diff --git a/doc/1-about.md b/doc/1-about.md
index e452553..05fe793 100644
--- a/doc/1-about.md
+++ b/doc/1-about.md
@@ -54,6 +54,30 @@ 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.1
+
+#### Changes
+
+* Bugfixes
+
+Please note that this version fixes the default thresholds for the disk check which were inadvertently broken in 2.3.0; if you're using percent-based custom thresholds you will need to add the '%' sign to your custom attributes
+
+#### Issues
+
+* Feature 8659: Implement String#contains
+
+* Bug 8540: Kill signal sent only to check process, not whole process group
+* Bug 8657: Missing program name in 'icinga2 --version'
+* Bug 8658: Fix check_disk thresholds: make sure partitions are the last arguments
+* Bug 8672: Api heartbeat message response time problem
+* Bug 8673: Fix check_disk default thresholds and document the change of unit
+* Bug 8679: Config validation fail because of unexpected new-line
+* Bug 8680: Update documentation for DB IDO HA Run-Once
+* Bug 8683: Make sure that the /var/log/icinga2/crash directory exists
+* Bug 8684: Fix formatting for the GDB stacktrace
+* Bug 8687: Crash in Dependency::Stop
+* Bug 8691: Debian packages do not create /var/log/icinga2/crash
+
 ### What's New in Version 2.3.0
 
 #### Changes
diff --git a/doc/12-distributed-monitoring-ha.md b/doc/12-distributed-monitoring-ha.md
index 962e49b..c358ff3 100644
--- a/doc/12-distributed-monitoring-ha.md
+++ b/doc/12-distributed-monitoring-ha.md
@@ -718,21 +718,22 @@ Example DB IDO MySQL:
     # icinga2 feature enable ido-mysql
     The feature 'ido-mysql' is already enabled.
 
-By default the DB IDO feature only runs on the elected zone master. All other passive
-nodes disable the active IDO database connection at runtime.
+By default the DB IDO feature only runs on one node. All other nodes in the same zone disable
+the active IDO database connection at runtime. The node with the active DB IDO connection is
+not necessarily the zone master.
 
 > **Note**
 >
 > The DB IDO HA feature can be disabled by setting the `enable_ha` attribute to `false`
 > for the [IdoMysqlConnection](6-object-types.md#objecttype-idomysqlconnection) or
-> [IdoPgsqlConnection](6-object-types.md#objecttype-idopgsqlconnection) object on all nodes in the
-> same zone.
+> [IdoPgsqlConnection](6-object-types.md#objecttype-idopgsqlconnection) object on **all** nodes in the
+> **same** zone.
 >
-> All endpoints will enable the DB IDO feature then, connect to the configured
+> All endpoints will enable the DB IDO feature and connect to the configured
 > database and dump configuration, status and historical data on their own.
 
 If the instance with the active DB IDO connection dies, the HA functionality will
-re-enable the DB IDO connection on the newly elected zone master.
+automatically elect a new DB IDO master.
 
 The DB IDO feature will try to determine which cluster endpoint is currently writing
 to the database and bail out if another endpoint is active. You can manually verify that
diff --git a/doc/2-getting-started.md b/doc/2-getting-started.md
index 0766f1b..2fa4c0d 100644
--- a/doc/2-getting-started.md
+++ b/doc/2-getting-started.md
@@ -123,7 +123,7 @@ By default Icinga 2 uses the following files and directories:
   ------------------------------------|------------------------------------
   /etc/icinga2                        | Contains Icinga 2 configuration files.
   /etc/init.d/icinga2                 | The Icinga 2 init script.
-  /usr/sbin/icinga2*                  | The Icinga 2 binary.
+  /usr/sbin/icinga2                   | The Icinga 2 binary.
   /usr/share/doc/icinga2              | Documentation files that come with Icinga 2.
   /usr/share/icinga2/include          | The Icinga Template Library and plugin command configuration.
   /var/run/icinga2                    | PID file.
diff --git a/doc/20-library-reference.md b/doc/20-library-reference.md
index f6e8e19..53727d0 100644
--- a/doc/20-library-reference.md
+++ b/doc/20-library-reference.md
@@ -399,6 +399,20 @@ Example:
 
     "Hello World".find("World") /* Returns 6 */
 
+### <a id="string-contains"></a> String#contains
+
+Signature:
+
+    function contains(str);
+
+Returns `true` if the string `str` was found in the string. If the string
+was not found `false` is returned. Use [find](20-library-reference.md#string-find)
+for getting the index instead.
+
+Example:
+
+    "Hello World".contains("World") /* Returns true */
+
 ### <a id="string-len"></a> String#len
 
 Signature
diff --git a/doc/3-monitoring-basics.md b/doc/3-monitoring-basics.md
index 86c2137..bb52e26 100644
--- a/doc/3-monitoring-basics.md
+++ b/doc/3-monitoring-basics.md
@@ -1058,16 +1058,38 @@ can also be inherited from a parent template using additive inheritance (`+=`).
       command = [ PluginDir + "/check_disk" ]
 
       arguments = {
-        "-w" = "$disk_wfree$%"
-        "-c" = "$disk_cfree$%"
-        "-W" = "$disk_inode_wfree$%"
-        "-K" = "$disk_inode_cfree$%"
-        "-p" = "$disk_partitions$"
-        "-x" = "$disk_partitions_excluded$"
+        "-w" = {
+          value = "$disk_wfree$"
+          description = "Exit with WARNING status if less than INTEGER units of disk are free or Exit with WARNING status if less than PERCENT of disk space is free"
+          required = true
+        }
+        "-c" = {
+          value = "$disk_cfree$"
+          description = "Exit with CRITICAL status if less than INTEGER units of disk are free or Exit with CRITCAL status if less than PERCENT of disk space is free"
+          required = true
+        }
+        "-W" = {
+          value = "$disk_inode_wfree$"
+          description = "Exit with WARNING status if less than PERCENT of inode space is free"
+        }
+        "-K" = {
+          value = "$disk_inode_cfree$"
+          description = "Exit with CRITICAL status if less than PERCENT of inode space is free"
+        }
+        "-p" = {
+          value = "$disk_partitions$"
+          description = "Path or partition (may be repeated)"
+          repeat_key = true
+          order = 1
+        }
+        "-x" = {
+          value = "$disk_partitions_excluded$"
+          description = "Ignore device (only works if -p unspecified)"
+        }
       }
 
-      vars.disk_wfree = 20
-      vars.disk_cfree = 10
+      vars.disk_wfree = "20%"
+      vars.disk_cfree = "10%"
     }
 
 > **Note**
@@ -1098,8 +1120,8 @@ string values for passing multiple partitions to the `check_disk` check plugin.
 
       vars += config
 
-      vars.disk_wfree = 10
-      vars.disk_cfree = 5
+      vars.disk_wfree = "10%"
+      vars.disk_cfree = "5%"
     }
 
 
diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md
index a9714df..0298420 100644
--- a/doc/7-icinga-template-library.md
+++ b/doc/7-icinga-template-library.md
@@ -129,12 +129,17 @@ dig_lookup           | **Optional.** The address that should be looked up.
 
 Check command object for the `check_disk` plugin.
 
+> **Note**
+>
+> `disk_wfree` and `disk_cfree` require the percent sign compared to older versions.
+> If omitted, disk units can be used. This has been changed in **2.3.0**.
+
 Custom Attributes:
 
 Name            	| Description
 ------------------------|------------------------
-disk_wfree      	| **Optional.** The free space warning threshold in %. Defaults to 20.
-disk_cfree      	| **Optional.** The free space critical threshold in %. Defaults to 10.
+disk_wfree      	| **Optional.** The free space warning threshold. Defaults to "20%". If the percent sign is omitted, units from `disk_units` are used.
+disk_cfree      	| **Optional.** The free space critical threshold. Defaults to "10%". If the percent sign is omitted, units from `disk_units` are used.
 disk_inode_wfree 	| **Optional.** The free inode warning threshold.
 disk_inode_cfree 	| **Optional.** The free inode critical threshold.
 disk_partition		| **Optional.** The partition. **Deprecated in 2.3.**
diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp
index 3a7ba14..3325802 100644
--- a/icinga-app/icinga.cpp
+++ b/icinga-app/icinga.cpp
@@ -298,7 +298,7 @@ int Main(void)
 			String appName;
 
 			try {
-				Utility::BaseName(Application::GetArgV()[0]);
+				appName = Utility::BaseName(Application::GetArgV()[0]);
 			} catch (const std::bad_alloc&) {
 				Log(LogCritical, "icinga-app", "Allocation failed.");
 				return EXIT_FAILURE;
diff --git a/icinga2.spec b/icinga2.spec
index 927aa3d..9241f3a 100644
--- a/icinga2.spec
+++ b/icinga2.spec
@@ -66,7 +66,7 @@
 
 Summary: Network monitoring application
 Name: icinga2
-Version: 2.3.0
+Version: 2.3.1
 Release: %{revision}%{?dist}
 License: GPL-2.0+
 Group: Applications/System
diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf
index dbf3535..1f4262d 100644
--- a/itl/command-plugins.conf
+++ b/itl/command-plugins.conf
@@ -493,11 +493,13 @@ object CheckCommand "disk" {
 			value = "$disk_partitions$"
 			description = "Path or partition (may be repeated)"
 			repeat_key = true
+			order = 1
 		}
 
 		"-p_old" = {
 			key = "-p"
 			value = "$disk_partition$"
+			order = 1
 		}
 
 		"-x" = {
@@ -601,8 +603,8 @@ object CheckCommand "disk" {
 		}
 	}
 
-	vars.disk_wfree = 20
-	vars.disk_cfree = 10
+	vars.disk_wfree = "20%"
+	vars.disk_cfree = "10%"
 	vars.disk_megabytes = true
 	vars.disk_exclude_type = ["none", "tmpfs", "sysfs", "proc", "devtmpfs", "devfs", "mtmfs"]
 }
diff --git a/lib/base/application.cpp b/lib/base/application.cpp
index b0a0ad4..4d72652 100644
--- a/lib/base/application.cpp
+++ b/lib/base/application.cpp
@@ -57,7 +57,6 @@ static bool l_InExceptionHandler = false;
 int Application::m_ArgC;
 char **Application::m_ArgV;
 double Application::m_StartTime;
-int Application::m_ExitStatus = 0;
 
 /**
  * Constructor for the Application class.
@@ -107,6 +106,12 @@ Application::~Application(void)
 
 void Application::Exit(int rc)
 {
+	if (rc)
+		Log(LogCritical, "Application")
+		    << "Shutting down after a fatal error; exit code: " << rc;
+	else
+		Log(LogInformation, "Application", "Shutting down...");
+
 	std::cout.flush();
 
 	BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
@@ -310,11 +315,6 @@ mainloop:
 		goto mainloop;
 	}
 
-	if (m_ExitStatus)
-		Log(LogInformation, "Application", "Shutting down Icinga after a fatal error.");
-	else
-		Log(LogInformation, "Application", "Shutting down Icinga...");
-
 	DynamicObject::StopObjects();
 	Application::GetInstance()->OnShutdown();
 
@@ -361,9 +361,10 @@ pid_t Application::StartReloadProcess(void)
  * Signals the application to shut down during the next
  * execution of the event loop.
  */
-void Application::RequestShutdown(int rc)
+void Application::RequestShutdown(void)
 {
-	m_ExitStatus = rc > m_ExitStatus ? rc : m_ExitStatus;
+	Log(LogInformation, "Application", "Received request to shut down.");
+
 	m_ShuttingDown = true;
 }
 
@@ -624,6 +625,8 @@ void Application::SigAbrtHandler(int)
 		  << std::endl;
 
 	String fname = GetCrashReportFilename();
+	Utility::MkDir(Utility::DirName(fname), 0750);
+
 	std::ofstream ofs;
 	ofs.open(fname.CStr());
 
@@ -638,10 +641,13 @@ void Application::SigAbrtHandler(int)
 
 	DisplayBugMessage(ofs);
 
+#ifndef _WIN32
+	ofs << "\n";
 	ofs.close();
 
-#ifndef _WIN32
 	GetDebuggerBacktrace(fname);
+#else /* _WIN32 */
+	ofs.close();
 #endif /* _WIN32 */
 }
 #else /* _WIN32 */
@@ -682,6 +688,8 @@ void Application::ExceptionHandler(void)
 #endif /* _WIN32 */
 
 	String fname = GetCrashReportFilename();
+	Utility::MkDir(Utility::DirName(fname), 0750);
+
 	std::ofstream ofs;
 	ofs.open(fname.CStr());
 
@@ -724,6 +732,8 @@ LONG CALLBACK Application::SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi)
 	l_InExceptionHandler = true;
 
 	String fname = GetCrashReportFilename();
+	Utility::MkDir(Utility::DirName(fname), 0750);
+
 	std::ofstream ofs;
 	ofs.open(fname.CStr());
 
diff --git a/lib/base/application.hpp b/lib/base/application.hpp
index bc2b73a..37bf6aa 100644
--- a/lib/base/application.hpp
+++ b/lib/base/application.hpp
@@ -69,7 +69,7 @@ public:
 
 	static void InstallExceptionHandlers(void);
 
-	static void RequestShutdown(int rc = 0);
+	static void RequestShutdown(void);
 	static void RequestRestart(void);
 	static void RequestReopenLogs(void);
 
@@ -162,7 +162,6 @@ private:
 	static bool m_Debugging; /**< Whether debugging is enabled. */
 	static LogSeverity m_DebuggingSeverity; /**< Whether debugging severity is set. */
 	static double m_StartTime;
-	static int m_ExitStatus;
 
 #ifndef _WIN32
 	static void SigIntTermHandler(int signum);
diff --git a/lib/base/process.cpp b/lib/base/process.cpp
index b8eb93b..5f66940 100644
--- a/lib/base/process.cpp
+++ b/lib/base/process.cpp
@@ -530,6 +530,11 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
 	if (m_Process == 0) {
 		// child process
 
+		if (setsid() < 0) {
+			perror("setsid() failed");
+			_exit(128);
+		}
+
 		if (dup2(fds[1], STDOUT_FILENO) < 0 || dup2(fds[1], STDERR_FILENO) < 0) {
 			perror("dup2() failed");
 			_exit(128);
@@ -611,14 +616,14 @@ bool Process::DoEvents(void)
 
 		if (timeout < Utility::GetTime()) {
 			Log(LogWarning, "Process")
-			    << "Killing process " << m_PID << " (" << PrettyPrintArguments(m_Arguments)
+			    << "Killing process group " << m_PID << " (" << PrettyPrintArguments(m_Arguments)
 			    << ") after timeout of " << m_Timeout << " seconds";
 
 			m_OutputStream << "<Timeout exceeded.>";
 #ifdef _WIN32
 			TerminateProcess(m_Process, 1);
 #else /* _WIN32 */
-			kill(m_Process, SIGKILL);
+			kill(-m_Process, SIGKILL);
 #endif /* _WIN32 */
 
 			is_timeout = true;
diff --git a/lib/base/string-script.cpp b/lib/base/string-script.cpp
index 72e1ded..c76ef90 100644
--- a/lib/base/string-script.cpp
+++ b/lib/base/string-script.cpp
@@ -110,6 +110,13 @@ static Value StringFind(const std::vector<Value>& args)
 		return result;
 }
 
+static bool StringContains(const String& str)
+{
+	ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
+	String self = vframe->Self;
+	return self.Contains(str);
+}
+
 static Value StringReplace(const String& search, const String& replacement)
 {
 	ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
@@ -133,6 +140,7 @@ Object::Ptr String::GetPrototype(void)
 		prototype->Set("lower", new Function(WrapFunction(StringLower)));
 		prototype->Set("split", new Function(WrapFunction(StringSplit)));
 		prototype->Set("find", new Function(WrapFunction(StringFind)));
+		prototype->Set("contains", new Function(WrapFunction(StringContains)));
 		prototype->Set("replace", new Function(WrapFunction(StringReplace)));
 	}
 
diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll
index e12f2b2..25310d6 100644
--- a/lib/config/config_lexer.ll
+++ b/lib/config/config_lexer.ll
@@ -251,7 +251,9 @@ in				return T_IN;
 \>				return T_GREATER_THAN;
 }
 
-[\r\n]+				{ yycolumn -= strlen(yytext) - 1; if (!yyextra->m_IgnoreNewlines) return T_NEWLINE; }
+\(				{ yyextra->m_IgnoreNewlines++; return '('; }
+\)				{ yyextra->m_IgnoreNewlines--; return ')'; }
+[\r\n]+				{ yycolumn -= strlen(yytext) - 1; if (!yyextra->m_IgnoreNewlines) { return T_NEWLINE; } }
 <<EOF>>				{ if (!yyextra->m_Eof) { yyextra->m_Eof = true; return T_NEWLINE; } else { yyterminate(); } }
 .				return yytext[0];
 
diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy
index 5ed34bf..c09d13e 100644
--- a/lib/config/config_parser.yy
+++ b/lib/config/config_parser.yy
@@ -907,11 +907,11 @@ rterm_no_side_effect: T_STRING
 	}
 	| '('
 	{
-		context->m_IgnoreNewlines++;
+		context->m_OpenBraces++;
 	}
 	rterm ')'
 	{
-		context->m_IgnoreNewlines--;
+		context->m_OpenBraces--;
 		$$ = $3;
 	}
 	| rterm T_LOGICAL_OR rterm { MakeRBinaryOp<LogicalOrExpression>(&$$, $1, $3, @1, @3); }
diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp
index 153b11e..95dd451 100644
--- a/lib/db_ido_mysql/idomysqlconnection.cpp
+++ b/lib/db_ido_mysql/idomysqlconnection.cpp
@@ -225,8 +225,7 @@ void IdoMysqlConnection::Reconnect(void)
 		if (!row) {
 			Log(LogCritical, "IdoMysqlConnection", "Schema does not provide any valid version! Verify your schema installation.");
 
-			Application::RequestShutdown(EXIT_FAILURE);
-			return;
+			Application::Exit(EXIT_FAILURE);
 		}
 
 		DiscardRows(result);
@@ -238,8 +237,7 @@ void IdoMysqlConnection::Reconnect(void)
 			    << "Schema version '" << version << "' does not match the required version '"
 			    << SCHEMA_VERSION << "'! Please check the upgrade documentation.";
 
-			Application::RequestShutdown(EXIT_FAILURE);
-			return;
+			Application::Exit(EXIT_FAILURE);
 		}
 
 		String instanceName = GetInstanceName();
diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp
index d3c7964..fca4e8f 100644
--- a/lib/db_ido_pgsql/idopgsqlconnection.cpp
+++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp
@@ -228,8 +228,7 @@ void IdoPgsqlConnection::Reconnect(void)
 
 			Log(LogCritical, "IdoPgsqlConnection", "Schema does not provide any valid version! Verify your schema installation.");
 
-			Application::RequestShutdown(EXIT_FAILURE);
-			return;
+			Application::Exit(EXIT_FAILURE);
 		}
 
 		String version = row->Get("version");
@@ -242,8 +241,7 @@ void IdoPgsqlConnection::Reconnect(void)
 			    << "Schema version '" << version << "' does not match the required version '"
 			    << SCHEMA_VERSION << "'! Please check the upgrade documentation.";
 
-			Application::RequestShutdown(EXIT_FAILURE);
-			return;
+			Application::Exit(EXIT_FAILURE);
 		}
 
 		String instanceName = GetInstanceName();
diff --git a/lib/remote/apiclient-heartbeat.cpp b/lib/remote/apiclient-heartbeat.cpp
index 066a610..bd7aad9 100644
--- a/lib/remote/apiclient-heartbeat.cpp
+++ b/lib/remote/apiclient-heartbeat.cpp
@@ -65,7 +65,7 @@ void ApiClient::HeartbeatTimerHandler(void)
 			request->Set("method", "event::Heartbeat");
 
 			Dictionary::Ptr params = new Dictionary();
-			params->Set("timeout", 30);
+			params->Set("timeout", 120);
 
 			request->Set("params", params);
 
@@ -78,8 +78,10 @@ Value ApiClient::HeartbeatAPIHandler(const MessageOrigin& origin, const Dictiona
 {
 	Value vtimeout = params->Get("timeout");
 
-	if (!vtimeout.IsEmpty())
+	if (!vtimeout.IsEmpty()) {
 		origin.FromClient->m_NextHeartbeat = Utility::GetTime() + vtimeout;
+		origin.FromClient->m_HeartbeatTimeout = vtimeout;
+	}
 
 	return Empty;
 }
diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp
index da4d51e..b566243 100644
--- a/lib/remote/apiclient.cpp
+++ b/lib/remote/apiclient.cpp
@@ -40,7 +40,7 @@ static Timer::Ptr l_ApiClientTimeoutTimer;
 
 ApiClient::ApiClient(const String& identity, bool authenticated, const TlsStream::Ptr& stream, ConnectionRole role)
 	: m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream), m_Role(role), m_Seen(Utility::GetTime()),
-	  m_NextHeartbeat(0), m_Context(false)
+	  m_NextHeartbeat(0), m_HeartbeatTimeout(0), m_Context(false)
 {
 	boost::call_once(l_ApiClientOnceFlag, &ApiClient::StaticInitialize);
 
@@ -136,6 +136,9 @@ bool ApiClient::ProcessMessage(void)
 
 	m_Seen = Utility::GetTime();
 
+	if (m_HeartbeatTimeout != 0)
+		m_NextHeartbeat = Utility::GetTime() + m_HeartbeatTimeout;
+
 	if (m_Endpoint && message->Contains("ts")) {
 		double ts = message->Get("ts");
 
diff --git a/lib/remote/apiclient.hpp b/lib/remote/apiclient.hpp
index b65efdc..80199f1 100644
--- a/lib/remote/apiclient.hpp
+++ b/lib/remote/apiclient.hpp
@@ -72,6 +72,7 @@ private:
 	ConnectionRole m_Role;
 	double m_Seen;
 	double m_NextHeartbeat;
+	double m_HeartbeatTimeout;
 	Timer::Ptr m_TimeoutTimer;
 
 	StreamReadContext m_Context;
diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp
index 7fe35b5..4204227 100644
--- a/lib/remote/apilistener.cpp
+++ b/lib/remote/apilistener.cpp
@@ -110,7 +110,7 @@ void ApiListener::Start(void)
 	if (!AddListener(GetBindHost(), GetBindPort())) {
 		Log(LogCritical, "ApiListener")
 		     << "Cannot add listener on host '" << GetBindHost() << "' for port '" << GetBindPort() << "'.";
-		Application::RequestShutdown(EXIT_FAILURE);
+		Application::Exit(EXIT_FAILURE);
 	}
 
 	m_Timer = new Timer();
diff --git a/test/config/8063.conf b/test/config/8063.conf
index fe3bcc7..991372c 100644
--- a/test/config/8063.conf
+++ b/test/config/8063.conf
@@ -4,16 +4,38 @@ object CheckCommand "8063-my-disk" {
   command = [ PluginDir + "/check_disk" ]
 
   arguments = {
-    "-w" = "$disk_wfree$%"
-    "-c" = "$disk_cfree$%"
-    "-W" = "$disk_inode_wfree$%"
-    "-K" = "$disk_inode_cfree$%"
-    "-p" = "$disk_partitions$"
-    "-x" = "$disk_partitions_excluded$"
+    "-w" = {
+      value = "$disk_wfree$"
+      description = "Exit with WARNING status if less than INTEGER units of disk are free or Exit with WARNING status if less than PERCENT of disk space is free"
+      required = true
+    }
+    "-c" = {
+      value = "$disk_cfree$"
+      description = "Exit with CRITICAL status if less than INTEGER units of disk are free or Exit with CRITCAL status if less than PERCENT of disk space is free"
+      required = true
+    }
+    "-W" = {
+      value = "$disk_inode_wfree$"
+      description = "Exit with WARNING status if less than PERCENT of inode space is free"
+    }
+    "-K" = {
+      value = "$disk_inode_cfree$"
+      description = "Exit with CRITICAL status if less than PERCENT of inode space is free"
+    }
+    "-p" = {
+      value = "$disk_partitions$"
+      description = "Path or partition (may be repeated)"
+      repeat_key = true
+      order = 1
+    }
+    "-x" = {
+      value = "$disk_partitions_excluded$"
+      description = "Ignore device (only works if -p unspecified)"
+    }
   }
 
-  vars.disk_wfree = 20
-  vars.disk_cfree = 10
+  vars.disk_wfree = "20%"
+  vars.disk_cfree = "10%"
 }
 
 object Host "8063-my-server" {
@@ -37,8 +59,8 @@ apply Service "8063-" for (disk => config in host.vars.local_disks) {
 
   vars += config
 
-  vars.disk_wfree = 10
-  vars.disk_cfree = 5
+  vars.disk_wfree = "10%"
+  vars.disk_cfree = "5%"
 
   assign where host.vars.local_disks
 }

-- 
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