Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to configure grafana with graphite

Tags:

nginx

graphite

I am using Nginx to serve both graphite and grafana (they are all running on the same server - not my desktop). I am able to access graphite via Nginx. However, grafana cannot seem to connect to graphite (error: Graphite HTTP Request Error). I have copied the nginx config below for grafana - any ideas on fixing this will be appreciated. The request URL that fails in the browser is this (accessible if I access it directly in the browser):

**http://xxx.xxx.xxx.xxx:8080/render**

Nginx default

server { 
        listen 85;  ##listen [::]:85; #ipv6only=on;
        server_name grafana;
        root /home/xxxx/grafana-1.5.3/;
        index index.html index.htm;
        ##logging per server
        access_log /var/log/nginx/grafana/access.log;
        error_log /var/log/nginx/grafana/error.log;

       location / {
       ##  root /home/xxxx/grafana-1.5.3/;
       }
}

config.js URL for graphite (in grafana)

graphiteUrl: "http://xxx.xxx.xxx.xxx:8080"

Edit Graphite does not need authentication for access from grafana. Also, I am using grafana v1.5.3

like image 627
ali haider Avatar asked Apr 29 '14 20:04

ali haider


2 Answers

Try to access graphite through nginx (same origin). Just add new location

location /render {
                proxy_pass      http://xxx.xxx.xxx.xxx:8080/render;
}

then in your grafana config file change graphite url

like image 200
Onbayev Kanat Avatar answered Oct 06 '22 15:10

Onbayev Kanat


I was able to solve this problem by changing the requests to GET instead of POST. See this issue for more information. https://github.com/grafana/grafana/issues/345

My data sources ended up looking like

datasources: {
  graphite: {
    type: 'graphite',
    url: window.location.protocol+"//"+window.location.hostname+":"+window.location.port+"/_graphite",
    default: true,
    render_method: 'GET'  
  },
},

I still haven't figured out how to get my graphite install to accept POST requests. Even when querying directly so I can be sure CORS isn't an issue.

like image 33
Justin B Avatar answered Oct 06 '22 17:10

Justin B