[icinga-checkins] icinga.org: icinga-api/mhein/default: * Delete schedule downtime defs

git at icinga.org git at icinga.org
Fri Jan 14 13:11:14 CET 2011


Module: icinga-api
Branch: mhein/default
Commit: b31ab0e59e35b3491df808b81b63dd016aba1383
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=b31ab0e59e35b3491df808b81b63dd016aba1383

Author: Marius Hein <marius.hein at netways.de>
Date:   Fri Jan 14 13:10:39 2011 +0100

* Delete schedule downtime defs

---

 objects/IcingaApiConstantsInterface.php            |    1 +
 objects/command/IcingaApiCommandCollection.php     |   19 +++++++++++++------
 .../data_interfaces/IcingaApiSearchIdoMysql.php    |    2 +-
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/objects/IcingaApiConstantsInterface.php b/objects/IcingaApiConstantsInterface.php
index b7f431e..a55d597 100644
--- a/objects/IcingaApiConstantsInterface.php
+++ b/objects/IcingaApiConstantsInterface.php
@@ -116,6 +116,7 @@ interface IcingaApiConstantsInterface {
 	const COMMAND_DURATION = 'duration';
 	const COMMAND_DATA = 'data';
 	const COMMAND_NOTIFICATION_OPTIONS = 'notification_options';
+	const COMMAND_DOWNTIME_ID = 'downtime_id';
 
 }
 
diff --git a/objects/command/IcingaApiCommandCollection.php b/objects/command/IcingaApiCommandCollection.php
index 4a911f0..928cc65 100644
--- a/objects/command/IcingaApiCommandCollection.php
+++ b/objects/command/IcingaApiCommandCollection.php
@@ -20,11 +20,16 @@ class IcingaApiCommandCollection
 		
 	// TODO: add missing commands
 	private $commandFields = array (
+	
+		/*
+		 * Downtimes
+		 */
+		'DEL_HOST_DOWNTIME'						=> array(self::COMMAND_DOWNTIME_ID),
+		'DEL_SVC_DOWNTIME'						=> array(self::COMMAND_DOWNTIME_ID),
+	
 		/*
 		 * SERVICE COMMANDS
 		 */
-		// Put this in a downtime view
-		// 'DEL_SVC_DOWNTIME'						=> array(self::COMMAND_HOST, self::COMMAND_SERVICE, self::COMMAND_ID),
 		'SET_SVC_NOTIFICATION_NUMBER'			=> array(self::COMMAND_HOST, self::COMMAND_SERVICE, self::COMMAND_DATA),
 		'SCHEDULE_SVC_CHECK'					=> array(self::COMMAND_HOST, self::COMMAND_SERVICE, self::COMMAND_CHECKTIME),
 		'SCHEDULE_FORCED_SVC_CHECK'				=> array(self::COMMAND_HOST, self::COMMAND_SERVICE, self::COMMAND_CHECKTIME),
@@ -53,10 +58,8 @@ class IcingaApiCommandCollection
 		/*
 		 * HOST COMMANDS
 		 */
-		// This have to be in a downtime view
-		// 'DEL_HOST_DOWNTIME'						=> array(self::COMMAND_HOST, self::COMMAND_ID),
 		'SCHEDULE_HOST_CHECK'					=> array(self::COMMAND_HOST, self::COMMAND_CHECKTIME),
-		'SCHEDULE_FORCED_HOST_CHECK'				=> array(self::COMMAND_HOST, self::COMMAND_CHECKTIME),
+		'SCHEDULE_FORCED_HOST_CHECK'			=> array(self::COMMAND_HOST, self::COMMAND_CHECKTIME),
 		'SCHEDULE_HOST_DOWNTIME'				=> array(self::COMMAND_HOST, self::COMMAND_STARTTIME, self::COMMAND_ENDTIME, self::COMMAND_FIXED, self::COMMAND_DATA, self::COMMAND_DURATION, self::COMMAND_AUTHOR, self::COMMAND_COMMENT),	
 		'SCHEDULE_HOST_SVC_DOWNTIME'			=> array(self::COMMAND_HOST, self::COMMAND_STARTTIME, self::COMMAND_ENDTIME, self::COMMAND_FIXED, self::COMMAND_DATA, self::COMMAND_DURATION, self::COMMAND_AUTHOR, self::COMMAND_COMMENT),
 		'PROCESS_HOST_CHECK_RESULT'				=> array(self::COMMAND_HOST, self::COMMAND_RETURN_CODE, self::COMMAND_OUTPUT, self::COMMAND_PERFDATA),
@@ -190,7 +193,11 @@ class IcingaApiCommandCollection
 		self::COMMAND_NOTIFICATION_OPTIONS => array (
 			'type'	=> 'notification_options',
 			'required' => true
-		)
+		),
+		self::COMMAND_DOWNTIME_ID => array(
+			'type'	=> 'ro',
+			'required'	=> true
+		),
 	);
 
 	private $commands = array (
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
index f836690..f3ad13b 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
@@ -415,7 +415,7 @@ implements IcingaApiSearchIdoInterface {
 			
 			${if_table:i,dt:left join ${TABLE_PREFIX}instances i on i.instance_id = dt.instance_id}
 			
-			where not dt.actual_end_time
+			where not dt.actual_end_time and not dt.was_cancelled
 			
 			${FILTER_AND}
 			${GROUPBY}





More information about the icinga-checkins mailing list