puppet-prometheus
puppet-prometheus copied to clipboard
Feature request for recording rule support
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.
Hi @bcoleman532, thanks for this issue. Are you able to add a PR for this?
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.
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.
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)',
},
],
},
],
},
},
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.
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.
prometheus < 2 is not an issue anymore, IMHO.
IMHO sufficient solutions are provided. Also there was no significant activity for a few years