Discussion:
[Check_mk (english)] Running check_mk behind proxy - changing url_prefix
Wayne Pascoe
2018-10-21 19:03:52 UTC
Permalink
Hi all,

I'm trying to move a deployment to docker, and I can't work out how to run
it behind a proxy. I've found some documentation for multi-site installs
around url_prefix, but nothing for a standard installation.

My use case is that I want to proxy requests from
https://mysite.com/monitoring/ to my check_mk_server.mysite.com:5000

Any documentation / pointers would be much appreciated,

Thanks,

Wayne
Arno Wijnhoven
2018-10-22 08:09:22 UTC
Permalink
Hi Wayne,

The way I interpret your issue makes me think you need another system (non-Check_MK) to use as a proxy.
I don’t think this is strictly a Check_MK thing.

Two alternatives come to mind, but both require the second URL check_mk_server.mysite.com:5000<http://check_mk_server.mysite.com:5000> to be reachable for end users.
As this is not proxying it’s probably not of any use, but here goes.

Distributed setup:

Have a main site at https://mysite.com/monitoring and add the docker site(s) as slave site(s).
Main site shouldn’t monitor anything, use it as Check_MK frontend only and let this main site do the notifying.

Mod_rewrite:
https://httpd.apache.org/docs/current/mod/mod_rewrite.html. Rewrite the URL on the fly.
Again, this is not proxying – second site must be reachable for end users.

Arno

From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of Wayne Pascoe
Sent: zondag 21 oktober 2018 21:04
To: checkmk-***@lists.mathias-kettner.de
Subject: [Check_mk (english)] Running check_mk behind proxy - changing url_prefix

Hi all,

I'm trying to move a deployment to docker, and I can't work out how to run it behind a proxy. I've found some documentation for multi-site installs around url_prefix, but nothing for a standard installation.

My use case is that I want to proxy requests from https://mysite.com/monitoring/ to my check_mk_server.mysite.com:5000<http://check_mk_server.mysite.com:5000>

Any documentation / pointers would be much appreciated,

Thanks,

Wayne
Wayne Pascoe
2018-10-22 08:37:51 UTC
Permalink
Hi Arno,

The issue I’m trying to solve is that check_mk.mysite.com:5000 cannot be accessible by end users.

The plan is to use nginx or apache on a publicly available server to proxy requests to check_mk

With other applications that we do this with (e.g kibana) we specify a url prefix or base url of Mysite.com/monitoring in the kibana config. Kibana then uses this to rewrite all of the links it sends back so that they are valid. For example, it may normally return a link of mysite.com/settings/indexpage but with this configuration it would return a link of mysite.com/monitoring/indexpage

Regards,
Post by Arno Wijnhoven
Hi Wayne,
The way I interpret your issue makes me think you need another system (non-Check_MK) to use as a proxy.
I don’t think this is strictly a Check_MK thing.
Two alternatives come to mind, but both require the second URL check_mk_server.mysite.com:5000 to be reachable for end users.
As this is not proxying it’s probably not of any use, but here goes.
Have a main site at https://mysite.com/monitoring and add the docker site(s) as slave site(s).
Main site shouldn’t monitor anything, use it as Check_MK frontend only and let this main site do the notifying.
https://httpd.apache.org/docs/current/mod/mod_rewrite.html. Rewrite the URL on the fly.
Again, this is not proxying – second site must be reachable for end users.
Arno
Sent: zondag 21 oktober 2018 21:04
Subject: [Check_mk (english)] Running check_mk behind proxy - changing url_prefix
Hi all,
I'm trying to move a deployment to docker, and I can't work out how to run it behind a proxy. I've found some documentation for multi-site installs around url_prefix, but nothing for a standard installation.
My use case is that I want to proxy requests from https://mysite.com/monitoring/ to my check_mk_server.mysite.com:5000
Any documentation / pointers would be much appreciated,
Thanks,
Wayne
Chris Vance
2018-10-22 18:26:18 UTC
Permalink
I set up a similar scenario using proxypass in apache:

ProxyRequests Off
ProxyPreserveHost On

# I chose to use the url http://apache-server.site/monitor/ instead of the root, but you could do it there too...
ProxyPassMatch "^/monitor/(.*)$" "https://my_check_mk_server.site/monitor/$1" connectiontimeout=5 timeout=450
ProxyPassReverse "/monitor/" "https://my_check_mk_server"




