diff --git a/Dockerfile b/Dockerfile index 6ad4ca4..38dfd23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG TARGETPLATFORM ARG BUILDPLATFORM LABEL authors="tebarius" -LABEL version="0.1.0" +LABEL version="0.2.0" LABEL description="netdata-DocRudi" WORKDIR /app diff --git a/README.md b/README.md index 865efd2..57b9076 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # netdata-DocRudi + + + + ## build to build container from source: 1. clone repository diff --git a/app/netdata_DocRudi.py b/app/netdata_DocRudi.py index 814b3a4..fe2ffb8 100755 --- a/app/netdata_DocRudi.py +++ b/app/netdata_DocRudi.py @@ -5,7 +5,6 @@ from datetime import datetime from urllib import request, parse, error import plotly.graph_objs as go -import plotly.utils from flask import Flask, render_template from plotly.subplots import make_subplots from waitress import serve @@ -40,7 +39,6 @@ def get_docker_data(q_context, q_dimension): url = f"{netdata_url}?{parse.urlencode(params)}" with request.urlopen(url) as response: data = json.loads(response.read().decode()) - return data['result'] def process_label(label): @@ -71,9 +69,15 @@ def create_plot(): return for i, label in enumerate(labels[1:], start=1): # Skip the first label (usually timestamp) + # docker-cgroups mit slice ... aussortieren, da solche nur kurzzeitig während ContainerBau + # aktiv sind if 'slice_system-slice' in labels[i]: continue y_values = [round(float(row[i]), 2) if row[i] is not None else None for row in plot_data] + # Überprüfen, ob es sich um die CPU-Daten handelt und wenn Netdata da Werte > 1000 liefert diese anpassen + # dies war beim docker_buildx_buildkit-Container geschehen (20000 % CPU-Nutzung geht halt irgendwie nicht) + if row == 1: # Angenommen, Reihe 1 ist für CPU-Daten + y_values = [value / 1000 if value is not None and value > 1000 else value for value in y_values] x_values = [datetime.fromtimestamp(row[0]) for row in plot_data] processed_label = process_label(label) @@ -103,7 +107,7 @@ def create_plot(): plot_bgcolor='#687a8a' ) - return plotly.utils.PlotlyJSONEncoder().encode(fig) + return fig.to_html(full_html=False) @app.route('/') diff --git a/app/templates/index.html b/app/templates/index.html index 9c8b4a2..eade7af 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -7,14 +7,11 @@ {% endif %}