vimeo / graph-explorer

A graphite dashboard powered by structured metrics
http://vimeo.github.io/graph-explorer/
Apache License 2.0
1.06k stars 93 forks source link

Can't POST metrics from Graphite #47

Closed liquid-sky closed 11 years ago

liquid-sky commented 11 years ago

Hi Dieterbe,

Wanted to test graph-explorer, but for some reason it's unable to POST anything from Graphite render, because it doesn't form URL fully. Here's some some debug info to illustrate that.

When I query for mem_usage (this metric is present in Graphite and in graph-explorer's metrics.json), graph-explorer generated page shows that one metric was found and there's graph present, but nothing's visible:

Patterns: target_type=what=mem_usage
Group by: target_type=what=server
Avg by:
Sum by:
From: -24hours
To: now
Limit: 500
Statement: graph
# targets matching: 1/29
# graphs matching: 0/0
# graphs from matching targets: 1
# total graphs: 1

I've noticed that the POST request that graph-explorer sends to Nginx hosting Graphite looks like this:

5.32.125.220 - - [01/Oct/2013:15:19:17 +0000] "POST /render/ HTTP/1.1" 200 3772 "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"

Where it requests for '/render/' and doesn't form a full target URL with the metric name and parameters.

On graph-explorer side it seems to be processing just fine, but there's no data to process:

5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /index/mem_usage HTTP/1.1" 200 8584 "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/jquery-ui.min.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/jquery.tswidget.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/graphite_helpers.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/rickshaw/vendor/d3.min.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/rickshaw/vendor/d3.layout.min.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/rickshaw/rickshaw.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/flot/jquery.flot.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/flot/jquery.flot.selection.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/flot/jquery.flot.time.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/flot/jquery.flot.stack.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/jquery.flot.axislabels.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/rickshaw/rickshaw.css HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/timezone-js/src/date.js HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "POST /graphs/ HTTP/1.1" 200 6465 "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
5.32.125.200 - - [01/Oct/2013:15:43:45 +0000] "GET /timeserieswidget/tz/northamerica HTTP/1.1" 304 - "http://5.32.60.23:8080/index/mem_usage" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"

Why doesn't it form request in full format ('/render/?<...>')? Have I missed anything in configuration? I've Graphite and Graph-Explorer running on two VMs in the same VLAN.

liquid-sky commented 11 years ago

The issue was with Nginx permissions. After adding

add_header Access-Control-Allow-Origin "*";    
add_header Access-Control-Allow-Methods "GET, OPTIONS";
add_header Access-Control-Allow-Headers "origin, authorization, accept";

Into graphite vhost config, I'm able to get graphs.