Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request for recording rule support #69

Open
bcoleman532 opened this issue Oct 17, 2017 · 7 comments
Open

Feature request for recording rule support #69

bcoleman532 opened this issue Oct 17, 2017 · 7 comments
Labels
enhancement New feature or request

Comments

@bcoleman532
Copy link

While I can define where prometheus can find a recording rule file, this module gives me no means to specify the contents of that file.

Ideally I would like to be able to use the same module to handle both the prometheus configuration and recording rule definitions.

@bastelfreak
Copy link
Member

Hi @bcoleman532, thanks for this issue. Are you able to add a PR for this?

@bcoleman532
Copy link
Author

At this time, no.

My workaround for this is a crude "just get it working" fix instead of doing it correctly.

I'd love to be able to eventually provide a PR but between my newness to puppet and my lack of time to work on creating one it isn't something that I could provide any time soon.

@bastelfreak
Copy link
Member

Are you able to share your hack as a PR? We can use that as a baseline to work together on the feature. Don't be scared about contribution, everybody started somewhere.

@allangood
Copy link

Hi @bcoleman532

I'm facing the same problem as you, but I resolved using the "extra_alerts" parameter.
IMHO, it works just fine and a new parameter will be overkill... Maybe just changing this parameter name for "extra_rules" makes more sense since this parameter can be used for any kind of rules, not only alerts.

How to use it:

extra_alerts => {
      'record_rules' => {
        'groups' => [
          {
            'name' => 'record.rules',
            'rules' => [
              {
                'record' => 'device:disk_free:avg',
                'expr' => 'avg(avg_over_time(disk_free{fstype=~"(ext[234]|btrfs)"}[1w])) by(host,device)',
              },
            ],
          },
        ],
      },
    },

@bramblek1
Copy link

This workaround is great for Prom 2.0 , it doesn't work for versions <2.0 as the templating does not recognise an "alert" with fields record/expr

My $0.02 opinion is that $alerts, $extra_alerts are incorrectly named and really should be $rules and $extra_rules in line with $rule_files.

@bastelfreak , @bcoleman532 I've got a branch for making the workaround valid for prom <2.0 if that is helpful for anyone else.

@hooten
Copy link

hooten commented Nov 8, 2019

It might work to use the rule_files param to support recording/alerting rules. You can specify a filepath glob, which allows you to break your rules up into multiple files.

@TheMeier
Copy link
Contributor

TheMeier commented May 5, 2024

prometheus < 2 is not an issue anymore, IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants