Skip to content

Commit fa7552d

Browse files
authored
Merge pull request #152 from devopshobbies/master
Creating Grafana data sources based on user inputs
2 parents fb77323 + 2ad17ee commit fa7552d

36 files changed

+889
-74
lines changed

app/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
from app.routes.jcasc import *
66
from app.routes.docker import *
77
from app.routes.jenkins import *
8-
from app.routes.gitlab import *
8+
from app.routes.gitlab import *
9+
from app.routes.grafana_data_sources import *

app/media/MyGrafana/mimir.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: 1
2+
datasources:
3+
- name: Mimir
4+
uid: mimir
5+
type: prometheus
6+
access: proxy
7+
orgId: 1
8+
url: http://mimir-nginx.mimir.svc.cluster.local/prometheus
9+
editable: true
10+
version: 1
11+
jsonData:
12+
alertmanagerUid: alertmanager
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Alertmanager
5+
uid: alertmanager
6+
type: alertmanager
7+
url: http://localhost:9093
8+
access: proxy
9+
orgId: 1
10+
jsonData:
11+
# Valid options for implementation include mimir, cortex and prometheus
12+
implementation: [prometheus|cortex|mimir]
13+
# Whether or not Grafana should send alert instances to this Alertmanager
14+
handleGrafanaManagedAlerts: [false|true]
15+
16+
editable: [true|false]
17+
# optionally
18+
basicAuth: true
19+
basicAuthUser: my_user
20+
secureJsonData:
21+
basicAuthPassword: test_password
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: elasticsearch-v7-filebeat
5+
type: elasticsearch
6+
access: proxy
7+
url: http://localhost:9200
8+
editable: [true|false]
9+
jsonData:
10+
index: '[filebeat-]YYYY.MM.DD'
11+
interval: Daily
12+
timeField: '@timestamp'
13+
logMessageField: message
14+
logLevelField: fields.level
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Loki
5+
uid: loki
6+
type: loki
7+
orgId: 1
8+
access: proxy
9+
editable: [true|false]
10+
url: http://localhost:3100
11+
jsonData:
12+
timeout: 60
13+
maxLines: 1000
14+
15+
# optionally
16+
basicAuth: true
17+
basicAuthUser: my_user
18+
secureJsonData:
19+
basicAuthPassword: test_password
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Mimir
5+
uid: mimir
6+
type: prometheus
7+
access: proxy
8+
orgId: 1
9+
url: http://mimir-nginx.mimir.svc.cluster.local/prometheus
10+
editable: [true|false]
11+
version: 1
12+
jsonData:
13+
httpHeaderName1: "X-Scope-OrgID"
14+
alertmanagerUid: "alertmanager"
15+
secureJsonData:
16+
httpHeaderValue1: "pods"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: MySQL
5+
type: mysql
6+
url: localhost:3306
7+
user: grafana
8+
editable: [true|false]
9+
jsonData:
10+
tlsAuth: true
11+
tlsSkipVerify: true
12+
database: grafana
13+
maxOpenConns: 100 # Grafana v5.4+
14+
maxIdleConns: 100 # Grafana v5.4+
15+
maxIdleConnsAuto: true # Grafana v9.5.1+
16+
connMaxLifetime: 14400 # Grafana v5.4+
17+
secureJsonData:
18+
password: ${GRAFANA_MYSQL_PASSWORD}
19+
tlsClientCert: ${GRAFANA_TLS_CLIENT_CERT}
20+
tlsCACert: ${GRAFANA_TLS_CA_CERT}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Postgres
5+
type: postgres
6+
url: localhost:5432
7+
user: grafana # Database user’s login/username
8+
editable: [true|false]
9+
secureJsonData:
10+
password: 'Password!'
11+
jsonData:
12+
database: grafana
13+
sslmode: 'disable' # disable/require/verify-ca/verify-full
14+
maxOpenConns: 100 # Grafana v5.4+
15+
maxIdleConns: 100 # Grafana v5.4+
16+
maxIdleConnsAuto: true # Grafana v9.5.1+
17+
connMaxLifetime: 14400 # Grafana v5.4+
18+
postgresVersion: 903 # 903=9.3, 904=9.4, 905=9.5, 906=9.6, 1000=10
19+
timescaledb: false
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Prometheus
5+
uid: prometheus
6+
type: prometheus
7+
access: proxy
8+
# Access mode - proxy (server in the UI) or direct (browser in the UI).
9+
url: http://localhost:9090
10+
editable: [true|false]
11+
jsonData:
12+
httpMethod: POST
13+
manageAlerts: true
14+
prometheusType: Prometheus
15+
prometheusVersion: 2.44.0
16+
cacheLevel: 'High'
17+
disableRecordingRules: false
18+
incrementalQueryOverlapWindow: 10m
19+
exemplarTraceIdDestinations:
20+
# Field with internal link pointing to data source in Grafana.
21+
# datasourceUid value can be anything, but it should be unique across all defined data source uids.
22+
- datasourceUid: my_jaeger_uid
23+
name: traceID
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Tempo
5+
type: tempo
6+
access: proxy
7+
orgId: 1
8+
url: http://tempo-query-frontend.tempo.svc.cluster.local:3100
9+
basicAuth: false
10+
version: 1
11+
editable: true
12+
apiVersion: 1
13+
uid: tempo
14+
jsonData:
15+
httpMethod: GET
16+
tracesToLogsV2: # If you are going to link your tracing data with logs, configure <<tracesToLogsV2>>
17+
datasourceUid: 'loki'
18+
spanStartTimeShift: '-2m'
19+
spanEndTimeShift: '2m'
20+
filterByTraceID: true
21+
filterBySpanID: true
22+
serviceMap: # If you are going to add serviceGraph feature to tempo, configure <<serviceMap.datasourceUid>>
23+
datasourceUid: 'Mimir-OtelMetrics-Tenant'
24+
nodeGraph: # If you are going to add nodeGraph feature to tempo, enable <<nodeGraph>>
25+
enabled: true

0 commit comments

Comments
 (0)