[icinga-checkins] icinga.org: icinga-web/r1.6: * Fixed perfdata being appended as separate item to X_CHECK_RESULT commands (fixes #2299)

git at icinga.org git at icinga.org
Fri Feb 24 15:20:27 CET 2012


Module: icinga-web
Branch: r1.6
Commit: 33f2f60e1cbc4e089682418f3a2b9618a859a5e7
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=33f2f60e1cbc4e089682418f3a2b9618a859a5e7

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Fri Feb 24 11:40:59 2012 +0100

* Fixed perfdata being appended as separate item to X_CHECK_RESULT commands (fixes #2299)

---

 .../Commands/CommandDispatcherModel.class.php      |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/app/modules/Api/models/Commands/CommandDispatcherModel.class.php b/app/modules/Api/models/Commands/CommandDispatcherModel.class.php
index 82b583e..3e404d6 100644
--- a/app/modules/Api/models/Commands/CommandDispatcherModel.class.php
+++ b/app/modules/Api/models/Commands/CommandDispatcherModel.class.php
@@ -43,8 +43,10 @@ class Api_Commands_CommandDispatcherModel extends IcingaApiBaseModel implements
             $command = $this->getCommand($cmd_name);
            
             $string = $this->buildCommandString($command,$params);   
+           
             if($onlySimple && !$command["isSimple"])
                 throw new Exception("Could not send command. Your user isn't allowed to send this command.");
+            
             $cmd = $this->getContext()->getModel($commandClass[0],$commandClass[1],
                                                  array(
                                                          "command" => "printf",
@@ -81,10 +83,12 @@ class Api_Commands_CommandDispatcherModel extends IcingaApiBaseModel implements
                     case "date":
                         $val = strtotime($val);
                         break;
-
                 }
-
-                $str .= ";".$val;
+                // Perfdata is a a special case that requires | instead of ;
+                if($param != "COMMAND_PERFDATA")
+                    $str .= ";".$val;
+                else
+                    $str .= "|".$val;
             }
         }
         return $str;





More information about the icinga-checkins mailing list