2015-04-07 39 views
0

我已經在同一臺機器上設置了一個石墨和grafana實例,但是使用不同的虛擬主機(使用Apache)能夠彼此獨立地訪問這兩個實例。使用htaccess用戶+密碼的Graphite&Grafana

它運行良好,但只要我嘗試在石墨實例上進行基本身份驗證,grafana就無法讀取數據了。我修改了Grafana的config.js源代碼,以包含石墨實例的用戶名和密碼(如下面的代碼片段所示)。

當我打開Grafana行編輯器時,我看到渲染器不使用用戶名+密碼(在reuqest - > url中)。我看到有:

http://graphite.my-server.de:80/render

怎麼能有Grafana使用的用戶名+密碼才能訪問石墨?

謝謝!

// Graphite & Elasticsearch example setup 
datasources: { 
    graphite: { 
    type: 'graphite', 
    url: "http://adminuser:[email protected]:80", 
    }, 
    elasticsearch: { 
    type: 'elasticsearch', 
    url: "http://adminuser:[email protected]:9200", 
    index: 'grafana-dash', 
    grafanaDB: true, 
    } 
}, 

回答

1

它看起來像你的瀏覽器緩存config.js與以前的設置。 嘗試使用清除緩存或使用其他瀏覽器。

而且,您確定elasticsearch具有相同的基本身份驗證登錄名和密碼嗎?

+0

現在是嘗試grafana v2.0與更簡單的體系結構的好時機。 (: –

1

問題出在apache設置。使用Google Chrome和開發工具插件進行調試顯示了該問題。需要添加這些標頭:

Header set Access-Control-Allow-Origin "http://grafana.my-server.de" 
Header set Access-Control-Allow-Credentials true 
Header set Access-Control-Allow-Methods "GET, OPTIONS" 
Header set Access-Control-Allow-Headers "origin, authorization, accept"