feat(hub): dashboards Grafana as-code (overview + node detail) + provisioning yaml + deploy_agent.sh

This commit is contained in:
Egutierrez
2026-06-07 12:54:39 +02:00
parent 527742b7c5
commit e87069d366
5 changed files with 390 additions and 0 deletions
+165
View File
@@ -0,0 +1,165 @@
{
"uid": "fleet-node",
"title": "Fleet — Node detail",
"tags": ["fleet"],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"refresh": "15s",
"time": { "from": "now-3h", "to": "now" },
"templating": {
"list": [
{
"name": "node",
"label": "Nodo",
"type": "query",
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"query": "label_values(node_uptime_seconds, instance)",
"refresh": 2,
"includeAll": false,
"multi": false,
"sort": 1,
"current": {}
}
]
},
"panels": [
{
"id": 1,
"type": "gauge",
"title": "CPU %",
"gridPos": { "h": 5, "w": 6, "x": 0, "y": 0 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_cpu_percent{instance=\"$node\"}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 70 }, { "color": "red", "value": 90 } ] } }, "overrides": [] },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false } }
},
{
"id": 2,
"type": "gauge",
"title": "RAM %",
"gridPos": { "h": 5, "w": 6, "x": 6, "y": 0 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_mem_used_percent{instance=\"$node\"}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 75 }, { "color": "red", "value": 90 } ] } }, "overrides": [] },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false } }
},
{
"id": 3,
"type": "stat",
"title": "Load 1m",
"gridPos": { "h": 5, "w": 6, "x": 12, "y": 0 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_load1{instance=\"$node\"}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "short", "color": { "mode": "fixed", "fixedColor": "blue" } }, "overrides": [] },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }, "colorMode": "value", "graphMode": "area" }
},
{
"id": 4,
"type": "stat",
"title": "Uptime",
"gridPos": { "h": 5, "w": 6, "x": 18, "y": 0 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_uptime_seconds{instance=\"$node\"}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "s", "color": { "mode": "fixed", "fixedColor": "purple" } }, "overrides": [] },
"options": { "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }, "colorMode": "value", "graphMode": "none" }
},
{
"id": 5,
"type": "timeseries",
"title": "CPU por núcleo",
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 5 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_cpu_core_percent{instance=\"$node\"}", "legendFormat": "core {{core}}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100, "custom": { "drawStyle": "line", "fillOpacity": 8, "showPoints": "never", "lineWidth": 1 } }, "overrides": [] },
"options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } }
},
{
"id": 6,
"type": "timeseries",
"title": "Memoria y swap",
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 5 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [
{ "refId": "A", "expr": "node_mem_total_bytes{instance=\"$node\"}", "legendFormat": "RAM total", "datasource": { "type": "prometheus", "uid": "victoriametrics" } },
{ "refId": "B", "expr": "node_mem_used_bytes{instance=\"$node\"}", "legendFormat": "RAM usada", "datasource": { "type": "prometheus", "uid": "victoriametrics" } },
{ "refId": "C", "expr": "node_mem_available_bytes{instance=\"$node\"}", "legendFormat": "RAM disponible", "datasource": { "type": "prometheus", "uid": "victoriametrics" } },
{ "refId": "D", "expr": "node_swap_used_bytes{instance=\"$node\"}", "legendFormat": "swap usado", "datasource": { "type": "prometheus", "uid": "victoriametrics" } }
],
"fieldConfig": { "defaults": { "unit": "bytes", "min": 0, "custom": { "drawStyle": "line", "fillOpacity": 8, "showPoints": "never", "lineWidth": 2 } }, "overrides": [] },
"options": { "legend": { "displayMode": "table", "placement": "right", "calcs": ["lastNotNull"] }, "tooltip": { "mode": "multi" } }
},
{
"id": 7,
"type": "timeseries",
"title": "Disco usado % por punto de montaje",
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 14 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_disk_used_percent{instance=\"$node\"}", "legendFormat": "{{mount}}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100, "custom": { "drawStyle": "line", "fillOpacity": 8, "showPoints": "never", "lineWidth": 2 } }, "overrides": [] },
"options": { "legend": { "displayMode": "table", "placement": "right", "calcs": ["lastNotNull"] }, "tooltip": { "mode": "multi", "sort": "desc" } }
},
{
"id": 8,
"type": "timeseries",
"title": "Disco I/O por dispositivo",
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 14 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [
{ "refId": "A", "expr": "rate(node_disk_read_bytes{instance=\"$node\"}[2m])", "legendFormat": "{{device}} read", "datasource": { "type": "prometheus", "uid": "victoriametrics" } },
{ "refId": "B", "expr": "rate(node_disk_write_bytes{instance=\"$node\"}[2m])", "legendFormat": "{{device}} write", "datasource": { "type": "prometheus", "uid": "victoriametrics" } }
],
"fieldConfig": { "defaults": { "unit": "Bps", "min": 0, "custom": { "drawStyle": "line", "fillOpacity": 8, "showPoints": "never", "lineWidth": 2 } }, "overrides": [] },
"options": { "legend": { "displayMode": "table", "placement": "right", "calcs": ["lastNotNull", "max"] }, "tooltip": { "mode": "multi", "sort": "desc" } }
},
{
"id": 9,
"type": "timeseries",
"title": "Red por interfaz",
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 23 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [
{ "refId": "A", "expr": "rate(node_net_recv_bytes{instance=\"$node\"}[2m])", "legendFormat": "{{iface}} recv", "datasource": { "type": "prometheus", "uid": "victoriametrics" } },
{ "refId": "B", "expr": "rate(node_net_sent_bytes{instance=\"$node\"}[2m])", "legendFormat": "{{iface}} sent", "datasource": { "type": "prometheus", "uid": "victoriametrics" } }
],
"fieldConfig": { "defaults": { "unit": "Bps", "min": 0, "custom": { "drawStyle": "line", "fillOpacity": 8, "showPoints": "never", "lineWidth": 2 } }, "overrides": [] },
"options": { "legend": { "displayMode": "table", "placement": "right", "calcs": ["lastNotNull", "max"] }, "tooltip": { "mode": "multi", "sort": "desc" } }
},
{
"id": 10,
"type": "timeseries",
"title": "Temperaturas (si hay sensores)",
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 23 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "node_temp_celsius{instance=\"$node\"}", "legendFormat": "{{sensor}}", "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"fieldConfig": { "defaults": { "unit": "celsius", "custom": { "drawStyle": "line", "fillOpacity": 8, "showPoints": "never", "lineWidth": 2 } }, "overrides": [] },
"options": { "legend": { "displayMode": "table", "placement": "right", "calcs": ["lastNotNull", "max"] }, "tooltip": { "mode": "multi", "sort": "desc" } }
},
{
"id": 11,
"type": "table",
"title": "Top procesos por CPU",
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 32 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "topk(10, node_proc_cpu_percent{instance=\"$node\"})", "format": "table", "instant": true, "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"transformations": [
{ "id": "organize", "options": { "excludeByName": { "Time": true, "instance": true, "__name__": true, "job": true }, "renameByName": { "name": "Proceso", "pid": "PID", "Value": "CPU %" } } }
],
"fieldConfig": { "defaults": {}, "overrides": [ { "matcher": { "id": "byName", "options": "CPU %" }, "properties": [ { "id": "unit", "value": "percent" }, { "id": "custom.cellOptions", "value": { "type": "gauge" } }, { "id": "max", "value": 100 } ] } ] },
"options": { "sortBy": [ { "displayName": "CPU %", "desc": true } ] }
},
{
"id": 12,
"type": "table",
"title": "Top procesos por RAM",
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 32 },
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"targets": [ { "refId": "A", "expr": "topk(10, node_proc_mem_percent{instance=\"$node\"})", "format": "table", "instant": true, "datasource": { "type": "prometheus", "uid": "victoriametrics" } } ],
"transformations": [
{ "id": "organize", "options": { "excludeByName": { "Time": true, "instance": true, "__name__": true, "job": true }, "renameByName": { "name": "Proceso", "pid": "PID", "Value": "RAM %" } } }
],
"fieldConfig": { "defaults": {}, "overrides": [ { "matcher": { "id": "byName", "options": "RAM %" }, "properties": [ { "id": "unit", "value": "percent" }, { "id": "custom.cellOptions", "value": { "type": "gauge" } }, { "id": "max", "value": 100 } ] } ] },
"options": { "sortBy": [ { "displayName": "RAM %", "desc": true } ] }
}
]
}