Skip to content

Commit

Permalink
Add Stash Grafana dashboard doc for v1beta1 API
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 055df44 commit 4689187
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 55 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions docs/guides/latest/monitoring/grafana/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
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.

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.

>Some basic metrics are also available for Stash Community Edition. You can create your own 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.

## 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).

>**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.**
**Install Panopticon:**

Now, install Panopticon using the following commands:

```bash
$ helm repo add appscode https://charts.appscode.com/stable/
$ helm repo update

$ helm install panopticon appscode/panopticon -n kubeops \
--create-namespace \
--set monitoring.enabled=true \
--set monitoring.agent=prometheus.io/operator \
--set monitoring.serviceMonitor.labels.release=prometheus-stack \
--set-file license=/path/to/license-file.txt
```

## Import Stash Garafana Dashboard

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

```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,

<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`.

<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.

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

Once, you have successfully imported the dashboard, you should see the Stash dashboard similar to this.

<figure align="center">
<img alt="Stash Grafana Dashboard" src="/docs/guides/latest/monitoring/grafana/images/stash_grafana_dashboard.png">
<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.

## Dashboard Tour

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

{{< youtube VYx1OI1tgkE >}}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Stash has native support for monitoring via [Prometheus](https://prometheus.io/)
Stash uses [Prometheus PushGateway](https://github.com/prometheus/pushgateway) to export the metrics for backup & restore operations. The following diagram shows the logical structure of the Stash monitoring flow.

<figure align="center">
<img alt="Stash Monitoring Flow" src="/docs/guides/latest/monitoring/images/monitoring-structure.svg">
<img alt="Stash Monitoring Flow" src="/docs/guides/latest/monitoring/overview/images/monitoring-structure.svg">
<figcaption align="center">Fig: Monitoring process in Stash</figcaption>
</figure>

Expand Down Expand Up @@ -237,19 +237,6 @@ $ helm install stash appscode/stash -n kube-system \
--set-file global.license=/path/to/license-file.txt
```

**Helm 2:**

```bash
$ helm install appscode/stash --name 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-file global.license=/path/to/license-file.txt
```

**YAML (with Helm 3):**

```bash
Expand Down Expand Up @@ -282,17 +269,6 @@ $ helm upgrade stash appscode/stash -n kube-system \
--set stash-community.monitoring.serviceMonitor.labels.k8s-apps=prometheus
```

**Helm 2:**

```bash
$ helm upgrade appscode/stash --name 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
```

**YAML (with Helm 3):**

```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ Forwarding from [::1]:9090 -> 9090
Now, we can access the web UI at `localhost:9090`. Open [http://localhost:9090/targets](http://localhost:9090/targets) in your browser. You should see `pushgateway` and `api` endpoints of `stash` service as targets.

<figure align="center">
<img alt="Stash Monitoring Flow" src="/docs/guides/latest/monitoring/images/prom_builtin_target.png">
<img alt="Stash Monitoring Flow" src="/docs/guides/latest/monitoring/prom-builtin/images/prom_builtin_target.png">
<figcaption align="center">Fig: Prometheus dashboard</figcaption>
</figure>

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ This chart will install [prometheus-operator/prometheus-operator](https://github
The above chart will also deploy a Prometheus server. Verify that the Prometheus server has been deployed by the following command:

```bash
$ kubectl get prometheus -n monitoring
kubectl get prometheus -n monitoring
NAME VERSION REPLICAS AGE
prometheus-stack-kube-prom-prometheus v2.22.1 1 3m
prometheus-stack-kube-prom-prometheus v2.28.1 1 69m
```

Let's check the YAML of the above Prometheus object,

```bash
$ kubectl get prometheus -n monitoring prometheus-stack-kube-prom-prometheus -o yaml
kubectl get prometheus -n monitoring prometheus-stack-kube-prom-prometheus -o yaml
```

```yaml
Expand All @@ -66,14 +66,21 @@ metadata:
annotations:
meta.helm.sh/release-name: prometheus-stack
meta.helm.sh/release-namespace: monitoring
creationTimestamp: "2021-09-27T04:49:18Z"
generation: 1
labels:
app: kube-prometheus-stack-prometheus
app.kubernetes.io/instance: prometheus-stack
app.kubernetes.io/managed-by: Helm
chart: kube-prometheus-stack-12.8.0
app.kubernetes.io/part-of: kube-prometheus-stack
app.kubernetes.io/version: 18.1.0
chart: kube-prometheus-stack-18.1.0
heritage: Helm
release: prometheus-stack
name: prometheus-stack-kube-prom-prometheus
namespace: monitoring
resourceVersion: "1406"
uid: e3100f51-1e17-41fd-81a3-a8f2fb7b6a70
spec:
alerting:
alertmanagers:
Expand All @@ -84,7 +91,7 @@ spec:
port: web
enableAdminAPI: false
externalUrl: http://prometheus-stack-kube-prom-prometheus.monitoring:9090
image: quay.io/prometheus/prometheus:v2.22.1
image: quay.io/prometheus/prometheus:v2.28.1
listenLocal: false
logFormat: logfmt
logLevel: info
Expand Down Expand Up @@ -116,7 +123,8 @@ spec:
serviceMonitorSelector:
matchLabels:
release: prometheus-stack
version: v2.22.1
shards: 1
version: v2.28.1
```
Notice the following ServiceMonitor related sections,
Expand Down Expand Up @@ -169,16 +177,28 @@ Here, we are going to enable monitoring for both backup metrics and operator met
If you haven't installed Stash yet, run the following command to enable Prometheus monitoring during installation

```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.release=prometheus-stack \
$ helm install stash appscode/stash -n kube-system \
--version {{< param "info.version" >}} \
--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
```

```bash
helm install stash charts/stash -n kube-system \
--set features.enterprise=true \
--set global.registry=appscodeci \
--set stash-enterprise.operator.tag=metrics_linux_amd64 \
--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=/home/emruz/Downloads/kubedb-enterprise-license-b99ef564-640a-46d2-80e1-ffcbc48b2fc9.txt
```

</div>
<div class="tab-pane fade" id="existing-installation-tab" role="tabpanel" aria-labelledby="existing-installation-tab">

Expand All @@ -187,33 +207,33 @@ $ helm install stash appscode/stash -n kube-system \
If you have installed Stash already in your cluster but didn't enable monitoring during installation, you can use `helm upgrade` command to enable monitoring in the existing installation.

```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.release=prometheus-stack
$ helm upgrade stash appscode/stash -n kube-system \
--reuse-values \
--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
```

</div>
</div>

>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.

This will create a `ServiceMonitor` object with the same name and namespace as the Stash operator. The `ServiceMonitor` will have the label `release: prometheus-stack` as we have provided it through the `--set monitoring.serviceMonitor.labels` parameter.

Let's verify that the ServiceMonitor has been created in the Stash operator namespace.

```bash
$ kubectl get servicemonitor -n kube-system
NAME AGE
stash 65s
kubectl get servicemonitor -n kube-system
NAME AGE
stash-stash-enterprise 94s
```

Let's check the YAML of the `ServiceMonitor` object,

```bash
$ kubectl get servicemonitor stash -n kube-system -o yaml
kubectl get servicemonitor -n kube-system stash-stash-enterprise -o yaml
```

```yaml
Expand All @@ -223,11 +243,15 @@ metadata:
annotations:
meta.helm.sh/release-name: stash
meta.helm.sh/release-namespace: kube-system
creationTimestamp: "2021-09-27T05:49:05Z"
generation: 1
labels:
app.kubernetes.io/managed-by: Helm
release: prometheus-stack
name: stash
name: stash-stash-enterprise
namespace: kube-system
resourceVersion: "8312"
uid: 6b51920d-9cf2-4604-ba2b-b77c30d8f0d3
spec:
endpoints:
- honorLabels: true
Expand All @@ -239,15 +263,15 @@ spec:
ca:
secret:
key: tls.crt
name: stash-apiserver-cert
serverName: stash.kube-system.svc
name: stash-stash-enterprise-apiserver-cert
serverName: stash-stash-enterprise.kube-system.svc
namespaceSelector:
matchNames:
- kube-system
selector:
matchLabels:
app.kubernetes.io/instance: stash
app.kubernetes.io/name: stash
app.kubernetes.io/name: stash-enterprise
```

Here, we have two endpoints in `spec.endpoints` section. The `pushgateway` endpoint exports backup and recovery metrics and the `api` endpoint exports the operator metrics.
Expand All @@ -267,7 +291,7 @@ Forwarding from [::1]:9090 -> 9090
Now, you can access the Web UI at `localhost:9090`. Open [http://localhost:9090/targets](http://localhost:9090/targets) in your browser. You should see `pushgateway` and `api` endpoints of the Stash operator are among the targets. This verifies that the Prometheus server is scrapping Stash metrics.

<figure align="center">
<img alt="Stash Monitoring Flow" src="/docs/guides/latest/monitoring/images/prom_operator_web_ui.png">
<img alt="Stash Monitoring Flow" src="/docs/guides/latest/monitoring/prom-operator/images/prom_operator_web_ui.png">
<figcaption align="center">Fig: Prometheus Web UI</figcaption>
</figure>

Expand Down

0 comments on commit 4689187

Please sign in to comment.