|
|
|
@ -22,9 +22,9 @@
|
|
|
|
|
|
|
|
|
|
# Prometheus
|
|
|
|
|
|
|
|
|
|
## 安装启动
|
|
|
|
|
## prometheus
|
|
|
|
|
|
|
|
|
|
### Linux安装
|
|
|
|
|
### Linux
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 下载
|
|
|
|
@ -38,11 +38,13 @@ mv prometheus-2.35.0-rc1.linux-amd64 prometheus
|
|
|
|
|
./prometheus --config.file=./prometheus.yml --web.enable-lifecycle
|
|
|
|
|
# --config.file=./prometheus.yml 指定配置
|
|
|
|
|
# --web.enable-lifecycle这个参数的主要目的是为了运行时重载配置
|
|
|
|
|
|
|
|
|
|
# 测试地址:http://localhost:9090/targets
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Docker安装
|
|
|
|
|
### Docker
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 启动prometheus
|
|
|
|
@ -54,40 +56,25 @@ prom/prometheus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 测试
|
|
|
|
|
|
|
|
|
|
http://localhost:9090/targets
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Grafana
|
|
|
|
|
|
|
|
|
|
## 安装启动
|
|
|
|
|
|
|
|
|
|
### Docker安装
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 启动grafana
|
|
|
|
|
docker run -d -p 3000:3000 --name=grafana \
|
|
|
|
|
-v /home/soft/monitor/grafana/Grafana-storage:/var/lib/Grafana \
|
|
|
|
|
-v /etc/localtime:/etc/localtime:ro \
|
|
|
|
|
grafana/grafana
|
|
|
|
|
```
|
|
|
|
|
### 配置
|
|
|
|
|
|
|
|
|
|
**使用方式**
|
|
|
|
|
|
|
|
|
|
- 第一步:添加数据源prometheus
|
|
|
|
|
- 第二步:导入或创建Dashboard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Node Exporter
|
|
|
|
|
## node_exporter
|
|
|
|
|
|
|
|
|
|
据说最好安装在linux上。
|
|
|
|
|
node_exporter用于采集服务器层面的运行指标,包括机器的loadavg、filesystem、meminfo等基础监控,类似于传统主机监控维度的zabbix-agent。node_exporter由prometheus官方提供、维护,不会捆绑安装,但基本上是必备的exporter。建议最好安装在linux上使用。
|
|
|
|
|
|
|
|
|
|
### 下载安装
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 下载地址https://github.com/prometheus/node_exporter/releases
|
|
|
|
|
wget https://github.91chi.fun//https://github.com//prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-386.tar.gz
|
|
|
|
|
|
|
|
|
|
# 解压
|
|
|
|
|
tar -zxvf node_exporter-1.3.1.linux-386.tar.gz
|
|
|
|
|
|
|
|
|
|
# 启动node_exporter
|
|
|
|
|
nohup ./node_exporter --web.listen-address 172.16.1.167:8081 &
|
|
|
|
|
|
|
|
|
@ -99,7 +86,7 @@ nohup ./node_exporter --web.listen-address 172.16.1.167:8081 &
|
|
|
|
|
### 配置方式
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
- job_name: node
|
|
|
|
|
- job_name: 'node_local'
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets: ['localhost:9100']
|
|
|
|
|
```
|
|
|
|
@ -114,6 +101,50 @@ https://grafana.com/grafana/dashboards/9276
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## mysql_exporter
|
|
|
|
|
|
|
|
|
|
### 下载安装
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 下载地址:https://github.com/prometheus/mysqld_exporter/releases
|
|
|
|
|
wget https://github.91chi.fun//https://github.com//prometheus/mysqld_exporter/releases/download/v0.14.0/mysqld_exporter-0.14.0.linux-386.tar.gz
|
|
|
|
|
|
|
|
|
|
export DATA_SOURCE_NAME='root:123456@(127.0.0.1:3306)/'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 监控模板
|
|
|
|
|
|
|
|
|
|
https://grafana.com/grafana/dashboards/7362
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Grafana
|
|
|
|
|
|
|
|
|
|
## 安装启动
|
|
|
|
|
|
|
|
|
|
### Docker安装
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 启动grafana
|
|
|
|
|
docker run -d -p 3000:3000 --name=grafana \
|
|
|
|
|
-v /home/soft/monitor/grafana/Grafana-storage:/var/lib/Grafana \
|
|
|
|
|
-v /etc/localtime:/etc/localtime:ro \
|
|
|
|
|
grafana/grafana
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**使用方式**
|
|
|
|
|
|
|
|
|
|
- 第一步:添加数据源prometheus
|
|
|
|
|
- 第二步:导入或创建Dashboard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## cAdvisor
|
|
|
|
|
|
|
|
|
|
### Docker安装
|
|
|
|
@ -197,12 +228,6 @@ https://grafana.com/grafana/dashboards/12900
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## MySQL
|
|
|
|
|
|
|
|
|
|
### 监控模板
|
|
|
|
|
|
|
|
|
|
https://grafana.com/grafana/dashboards/7362
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Sentry
|
|
|
|
|