makeporngreatagain.pro
yeahporn.top
hd xxx

Recording Rules In Prometheus

392
  1. Using the expression editor, view the uptime of all targets:
     up
  2. Since we don’t want to alert on each individual job and instance we have, let’s take the average of our uptime instead:
     avg (up)
  3. We do not want an average of everything, however. Next, use the without clause to ensure we’re not merging our targets by instance:
     avg without (instance) (up)
  4. Further refine the expression so we only see the uptime for our forethought jobs:
     avg without (instance) (up{job="forethought"})
  5. Now that we have our expression written, we can look into how to add this as a rule. Switch to your terminal.
  6. Open the Prometheus configuration file:
     $ sudo $EDITOR /etc/prometheus/prometheus.yml
  7. Locate the rule_files parameter. Add a rule file at rules.yml:
     rule_files:
       - "rules.yml"

    Save and exit the file.

  8. Create the rules.yml file in /etc/prometheus:
     $ sudo $EDITOR /etc/prometheus/rules.yml
  9. Every rule needs to be contained in a group. Define a group called uptime, which will track the uptime of anything that affects the end user:
     groups:
       - name: uptime
  10. We’re first going to define a recording rule, which will keep track of the results of a PromQL expression, without performing any kind of alerting:
    groups:
      - name: uptime
        rules:
          - record: job:uptime:average:ft
            expr: avg without (instance) (up{job="forethought"})

    Notice that format of record — this is the setup we need to use to define the name of our recording rule. Once defined, we can call this metric directly in PromQL.

    The expr is just the expression, as we would normally write it in the expression editor.

    Save and exit the file.

  11. Restart Promtheus for the rules changes to take effect:
    $ sudo systemctl restart prometheus
  12. Return to the web UI and navigate to Status > Rules.
  13. Click on the provided rule — it will take us to the expression editor! Return to the Rules page when done.

Comments are closed, but trackbacks and pingbacks are open.

baseofporn.com https://www.opoptube.com
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.