Chris
---------------
On Mon, 22 Oct 2018 09:37:51 +0100
Wayne Pascoe <***@penguinpowered.org> wrote:
---------------
Post by Wayne Pascoe
Hi Arno,
The issue I’m trying to solve is that check_mk.mysite.com:5000 cannot be
accessible by end users.
The plan is to use nginx or apache on a publicly available server to proxy
requests to check_mk
With other applications that we do this with (e.g kibana) we specify a url
prefix or base url of Mysite.com/monitoring in the kibana config. Kibana then
uses this to rewrite all of the links it sends back so that they are valid.
For example, it may normally return a link of mysite.com/settings/indexpage
but with this configuration it would return a link of
mysite.com/monitoring/indexpage
Regards,
Post by Arno Wijnhoven
Hi Wayne,
The way I interpret your issue makes me think you need another system
(non-Check_MK) to use as a proxy. I don’t think this is strictly a Check_MK
thing.
Two alternatives come to mind, but both require the second URL
check_mk_server.mysite.com:5000 to be reachable for end users. As this is
not proxying it’s probably not of any use, but here goes.
Have a main site at https://mysite.com/monitoring and add the docker
site(s) as slave site(s). Main site shouldn’t monitor anything, use it as
Check_MK frontend only and let this main site do the notifying.
https://httpd.apache.org/docs/current/mod/mod_rewrite.html. Rewrite the URL
on the fly. Again, this is not proxying – second site must be reachable for
end users.
Arno
Behalf Of Wayne Pascoe Sent: zondag 21 oktober 2018 21:04
Subject: [Check_mk (english)] Running check_mk behind proxy - changing url_prefix
Hi all,
I'm trying to move a deployment to docker, and I can't work out how to run
it behind a proxy. I've found some documentation for multi-site installs
around url_prefix, but nothing for a standard installation. My use case is
that I want to proxy requests from https://mysite.com/monitoring/ to my
check_mk_server.mysite.com:5000 Any documentation / pointers would be much
appreciated,
Thanks,
Wayne
Wayne Pascoe
2018-10-29 09:02:43 UTC
Permalink
Hi Chris,

I’m still struggling with this a little. Does the proxypassreverse rewrite the URLs coming from check_mk ?

Where I’m at so far is:
Check_mk is running on http://somehost:6000/sitename/check_mk/ <http://somehost:6000/sitename/check_mk/> and I need to access it from https://example.com/arbitraryprefix/check_mk/ <https://example.com/arbitraryprefix/check_mk/>

I can access check_mk for the first time at https://example.com/arbitraryprefix/check_mk/index.py <https://example.com/arbitraryprefix/check_mk/index.py> - This works

However, all links in the returned page are invalid because they're not aware of the proxy. So they're things like https://example.com/sitename/check_mk/dashboard.py <https://example.com/sitename/check_mk/dashboard.py> instead of https://example.com/arbitraryprefix/check_mk/dashboard.py <https://example.com/arbitraryprefix/check_mk/dashboard.py>

Did you have to do anything in addition to your proxy setup to make check_mk work at these URLs ?

Thanks,
--
Wayne Pascoe (gpg --keyserver www.co.uk.pgp.net --recv-keys 79A7C870)
Post by Chris Vance
ProxyRequests Off
ProxyPreserveHost On
# I chose to use the url http://apache-server.site/monitor/ instead of the root, but you could do it there too...
ProxyPassMatch "^/monitor/(.*)$" "https://my_check_mk_server.site/monitor/$1" connectiontimeout=5 timeout=450
ProxyPassReverse "/monitor/" "https://my_check_mk_server"
Chris
---------------
On Mon, 22 Oct 2018 09:37:51 +0100
---------------
Post by Wayne Pascoe
Hi Arno,
The issue I’m trying to solve is that check_mk.mysite.com:5000 cannot be
accessible by end users.
The plan is to use nginx or apache on a publicly available server to proxy
requests to check_mk
With other applications that we do this with (e.g kibana) we specify a url
prefix or base url of Mysite.com/monitoring in the kibana config. Kibana then
uses this to rewrite all of the links it sends back so that they are valid.
For example, it may normally return a link of mysite.com/settings/indexpage
but with this configuration it would return a link of
mysite.com/monitoring/indexpage
Regards,
Post by Arno Wijnhoven
Hi Wayne,
The way I interpret your issue makes me think you need another system
(non-Check_MK) to use as a proxy. I don’t think this is strictly a Check_MK
thing.
Two alternatives come to mind, but both require the second URL
check_mk_server.mysite.com:5000 to be reachable for end users. As this is
not proxying it’s probably not of any use, but here goes.
Have a main site at https://mysite.com/monitoring and add the docker
site(s) as slave site(s). Main site shouldn’t monitor anything, use it as
Check_MK frontend only and let this main site do the notifying.
https://httpd.apache.org/docs/current/mod/mod_rewrite.html. Rewrite the URL
on the fly. Again, this is not proxying – second site must be reachable for
end users.
Arno
Behalf Of Wayne Pascoe Sent: zondag 21 oktober 2018 21:04
Subject: [Check_mk (english)] Running check_mk behind proxy - changing url_prefix
Hi all,
I'm trying to move a deployment to docker, and I can't work out how to run
it behind a proxy. I've found some documentation for multi-site installs
around url_prefix, but nothing for a standard installation. My use case is
that I want to proxy requests from https://mysite.com/monitoring/ to my
check_mk_server.mysite.com:5000 Any documentation / pointers would be much
appreciated,
Thanks,
Wayne
_______________________________________________
checkmk-en mailing list
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
Loading...