Drone CI plugin for testing alerting and recording rules in Prometheus
2.2K
Docker image for testing alerting and recording rules in Prometheus.
| Param | Default | Description |
|---|---|---|
alertrules_dir | alerts | Directory with alerting rules files |
alertrules_files | "" | If empty string files will be searched in the alertrules_dir |
recordingrules_dir | rules | Directory with recording rules files |
recordingrules_files | "" | If empty string files will be searched in the recordingrules_dir |
alertrules_tests_dir | tests | Directory with tests |
alertrules_tests | "" | If empty string files will be searched in the alertrules_tests_dir |
scrapetargets_dir | tests | Directory with scrape targets |
scrapetargets_files | "" | If empty string files will be searched in the scrapetargets_dir |
exclude_regex | ^NO_EXCLUDE_FILES\$ | Regular expression to exclude files from checking and testing |
verbose | false | Show verbose output, including promtool results |
steps:
- name: check and test alertrules
image: osshelp/drone-prometheus-alerts
steps:
- name: check and test alertrules
image: osshelp/drone-prometheus-alerts
settings:
alertrules_files:
- alerts/file1.yml
- alerts/file2.yml
alertrules_tests:
- tests/test1.yml
steps:
- name: check and test alertrules
image: osshelp/drone-prometheus-alerts
settings:
exclude_regex: '(regex1|regex2)'
Using alerting rules without corresponding testing is considered a very bad idea. One day you can break your alerting without even noticing it. The consequences you can imagine by yourself. So, read the official docs on promtool and add tests for your alerting rules.
There are some scenarios where testing standalone alerting and/or recording rules isn't enough. So, we decided to render temporary prometheus.yml based on the default one from official releases. All found rules and targets are injected into this prometheus.yml, then it's validated by promtool check config prometheus.yml. Just another layer of protection from unusual mistakes.
Source repository is available at Github here.
GPL3
OSSHelp Team, see https://oss.help
Content type
Image
Digest
sha256:415ea6889…
Size
48.3 MB
Last updated
over 1 year ago
docker pull osshelp/drone-prometheus-alerts