0

我安装了石墨,它正在更新数据。我还安装并配置了 grafana 以使用石墨。

当我尝试在 grafana 上创建图表时,我收到“时间序列请求错误”。

我在同一台服务器上有 grafana 石墨。这与Cors有关吗?我不熟悉配置 cors 等。

我将如何解决这个问题?

这是我的 nginx.conf 文件:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

server {
    listen 8080 default_server;
    server_name _;
    location / {
      root /srv/www/htdocs;
      index index.html;
    }
    location /graphite/ {
        add_header 'Access-Control-Allow-Origin' *;
        proxy_pass                 http://127.0.0.1:8090/;
        proxy_set_header           X-Real-IP   $remote_addr;
        proxy_set_header           X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header           X-Forwarded-Proto  $scheme;
        proxy_set_header           X-Forwarded-Server  $host;
        proxy_set_header           X-Forwarded-Host  $host;
        proxy_set_header           Host  $host;
        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;
    }

    location /elasticsearch/ {
        proxy_pass                 http://127.0.0.1:9200/;
        proxy_set_header           X-Real-IP   $remote_addr;
        proxy_set_header           X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header           X-Forwarded-Proto  $scheme;
        proxy_set_header           X-Forwarded-Server  $host;
        proxy_set_header           X-Forwarded-Host  $host;
        proxy_set_header           Host  $host;

        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;
    }

} }

4

1 回答 1

0

如果您制作 Nginx proxy_pass,则不需要 CORS。按照我的建议使用 Nginx 设置 Grafana https://github.com/mikhailov/grafana/blob/master/sample/nginx_testing.conf

于 2014-11-09T20:44:54.670 回答