Files
homelab-infra/monitoring/grafana/dashboards/containers-logs.json
T

110 lines
2.7 KiB
JSON

{
"uid": "homelab-containers-logs",
"title": "Homelab / Containers + Logs",
"tags": ["homelab", "cadvisor", "loki", "dozzle-replacement"],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"refresh": "30s",
"time": {
"from": "now-1h",
"to": "now"
},
"templating": {
"list": [
{
"name": "service",
"label": "Service",
"type": "query",
"datasource": "Loki",
"query": "label_values(compose_service)",
"refresh": 1,
"includeAll": true,
"multi": true,
"allValue": ".+",
"current": {
"selected": true,
"text": "All",
"value": "$__all"
}
},
{
"name": "search",
"label": "Regex Match",
"type": "textbox",
"query": ".+",
"current": {
"selected": true,
"text": ".+",
"value": ".+"
}
}
]
},
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "Container CPU",
"datasource": "Prometheus",
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
"targets": [
{
"refId": "A",
"expr": "sum by (name) (rate(container_cpu_usage_seconds_total{name!=\"\"}[5m]))",
"legendFormat": "{{name}}"
}
],
"fieldConfig": {"defaults": {"unit": "cores"}, "overrides": []}
},
{
"id": 2,
"type": "timeseries",
"title": "Container memory",
"datasource": "Prometheus",
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
"targets": [
{
"refId": "A",
"expr": "sum by (name) (container_memory_working_set_bytes{name!=\"\"})",
"legendFormat": "{{name}}"
}
],
"fieldConfig": {"defaults": {"unit": "bytes"}, "overrides": []}
},
{
"id": 3,
"type": "timeseries",
"title": "Log error rate",
"datasource": "Loki",
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 8},
"targets": [
{
"refId": "A",
"expr": "sum by (compose_service) (count_over_time({compose_service=~\"${service:regex}\", container=~\".+\"} |~ \"(?i)error|exception|panic|fatal|traceback|oom|killed\" [$__interval]))",
"legendFormat": "{{compose_service}}"
}
]
},
{
"id": 4,
"type": "logs",
"title": "Live logs",
"datasource": "Loki",
"gridPos": {"h": 14, "w": 24, "x": 0, "y": 16},
"targets": [
{
"refId": "A",
"expr": "{compose_service=~\"${service:regex}\", container=~\".+\"} |~ \"$search\""
}
],
"options": {
"showLabels": false,
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": false
}
}
]
}