1
0
Fork 0
salty-dog/rules/grafana.yml

104 lines
2.5 KiB
YAML
Raw Permalink Normal View History

2019-06-26 00:07:52 +00:00
name: grafana
rules:
- name: single-env
desc: dashboards must have a single environment tag
level: info
tags:
- grafana
- dashboard
- env
select: '$.dashboard'
check:
type: object
properties:
tags:
type: array
oneOf:
- contains:
const: production
- contains:
const: staging
- name: production-alerts
2019-06-26 00:07:52 +00:00
desc: dashboards with the production tag must use notification channels with production in the name
level: info
tags:
- grafana
- dashboard
2019-06-26 12:10:05 +00:00
# this is not the ideal selector for this rule, but tags are located at $.dashboard.tags, while notification
# channels are nested under $.dashboard.panels[*].alert.notifications[*].uid
select: '$.dashboard'
2019-06-26 00:07:52 +00:00
filter:
type: object
properties:
tags:
type: array
items:
type: string
contains:
const: production
check:
type: object
properties:
panels:
type: array
items:
type: object
properties:
alert:
type: object
properties:
notifications:
type: array
items:
type: object
required: [uid]
properties:
uid:
type: string
pattern: production
- name: staging-alerts
desc: dashboards with the staging tag must not use notification channels with production in the name
level: info
tags:
- grafana
- dashboard
select: '$.dashboard'
filter:
type: object
properties:
tags:
type: array
items:
type: string
contains:
const: staging
2019-06-26 00:07:52 +00:00
check:
type: object
properties:
panels:
type: array
items:
type: object
properties:
alert:
2019-06-26 00:07:52 +00:00
type: object
properties:
notifications:
type: array
items:
type: object
required: [uid]
properties:
uid:
type: string
not:
pattern: production