Skip to content

Commit

Permalink
chore(compose): add Grafana panel with controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgomesdev committed Dec 23, 2023
1 parent 4cc0089 commit b67f66b
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 4 deletions.
205 changes: 201 additions & 4 deletions server/docker/grafana-dashboards/metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
},
{
"name": "DS_GRAPHQL_DATA SOURCE",
"label": "GraphQL Data Source",
"description": "",
"type": "datasource",
"pluginId": "fifemon-graphql-datasource",
"pluginName": "GraphQL Data Source"
}
],
"__elements": {},
"__requires": [
{
"type": "datasource",
"id": "fifemon-graphql-datasource",
"name": "GraphQL Data Source",
"version": "1.3.0"
},
{
"type": "grafana",
"id": "grafana",
Expand All @@ -29,6 +43,12 @@
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
Expand Down Expand Up @@ -73,7 +93,7 @@
"y": 0
},
"id": 24,
"title": "Overview",
"title": "Connected Devices",
"type": "row"
},
{
Expand Down Expand Up @@ -148,10 +168,187 @@
"refId": "A"
}
],
"title": "Connected Devices",
"title": "Count",
"transformations": [],
"type": "stat"
},
{
"datasource": {
"type": "fifemon-graphql-datasource",
"uid": "${DS_GRAPHQL_DATA SOURCE}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"filterable": false,
"inspect": false,
"minWidth": 50
},
"mappings": [
{
"options": {
"BLUETOOTH": {
"index": 0,
"text": "Bluetooth"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "batteryLevel"
},
"properties": [
{
"id": "mappings",
"value": [
{
"options": {
"CHARGING": {
"color": "dark-blue",
"index": 1
},
"FORTY_PERCENT": {
"color": "orange",
"index": 3
},
"SIXTY_PERCENT": {
"color": "yellow",
"index": 2
},
"UNKNOWN": {
"color": "#2828f9",
"index": 5
}
},
"type": "value"
},
{
"options": {
"pattern": "CHARGED|FULL|EIGHTY_PERCENT",
"result": {
"color": "green",
"index": 0
}
},
"type": "regex"
},
{
"options": {
"pattern": "TWENTY_PERCENT|EMPTY",
"result": {
"color": "red",
"index": 4
}
},
"type": "regex"
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.width",
"value": 123
}
]
},
{
"matcher": {
"id": "byName",
"options": "connectionType"
},
"properties": [
{
"id": "custom.width",
"value": 142
}
]
},
{
"matcher": {
"id": "byName",
"options": "address"
},
"properties": [
{
"id": "custom.width",
"value": 141
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 7,
"x": 4,
"y": 1
},
"id": 32,
"options": {
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "9.4.3",
"targets": [
{
"aliasBy": "",
"annotationTags": "",
"annotationText": "",
"annotationTitle": "",
"constant": 6.5,
"dataPath": "controllers",
"datasource": {
"type": "fifemon-graphql-datasource",
"uid": "${DS_GRAPHQL_DATA SOURCE}"
},
"endTimePath": "endTime",
"groupBy": "",
"queryText": "query {\n controllers {\n address\n connectionType\n batteryLevel\n currentLedEffect\n }\n}",
"refId": "A",
"timePath": ""
}
],
"title": "Details",
"type": "table"
},
{
"collapsed": false,
"gridPos": {
Expand Down Expand Up @@ -609,7 +806,7 @@
"list": [
{
"current": {
"selected": true,
"selected": false,
"text": [
"controller_update",
"controllers_list",
Expand Down Expand Up @@ -663,6 +860,6 @@
"timezone": "",
"title": "Metrics",
"uid": "TrD1CkZgk",
"version": 41,
"version": 44,
"weekStart": ""
}
2 changes: 2 additions & 0 deletions server/docker/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ services:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- grafana
deploy:
Expand Down

0 comments on commit b67f66b

Please sign in to comment.