Skip to content

Commit

Permalink
doc: clarify users must login to grafana console before swithching gr…
Browse files Browse the repository at this point in the history
…afana user (#1673)

Signed-off-by: Subbarao Meduri <[email protected]>
  • Loading branch information
subbarao-meduri authored Dec 16, 2024
1 parent dc0ecbe commit d07e087
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -27,32 +27,35 @@ clusterrolebinding.rbac.authorization.k8s.io/open-cluster-management:grafana-crb
Grafana dev URL: grafana-dev-open-cluster-management-observability.apps.<basedomain>.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.<basedomain>.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 <kube:admin> 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 <kube:admin> 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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d07e087

Please sign in to comment.