Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7

Recording Rules

Add the configuration as described below in <custom_values.yaml> to add recording rules to kfuse and reinstall the helm release. Change the rule name and expression as desired. Following example defines a recording rules to create a metric named application_availability_slo using rule as specified in the expr field.

Code Block
  rulemanager:
    rules:
      groups:
      - name: recording_rules
        rules:
          - record: application_availability_slo
            expr: sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*"}[28d])) / sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*|5.*"}[28d]))

If you are adding multiple rules then its best to add them to a group of its own, as follows (using MyGroup):

Code Block
  rulemanager:
    rules:
      ...
      MyGroup:
      - name: my_group_rules
        rules:
          - record: rule_name_1
            expr: sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*"}[28d])) / sum by (kube_cluster_name, kube_service) (increase(promhttp_metric_handler_requests_total{code=~"2.*|5.*"}[28d]))

Dashboards & Alerts

Using Kloudfuse catalog service

Please refer to the catalog service documentation here.

Using grafana apis

Dashboards

Grafana Dashboards can easily be exported and imported, either from the UI or from the HTTP API

  • If using UI, the converted dashboards can be imported to grafana Grafana in your environment by simply following instructions from Grafana found here.

  • If using the command line (using the HTTP API), you will need an API key with admin privilege. You can create an API key by following these instructions. Also, you will need a folder to have been created to which the alerts will be With the API key generated, use the following command to import the provided/converted grafana Grafana dashboard:

    • Code Block
      # the curl command to import the dashboard
      curl -H 'Content-Type: application/json' \
           -H 'Authorization: Bearer <API_KEY>' \
           -X POST http://<cluster-address>/grafana/api/dashboards/db -d @<converted-file-location.json>

Alerts

Note that the following is intended to import to Grafana as per Grafana Alert Provisioning API. If you are importing the alerts definition to the Prometheus server directly, the input format (i.e., the converted file) is different. Please make sure to communicate with the Kloudfuse team prior to conversion to ensure that you have the correct format of the converted files.

...

  • Make sure to create a folder (namespace) for where the alerts need to be imported. Update folderUID and ruleGroup in the alert json to match the folder where you wish to create the alert rule.

    • If you are unsure what the folderUID is of the destination folder, you can query get it using curl:

    • Code Block
      curl -H 'Content-Type: application/json' \
           -H 'Authorization: Bearer <API_KEY>' \
          -X GET http://<cluster-address>/grafana/api/folders
    • If you don’t have a ruleGroup created already, you can create one by following these instructions.

  • If using the command line (using the HTTP API), you will need an API key with admin privilege. You can create an API key by following these instructions.

  • Code Block
    # the curl command to import alerts.
    curl -H 'Content-Type: application/json' \
         -H 'Authorization: Bearer <API_KEY>' \
        -X POST http://<cluster-address>/grafana/api/rulerv1/grafana/api/v1/rules/<NAMESPACE>provisioning/alert-rules -d @<converted-file-location.json>

...