赞
踩
1.官网下载较慢,可选择镜像下载:https://www.cnblogs.com/liuhanxu/p/14426627.html
- tar xvfz prometheus-2.36.1.linux-amd64.tar.gz # 解压
-
- cd prometheus-2.36.1.linux-amd64 #切换到解压后的路径
3.启动
- # 直接启动
- ./prometheus --config.file=prometheus.yml
-
- # 后台启动
- nohup ./prometheus --config.file=prometheus.yml > prom.log 2>&1 &
启动后默认端口号是 9090
- - job_name: "nodes"
- static_configs:
- - targets: ['192.168.1.110:9100'] # 此处填写你上面 被监控机器启动的 采集器(node_exporter,下面将讲到)的ip
- 和端口.
- # - targets: ['192.168.1.110:9100'] 有多个就在后面追加多个
- # 解压
- tar -xvf node_exporter-1.3.1.linux-amd64.tar.gz
- # 切换到解压后的目录
- cd node_exporter-1.3.1.linux-amd64
3.启动
- # 切换到解压目录后,直接启动命令如下,但关闭命令行窗口后就停止服务了
- ./node_exporter
-
- # 后台启动
- nohup ./node_exporter > node_exporter.log 2>&1 &
-
4. 修改配置
- ./node_exporter --help # 查看支持的所有collectors,可根据实际需求 enable 和 disabled
- 各项指标收集
- 如 --collector.cpu=disabled ,不再收集cpu相关信息
2. 选择 prometheus
3. 配置 prometheus 的服务器ip和端口,配完之后拉到最后保存 (Save & test)
4. 创建监控看板
下载 看板模板(新手推荐):https://grafana.com/grafana/dashboards/12633
https://grafana.com/grafana/dashboards/1860
下载模板后,导入看板 dashboard
5. 选择刚刚创建的数据源
最后效果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。