jonnymccullagh / munstrap

Alternative Munin 2.x templates based on Twitter Bootstrap
GNU General Public License v2.0
112 stars 15 forks source link

static assets on different path #12

Closed Kriechi closed 9 years ago

Kriechi commented 9 years ago

I stumbled across a strange glitch:

I used the suggested nginx config from: http://guide.munin-monitoring.org/en/latest/example/webserver/nginx.html

where it says:

location /munin/static/ {
        alias /etc/munin/static/;
}

So this means my static assets should be accessible on a URL path like http://server.tld/munin/static/js/some.js

But I had problems with this template as the template variable R_PATH does not reflect this path. Do I have to set a specific path-prefix somewhere, or should I adapt the template for my setup?

e.g. the problem is on these lines: https://github.com/jonnymccullagh/munstrap/blob/master/templates/partial/head.tmpl#L12-15

Edit: I just noticed that everything else seems to be broken as well. Links, problems, hosts, breadcrumbs...

jonnymccullagh commented 9 years ago

Kriechi, I use Apache myself with only ScriptAlias /munin-cgi/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph I don't have a location directive pointing to my /etc/munin directory. As I understand it (and I am not a Munin dev) HTML files to be presented to the browser are generated into a web folder (for me /var/www/html/munin ). These files are generated based on the contents of the /etc/munin/templates and /etc/munin/static directories. So the contents of /etc/munin/static are copied to /var/www/html/munin/static meaning that it is not necessary to specify a location in your web server configuration as the static files will be available within the path served by Nginx anyway. Maybe you could try removing the location directive from the Nginx config and see what happens? jonny

Kriechi commented 9 years ago

The static folder seems not to be copied over to var/cache/munin/www.

jonnymccullagh commented 9 years ago

Sorry you are right. I just looked over my own instructions here http://blog.redbranch.net/2013/11/28/munin-bootstrap-template-munstrap/ where I cp -R /etc/munin/static /var/www/html/munin Do you want to try following those instructions and changing your paths for your OS and Nginx? jonny

Kriechi commented 9 years ago

Yes, copying the static files to /var/cache/munin/www in my case, and removing the special location /munin/static/ block gives me a working solution.

But I want Munin to be accessible under /munin/ because there other services running on the same host. As soon as the munin files are not unter the root, everything breaks down. R_PATH and ROOT_PATH seem to be set wrong somehow... But I'm not even sure if this is a munstrap problem or just a bug in Munin itself maybe?

jonnymccullagh commented 9 years ago

Kriechi, I don't think this is a bug in either Munin or Munstrap. It is more to do with how you configure your web server. By amending your munin.conf, Nginx confs, path to munin www etc you should be able to achieve what you want. But it might take a little playful cleverness. jonny

Kriechi commented 9 years ago

I don't think so, because in the html files generated by munin and the template, all the URLs and link tags are created with the wrong relative url part. The variables controlling this are R_PATH and ROOT_PATH - but I could not find a way to alter them somehow... I'll dig deeper into the munin perl script responsible for that stuff.

Kriechi commented 9 years ago

I finally figured it out. More or less my own stupidity. Ubuntu 12.04 ships Munin 1.4.6, which as correctly stated in the munstrap-readme, is not supported.

I upgraded the munin package on my server via a custom ppa to v2.0.21. Now everything seems to be working properly.

For anyone else having having this issue with Ubuntu and old Munin packages, I used this: https://chanmannlim.wordpress.com/2014/02/11/munin/