process-exporter docker docker部署
- docker拉取镜像无法拉取问题
docker run -d --name process-exporter -p 9256:9256 --restart unless-stopped -v /home/prometheus/process_exporter.yml:/process_exporter.yml timn/process-exporte --config.path=process_exporter.yml
process-exporter二进制安装
- 下载
wget https://github.com/ncabatoff/process-exporter/releases/download/v0.7.10/process-exporter-0.7.10.linux-amd64.tar.gz
- 定义配置文件
cd /home/prometheus/
vim process_exporter.yml
process_names:
#指定多个进程:
- name: "{{.Matches}}"
cmdline:
- 'docker'
- name: "{{.Matches}}"
cmdline:
- 'fdfs_storaged'
- name: "{{.Matches}}"
cmdline:
- 'fdfs_trackerd'
- name: "{{.Matches}}"
cmdline:
- 'sshd'
#指定所有进程方式:
#process_names:
# - name: "{{.Comm}}"
# cmdline:
# - '.+'
- 添加服务启动
cat > /usr/lib/systemd/system/process_exporter.service << EOF
[Unit]
Description=process_exporter
Documentation=https://github.com/ncabatoff/process-exporter
After=network.target
[Service]
Type=simple
ExecStart=/home/prometheus/process-exporter -config.path=/home/prometheus/process_exporter.yml
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl enable process_exporter
systemctl daemon-reload && systemctl enable process_exporter
- Prometheus配置文件添加对应节点
scrape_configs:
- job_name: process-exporter
static_configs:
- targets: ['192.168.27.47:9256']
labels:
instance: process-exporter
blackbox-exporter 部署
- docker 部署blackbox-exporter
docker run -itd -p 9115:9115 --name blackbox_exporter prom/blackbox-exporter:v0.25.0
- grafana 上导入 blackbox_exporter dashboard:
13659
- blackbox_exporter 采集加入的采集池中
scrape_configs:
- job_name: 'blackbox-http'
# metrics的path 注意不都是/metrics
metrics_path: /probe
# 传入的参数
params:
module: [http_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
- http://baidu.com # Target to probe with http.
- https://jd.com # Target to probe with https.
- http://192.168.27.47:3000 # Target to probe with http on port 3000.
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.168.27.47:9115
- job_name: 'blackbox-port'
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 192.168.27.38:8010
- 192.168.27.39:8010
labels:
instance: 'port_status'
group: 'tcp'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.168.27.47:9115
-
模块使用 ssh_banner 探172.20.70.215:22
http://172.20.70.205:9115/probe?module=ssh_banner&target=172.20.70.215:22
-
进行ping探测
http://172.20.70.205:9115/probe?module=icmp&target=www.baidu.com
评论区