码迷,mamicode.com
首页 > 数据库 > 详细

InfluxDB+cAdvisor+Grafana配置Docker监控

时间:2018-01-31 11:21:24      阅读:510      评论:0      收藏:0      [点我收藏+]

标签:nal   val   读写   art   recover   roo   inf   ems   ica   

一、配置influxdb docker run -d -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 --name influxsrv tutum/influxdb 默认用户名:root, 默认密码:root # 创建数据库 create database ‘cadvisor‘; # 创建用户 CREATE USER ‘cadvisor‘ WITH PASSWORD ‘cadvisor‘ # 用户授权 grant all privileges on ‘cadvisor‘ to ‘cadvisor‘ # 授予读写权限 grant WRITE on ‘cadvisor‘ to ‘cadvisor‘ grant READ on ‘cadvisor‘ to ‘cadvisor‘ 二、cadvisor数据收集,在监控节点启动 # docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=9090:8080 --detach=true --name=cadvisor google/cadvisor:latest -storage_driver=influxdb -storage_driver_host=192.168.1.100:8086 -storage_driver_db=cadvisor -storage_driver_user=cadvisor -storage_driver_password=cadvisor storage_driver=influxdb 指定存储驱动,使cadvisor将数据存储到数据库中,更多存储插件,请参考这里 -storage_driver_host=influxdb:8086 InfluxDB数据库的地址 -storage_driver_db=cadvisor 数据库名称 如果要指定用户名可以用-storage_driver_user参数,默认是root 如果要指定密码可以用-storage_driver_password参数,默认是root 报错: W0130 03:47:13.734200 1 manager.go:313] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory I0130 03:47:13.740891 1 manager.go:329] Starting recovery of all containers I0130 03:47:14.131098 1 manager.go:334] Recovery completed F0130 03:47:14.174599 1 cadvisor.go:156] Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory 解决办法: # mount -o remount,rw /sys/fs/cgroup/ # ln -sf /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu 二、prometheus配置 docker run -d -p 9090:9090 -v /nfs/prometheus-data/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus 配置文件: global: scrape_interval: 15s # By default, scrape targets every 15 seconds. # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels: monitor: ‘codelab-monitor‘ # A scrape configuration containing exactly one endpoint to scrape: # Here it‘s Prometheus itself. scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: ‘prometheus‘ # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 5s static_configs: - targets: [‘192.168.1.100:9090‘] 三、grafana展示 docker run -d -p 3000:3000 grafana/grafana http://10.6.8.41:3000/login 用户名密码admin admin

InfluxDB+cAdvisor+Grafana配置Docker监控

标签:nal   val   读写   art   recover   roo   inf   ems   ica   

原文地址:http://blog.51cto.com/peaceweb/2067182

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!