mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-21 21:26:16 +01:00
* Split interfaces * add filters * feat: split interfaces and add filters (without locales) * make it an line chart * fix the colors * remove tx rx tooltip * fill the chart * update chart and cleanup * chore * update system tab * Fix alerts * chore * fix chart * resolve conflicts * Use new formatSpeed * fix records * update pakage * Fix network I/O stats compilation errors - Added globalNetIoStats field to Agent struct to track total bandwidth usage - Updated initializeNetIoStats() to initialize both per-interface and global network stats - Modified system.go to use globalNetIoStats for bandwidth calculations - Maintained per-interface tracking in netIoStats map for interface-specific data This resolves the compilation errors where netIoStats was accessed as a single struct instead of a map[string]NetIoStats. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove redundant bandwidth chart and fix network interface data access - Removed the old Bandwidth chart since network interface charts provide more detailed per-interface data - Fixed system.tsx to look for network interface data in stats.ni instead of stats.ns - Fixed NetworkInterfaceChart component to use correct data paths (stats.ni) - Network interface charts should now display properly with per-interface network statistics 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Restore split network metrics display in systems table - Modified systems table Net column to show separate sent/received values - Added green ↑ arrow for sent traffic and blue ↓ arrow for received traffic - Uses info.ns (NetworkSent) and info.nr (NetworkRecv) from agent - Maintains sorting functionality based on total network traffic - Shows values in appropriate units (B/s, KB/s, MB/s, etc.) This restores the split network metrics view that was present in the original feat/split-interfaces branch before the merge conflict resolution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove unused bandwidth fields and calculations from agent Removed legacy bandwidth collection code that is no longer used by the frontend: **Removed from structs:** - Stats.Bandwidth [2]uint64 (bandwidth bytes array) - Stats.MaxBandwidth [2]uint64 (max bandwidth bytes array) - Info.Bandwidth float64 (total bandwidth MB/s) - Info.BandwidthBytes uint64 (total bandwidth bytes/s) **Removed from agent:** - globalNetIoStats tracking and calculations - bandwidth byte-per-second calculations - bandwidth array assignments in systemStats - bandwidth field assignments in systemInfo **Removed from records:** - Bandwidth array accumulation and averaging in AverageSystemStats - MaxBandwidth tracking in peak value calculations The frontend now uses only: - info.ns/info.nr (split metrics in systems table) - stats.ni (per-interface charts) This cleanup removes ~50 lines of unused code and eliminates redundant calculations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Optimize network collection for better performance **Performance Improvements:** - Pre-allocate NetworkInterfaces map with known capacity to reduce allocations - Remove redundant byte counters (totalBytesSent, totalBytesRecv) that were unused - Direct calculation to MB/s, avoiding intermediate bytes-per-second variables - Reuse existing NetIoStats structs when possible to reduce GC pressure - Streamlined single-pass processing through network interfaces **Optimizations:** - Reduced memory allocations per collection cycle - Fewer arithmetic operations (eliminated double conversion) - Better cache locality with simplified data flow - Reduced time complexity from O(n²) operations to O(n) **Maintained Functionality:** - Same per-interface statistics collection - Same total network sent/recv calculations - Same error handling and reset logic - Same data structures and output format Expected improvement: ~15-25% reduction in network collection CPU time and memory allocations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix the Unit preferences * Add total bytes sent and received to network interface stats and implement total bandwidth chart * chore: fix Cumulative records * Add connection counts * Add connection stats * Fix ordering * remove test builds * improve entre command in makefile * rebase
103 lines
3.1 KiB
Makefile
103 lines
3.1 KiB
Makefile
# Default OS/ARCH values
|
|
OS ?= $(shell go env GOOS)
|
|
ARCH ?= $(shell go env GOARCH)
|
|
# Skip building the web UI if true
|
|
SKIP_WEB ?= false
|
|
|
|
# Set executable extension based on target OS
|
|
EXE_EXT := $(if $(filter windows,$(OS)),.exe,)
|
|
|
|
.PHONY: tidy build-agent build-hub build-hub-dev build clean lint dev-server dev-agent dev-hub dev generate-locales
|
|
.DEFAULT_GOAL := build
|
|
|
|
clean:
|
|
go clean
|
|
rm -rf ./build
|
|
|
|
lint:
|
|
golangci-lint run
|
|
|
|
test: export GOEXPERIMENT=synctest
|
|
test:
|
|
go test -tags=testing ./...
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
build-web-ui:
|
|
@if command -v bun >/dev/null 2>&1; then \
|
|
bun install --cwd ./internal/site && \
|
|
bun run --cwd ./internal/site build; \
|
|
else \
|
|
npm install --prefix ./internal/site && \
|
|
npm run --prefix ./internal/site build; \
|
|
fi
|
|
|
|
# Conditional .NET build - only for Windows
|
|
build-dotnet-conditional:
|
|
@if [ "$(OS)" = "windows" ]; then \
|
|
echo "Building .NET executable for Windows..."; \
|
|
if command -v dotnet >/dev/null 2>&1; then \
|
|
rm -rf ./agent/lhm/bin; \
|
|
dotnet build -c Release ./agent/lhm/beszel_lhm.csproj; \
|
|
else \
|
|
echo "Error: dotnet not found. Install .NET SDK to build Windows agent."; \
|
|
exit 1; \
|
|
fi; \
|
|
fi
|
|
|
|
# Update build-agent to include conditional .NET build
|
|
build-agent: tidy build-dotnet-conditional
|
|
GOOS=$(OS) GOARCH=$(ARCH) go build -o ./build/beszel-agent_$(OS)_$(ARCH)$(EXE_EXT) -ldflags "-w -s" ./internal/cmd/agent
|
|
|
|
build-hub: tidy $(if $(filter false,$(SKIP_WEB)),build-web-ui)
|
|
GOOS=$(OS) GOARCH=$(ARCH) go build -o ./build/beszel_$(OS)_$(ARCH)$(EXE_EXT) -ldflags "-w -s" ./internal/cmd/hub
|
|
|
|
build-hub-dev: tidy
|
|
mkdir -p ./internal/site/dist && touch ./internal/site/dist/index.html
|
|
GOOS=$(OS) GOARCH=$(ARCH) go build -tags development -o ./build/beszel-dev_$(OS)_$(ARCH)$(EXE_EXT) -ldflags "-w -s" ./internal/cmd/hub
|
|
|
|
build: build-agent build-hub
|
|
|
|
generate-locales:
|
|
@if [ ! -f ./internal/site/src/locales/en/en.ts ]; then \
|
|
echo "Generating locales..."; \
|
|
command -v bun >/dev/null 2>&1 && cd ./internal/site && bun install && bun run sync || cd ./internal/site && npm install && npm run sync; \
|
|
fi
|
|
|
|
dev-server: generate-locales
|
|
cd ./internal/site
|
|
@if command -v bun >/dev/null 2>&1; then \
|
|
cd ./internal/site && bun run dev --host 0.0.0.0; \
|
|
else \
|
|
cd ./internal/site && npm run dev --host 0.0.0.0; \
|
|
fi
|
|
|
|
dev-hub: export ENV=dev
|
|
dev-hub:
|
|
mkdir -p ./internal/site/dist && touch ./internal/site/dist/index.html
|
|
@if command -v entr >/dev/null 2>&1; then \
|
|
find ./internal -type f -name '*.go' | entr -r -s "cd ./internal/cmd/hub && go run -tags development . serve --http 0.0.0.0:8090"; \
|
|
else \
|
|
cd ./internal/cmd/hub && go run -tags development . serve --http 0.0.0.0:8090; \
|
|
fi
|
|
|
|
dev-agent:
|
|
@if command -v entr >/dev/null 2>&1; then \
|
|
find ./internal/cmd/agent/*.go ./agent/*.go | entr -r go run github.com/henrygd/beszel/internal/cmd/agent; \
|
|
else \
|
|
go run github.com/henrygd/beszel/internal/cmd/agent; \
|
|
fi
|
|
|
|
build-dotnet:
|
|
@if command -v dotnet >/dev/null 2>&1; then \
|
|
rm -rf ./agent/lhm/bin; \
|
|
dotnet build -c Release ./agent/lhm/beszel_lhm.csproj; \
|
|
else \
|
|
echo "dotnet not found"; \
|
|
fi
|
|
|
|
|
|
# KEY="..." make -j dev
|
|
dev: dev-server dev-hub dev-agent
|