check_logfiles: 3.7.5.1
[omd.git] / packages / shinken / SHINKEN_WEBUI_TCP_PORT.hook
bloba1c3aeeaa994643b87824ea636b7a57b2ff82c6e
1 #!/bin/bash
3 # Alias: TCP port number for Apache
4 # Menu: Web GUI
5 # Description:
6 # Configure the TCP port used for the Shinken WebUI
7 # process of this site. This option is only useful if
8 # the CORE is set to "shinken" and WEBSERVER is set to "own".
10 # After changing this variable, the site-wide Apache webserver
11 # must be restarted.
13 case "$1" in
14 default)
15 # Scan for a free port number by looking at the
16 # configuration of the other sites...
17 PORT=$($OMD_ROOT/lib/omd/port_is_used SHINKEN_WEBUI_TCP_PORT 57767)
18 echo "$PORT"
20 choices)
21 echo "(none)|([1-9][0-9]{0,5})|([a-zA-Z0-9\.\-]*:[1-9][0-9]{0,5})"
23 set)
24 if [ "$2" = "none" ]; then
25 echo 0
26 else
27 PORT=$($OMD_ROOT/lib/omd/port_is_used SHINKEN_WEBUI_TCP_PORT $2)
28 if [ "$PORT" != "$2" ] ; then
29 echo "WebUI port $2 is in use. I've choosen $PORT instead." >&2
30 echo "$PORT"
32 cat <<EOF > $OMD_ROOT/etc/shinken/apache.conf
33 # This file is managed by 'omd config set SHINKEN_WEBUI_TCP_PORT'.
34 # Better do not edit manually
35 <IfModule mod_alias.c>
36 <Location /$OMD_SITE/shinken>
37 RewriteEngine On
38 RewriteCond %{ENV:REDIRECT_STATUS} !=501
39 RewriteCond $OMD_ROOT/lib/shinken/shinken/modules/webui_broker/__init__.py -f
40 RewriteRule ^/(.*) http://%{HTTP_HOST}:$PORT [last,redirect=301]
41 RewriteRule .* http://127.0.0.1/mi/gibts/ned [last,redirect=501]
42 ErrorDocument 501 "<h1>OMD: Shinken WebUI not available</h1>You are using a distribution where the Shinken WebUI feature has been deactivated because the built-in Python interpreter is too old.<br>In order to be correctly displayed with Internet Explorer, this message must be longer than 512 bytes. <br><br>Mir san vom Woid dahoam, des kennt a jeda glei,<br>wenns von de Berge hallt, dann samma mir dabei.<br>Und wenn as Stutzerl knallt, dann samma mir um d'Weg,<br> Mir san vom Woid dahoam, da Woid is sche.<br>Mir san af Straubing zua als lust'ge Bauernknecht,<br>Weil mir uns eib&uuml;lt ham, des war fir uns des recht.<br>Uns hods ned g'folln do draussd, ham miassn glei hoamgeh,<br>Mir san vom Woid dahoam, da Woid is sche."
43 </Location>
44 </IfModule>
45 EOF
48 depends)
49 [ "$CONFIG_CORE" = shinken ]
51 esac