...
 
Commits (2)
../prometheus-only/alert.rules.yml
\ No newline at end of file
route:
receiver: pushover_receiver
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
group_by: [cluster, alertname]
receivers:
- name: pushover_receiver
pushover_configs:
- user_key: uq2igmdbjbpz5ay2n4mc1ry7djs8yz
token: ay4yuv58m9k9c11qvbbpqmpawfyko6
version: "3"
services:
prom:
image: prom/prometheus:v2.4.3
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./alert.rules.yml:/etc/prometheus/alert.rules.yml
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
ports:
- 9090:9090
depends_on:
- exporter
exporter:
image: prom/node-exporter:v0.16.0
ports:
- "9100:9100"
alertmanager:
image: prom/alertmanager:v0.15.2
volumes:
- ./alertmanager.yml:/alertmanager.yml
command:
- '--config.file=/alertmanager.yml'
- '--web.external-url=http://localhost:9093/'
ports:
- '9093:9093'
\ No newline at end of file
../prometheus-only/prometheus.yml
\ No newline at end of file
alerts1='[
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example1"
},
"annotations": {
"info": "The disk sda1 is running full",
"summary": "please check the instance example1"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda2",
"instance": "example1"
},
"annotations": {
"info": "The disk sda2 is running full",
"summary": "please check the instance example1",
"runbook": "the following link http://test-url should be clickable"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example2"
},
"annotations": {
"info": "The disk sda1 is running full",
"summary": "please check the instance example2"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sdb2",
"instance": "example2"
},
"annotations": {
"info": "The disk sdb2 is running full",
"summary": "please check the instance example2"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example3",
"severity": "critical"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example3",
"severity": "warning"
}
}
]'
curl -XPOST -d"$alerts1" http://localhost:9093/api/v1/alerts
\ No newline at end of file
......@@ -9,4 +9,4 @@ groups:
severity: page
annotations:
summary: "Instance {{ $labels.instance }} down"
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 30 seconds."
......@@ -4,7 +4,7 @@ global:
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
monitor: 'cosee-monitor'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
......@@ -15,7 +15,12 @@ scrape_configs:
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- targets: ['localhost:9090', 'exporter:9100']
alerting:
alertmanagers:
- static_configs:
- targets: ["alertmanager:9093"]
rule_files:
- 'alert.rules.yml'
\ No newline at end of file