Skip to content

Instantly share code, notes, and snippets.

@willthames
Created September 13, 2019 01:41
Show Gist options
  • Save willthames/994b3f3d7a5b43ecf3a0855d82857f3d to your computer and use it in GitHub Desktop.
Save willthames/994b3f3d7a5b43ecf3a0855d82857f3d to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: ConfigMap
metadata:
name: test-rules
namespace: monitoring
data:
node.rules.yml: |-
{{ lookup('template', 'template.j2')|indent(4) }}
- 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 }}"
- debug:
var: item
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