3 # Alias: TCP port number and listening address for MongoDB
6 # Configure the TCP port used for the MongoDB
7 # process of this site. This option is only useful if
8 # the CORE is set to "shinken" and MONGODB is set to "on".
13 # Scan for a free port number by looking at the
14 # configuration of the other sites...
15 PORT
=$
($OMD_ROOT/lib
/omd
/port_is_used MONGODB_TCP_PORT
27017)
19 echo "([1-9][0-9]{0,5})|([a-zA-Z0-9\.\-]*:[1-9][0-9]{0,5})"
22 SELECTED_PORT
=${2:=localhost:27017}
23 if [ "${SELECTED_PORT##*:}" = "${SELECTED_PORT%%:*}" ]; then
25 elif [ "${SELECTED_PORT%%:*}" = "localhost" ]; then
26 SELECTED_PORT
=${SELECTED_PORT##*:}
29 BIND_IP
=${SELECTED_PORT%%:*}
30 SELECTED_PORT
=${SELECTED_PORT##*:}
32 PORT
=$
($OMD_ROOT/lib
/omd
/port_is_used MONGODB_TCP_PORT
$SELECTED_PORT)
33 CHECK_PORT
=${PORT##*:}
34 if [ "$CHECK_PORT" != "$SELECTED_PORT" ] ; then
35 echo "MongoDB port $SELECTED_PORT is in use. I've choosen $PORT instead." >&2
38 cat <<EOF > $OMD_ROOT/etc/mongodb/mongod.d/port.conf
44 [ "$CONFIG_MONGODB" = on
]