Skip to content

Instantly share code, notes, and snippets.

@shurup
Created January 13, 2023 10:21
Show Gist options
  • Save shurup/0478a9945199b30276257cae7fc6c6c3 to your computer and use it in GitHub Desktop.
Save shurup/0478a9945199b30276257cae7fc6c6c3 to your computer and use it in GitHub Desktop.
Grafana dashboard for Kubernetes NetFlow
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"iteration": 1658914352596,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "reqps"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 0
},
"id": 7,
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right",
"sortBy": "Last *",
"sortDesc": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P0D6E4079E36703EB"
},
"editorMode": "code",
"expr": "sum by (srcnamespace,dstnamespace) (rate(netflow_connection_count{dstnamespace=~\"$dstnamespace\",srcnamespace=~\"$srcnamespace\",srchost=~\"$srchost\",dsthost=~\"$dsthost\"}[1m]))",
"interval": "",
"legendFormat": "{{srcnamespace}} -> {{dstnamespace}}",
"range": true,
"refId": "A"
}
],
"title": "Namespace Request/Response flow rate",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bps"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 9
},
"id": 4,
"options": {
"legend": {
"calcs": [
"lastNotNull",
"mean"
],
"displayMode": "table",
"placement": "right",
"sortBy": "Mean",
"sortDesc": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P0D6E4079E36703EB"
},
"editorMode": "code",
"expr": "sum by (srcnamespace,dstnamespace) (rate(netflow_connection_bytes{dstnamespace=~\"$dstnamespace\",srcnamespace=~\"$srcnamespace\",srchost=~\"$srchost\",dsthost=~\"$dsthost\"}[5m])) * 8",
"legendFormat": "{{srcnamespace}} -> {{dstnamespace}}",
"range": true,
"refId": "A"
}
],
"title": "Namespase Bandwith",
"type": "timeseries"
},
{
"collapsed": true,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 18
},
"id": 6,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "reqps"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 19
},
"id": 2,
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right",
"sortBy": "Last *",
"sortDesc": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P0D6E4079E36703EB"
},
"editorMode": "code",
"expr": "sum by (srchost,dsthost,srcnamespace,dstnamespace) (rate(netflow_connection_count{dstnamespace=~\"$dstnamespace\",srcnamespace=~\"$srcnamespace\",srchost=~\"$srchost\",dsthost=~\"$dsthost\"}[1m]))",
"interval": "",
"legendFormat": "{{srchost}}.{{srcnamespace}} -> {{dsthost}}.{{dstnamespace}}",
"range": true,
"refId": "A"
}
],
"title": "Request/Response rate",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bps"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 28
},
"id": 3,
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right",
"sortBy": "Last *",
"sortDesc": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P0D6E4079E36703EB"
},
"editorMode": "code",
"expr": "sum by (srchost,srcnamespace,dsthost,dstnamespace) (rate(netflow_connection_bytes{dstnamespace=~\"$dstnamespace\",srcnamespace=~\"$srcnamespace\",srchost=~\"$srchost\",dsthost=~\"$dsthost\"}[5m])) * 8",
"legendFormat": "{{srchost}}.{{srcnamespace}} -> {{dsthost}}.{{dstnamespace}}",
"range": true,
"refId": "A"
}
],
"title": "Bandwith",
"type": "timeseries"
}
],
"title": "Details",
"type": "row"
}
],
"refresh": "5m",
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "default",
"value": "default"
},
"hide": 0,
"includeAll": false,
"label": "Prometheus",
"multi": false,
"name": "ds_prometheus",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"definition": "label_values(netflow_connection_count, srcnamespace)",
"hide": 0,
"includeAll": true,
"label": "Source namespace",
"multi": true,
"name": "srcnamespace",
"options": [],
"query": {
"query": "label_values(netflow_connection_count, srcnamespace)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"definition": "label_values(netflow_connection_count, srcnamespace)",
"hide": 0,
"includeAll": true,
"label": "Destination namespace",
"multi": true,
"name": "dstnamespace",
"options": [],
"query": {
"query": "label_values(netflow_connection_count, srcnamespace)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {
"selected": true,
"text": [
"lenta-site-api"
],
"value": [
"lenta-site-api"
]
},
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"definition": "label_values(netflow_connection_count{srcnamespace=~\"$srcnamespace\",dstnamespace=~\"$dstnamespace\"}, srchost)",
"hide": 0,
"includeAll": true,
"label": "Src",
"multi": true,
"name": "srchost",
"options": [],
"query": {
"query": "label_values(netflow_connection_count{srcnamespace=~\"$srcnamespace\",dstnamespace=~\"$dstnamespace\"}, srchost)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "${ds_prometheus}"
},
"definition": "label_values(netflow_connection_count{srcnamespace=~\"$srcnamespace\",dstnamespace=~\"$dstnamespace\"}, dsthost)",
"hide": 0,
"includeAll": true,
"label": "Dst",
"multi": true,
"name": "dsthost",
"options": [],
"query": {
"query": "label_values(netflow_connection_count{srcnamespace=~\"$srcnamespace\",dstnamespace=~\"$dstnamespace\"}, dsthost)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
}
]
},
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "iptnetflow",
"uid": "BONATEg4z",
"version": 1,
"weekStart": ""
}
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 86,
"iteration": 1661104216411,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "hamedkarbasi93-nodegraphapi-datasource",
"uid": "P17CDE6154CD2DC09"
},
"gridPos": {
"h": 25,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"targets": [
{
"datasource": {
"type": "hamedkarbasi93-nodegraphapi-datasource",
"uid": "P17CDE6154CD2DC09"
},
"queryText": "srcnamespace=$srcnamespace&dstnamespace=$dstnamespace&to=${__to}&from=${__from}",
"refId": "A"
}
],
"title": "Graph",
"type": "nodeGraph"
}
],
"refresh": "",
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": "kube-system",
"value": "kube-system"
},
"definition": "label_values(netflow_connection_count, srcnamespace)",
"hide": 0,
"includeAll": false,
"label": "srcnamespace",
"multi": false,
"name": "srcnamespace",
"options": [],
"query": {
"query": "label_values(netflow_connection_count, srcnamespace)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": true,
"text": "kube-system",
"value": "kube-system"
},
"definition": "label_values(netflow_connection_count, srcnamespace)",
"hide": 0,
"includeAll": false,
"label": "dstnamespace",
"multi": false,
"name": "dstnamespace",
"options": [],
"query": {
"query": "label_values(netflow_connection_count, srcnamespace)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "iptnetflow-nodegraph",
"uid": "AtE7tZWVz",
"version": 1,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment