Created
September 13, 2019 01:41
-
-
Save willthames/994b3f3d7a5b43ecf3a0855d82857f3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: test-rules | |
namespace: monitoring | |
data: | |
node.rules.yml: |- | |
{{ lookup('template', 'template.j2')|indent(4) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
tasks: | |
- set_fact: | |
resources: [] | |
- set_fact: | |
resources: >- | |
{{ resources + lookup('template', item) | from_yaml_all | list }} | |
loop: | |
- includer.yml | |
- include_tasks: task.yml | |
loop: "{{ resources }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- debug: | |
var: item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groups: | |
- name: node.rules | |
rules: | |
- alert: node.loadaverage | |
expr: (node_load5 / count(node_cpu_seconds_total{job="aws-nodes",mode="system"}) WITHOUT (cpu, mode)) > 20 | |
for: 2m | |
labels: | |
service: k8s | |
severity: INFO | |
annotations: | |
description: '{{ '{{ $labels.instance }}' }}: The 5 minute average load is high: {{ '{{ $value | printf "%.2f" }}' }}' | |
summary: '{{ '{{ $labels.instance }}' }}: High load average detected' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment