Checkmk / grafana-checkmk-datasource

CheckMK data source for Grafana
Apache License 2.0
88 stars 14 forks source link

Align defaults for datasource settings #236

Closed BenediktSeidl closed 10 months ago

BenediktSeidl commented 10 months ago

Previously we had two different defaults for the edition setting:

If you use a provisioned datasource and did not specify the edition explicitly, you saw "CEE" chosen in the UI, but the backend actually used the "RAW" edition.

In order to align this, we chose to set both defaults to CEE.

If you use checkmk raw edition and a provisioned datasource or created the datasource with an very old version of this plugin you have to take manual action:

You can use the following python script to check if you are affected: (You can only be affected if you use the plugin to fetch matrices from checkmk raw edition.)

import requests

GRAFANA_URL = "http://127.0.0.1:3000/"  # with closing slash

URL = f"{GRAFANA_URL}api/datasources"

GRAFANA_USER = "admin"
GRAFANA_PASSWORD = "password"
data_sources = requests.get(URL, auth=(GRAFANA_USER, GRAFANA_PASSWORD))

for data_source in data_sources.json():
    if data_source["type"] in {"tribe-29-checkmk-datasource", "checkmk-cloud-datasource"}:
        json_data = data_source["jsonData"]
        if "edition" not in json_data:
            print("found affected data_source:")
            print(f'  name: {data_source["name"]}')
            print(f'  id: {data_source["id"]}')
            print(f'  uid: {data_source["uid"]}')