:https://download.csdn.net/download/qq_42208305/87792827
加载离线镜像 :
监控端安装: docker load -i prometheus.tar docker load -i grafana.tar
被监控端安装: docker load -i node-exporter.tar
docker 安装 prometheus
编写配置文件 vi prometheus.yml
# my global confi
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
#多一个监控机器,添加一个配置文件,并重启prometheus
- job_name: 'node_exporter'
static_configs:
- targets:['192.168.137.241:9100']
/opt/prometheus.yml 编写的配置文件路径
docker启动prometheus
docker run -d -p 9090:9090 -v /opt/prometheus.yml:/etc/prometheus/prometheus.yml -v "/etc/localtime:/etc/localtime" --name prometheus --net=host prom/prometheus:latest
docker 安装 grafana
设置登录密码 admin8888
docker run -d -i -p 3000:3000 -v "/etc/localtime:/etc/localtime" -e "GF_SERVER_ROOT_URL=http://grafana.server.name" -e "GF_SECURITY_ADMIN_PASSWORD=admin8888" --net=host grafana/grafana
docker 安装 node-exporter (被监控端安装)
docker run -d -p 9100:9100 -v "/proc:/host/proc" -v "/sys:/host/sys" -v "/:/rootfs" -v "/etc/localtime:/etc/localtime" --net=host prom/node-exporter --path.procfs /host/proc --path.sysfs /host/sys --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
grafana 页面配置
页面访问地址:http://ip:3000 帐号密码 admin admin8888
模版下载:1 Node Exporter Dashboard 22/04/17 通用Job分组版 | Grafana Labs
如果有什么问题,或者步骤有遗漏可以留言