Sign inSign up

osshelp/drone-prometheus-alerts

By osshelp

Updated over 1 year ago

Drone CI plugin for testing alerting and recording rules in Prometheus

Image
1

2.2K

osshelp/drone-prometheus-alerts repository overview

Description

Docker image for testing alerting and recording rules in Prometheus.

Settings

ParamDefaultDescription
alertrules_diralertsDirectory with alerting rules files
alertrules_files""If empty string files will be searched in the alertrules_dir
recordingrules_dirrulesDirectory with recording rules files
recordingrules_files""If empty string files will be searched in the recordingrules_dir
alertrules_tests_dirtestsDirectory with tests
alertrules_tests""If empty string files will be searched in the alertrules_tests_dir
scrapetargets_dirtestsDirectory 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
verbosefalseShow verbose output, including promtool results

Usage examples

Find and lint files automatically
steps:
  - name: check and test alertrules
    image: osshelp/drone-prometheus-alerts
Specific files to check and specific tests
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
Exclude files by exclude_regex
steps:
  - name: check and test alertrules
    image: osshelp/drone-prometheus-alerts
    settings:
      exclude_regex: '(regex1|regex2)'

FAQ

Why it fails with alerts without tests?

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.

Why do you create temporary prometheus.yml?

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.

Sources

Source repository is available at Github here.

License

GPL3

Author

OSSHelp Team, see https://oss.help

Tag summary

Content type

Image

Digest

sha256:415ea6889

Size

48.3 MB

Last updated

over 1 year ago

docker pull osshelp/drone-prometheus-alerts