A lightweight upload latency monitor that:
- continuously uploads a test file to an endpoint and logs results (
traffic-monitor.sh) - generates a standalone HTML latency chart from the log (
generate_latency_chart.py)
traffic-monitor.sh— sends repeated upload requests and appends latency/status lines toupload-latency.loggenerate_latency_chart.py— parses the log and creates a chart HTML fileupload-latency.log— sample/output log fileupload-latency-chart*.html— generated chart examples
- macOS/Linux shell with
bash curlpython3
From the project directory:
chmod +x traffic-monitor.sh
./traffic-monitor.shPress Ctrl+C to stop.
In traffic-monitor.sh:
SERVER_URL="http://dlptest.com/api/http-post/"TEST_FILE="/tmp/latency-test.bin"(auto-created as 1MB if missing)INTERVAL=0(runs continuously with no delay)CONNECT_TIMEOUT=10MAX_TIME=60LOG_FILE="./upload-latency.log"
If needed, edit these variables at the top of the script.
Generate a chart from the full log:
python3 generate_latency_chart.py \
--input upload-latency.log \
--output upload-latency-chart-all.htmlGenerate a chart for only the first N minutes from the first log timestamp:
python3 generate_latency_chart.py \
--minutes 10 \
--input upload-latency.log \
--output upload-latency-chart-10m.htmlOpen the generated HTML file in any browser.
Examples:
2026-10-07 16:30:03 | FAILED | CURL_ERROR_56
2026-10-07 16:30:11 | OK | 343 ms | HTTP 200
generate_latency_chart.py only plots OK rows that include latency in ms.
- HTTP 2xx/3xx responses are logged as
OK; other HTTP statuses are logged asHTTP_ERROR. - Curl execution failures are logged as
FAILEDwith a categorized error (TIMEOUT,DNS_FAILURE, etc.).