#Nabox3 adding Prometheus recording rules

1 messages · Page 1 of 1 (latest)

azure storm
#

Hi, I am using Nabox3
And also, I have some self-built Prometheus , harvest and Grafana
In the Prometheus, I am using recording rules to calculate some metrics and given a new metric name
ex:
groups:

  • name: k8s_pvc_metrics
    rules:

    Precompute PVC Info

    • record: kube_pvc_max_info
      expr: max(kube_pod_spec_volumes_persistentvolumeclaims_info{namespace=~"$namespace"})
      by (persistentvolumeclaim, namespace)

    Precompute Namespace Labels with Volume Name

    • record: kube_pvc_namespace_labels
      expr: label_replace(
      kube_persistentvolumeclaim_info{namespace=~"$namespace"}
      * on(job, namespace) group_left(label_prodsuite) kube_namespace_labels,
      "volume_name", "$1", "volumename", "(.*)"
      )

But is it possible to have these recording rules in Nabox3
Can I just create this yaml under "/usr/local/nabox/files/prometheus' and add this yaml file to rule_files under prometheus.yml?

minor roost
#

You might be able to do something like that yes. But in prometheus.yaml set the path relative to the container which is /prometheus/rules_file

azure storm
# minor roost You might be able to do something like that yes. But in prometheus.yaml set the ...

I am now creating a recording_rules.yml under /usr/local/nabox/files/prometheus/ and add the recording_rules.yml into rule_files under prometheus.yml.

I restart prometheus by "dc restart prometheus"
But there are no new metric found.

I tried to add the yaml into default ems_alert_rules.yml,
And it works.

How can I use the newly created yaml instead of adding recording_rules into default yaml?
What do you mean to set the path?

minor roost
#

I was wrong in my previous message. What you see in /usr/local/nabox/files/prometheus is actually seen by prometheus as /etc/prometheus

azure storm
#

Noted.
And how can I use the newly created yaml instead of adding recording_rules into default yaml ex:default ems_alert_rules.yml

minor roost
#

Not sure I follow, sorry.
Current prom config states :

rule_files:
  - 'alert_rules.yml'
  - 'ems_alert_rules.yml'

You could add your own rule file here, as a third line, that would work ?