Skip to content

Commit

Permalink
Update instruction for enabling Prometheus monitoring in Stash
Browse files Browse the repository at this point in the history
Signed-off-by: Emruz Hossain <emruz@appscode.com>
  • Loading branch information
Emruz Hossain committed Sep 27, 2021
1 parent 4689187 commit 1f57664
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 101 deletions.
40 changes: 15 additions & 25 deletions docs/guides/latest/monitoring/grafana/index.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
---
title: Stash Grafana Dashboard | Stash
description: Using Stash Grafana Dashboard
menu:
docs_{{ .version }}:
identifier: monitoring-grafana-dashboard
name: Grafana Dashboard
parent: monitoring
weight: 30
product_name: stash
menu_name: docs_{{ .version }}
section_menu_id: guides
---

{{< notice type="warning" message="This is an Enterprise-only feature. You must be **Stash Enterprise** customer to use pre-built Stash Grafana dashboard." >}}

# Stash Grafana Dashboard

Grafana provides an elegant graphical user interface to visualize data. You can create beautiful dashboard easily with a meaningful representation of your Prometheus metrics.
Grafana provides an elegant graphical user interface to visualize data. You can create a beautiful dashboard easily with a meaningful representation of your Prometheus metrics.

We provide a pre-built Grafana dashboard to our **Stash Enterprise** users only. In this guide, we are going to show you how you can import this dashboard from your Grafana UI. We will also give you an overview of the different components of the dashboard.
We provide a pre-built Grafana dashboard to our **Stash Enterprise** users. In this guide, we are going to show you how you can import this dashboard from your Grafana UI.

>Some basic metrics are also available for Stash Community Edition. You can create your own dashboard using those metrics.
>Some basic metrics are also available for Stash Community Edition. You can create your dashboard using those metrics.
## Before You Begin

- At first, you need to setup a Prometheus monitoring stack in your cluster. Please, follow the [Prometheus Operator](/docs/guides/latest/monitoring/prom-operator/index.md) guide to setup your monitoring stack if you haven't done already.
- Then, install Stash Enterprise edition with monitoring enabled. Please, follow [this guide](/docs/guides/latest/monitoring/prom-operator/index.md#enable-monitoring-in-stash) if you haven't done already.
- You must have `stash_dashboard.json` file. Please, contact us to get the dashboard json file.
- You must have `stash_dashboard.json` file. Please, contact us to get the dashboard JSON file.

## Install Panopticon

Stash Grafana dashboard depends on our another product called [Panopticon](https://blog.byte.builders/post/introducing-panopticon/). It is a Kubernetes state metric exporter similar to [kube-state-metrics](https://github.com/kubernetes/kube-state-metrics) but generic for all Kubernetes resources including CRDs. In this section, we are going to show the installation procedure for Panopticon.

**Issue License:**

Like other AppsCode products, [Panopticon](https://blog.byte.builders/post/introducing-panopticon/) also need a license to to run. You can grab a 30 days trial license for Panopticon from [here](https://license-issuer.appscode.com/?p=panopticon-enterprise).
Like other AppsCode products, [Panopticon](https://blog.byte.builders/post/introducing-panopticon/) also need a license to run. You can grab a 30 days trial license for Panopticon from [here](https://license-issuer.appscode.com/?p=panopticon-enterprise).

>**If you already have an enterprise license for KubeDB or Stash, you do not need to issue a new license for Panopticon. Your existing KubeDB or Stash license will work with Panopticon.**
Expand All @@ -54,31 +40,35 @@ $ helm install panopticon appscode/panopticon -n kubeops \
--set-file license=/path/to/license-file.txt
```

Make sure to use the appropriate label in `monitoring.serviceMonitor.labels` field according to your setup. This label is used by the Prometheus server to select the desired ServiceMonitor.

## Import Stash Garafana Dashboard

At first, let's port-forward the respective service for Grafana dashboard so that we can access through our browser.
At first, let's port-forward the respective service for the Grafana dashboard so that we can access it through our browser locally.

```bash
❯ kubectl port-forward -n monitoring service/prometheus-stack-grafana 3000:80
Forwarding from 127.0.0.1:3000 -> 3000
Forwarding from [::1]:3000 -> 3000
```

Now, go to http://localhost:3000/ and login to your Grafana UI. Then, on the Grafana UI, click the `+` icon from the left sidebar and then click on `Import` button as below,
Now, go to [http://localhost:3000](http://localhost:3000/) in your browser and login to your Grafana UI. If you followed the [Prometheus Operator](/docs/guides/latest/monitoring/prom-operator/index.md) guide to deploy your Prometheus stack, then the default username and password should be `admin`, and `prom-operator` respectively.

Then, on the Grafana UI, click the `+` icon from the left sidebar and then click on `Import` button as below,

<figure align="center">
<img alt="Import Stash Grafana Dashboard: Step 1" src="/docs/guides/latest/monitoring/grafana/images/import_dashboard_1.png">
<figcaption align="center">Fig: Import Stash Grafana Dashboard (Step 1)</figcaption>
</figure>

Then, on the import UI, you can either upload the `stash_dashboard.json` file by clicking `Upload JSON file` button or you can paste the content of the JSON file in the text area labeled as `Import via panel json`.
Then, on the import UI, you can either upload the `stash_dashboard.json` file by clicking the `Upload JSON file` button or you can paste the content of the JSON file in the text area labeled as `Import via panel json`.

<figure align="center">
<img alt="Import Stash Grafana Dashboard: Step 2" src="/docs/guides/latest/monitoring/grafana/images/import_dashboard_2.png">
<figcaption align="center">Fig: Import Stash Grafana Dashboard (Step 2)</figcaption>
</figure>

Then, on the next step click `Import` button as below.
Then, on the next step click the `Import` button as below.

<figure align="center">
<img alt="Import Stash Grafana Dashboard: Step 3" src="/docs/guides/latest/monitoring/grafana/images/import_dashboard_3.png">
Expand All @@ -92,10 +82,10 @@ Once, you have successfully imported the dashboard, you should see the Stash das
<figcaption align="center">Fig: Stash Grafana Dashboard</figcaption>
</figure>

If your cluster does not have any backup configured, you may see the dashboard panels are empty. Nothing to worry here. Just, run some backups and your dashboard should be populated automatically.
>If your cluster does not have any backup configured, you may see the dashboard panels are empty. Nothing to worry about here. Just, run some backups and your dashboard should be populated automatically.
## Dashboard Tour

The following video gives a tour of different components of the Stash Grafana dashboard.
The following video gives a tour of the different components of the Stash Grafana dashboard.

{{< youtube VYx1OI1tgkE >}}
48 changes: 24 additions & 24 deletions docs/guides/latest/monitoring/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ You have to enable Prometheus monitoring during installing / upgrading Stash. Th

| Helm Values | Acceptable Values | Default | Usage |
| -------------------------------------------------- | --------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stash-community.monitoring.agent` | `prometheus.io/builtin` or `prometheus.io/operator` | `none` | Specify which monitoring agent to use for monitoring Stash. |
| `stash-community.monitoring.backup` | `true` or `false` | `false` | Specify whether to monitor Stash backup and restore. |
| `stash-community.monitoring.operator` | `true` or `false` | `false` | Specify whether to monitor Stash operator. |
| `stash-community.monitoring.serviceMonitor.labels` | any label | `app: <generated app name>` and `release: <release name>`. | Specify the labels for ServiceMonitor. Prometheus crd will select ServiceMonitor using these labels. Only usable when monitoring agent is `prometheus.io/operator`. |
| `stash-enterprise.monitoring.agent` | `prometheus.io/builtin` or `prometheus.io/operator` | `none` | Specify which monitoring agent to use for monitoring Stash. |
| `stash-enterprise.monitoring.backup` | `true` or `false` | `false` | Specify whether to monitor Stash backup and restore. |
| `stash-enterprise.monitoring.operator` | `true` or `false` | `false` | Specify whether to monitor Stash operator. |
| `stash-enterprise.monitoring.serviceMonitor.labels` | any label | `app: <generated app name>` and `release: <release name>`. | Specify the labels for ServiceMonitor. Prometheus crd will select ServiceMonitor using these labels. Only usable when monitoring agent is `prometheus.io/operator`. |

>Use `stash-enterprise` instead of `stash-community` if you are using Stash Enterprise edition.
>Use `stash-community` instead of `stash-enterprise` if you are using Stash Community edition.
You can enable monitoring in Stash as below,
The following instruction show example of enabling monitoring in Stash for the Prometheus server deployed with Prometheus Operator. You can check the [Builtin Prometheus](/docs/guides/latest/monitoring/prom-builtin/index.md) scraper guide if you are managing your Prometheus server manually.

<ul class="nav nav-tabs" id="installerTab" role="tablist">
<li class="nav-item">
Expand All @@ -229,11 +229,11 @@ If you haven't installed Stash yet, run the following command to enable Promethe
```bash
$ helm install stash appscode/stash -n kube-system \
--version {{< param "info.version" >}} \
--set features.community=true \
--set stash-community.monitoring.agent=prometheus.io/operator \
--set stash-community.monitoring.backup=true \
--set stash-community. monitoring.operator=true \
--set stash-community.monitoring.serviceMonitor.labels.k8s-app=prometheus \
--set features.enterprise=true \
--set stash-enterprise.monitoring.agent=prometheus.io/operator \
--set stash-enterprise.monitoring.backup=true \
--set stash-enterprise. monitoring.operator=true \
--set stash-enterprise.monitoring.serviceMonitor.labels.release=prometheus-stack \
--set-file global.license=/path/to/license-file.txt
```

Expand All @@ -243,11 +243,11 @@ $ helm install stash appscode/stash -n kube-system \
$ helm install stash appscode/stash -n kube-system \
--no-hooks \
--version {{< param "info.version" >}} \
--set features.community=true \
--set stash-community.monitoring.agent=prometheus.io/operator \
--set stash-community.monitoring.backup=true \
--set stash-community.monitoring.operator=true \
--set stash-community.monitoring.serviceMonitor.labels.k8s-app=prometheus \
--set features.enterprise=true \
--set stash-enterprise.monitoring.agent=prometheus.io/operator \
--set stash-enterprise.monitoring.backup=true \
--set stash-enterprise.monitoring.operator=true \
--set stash-enterprise.monitoring.serviceMonitor.labels.release=prometheus-stack \
--set-file global.license=/path/to/license-file.txt | kubectl apply -f -
```

Expand All @@ -263,10 +263,10 @@ If you have installed Stash already in your cluster but didn't enable monitoring
```bash
$ helm upgrade stash appscode/stash -n kube-system \
--reuse-values \
--set stash-community.monitoring.agent=prometheus.io/operator \
--set stash-community.monitoring.backup=true \
--set stash-community.monitoring.operator=true \
--set stash-community.monitoring.serviceMonitor.labels.k8s-apps=prometheus
--set stash-enterprise.monitoring.agent=prometheus.io/operator \
--set stash-enterprise.monitoring.backup=true \
--set stash-enterprise.monitoring.operator=true \
--set stash-enterprise.monitoring.serviceMonitor.labels.release=prometheus-stack
```

**YAML (with Helm 3):**
Expand All @@ -275,10 +275,10 @@ $ helm upgrade stash appscode/stash -n kube-system \
$ helm upgrade stash appscode/stash -n kube-system \
--no-hooks \
--reuse-values \
--set stash-community.monitoring.agent=prometheus.io/operator \
--set stash-community.monitoring.backup=true \
--set stash-community.monitoring.operator=true \
--set stash-community.monitoring.serviceMonitor.labels.k8s-apps=prometheus | kubectl apply -f -
--set stash-enterprise.monitoring.agent=prometheus.io/operator \
--set stash-enterprise.monitoring.backup=true \
--set stash-enterprise.monitoring.operator=true \
--set stash-enterprise.monitoring.serviceMonitor.labels.release=prometheus-stack | kubectl apply -f -
```

</div>
Expand Down
Loading

0 comments on commit 1f57664

Please sign in to comment.