Skip to content

Commit 25813f9

Browse files
authored
Merge pull request aballaci#1 from aballaci/feature/metrics
Feature/metrics
2 parents 5f5fdff + e7d67d6 commit 25813f9

File tree

150 files changed

+248137
-47246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+248137
-47246
lines changed

Readme.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,38 @@ These instructions will get you a copy of the project up and running on your loc
1616

1717
### Prerequisites
1818

19-
What things you need to install the software and how to install them
19+
install prometheus:
2020

21-
```
22-
Give examples
23-
```
21+
```helm install prometheus ./prometheus```
22+
23+
install the postgres persistent volumes that populate the database:
24+
25+
```kubectl create -f persistent-volume.yml```
26+
27+
install postgres
28+
29+
``` helm install postgres postgresql/ ```
30+
31+
install grafana:
32+
33+
```helm upgrade grafana ./grafana/```
34+
35+
create the prometheus datasource:
36+
37+
url: ```http://prometheus-server```
38+
39+
access: ``Server(default)``
40+
41+
install the dashboard in grafana importing it from grafana_dashboard_spring-boot-statistics_rev2.json
2442

2543
### Installing
2644

2745
<code> kubectl apply -f springboot-jpa.yaml </code>
2846

2947
```
30-
Give the example
48+
Metrics: http://localhost:8080/actuator/metrics
49+
50+
Metrics in prometheus format: http://localhost:8080/actuator/prometheus
3151
```
3252

3353
And repeat

grafana/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.vscode
20+
.project
21+
.idea/
22+
*.tmproj
23+
OWNERS

grafana/Chart.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
appVersion: 6.7.3
3+
description: The leading tool for querying and visualizing time series and metrics.
4+
engine: gotpl
5+
home: https://grafana.net
6+
icon: https://raw.githubusercontent.com/grafana/grafana/master/public/img/logo_transparent_400x.png
7+
kubeVersion: ^1.8.0-0
8+
maintainers:
9+
10+
name: zanhsieh
11+
12+
name: rtluckie
13+
14+
name: maorfr
15+
name: grafana
16+
sources:
17+
- https://github.com/grafana/grafana
18+
tillerVersion: '>=2.12.0'
19+
version: 5.0.26

grafana/README.md

Lines changed: 361 additions & 0 deletions
Large diffs are not rendered by default.

grafana/ci/default-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Leave this file empty to ensure that CI runs builds against the default configuration in values.yaml.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
dashboards:
2+
my-provider:
3+
my-awesome-dashboard:
4+
# An empty but valid dashboard
5+
json: |
6+
{
7+
"__inputs": [],
8+
"__requires": [
9+
{
10+
"type": "grafana",
11+
"id": "grafana",
12+
"name": "Grafana",
13+
"version": "6.3.5"
14+
}
15+
],
16+
"annotations": {
17+
"list": [
18+
{
19+
"builtIn": 1,
20+
"datasource": "-- Grafana --",
21+
"enable": true,
22+
"hide": true,
23+
"iconColor": "rgba(0, 211, 255, 1)",
24+
"name": "Annotations & Alerts",
25+
"type": "dashboard"
26+
}
27+
]
28+
},
29+
"editable": true,
30+
"gnetId": null,
31+
"graphTooltip": 0,
32+
"id": null,
33+
"links": [],
34+
"panels": [],
35+
"schemaVersion": 19,
36+
"style": "dark",
37+
"tags": [],
38+
"templating": {
39+
"list": []
40+
},
41+
"time": {
42+
"from": "now-6h",
43+
"to": "now"
44+
},
45+
"timepicker": {
46+
"refresh_intervals": ["5s"]
47+
},
48+
"timezone": "",
49+
"title": "Dummy Dashboard",
50+
"uid": "IdcYQooWk",
51+
"version": 1
52+
}
53+
datasource: Prometheus
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
dashboards:
2+
my-provider:
3+
my-awesome-dashboard:
4+
gnetId: 10000
5+
revision: 1
6+
datasource: Prometheus
7+
dashboardProviders:
8+
dashboardproviders.yaml:
9+
apiVersion: 1
10+
providers:
11+
- name: 'my-provider'
12+
orgId: 1
13+
folder: ''
14+
type: file
15+
updateIntervalSeconds: 10
16+
disableDeletion: true
17+
editable: true
18+
options:
19+
path: /var/lib/grafana/dashboards/my-provider
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

grafana/templates/NOTES.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
1. Get your '{{ .Values.adminUser }}' user password by running:
2+
3+
kubectl get secret --namespace {{ template "grafana.namespace" . }} {{ template "grafana.fullname" . }} -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
4+
5+
2. The Grafana server can be accessed via port {{ .Values.service.port }} on the following DNS name from within your cluster:
6+
7+
{{ template "grafana.fullname" . }}.{{ template "grafana.namespace" . }}.svc.cluster.local
8+
{{ if .Values.ingress.enabled }}
9+
If you bind grafana to 80, please update values in values.yaml and reinstall:
10+
```
11+
securityContext:
12+
runAsUser: 0
13+
runAsGroup: 0
14+
fsGroup: 0
15+
16+
command:
17+
- "setcap"
18+
- "'cap_net_bind_service=+ep'"
19+
- "/usr/sbin/grafana-server &&"
20+
- "sh"
21+
- "/run.sh"
22+
```
23+
Details refer to https://grafana.com/docs/installation/configuration/#http-port.
24+
Or grafana would always crash.
25+
26+
From outside the cluster, the server URL(s) are:
27+
{{- range .Values.ingress.hosts }}
28+
http://{{ . }}
29+
{{- end }}
30+
{{ else }}
31+
Get the Grafana URL to visit by running these commands in the same shell:
32+
{{ if contains "NodePort" .Values.service.type -}}
33+
export NODE_PORT=$(kubectl get --namespace {{ template "grafana.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana.fullname" . }})
34+
export NODE_IP=$(kubectl get nodes --namespace {{ template "grafana.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
35+
echo http://$NODE_IP:$NODE_PORT
36+
{{ else if contains "LoadBalancer" .Values.service.type -}}
37+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
38+
You can watch the status of by running 'kubectl get svc --namespace {{ template "grafana.namespace" . }} -w {{ template "grafana.fullname" . }}'
39+
export SERVICE_IP=$(kubectl get svc --namespace {{ template "grafana.namespace" . }} {{ template "grafana.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
40+
http://$SERVICE_IP:{{ .Values.service.port -}}
41+
{{ else if contains "ClusterIP" .Values.service.type }}
42+
export POD_NAME=$(kubectl get pods --namespace {{ template "grafana.namespace" . }} -l "app={{ template "grafana.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
43+
kubectl --namespace {{ template "grafana.namespace" . }} port-forward $POD_NAME 3000
44+
{{- end }}
45+
{{- end }}
46+
47+
3. Login with the password from step 1 and the username: {{ .Values.adminUser }}
48+
49+
{{- if not .Values.persistence.enabled }}
50+
#################################################################################
51+
###### WARNING: Persistence is disabled!!! You will lose your data when #####
52+
###### the Grafana pod is terminated. #####
53+
#################################################################################
54+
{{- end }}

grafana/templates/_helpers.tpl

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "grafana.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "grafana.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "grafana.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Create the name of the service account
36+
*/}}
37+
{{- define "grafana.serviceAccountName" -}}
38+
{{- if .Values.serviceAccount.create -}}
39+
{{ default (include "grafana.fullname" .) .Values.serviceAccount.name }}
40+
{{- else -}}
41+
{{ default "default" .Values.serviceAccount.name }}
42+
{{- end -}}
43+
{{- end -}}
44+
45+
{{- define "grafana.serviceAccountNameTest" -}}
46+
{{- if .Values.serviceAccount.create -}}
47+
{{ default (print (include "grafana.fullname" .) "-test") .Values.serviceAccount.nameTest }}
48+
{{- else -}}
49+
{{ default "default" .Values.serviceAccount.nameTest }}
50+
{{- end -}}
51+
{{- end -}}
52+
53+
{{/*
54+
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
55+
*/}}
56+
{{- define "grafana.namespace" -}}
57+
{{- if .Values.namespaceOverride -}}
58+
{{- .Values.namespaceOverride -}}
59+
{{- else -}}
60+
{{- .Release.Namespace -}}
61+
{{- end -}}
62+
{{- end -}}
63+
64+
{{/*
65+
Common labels
66+
*/}}
67+
{{- define "grafana.labels" -}}
68+
helm.sh/chart: {{ include "grafana.chart" . }}
69+
{{ include "grafana.selectorLabels" . }}
70+
{{- if or .Chart.AppVersion .Values.image.tag }}
71+
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
72+
{{- end }}
73+
app.kubernetes.io/managed-by: {{ .Release.Service }}
74+
{{- end -}}
75+
76+
{{/*
77+
Selector labels
78+
*/}}
79+
{{- define "grafana.selectorLabels" -}}
80+
app.kubernetes.io/name: {{ include "grafana.name" . }}
81+
app.kubernetes.io/instance: {{ .Release.Name }}
82+
{{- end -}}

0 commit comments

Comments
 (0)