Skip to content

Commit

Permalink
Add readme for alerts in prometheus 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jhooyberghs committed Dec 5, 2017
1 parent d2e0c7a commit deb8216
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ or simply:
include ::prometheus
```

To add alert rules, add the following to the class prometheus:
To add alert rules, add the following to the class prometheus in case you are using prometheus < 2.0:
```puppet
alerts => [{ 'name' => 'InstanceDown', 'condition' => 'up == 0', 'timeduration' => '5m', labels => [{ 'name' => 'severity', 'content' => 'page'}], 'annotations' => [{ 'name' => 'summary', content => 'Instance {{ $labels.instance }} down'}, {'name' => 'description', content => '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.' }]}]
```
Expand All @@ -91,6 +91,23 @@ alertrules:

```

When using prometheus >= 2.0, we use the new yaml format (https://prometheus.io/docs/prometheus/2.0/migration/#recording-rules-and-alerts) configuration

```yaml
alerts:
groups:
- name: alert.rules
rules:
- alert: 'InstanceDown'
expr: 'up == 0'
for: '5m'
labels:
'severity': 'page'
annotations:
'summary': 'Instance {{ $labels.instance }} down'
'description': '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.'
```
On the monitored nodes:
```puppet
Expand Down

0 comments on commit deb8216

Please sign in to comment.