赞
踩
# 因为目录/data用户组和用户是jtserver,docker执行命令是root用户,先将/data/lib/prometheus给其他组权限才能执行
sudo mkdir /data/lib/prometheus
sudo chown 767 /data/lib/prometheus
docker run -d \
-p 9090:9090 \
--restart=always \
--name prometheus \
-v /data/lib/prometheus:/data/lib/prometheus \
-v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/data/lib/prometheus
docker run -d -p 9100:9100 \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
--restart=always \
prom/node-exporter \
--collector.procfs /host/proc \
--collector.sysfs /host/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
docker run -d \
-p 3000:3000 \
--restart=always \
--name=grafana \
-e "GF_SECURITY_ADMIN_PASSWORD=admin" \
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,raintank-worldping-app,grafana-piechart-panel" \
-v /data/lib/grafana:/var/lib/grafana \
grafana/grafana
docker pull prom/mysqld-exporter
mysql> INSERT INTO mysql.user(Host,User,Password) VALUES("localhost", "mysql_monitor", password("mysql_monitor"));
mysql> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'mysql_monitor'@'localhost' IDENTIFIED BY 'mysql_monitor';
mysql> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'mysql_monitor'@'%' IDENTIFIED BY 'mysql_monitor';
mysql> FLUSH PRIVILEGES;
docker run -d -p 9104:9104 \
--name=mysqld-exporter \
--restart=always \
-e DATA_SOURCE_NAME="mysql_monitor:mysql_monitor@(172.17.0.1:3306)/" \
prom/mysqld-exporter
参考
- https://github.com/prometheus/node_exporter
- https://github.com/grafana/grafana-docker
- http://www.ywnds.com/?p=9668
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。