Install

docker run -it\
--name graphite2\
--rm\
-p 80:80\
-p 2003-2004:2003-2004\
-p 2023-2024:2023-2024\
-p 8125:8125/udp\
-p 8126:8126\
graphiteapp/graphite-statsd

配置graphite-statsd容器中的nginx支持跨域

  1. 进入到容器中;
  2. 查看/etc/nginx/sites-enabled/graphite-statsd.conf的跨域相关的配置,将Access-Control-Allow-Headers的值改为*;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';//默认
add_header 'Access-Control-Allow-Headers' '*';// 修改后
add_header 'Access-Control-Allow-Credentials' 'true';
}`
docker run -d -p 3000:3000 grafana/grafana

Configuration Grafana

在Grafana中新增Graphite类型的数据源;

Graphite & Grafana_grafana


新建一个Panel测试一下

Graphite & Grafana_docker_02