-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align defaults for datasource settings
Previously we had two different defaults for the edition setting: * one default was set to CEE but was only applied if the datasource settings page was opened and was only applied to the backend after "save" was pressed. * the other default setting was set to RAW and was applied in the backend 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: * if you use a provisioned datasource: specify the edition explicitly * if you used a old version of this plugin to create the datasource: open the datasource settings, make sure the RAW edition is chosen, and save the settings. 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"]}') ```
- Loading branch information
1 parent
c1e5358
commit bbf3f1f
Showing
4 changed files
with
39 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Backend as BackendType, DataSourceOptions, Edition } from './types'; | ||
|
||
export class Settings { | ||
protected settings: DataSourceOptions; | ||
|
||
constructor(settings: DataSourceOptions) { | ||
this.settings = settings; | ||
} | ||
|
||
get edition(): Edition { | ||
// cloud instances of this plugin don't save the edition and use this default | ||
return this.settings.edition ?? 'CEE'; | ||
} | ||
|
||
get backend(): BackendType { | ||
// cloud instances of this plugin don't save the backend and use this default | ||
return this.settings.backend ?? 'rest'; | ||
} | ||
|
||
get url(): string | undefined { | ||
return this.settings.url; | ||
} | ||
|
||
get username(): string { | ||
return this.settings.username ?? ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters