docker部署prometheus:v2.2.1
参考链接:官网:https://prometheus.io/非官方:https://github.com/1046102779/prometheusPrometheus 实战:https://songjiayang.gitbooks.io/prometheus/content/运维之美:https://www.hi-linux.com/posts/25047.htmlsystemctl stop
参考链接:
systemctl stop firewalld
systemctl enable firewallld
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
yum -y install docker
systemctl start docker
systemctl enable docker
#*************************************
docker search prometheus
docker pull docker.io/prom/prometheus:v2.2.1
mkdir /var/lib/prometheus-data
docker run -d -p 9090:9090 -v /root/prometheus/prometheus-rules/alerting.rules:/etc/prometheus-rules/alerting.rules -v /root/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /var/lib/prometheus-data:/prometheus --name prometheus docker.io/prom/prometheus:v2.2.1
#配置文件
cat /root/prometheus/prometheus.yml
global:
scrape_interval: 1m
scrape_timeout: 10s
evaluation_interval: 1m
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "192.168.1.223:9093"
rule_files:
- /etc/prometheus-rules/*.rules
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets:
- 192.168.1.223:9090
cat /root/prometheus/prometheus-rules/alerting.rules
groups:
- name: example-rules
interval: 30s # defaults to global interval
rules:
- alert: Node Down
expr: up{job="kubernetes-nodes"} == 0
annotations:
miqTarget: "ContainerNode"
severity: "HIGH"
message: "{{$labels.instance}} is down"
groups:- name: example-rules interval: 30s # defaults to global interval rules: - alert: Node Down expr: up{job="kubernetes-nodes"} == 0 annotations: miqTarget: "ContainerNode" severity: "HIGH" message: "{{$labels.instance}} is down" |
更多推荐
所有评论(0)