From 1894054929b413f444437c2bfa77f573fbd0405e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20Mo=C3=9Fhammer?= Date: Wed, 31 Jul 2013 17:03:21 +0200 Subject: [PATCH] Implement first commands, fix obsessing state refs #4441 --- .../Protocol/Commandpipe/CommandPipe.php | 26 +++++++++++++++++++ .../Protocol/Commandpipe/PropertyModifier.php | 2 ++ 2 files changed, 28 insertions(+) diff --git a/library/Icinga/Protocol/Commandpipe/CommandPipe.php b/library/Icinga/Protocol/Commandpipe/CommandPipe.php index 4355432b6..e4563cf75 100644 --- a/library/Icinga/Protocol/Commandpipe/CommandPipe.php +++ b/library/Icinga/Protocol/Commandpipe/CommandPipe.php @@ -645,6 +645,32 @@ class CommandPipe ); } + public function startObsessing($objects) + { + foreach ($objects as $object) { + $type = $this->getObjectType($object); + $msg = "START_OBSESSING_OVER_". (($type == self::TYPE_SERVICE) ? 'SVC' : 'HOST'); + $msg .= ';'.$object->host_name; + if ($type == self::TYPE_SERVICE) { + $msg .= ';'.$object->service_description; + } + $this->send($msg); + } + } + + public function stopObsessing($objects) + { + foreach ($objects as $object) { + $type = $this->getObjectType($object); + $msg = "STOP_OBSESSING_OVER_". (($type == self::TYPE_SERVICE) ? 'SVC' : 'HOST'); + $msg .= ';'.$object->host_name; + if ($type == self::TYPE_SERVICE) { + $msg .= ';'.$object->service_description; + } + $this->send($msg); + } + } + /** * Start obsessing over provided services/hosts * diff --git a/library/Icinga/Protocol/Commandpipe/PropertyModifier.php b/library/Icinga/Protocol/Commandpipe/PropertyModifier.php index 8dd72a1a0..eba909bb2 100644 --- a/library/Icinga/Protocol/Commandpipe/PropertyModifier.php +++ b/library/Icinga/Protocol/Commandpipe/PropertyModifier.php @@ -74,6 +74,7 @@ class PropertyModifier */ const FRESHNESS = "%s_FRESHNESS_CHECKS"; + /** * Template for enabling/disabling event handler */ @@ -90,6 +91,7 @@ class PropertyModifier self::PASSIVE => self::STATE_KEEP, self::NOTIFICATIONS => self::STATE_KEEP, self::FRESHNESS => self::STATE_KEEP, + self::OBSESSING => self::STATE_KEEP, self::EVENTHANDLER => self::STATE_KEEP );