搭建 监控 linux,3分钟在linux服务器搭建一套prometheus+grafana监控

1.服务器node执行,被监控端

docker run -d --name node-exporter --restart=always --net="host" --pid="host" -v "/:/host:ro,rslave" prom/node-exporter --path.rootfs=/host

docker run -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /var/lib/docker/:/var/lib/docker:ro -p 28080:8080 --detach=true --privileged=true --name=cadvisor --restart=always google/cadvisor:latest

2.直接再现有prometheus上配置

或者在服务器执行下面命令搭建一个

docker run -d -p 9090:9090 --restart=always --name=prometheus -v /data/prom/prometheus/config:/etc/prometheus prom/prometheus --config.file=/etc/prometheus/prometheus.yml --web.enable-lifecycle

配置主机

global:

scrape_interval: 35s

evaluation_interval: 35s

alerting:

alertmanagers:

static_configs:

targets:

alert.devops-test.mingyuanyun.com

rule_files:

"first_rules.yml"

- "second_rules.yml"

scrape_configs:

job_name: 'prometheus'

static_configs:

targets: ['localhost:9090']

job_name: 测试环境win

honor_timestamps: true

scrape_interval: 50s

scrape_timeout: 40s

metrics_path: /metrics

scheme: http

static_configs:

targets:

xxxx:9182

job_name: 测试环境linux

honor_timestamps: true

scrape_interval: 50s

scrape_timeout: 40s

metrics_path: /metrics

scheme: http

static_configs:

targets:

10.5.11.xxx:9100

job_name: 测试环境容器

honor_timestamps: true

scrape_interval: 50s

scrape_timeout: 40s

metrics_path: /metrics

scheme: http

static_configs:

targets:

10.5.11.xxx:28080

搭建一个模板

docker run -d --restart=always -p 3001:3000 --name grafana grafana/grafana

导入 8919

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值