Marvel + Nginx

monitoring

#1

Hello again,

Trying to get Marvel's dashboard working behind Nginx. Everything works if I bypass Nginx by going to http://myserver:9200/_plugin/marvel/. Going through Nginx by going to http://my-server/marvel/ gives me an empty dashboard. Url goes up to http://myserver/marvel/kibana/index.html#/dashboard and then stops.

With Nginx:


Without Nginx:

Nginx sites-available:

server {
    listen 80;

    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location /kibana/ {
        proxy_http_version     1.1;
        proxy_ignore_headers   Cache-Control;
        proxy_pass             http://localhost:5601/;
        proxy_read_timeout     90;
        proxy_redirect         off;
        proxy_set_header       Authorization '';
        proxy_set_header       Connection "";
        proxy_set_header       Host $http_host;
        proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header       X-Forwarded-Proto $scheme;
     }

     location /marvel/ {
        proxy_http_version     1.1;
        proxy_ignore_headers   Cache-Control;
        proxy_pass             http://localhost:9200/_plugin/marvel/;
        proxy_read_timeout     90;
        proxy_redirect         off;
        proxy_set_header       Authorization '';
        proxy_set_header       Connection "";
        proxy_set_header       Host $http_host;
        proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header       X-Forwarded-Proto $scheme;
     }
}

Nginx error logs show the following:

2015/09/24 14:58:42 [error] 19623#0: *241 open() "/usr/share/nginx/html/_nodes" failed (2: No such file or directory), client: <my public ip>, server: , request: "GET /_nodes HTTP/1.1", host: "my-server", referrer: "http://my-server/marvel/kibana/index.html"

It's trying to get /_nodes, but is looking for it in Nginx's own directory.

The only mentions of _nodes I could find below:

./plugins/marvel/_site/sense/app/kb/api_0_90/nodes.js:define([],function(){return function(n){n.addEndpointDescription("_nodes/hot_threads",{methods:["GET"],patterns:["_nodes/hot_threads","_nodes/{nodes}/hot_threads"]})}});

./plugins/marvel/_site/sense/app/kb/api_1_0/nodes.js:define([],function(){return function(e){e.addEndpointDescription("_nodes/hot_threads",{methods:["GET"],patterns:["_nodes/hot_threads","_nodes/{nodes}/hot_threads"]}),e.addEndpointDescription("_nodes/info",{patterns:["_nodes","_nodes/{metrics}","_nodes/{nodes}","_nodes/{nodes}/{metrics}","_nodes/{nodes}/info/{metrics}"],url_components:{metrics:["settings","os","process","jvm","thread_pool","network","transport","http","plugins","_all"]}}),e.addEndpointDescription("_nodes/stats",{patterns:["_nodes/stats","_nodes/stats/{metrics}","_nodes/stats/{metrics}/{index_metric}","_nodes/{nodes}/stats","_nodes/{nodes}/stats/{metrics}","_nodes/{nodes}/stats/{metrics}/{index_metric}"],url_components:{metrics:["os","jvm","thread_pool","network","fs","transport","http","indices","process","breaker","_all"],index_metric:["store","indexing","get","search","merge","flush","refresh","filter_cache","id_cache","fielddata","docs","warmer","percolate","completion","segments","translog","query_cache","_all"]}})}});


(Niraj Kumar) #2

Can you paste the entire config. Including where the root is pointing to.


(Jamiel) #3

You need to proxy /_nodes to your elasticsearch instance. Add in:

location /_nodes {
proxy_http_version 1.1;
proxy_ignore_headers Cache-Control;
proxy_pass http://localhost:9200/_nodes;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header Authorization '';
proxy_set_header Connection "";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

Or simply add a default proxy to send everything to your ES instance if your security circumstances allows it.


(Luc Suryo) #4

I tried the above config but still having issues. Marvel comes up but no data, with the url :9200/_plugin/marvel is see the clients.... we are only allowed to expose port 80 or 443 so
without a working setup we can use Marvel, fyi the kopf plugin works just find...

full config

server {

listen 80 ;
server_name marvel.internal.momo.net;

location /marvel/ {
    proxy_http_version 1.1;
    proxy_ignore_headers Cache-Control;
    proxy_pass http://localhost:9200/_plugin/marvel/;
    proxy_read_timeout 90;
    proxy_redirect off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

location /_nodes {
    proxy_http_version 1.1;
    proxy_ignore_headers Cache-Control;
    proxy_pass http://localhost:9200/_nodes;
    proxy_read_timeout 90;
    proxy_redirect off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

ES 1.7.3 with latest Marvel 1.3


(system) #5