Skip to content

Commit 1a703ed

Browse files
feat: add grafana dashboard
Co-authored-by: Mahesh <maheshbmemhs@gmail.com>
1 parent 206f521 commit 1a703ed

File tree

4 files changed

+227
-0
lines changed

4 files changed

+227
-0
lines changed

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ services:
141141
# Mount source code for hot reload
142142
- ./services/simulator:/app/services/simulator
143143
- ./libs/common:/app/libs/common
144+
# Mount OpenDC binaries
145+
- ./opendc:/app/opendc:ro
144146
# Mount configuration file
145147
- ${CONFIG_PATH:-./config/default.yaml}:/app/config.yaml:ro
146148
# Mount data directory for run outputs
@@ -220,6 +222,28 @@ services:
220222
- opendt-network
221223
command: uvicorn dashboard.main:app --host 0.0.0.0 --port 8000 --reload
222224

225+
226+
227+
228+
grafana:
229+
image: grafana/grafana:latest
230+
container_name: grafana
231+
restart: always
232+
environment:
233+
- GF_INSTALL_PLUGINS=yesoreyeram-infinity-datasource
234+
- GF_SECURITY_ADMIN_PASSWORD=admin
235+
ports:
236+
- "3000:3000"
237+
volumes:
238+
- grafana-storage:/var/lib/grafana
239+
- ./grafana/provisioning:/etc/grafana/provisioning
240+
networks:
241+
- opendt-network
242+
243+
244+
245+
246+
223247
# ==============================================================================
224248
# NETWORKS
225249
# ==============================================================================
@@ -237,3 +261,5 @@ volumes:
237261
name: opendt-postgres-data
238262
kafka_data:
239263
name: opendt-kafka-data
264+
grafana-storage:
265+
name: opendt-grafana-storage
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: 1
2+
3+
providers:
4+
- name: 'OpenDT Dashboards'
5+
orgId: 1
6+
folder: ''
7+
type: file
8+
disableDeletion: false
9+
updateIntervalSeconds: 10
10+
allowUiUpdates: true
11+
options:
12+
path: /etc/grafana/provisioning/dashboards
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{
2+
"annotations": {
3+
"list": [
4+
{
5+
"builtIn": 1,
6+
"datasource": {
7+
"type": "grafana",
8+
"uid": "-- Grafana --"
9+
},
10+
"enable": true,
11+
"hide": true,
12+
"iconColor": "rgba(0, 211, 255, 1)",
13+
"name": "Annotations & Alerts",
14+
"type": "dashboard"
15+
}
16+
]
17+
},
18+
"editable": true,
19+
"fiscalYearStartMonth": 0,
20+
"graphTooltip": 0,
21+
"id": 2,
22+
"links": [],
23+
"panels": [
24+
{
25+
"datasource": {
26+
"type": "yesoreyeram-infinity-datasource",
27+
"uid": "df5tfgbpfeakgc"
28+
},
29+
"fieldConfig": {
30+
"defaults": {
31+
"color": {
32+
"mode": "palette-classic"
33+
},
34+
"custom": {
35+
"axisBorderShow": false,
36+
"axisCenteredZero": false,
37+
"axisColorMode": "text",
38+
"axisLabel": "",
39+
"axisPlacement": "auto",
40+
"barAlignment": 0,
41+
"barWidthFactor": 0.6,
42+
"drawStyle": "line",
43+
"fillOpacity": 0,
44+
"gradientMode": "none",
45+
"hideFrom": {
46+
"legend": false,
47+
"tooltip": false,
48+
"viz": false
49+
},
50+
"insertNulls": false,
51+
"lineInterpolation": "linear",
52+
"lineWidth": 1,
53+
"pointSize": 5,
54+
"scaleDistribution": {
55+
"type": "linear"
56+
},
57+
"showPoints": "auto",
58+
"showValues": false,
59+
"spanNulls": false,
60+
"stacking": {
61+
"group": "A",
62+
"mode": "none"
63+
},
64+
"thresholdsStyle": {
65+
"mode": "off"
66+
}
67+
},
68+
"mappings": [],
69+
"thresholds": {
70+
"mode": "absolute",
71+
"steps": [
72+
{
73+
"color": "green",
74+
"value": 0
75+
},
76+
{
77+
"color": "red",
78+
"value": 80
79+
}
80+
]
81+
}
82+
},
83+
"overrides": [
84+
{
85+
"matcher": {
86+
"id": "byName",
87+
"options": "actual_power"
88+
},
89+
"properties": [
90+
{
91+
"id": "color",
92+
"value": {
93+
"fixedColor": "light-red",
94+
"mode": "fixed"
95+
}
96+
}
97+
]
98+
}
99+
]
100+
},
101+
"gridPos": {
102+
"h": 8,
103+
"w": 12,
104+
"x": 0,
105+
"y": 0
106+
},
107+
"id": 1,
108+
"options": {
109+
"legend": {
110+
"calcs": [],
111+
"displayMode": "list",
112+
"placement": "bottom",
113+
"showLegend": true
114+
},
115+
"tooltip": {
116+
"hideZeros": false,
117+
"mode": "single",
118+
"sort": "none"
119+
}
120+
},
121+
"pluginVersion": "12.3.0",
122+
"targets": [
123+
{
124+
"columns": [],
125+
"datasource": {
126+
"type": "yesoreyeram-infinity-datasource",
127+
"uid": "df5tfgbpfeakgc"
128+
},
129+
"filters": [],
130+
"format": "table",
131+
"global_query_id": "",
132+
"parser": "backend",
133+
"refId": "A",
134+
"root_selector": "data",
135+
"source": "url",
136+
"type": "json",
137+
"url": "http://dashboard:8000/api/power?interval_seconds=60",
138+
"url_options": {
139+
"data": "",
140+
"method": "GET"
141+
}
142+
}
143+
],
144+
"title": "New panel",
145+
"transformations": [
146+
{
147+
"id": "convertFieldType",
148+
"options": {
149+
"conversions": [
150+
{
151+
"destinationType": "time",
152+
"targetField": "timestamp"
153+
}
154+
],
155+
"fields": {}
156+
}
157+
}
158+
],
159+
"type": "timeseries"
160+
}
161+
],
162+
"preload": false,
163+
"refresh": "",
164+
"schemaVersion": 42,
165+
"tags": [],
166+
"templating": {
167+
"list": []
168+
},
169+
"time": {
170+
"from": "2022-10-06T22:02:30.000Z",
171+
"to": "2022-10-09T06:44:30.000Z"
172+
},
173+
"timepicker": {},
174+
"timezone": "browser",
175+
"title": "opendt_power",
176+
"uid": "adtg2gc",
177+
"version": 1
178+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: OpenDT API
5+
type: yesoreyeram-infinity-datasource
6+
access: proxy
7+
uid: df5tfgbpfeakgc
8+
editable: true
9+
isDefault: false
10+
jsonData:
11+
auth_method: none

0 commit comments

Comments
 (0)