学习笔记Linux基础Linux 基础 - Grafana 监控
Pupper一、 安装 node-exporter
1.下载 node-exporter
1
| docker pull prom/node-exporter
|
2.创建容器
1
| docker run -id --name=exporter -p 9100:9100 prom/node-exporter
|
3.连接页面查看是否可以访问
1
| http://ip 地址:9101/metrics
|
二、Prometheus安装及配置
1. 设置配置文件
1 2 3
| mkdir /home/prometheus cd /home/prometheus vim prometheus.yml
|
::: danger
下边的地址为安装 node_exporter 的地址,如果监控其他服务器,需要将 localhost 改为其他服务器的 ip 地址, 端口号为 node_exporter 的映射端口号
:::
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| global: scrape_interval: 60s evaluation_interval: 60s
scrape_configs: - job_name: prometheus static_configs: - targets: ['localhost:9090'] labels: instance: prometheus
- job_name: linux static_configs: - targets: ['IP地址:9100'] labels: instance: localhost
|
2.下载 Prometheus
1
| docker pull prom/prometheus
|
3.创建容器
1
| docker run -id --name=prometheus -p 9090:9090 -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
|
4.连接页面查看是否可以访问
三、安装 Grafana
1.拉取镜像
1
| docker pull grafana/grafana
|
2.创建容器
1
| docker run -id --name=myGrafana -p 3000:3000 grafana/grafana
|
3.连接页面查看是否可以访问
::: tip
初始的账号密码都为 admin
:::