[omd-commits] OMD Git: omd: fix shinken port hooks

git version control git at mathias-kettner.de
Wed Apr 13 12:27:37 CEST 2016


Module:   omd
Branch:   master
Commit:   4616026afea1b90a1b5a77b30ace6f12398abd93
URL:      http://omdistro.org/projects/omd/repository/revisions/4616026afea1b90a1b5a77b30ace6f12398abd93

Author:   Sven Nierlein <Sven.Nierlein at consol.de>
Date:     Wed Apr 13 12:16:49 2016 +0200
Commiter: Sven Nierlein <Sven.Nierlein at consol.de>
Date:     Wed Apr 13 12:16:49 2016 +0200

fix shinken port hooks

when omd config set is called, we need to test against the selected
port, not the default one. Otherwise the port switches constantly.

---

 packages/shinken/MONGODB_TCP_PORT.hook       |    2 +-
 packages/shinken/SHINKEN_WEBUI_TCP_PORT.hook |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/shinken/MONGODB_TCP_PORT.hook b/packages/shinken/MONGODB_TCP_PORT.hook
index d03ae7b..86eeb50 100755
--- a/packages/shinken/MONGODB_TCP_PORT.hook
+++ b/packages/shinken/MONGODB_TCP_PORT.hook
@@ -29,7 +29,7 @@ case "$1" in
             BIND_IP=${SELECTED_PORT%%:*}
             SELECTED_PORT=${SELECTED_PORT##*:}
         fi
-        PORT=$($OMD_ROOT/lib/omd/port_is_used MONGODB_TCP_PORT 27017)
+        PORT=$($OMD_ROOT/lib/omd/port_is_used MONGODB_TCP_PORT $SELECTED_PORT)
         CHECK_PORT=${PORT##*:}
         if [ "$CHECK_PORT" != "$SELECTED_PORT" ] ; then
             echo "MongoDB port $SELECTED_PORT is in use. I've choosen $PORT instead." >&2
diff --git a/packages/shinken/SHINKEN_WEBUI_TCP_PORT.hook b/packages/shinken/SHINKEN_WEBUI_TCP_PORT.hook
index 4d2da86..a1c3aee 100755
--- a/packages/shinken/SHINKEN_WEBUI_TCP_PORT.hook
+++ b/packages/shinken/SHINKEN_WEBUI_TCP_PORT.hook
@@ -24,7 +24,7 @@ case "$1" in
         if [ "$2" = "none" ]; then
             echo 0
         else
-            PORT=$($OMD_ROOT/lib/omd/port_is_used SHINKEN_WEBUI_TCP_PORT 57767)
+            PORT=$($OMD_ROOT/lib/omd/port_is_used SHINKEN_WEBUI_TCP_PORT $2)
             if [ "$PORT" != "$2" ] ; then
                 echo "WebUI port $2 is in use. I've choosen $PORT instead." >&2
                 echo "$PORT"



More information about the omd-commits mailing list