-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grafana for prometheus based on https://github.com/mrsiano/grafana-ocp
- Loading branch information
Showing
5 changed files
with
5,228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Grafana Add-on | ||
|
||
This addon installs grafana for metrics visualization from prometheus | ||
|
||
## Prerequisites | ||
|
||
The prometheus addon is required | ||
|
||
``` | ||
minishift addon install prometheus-3.7 | ||
minishift addon apply prometheus-3.7 --addon-env namespace=kube-system | ||
``` | ||
|
||
## Deploy grafana | ||
|
||
To deploy grafana do: | ||
|
||
``` | ||
minishift addon apply grafana --addon-env namespace=grafana | ||
~/.minishift/addons/grafana-prometheus/setup-grafana.sh grafana | ||
``` | ||
|
||
_NOTE_: namespace is a required environment variable for the add-on to run. Refer [addon-dynamic-variables](https://docs.openshift.org/latest/minishift/using/addons.html#addon-dynamic-variables) documentation. | ||
|
||
## Use grafana | ||
grafana will be available at: | ||
|
||
``` | ||
minishift openshift service grafana-ocp -n grafana | ||
``` | ||
|
||
After connecting to grafana, you should log as user: admin, password: admin | ||
|
||
## Delete grafana | ||
Delete grafana with: | ||
|
||
``` | ||
oc delete project -n grafana --as=system:admin | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
kind: Template | ||
apiVersion: v1 | ||
metadata: | ||
name: grafana-ocp | ||
annotations: | ||
"openshift.io/display-name": Grafana ocp | ||
description: | | ||
Grafana server with patched Prometheus datasource. | ||
iconClass: icon-cogs | ||
tags: "metrics,monitoring,grafana,prometheus" | ||
parameters: | ||
- description: External URL for the grafana route | ||
name: ROUTE_URL | ||
value: "" | ||
- description: The namespace to instantiate heapster under. Defaults to 'grafana'. | ||
name: NAMESPACE | ||
value: grafana | ||
objects: | ||
- apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
name: grafana-ocp | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
host: "${ROUTE_URL}" | ||
to: | ||
name: grafana-ocp | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: grafana-ocp | ||
namespace: "${NAMESPACE}" | ||
labels: | ||
metrics-infra: grafana-ocp | ||
name: grafana-ocp | ||
spec: | ||
selector: | ||
name: grafana-ocp | ||
ports: | ||
- port: 8082 | ||
protocol: TCP | ||
targetPort: grafana-http | ||
- apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: grafana-ocp | ||
namespace: "${NAMESPACE}" | ||
labels: | ||
metrics-infra: grafana-ocp | ||
name: grafana-ocp | ||
spec: | ||
selector: | ||
name: grafana-ocp | ||
replicas: 1 | ||
template: | ||
version: v1 | ||
metadata: | ||
labels: | ||
metrics-infra: grafana-ocp | ||
name: grafana-ocp | ||
spec: | ||
volumes: | ||
- name: data | ||
emptyDir: {} | ||
containers: | ||
- image: "mrsiano/grafana-ocp:latest" | ||
name: grafana-ocp | ||
ports: | ||
- name: grafana-http | ||
containerPort: 3000 | ||
volumeMounts: | ||
- name: data | ||
mountPath: "/root/go/src/github.com/grafana/grafana/data" | ||
command: | ||
- "./bin/grafana-server" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Name: grafana-prometheus | ||
# Description: This template adds grafana for displaying Openshift Metrics in its own namespace. If requires metrics and management-infra addon, to connect to hawkular-metrics on openshift. | ||
# Url: https://github.com/mrsiano/grafana-ocp | ||
# OpenShift-Version: >=3.7.0 | ||
# Required-Vars: grafana_namespace | ||
|
||
# TODO: Once conditional commands are there, create the namespace if it does not exist | ||
oc adm new-project #{grafana_namespace} | ||
oc new-app -f grafana-ocp.yaml -n #{grafana_namespace} | ||
|
||
echo You have installed #{addon-name} | ||
echo To finish install run: | ||
echo ~/.minishift/addons/grafana-prometheus/setup-grafana.sh #{grafana_namespace} | ||
echo | ||
echo To delete: | ||
echo oc delete project -n #{grafana_namespace} --as=system:admin |
Oops, something went wrong.