From 9c4513e5647c9155aa5da2115826f6a8973c23f4 Mon Sep 17 00:00:00 2001 From: Subbarao Meduri Date: Wed, 20 Nov 2024 07:44:38 -0500 Subject: [PATCH] doc: clarify users must login to grafana console before swithching grafana user Signed-off-by: Subbarao Meduri --- tools/README.md | 57 ++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/tools/README.md b/tools/README.md index c900c76fe..a167414a0 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,12 +1,12 @@ -# How to design a grafana dashboard +# How to Design a Grafana Dashboard ## Prerequisites You must enable the observability service by creating a MultiClusterObservability CustomResource (CR) instance. -## Setup grafana develop instance +## Setup Grafana Developer Instance -Firstly, you should use this script `setup-grafana-dev.sh` to setup your grafana instance. You need to run this as a kubeadmin user. +Use the script `setup-grafana-dev.sh` to setup your Grafana instance. You need to run this as a `kubeadmin` user. ```bash $ ./setup-grafana-dev.sh --deploy @@ -27,32 +27,35 @@ clusterrolebinding.rbac.authorization.k8s.io/open-cluster-management:grafana-crb Grafana dev URL: grafana-dev-open-cluster-management-observability.apps..com ``` -## Switch user to be grafana admin +## Switch User to be Grafana Admin -Secondly, you need to ask a user to login grafana-dev host before use this script `switch-to-grafana-admin.sh` to switch the user to be a grafana admin. +1. Log in to Grafana developer instance by navigating to the URL: + `https://grafana-dev-open-cluster-management-observability.apps..com` + Use the credentials of the user who you want to be Grafana admin to complete the login. -```bash -$ ./switch-to-grafana-admin.sh kube:admin -User switched to be grafana admin -``` - -The above example shows a kubeadmin user. However, let us say the following user is logged in: - -```bash -oc whoami -frank -``` +2. Run the `switch-to-grafana-admin.sh` script to assign Grafana admin privileges to the logged-in user. + + For example, if you want `kube:admin` to be Grafana admin, you would run: + ```bash + $ ./switch-to-grafana-admin.sh kube:admin + User switched to be Grafana admin + ``` -Now, if we want to make `frank` Grafana admin, we will simply run: + If another user, such as `frank`, is logged in, you would run: + ```bash + $ ./switch-to-grafana-admin.sh frank + User frank switched to be Grafana admin + ``` -```bash -$ ./switch-to-grafana-admin.sh frank -User frank switched to be grafana admin -``` + Note: If you see an error like the one below, it may be because you did not log in to the Grafana developer instance in step (1) or you provided an invalid username. + ```bash + $ ./switch-to-grafana-admin.sh frank + Failed to fetch user ID, please check your user name + ``` -## Design your grafana dashboard +## Design your Grafana Dashboard -Now, refresh the grafana console and follow these steps to design your dashboard: +Now, refresh the Grafana console and follow these steps to design your dashboard: 1. Click the **+** icon on the left panel, select **Create Dashboard**, and then click **Add new panel**. 2. In the New Dashboard/Edit Panel view, go to the **Query** tab. @@ -94,17 +97,17 @@ annotations: observability.open-cluster-management.io/dashboard-folder: Custom ``` -5. Update metrics allowlist +5. Update Metrics List if Necessary -When you generate a new dashboard like [example/custom-dashboard.yaml](example/custom-dashboard.yaml), there may have no data when you first create it. This is because it depends on some new metrics which don't upload to hub by default. You also need to update custom metrics allowlist, so that new metrics can be uploaded to the server and shown in dashboard. In this example, run the following command to update metrics. +When creating a new dashboard (e.g., [example/custom-dashboard.yaml](example/custom-dashboard.yaml)), it may be necessary to add new metrics using a custom allowlist config map if the new dashboard depends on new metrics which are not collected by default. Below is an example of how custom metrics can be added to support the example dashboard. ```bash oc apply -f observability-metrics-custom-allowlist.yaml ``` -## Uninstall grafana develop instance +## Uninstall Grafana Developer Instance -You can use the following command to uninstall your grafana instance. +You can use the following command to uninstall your Grafana instance. ```bash $ ./setup-grafana-dev.sh --clean