Docker InfluxDB和Grafana配置

拉取镜像

1
docker pull samuelebistoletti/docker-statsd-influxdb-grafana:2.1.0

启动镜像

1
2
3
4
5
6
7
8
9
docker run --ulimit nofile=66000:66000 \
-d \
--name docker-statsd-influxdb-grafana-2.1.0 \
-p 3003:3003 \
-p 3004:8888 \
-p 8086:8086 \
-p 22022:22 \
-p 8125:8125/udp \
samuelebistoletti/docker-statsd-influxdb-grafana:2.1.0

关闭启动

1
2
3
docker stop docker-statsd-influxdb-grafana

docker start docker-statsd-influxdb-grafana

端口映射关系

Mapped Ports

1
2
3
4
5
6
7
Host		Container		Service

3003 3003 grafana
3004 8888 influxdb-admin (chronograf)
8086 8086 influxdb
8125 8125 statsd
22022 22 sshd

SSH

1
ssh root@localhost -p 22022

Password: root

Grafana

Open http://localhost:3003

1
2
Username: root
Password: root

Add data source on Grafana

  1. Using the wizard click on Add data source
  2. Choose a name for the source and flag it as Default
  3. Choose InfluxDB as type
  4. Choose direct as access
  5. Fill remaining fields as follows and click on Add without altering other fields
1
2
3
4
Url: http://localhost:8086
Database: telegraf
User: telegraf
Password: telegraf

Basic auth and credentials must be left unflagged. Proxy is not required.

Now you are ready to add your first dashboard and launch some query on database.

InfluxDB

Web Interface

Open http://localhost:3004

1
2
3
Username: root
Password: root
Port: 8086

InfluxDB Shell (CLI)

  1. Establish a ssh connection with the container
  2. Launch influx to open InfluxDB Shell (CLI)

数据收集

安装TeleGraf

1
brew install telegraf

设置

/etc/telegraf/telegraf.conf
修改influxdb地址,用户名及密码,设置hostname

1
telegraf -config /usr/local/etc/telegraf.conf

重启服务

1
brew services restart telegraf

导入Grafana Dashboard

下载最新版本的dashboard配置:
https://grafana.com/dashboards/1443/revisions

在grafana的新建dashboard并导入配置,完成。

注意

docker内部已经启动了telegraf,如果不需要的话可以停掉,在多台服务器上安装并配置Telegraf写入同一Influxdb就可以实现对集群进行系统监控。

参考

Docker Image with Telegraf (StatsD), InfluxDB and Grafana

Docker+Grafana+Influxdb+Telegraf安装部署

Telegraf+InfluxDB+Grafana搭建服务器监控平台

grafana + influxdb + telegraf , 构建性能监控平台

Grafana部署-展示Zabbix数据

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. Mapped Ports
  2. 2. SSH
  3. 3. Grafana
    1. 3.1. Add data source on Grafana
  4. 4. InfluxDB
    1. 4.1. Web Interface
    2. 4.2. InfluxDB Shell (CLI)
  5. 5. 数据收集
  6. 6. 参考
,