Skip to content

Commit

Permalink
Example Grafana dashboard for Quilkin Metrics
Browse files Browse the repository at this point in the history
Created setup scripts (Makefile) and a sample dashboard (screenshot in
this commit) to show off some of Quilkin's expected metrics.

Over time this can be expanded to include more panels in this dashboard,
and other dashboards as well 👍🏻

At this stage, stayed away from Filter specific metrics, so that we have
something that works out of the box, and can be expanded as needed.

Closes #234
  • Loading branch information
markmandel committed Jun 22, 2021
1 parent 14a1d8c commit 2d3fda8
Show file tree
Hide file tree
Showing 5 changed files with 710 additions and 0 deletions.
62 changes: 62 additions & 0 deletions examples/grafana-dashboards/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2021 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))


# setup grafana, prometheus and the charts
setup: setup-prometheus setup-grafana install-dashboards

# clean up the cluster
clean: clean-prometheus clean-grafana clean-dashboards

# install prometheus in the cluster
setup-prometheus: SCRAPE_INTERVAL ?= 30s
setup-prometheus:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm upgrade prometheus prometheus-community/prometheus --install --wait \
--namespace metrics --create-namespace \
--set server.global.scrape_interval=$(SCRAPE_INTERVAL) $(HELM_ARGS)

clean-prometheus:
helm uninstall prometheus --namespace=metrics

# install grafana in the cluster
setup-grafana: PASSWORD ?= admin
setup-grafana:
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm upgrade grafana grafana/grafana --install --wait \
--namespace=metrics --create-namespace \
--set adminPassword=$(PASSWORD) $(HELM_ARGS) -f $(current_dir)/grafana.yaml

clean-grafana:
helm uninstall grafana --namespace=metrics

install-dashboards:
kubectl apply -f $(current_dir)/dashboards/

clean-dashboards:
kubectl delete -f $(current_dir)/dashboards/

# portforward prometheus web ui
prometheus-portforward: DOCKER_RUN_ARGS+=--network=host
prometheus-portforward:
kubectl port-forward deployments/prometheus-server 9090 -n metrics

# portforward grafana web ui
grafana-portforward: DOCKER_RUN_ARGS+=--network=host
grafana-portforward:
kubectl port-forward deployments/grafana 3000 -n metrics
29 changes: 29 additions & 0 deletions examples/grafana-dashboards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Grafana Dashboards

This folder provides example [Grafana][grafana] dashboards for Quilkin metrics.

![example general dashboard](./quilkin-general.png)

## Importing the dashboards

If you are hosting Grafana on a Kubernetes cluster, and have the
[Sidecar for dashboard](https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md#sidecar-for-datasources)
enabled, run:

`kubectl apply -f ./dashboards/` to apply all the ConfigMaps for the dashboards to your cluster into the `metrics`
namespace.

If you are running Grafana in an alternative environement, copy and paste the JSON from the yaml files
into the [Import Dashboard](https://grafana.com/docs/grafana/latest/dashboards/export-import/#import-dashboard) utility.

## Makefile for convenience

A sample [Makefile](./Makefile) with convenience targets for installing [Prometheus](https://prometheus.io/) and
[Grafana][grafana] in a Kubernetes cluster, along with charts is also available in the [dashboards](./dashboards)
folder.

This installs all the components in a `metrics` namespace.

Run `make setup grafana-portforward` to install everything, and forward the Grafana service to the local port 3000.

[grafana]: https://grafana.com/
Loading

0 comments on commit 2d3fda8

Please sign in to comment.