sansae@sansaeubuntu:~$ docker run -d --name prometheus --link exporter --link alertmanager -p 9090:9090 prom/prometheus
8125a3d79028fca48963236c2f5a3c1ca12fe2287af0e5331253bebf8bb55434
sansae@sansaeubuntu:~$
sansae@sansaeubuntu:~$ docker exec -it prometheus sh
/prometheus $ vi /etc/prometheus/prometheus.yml
/prometheus $
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9093
rule_files:
- "/etc/prometheus/alert.urles"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/prometheus $
/prometheus $
/prometheus $ vi /prometheus/alert.rules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
groups:
- name: example
rules:
- alert: cpuUsge
expr: 100 - (avg by (instance) (irate(node_cpu_seconds_total{job='node_exporter',mode="idle"}[5m])) * 100) > 9545
for: 1m
labels:
severity: critical
annotations:
summary: Machine under healvy load
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scrape_configs:
- job_name: 'node_exporter'
scrape_interval: 5s
static_configs:
- targets: ['exporter:9100']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/prometheus $ exit
sansae@sansaeubuntu:~$
sansae@sansaeubuntu:~$ docker stop prometheus
prometheus
sansae@sansaeubuntu:~$ docker start prometheus
prometheus
sansae@sansaeubuntu:~$ |