Importing Dashboards and Alerts into Kloudfuse
Update Recording Rules
-
Add the following configuration for recording rules to the Kloudfuse
custom_values.yaml
file. -
Change the rule name and expression as necessary.
rulemanager: rules: groups: - name: recording_rules rules: - record: application_availability_slo (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]))
1 Defines a new metric application_availability_slo
using the rule specified in theexpr
field. -
If adding multiple rules, then add them to a group of its own,
MyGroup
: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]))
-
Reinstall the helm release.
Importing Dashboards and Alerts
Using Kloudfuse Catalog Service
See Catalog Service.
Deprecation
This feature is deprecated as of 3.2.2 Kloudfuse release. |
Using Kloudfuse Customer Scripts
To migrate existing alerts, use the alert.py
file, hosted for you in our customer/scripts/alerts_upload_download_delete_script
/
directory.
To migrate existing dashboards, use the upload_dashboards.sh
and download_dashboards.sh
files, hosted for you in our customer/scripts/
directory.
Using Grafana APIs
Dashboards
Grafana Dashboards can easily be exported and imported, either from the UI or HTTP API (see Grafana documentation for Dashboard HTTP API).
-
UI
-
HTTP API
Import the converted dashboards to Grafana in your environment; see Grafana documentation Import Dashboard.
Create an API key. You must also have a folder for storing the generated alerts. Use the following command to import the converted Grafana dashboard:
# 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
This section explains how to import to Grafana, based on Grafana Alert API. If you are importing the alerts definition into the Prometheus server directly, the input format (converted file) has a different form. Contact our Support team before converting so that we can validate the converted file format. |
Follow these steps to import the Grafana alerts to your grafana instance.
-
Create a folder (namespace) where to store the imported alerts.
-
Update
folderUID
andruleGroup
in the alert json to match the folder where you plan to create the alert rule.-
To gt the
folderUID
of the destination folder, run the following curl query:curl -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <API_KEY>' \ -X GET http://<cluster-address>/grafana/api/folders
-
To create a
ruleGroup
, see Grafana Documentation Create a new rule group.
-
-
If using the command line with HTTP API, you must have an API key with admin privilege.
curl -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <API_KEY>' \ -X POST http://<cluster-address>/grafana/api/v1/provisioning/alert-rules -d @<converted-file-location.json>