mirror of
https://github.com/malarinv/iperf3-monitor.git
synced 2026-03-08 05:22:35 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49fb881f24 | |||
| e54a02ad8c | |||
| 0a3249f30b | |||
| 1eeb4b20df |
194
charts/iperf3-monitor/grafana/iperf3-dashboard.json
Normal file
194
charts/iperf3-monitor/grafana/iperf3-dashboard.json
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
{
|
||||||
|
"__inputs": [],
|
||||||
|
"__requires": [
|
||||||
|
{
|
||||||
|
"type": "grafana",
|
||||||
|
"id": "grafana",
|
||||||
|
"name": "Grafana",
|
||||||
|
"version": "8.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "datasource",
|
||||||
|
"id": "prometheus",
|
||||||
|
"name": "Prometheus",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"builtIn": 1,
|
||||||
|
"datasource": {
|
||||||
|
"type": "grafana",
|
||||||
|
"uid": "-- Grafana --"
|
||||||
|
},
|
||||||
|
"enable": true,
|
||||||
|
"hide": true,
|
||||||
|
"iconColor": "rgba(0, 211, 255, 1)",
|
||||||
|
"name": "Annotations & Alerts",
|
||||||
|
"type": "dashboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": true,
|
||||||
|
"fiscalYearStartMonth": 0,
|
||||||
|
"gnetId": null,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"id": null,
|
||||||
|
"links": [],
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "avg(iperf_network_bandwidth_mbps) by (source_node, destination_node)",
|
||||||
|
"format": "heatmap",
|
||||||
|
"legendFormat": "{{source_node}} -> {{destination_node}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cards": { "cardPadding": null, "cardRound": null },
|
||||||
|
"color": {
|
||||||
|
"mode": "spectrum",
|
||||||
|
"scheme": "red-yellow-green",
|
||||||
|
"exponent": 0.5,
|
||||||
|
"reverse": false
|
||||||
|
},
|
||||||
|
"dataFormat": "tsbuckets",
|
||||||
|
"yAxis": { "show": true, "format": "short" },
|
||||||
|
"xAxis": { "show": true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Bandwidth Over Time (Source: $source_node, Dest: $destination_node)",
|
||||||
|
"type": "timeseries",
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 0,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "iperf_network_bandwidth_mbps{source_node=~\"^$source_node$\", destination_node=~\"^$destination_node$\", protocol=~\"^$protocol$\"}",
|
||||||
|
"legendFormat": "Bandwidth",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"unit": "mbps"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Jitter Over Time (Source: $source_node, Dest: $destination_node)",
|
||||||
|
"type": "timeseries",
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 8,
|
||||||
|
"w": 12,
|
||||||
|
"x": 12,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "iperf_network_jitter_ms{source_node=~\"^$source_node$\", destination_node=~\"^$destination_node$\", protocol=\"udp\"}",
|
||||||
|
"legendFormat": "Jitter",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"unit": "ms"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refresh": "30s",
|
||||||
|
"schemaVersion": 36,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": ["iperf3", "network", "kubernetes"],
|
||||||
|
"templating": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"current": {},
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"definition": "label_values(iperf_network_bandwidth_mbps, source_node)",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": false,
|
||||||
|
"multi": false,
|
||||||
|
"name": "source_node",
|
||||||
|
"options": [],
|
||||||
|
"query": "label_values(iperf_network_bandwidth_mbps, source_node)",
|
||||||
|
"refresh": 1,
|
||||||
|
"regex": "",
|
||||||
|
"skipUrlSync": false,
|
||||||
|
"sort": 1,
|
||||||
|
"type": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"current": {},
|
||||||
|
"datasource": {
|
||||||
|
"type": "prometheus",
|
||||||
|
"uid": "prometheus"
|
||||||
|
},
|
||||||
|
"definition": "label_values(iperf_network_bandwidth_mbps{source_node=~\"^$source_node$\"}, destination_node)",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": false,
|
||||||
|
"multi": false,
|
||||||
|
"name": "destination_node",
|
||||||
|
"options": [],
|
||||||
|
"query": "label_values(iperf_network_bandwidth_mbps{source_node=~\"^$source_node$\"}, destination_node)",
|
||||||
|
"refresh": 1,
|
||||||
|
"regex": "",
|
||||||
|
"skipUrlSync": false,
|
||||||
|
"sort": 1,
|
||||||
|
"type": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"current": { "selected": true, "text": "tcp", "value": "tcp" },
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": false,
|
||||||
|
"multi": false,
|
||||||
|
"name": "protocol",
|
||||||
|
"options": [
|
||||||
|
{ "selected": true, "text": "tcp", "value": "tcp" },
|
||||||
|
{ "selected": false, "text": "udp", "value": "udp" }
|
||||||
|
],
|
||||||
|
"query": "tcp,udp",
|
||||||
|
"skipUrlSync": false,
|
||||||
|
"type": "custom"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-1h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {},
|
||||||
|
"timezone": "browser",
|
||||||
|
"title": "Kubernetes iperf3 Network Performance",
|
||||||
|
"uid": "k8s-iperf3-dashboard",
|
||||||
|
"version": 1,
|
||||||
|
"weekStart": ""
|
||||||
|
}
|
||||||
@@ -47,9 +47,9 @@ app.kubernetes.io/instance: {{ .Release.Name }}
|
|||||||
Create the name of the service account to use
|
Create the name of the service account to use
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "iperf3-monitor.serviceAccountName" -}}
|
{{- define "iperf3-monitor.serviceAccountName" -}}
|
||||||
{{- if .Values.serviceAccount.create -}}
|
{{- if .Values.rbac.create -}}
|
||||||
{{- default (include "iperf3-monitor.fullname" .) .Values.serviceAccount.name -}}
|
{{- default (include "iperf3-monitor.fullname" .) .Values.serviceAccount.name -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- default "default" .Values.serviceAccount.name -}}
|
{{- default "default" .Values.serviceAccount.name -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-grafana-dashboard
|
||||||
|
labels:
|
||||||
|
grafana_dashboard: "1"
|
||||||
|
app.kubernetes.io/name: {{ include "iperf3-monitor.name" . }}
|
||||||
|
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
data:
|
||||||
|
iperf3-dashboard.json: |
|
||||||
|
{{ .Files.Get "grafana/iperf3-dashboard.json" | nindent 4 }}
|
||||||
@@ -5,25 +5,13 @@ FROM python:3.9-slim as builder
|
|||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install iperf3 and build dependencies
|
# Minimal dependencies for builder stage if any Python packages had C extensions.
|
||||||
|
# Assuming requirements.txt does not need gcc or other build tools for now.
|
||||||
|
# If pip install fails later, add necessary build tools (e.g., gcc, python3-dev) here.
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends gcc iperf3 libiperf-dev && \
|
# apt-get install -y --no-install-recommends gcc python3-dev # Example if needed
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Determine the correct libiperf source directory based on TARGETARCH
|
|
||||||
# and copy libiperf.so.0 to a canonical temporary location /tmp/lib/ within the builder stage.
|
|
||||||
RUN echo "Builder stage TARGETARCH: ${TARGETARCH}" && \
|
|
||||||
LIBIPERF_SRC_DIR_SEGMENT="" && \
|
|
||||||
if [ "${TARGETARCH}" = "amd64" ]; then \
|
|
||||||
LIBIPERF_SRC_DIR_SEGMENT="x86_64-linux-gnu"; \
|
|
||||||
elif [ "${TARGETARCH}" = "arm64" ]; then \
|
|
||||||
LIBIPERF_SRC_DIR_SEGMENT="aarch64-linux-gnu"; \
|
|
||||||
else \
|
|
||||||
echo "Unsupported TARGETARCH in builder: ${TARGETARCH}" && exit 1; \
|
|
||||||
fi && \
|
|
||||||
mkdir -p /tmp/lib && \
|
|
||||||
cp "/usr/lib/${LIBIPERF_SRC_DIR_SEGMENT}/libiperf.so.0" /tmp/lib/libiperf.so.0
|
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
@@ -33,11 +21,11 @@ FROM python:3.9-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy iperf3 binary from the builder stage
|
# Install iperf3 and its runtime dependency libsctp1 directly in the final stage.
|
||||||
COPY --from=builder /usr/bin/iperf3 /usr/bin/iperf3
|
# This simplifies the Dockerfile by removing the need to copy iperf3 components from the builder.
|
||||||
# Copy the prepared libiperf.so.0 from the builder's canonical temporary location
|
RUN apt-get update && \
|
||||||
# into a standard library path in the final image.
|
apt-get install -y --no-install-recommends iperf3 libsctp1 && \
|
||||||
COPY --from=builder /tmp/lib/libiperf.so.0 /usr/lib/libiperf.so.0
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy installed Python packages from the builder stage
|
# Copy installed Python packages from the builder stage
|
||||||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
||||||
@@ -49,4 +37,4 @@ COPY exporter.py .
|
|||||||
EXPOSE 9876
|
EXPOSE 9876
|
||||||
|
|
||||||
# Set the entrypoint
|
# Set the entrypoint
|
||||||
CMD ["python", "exporter.py"]
|
CMD ["python", "exporter.py"]
|
||||||
|
|||||||
Reference in New Issue
Block a user