-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grafana for prometheus #53
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command is wrong as it should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's about installing the pre-requisite prometheus - not the grafana addon |
||
``` | ||
|
||
## Deploy grafana | ||
|
||
To deploy grafana do: | ||
|
||
``` | ||
minishift addon apply grafana --addon-env namespace=grafana | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like not must be 'grafana_namespace' instead of 'namespace' and 'grafana-prometheus' instead of '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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice to have grafana-prometheus.addon.remove file also |
||
``` |
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" |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good practice to tell how much RAM and CPU needs to be allocated to Minishift for this to run smoothly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grafana requires very little memory and cpu. it's merely to display data from its configured backend
see here