feat: add monitoring agent (Go) + agent report API + cloud billing UI
- Go agent: CPU/mem/disk/port collectors, HTTP report, static binary - Cross-compile: linux/amd64 + linux/arm64 (statically linked) - One-line install script for all Linux distros - Backend: POST /api/v1/agent/report (no JWT) + GET /agent/latest,history (JWT) - CloudBilling.tsx: fixed syntax errors, stats/trends/records/alerts - K8s menu renamed to Kubernetes管理 Signed-off-by: Logan.Li
This commit is contained in:
1 parent
77d13b07d5
commit
ac0b8e75c0
17 files changed
+1267
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# Makefile for AIOps Agent
|
||||
# 提供本地构建、交叉编译及常用开发任务
|
||||
# 署名 Logan.Li
|
||||
|
||||
APP := aiops-agent
|
||||
VERSION := 1.0.0
|
||||
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
# 注入版本信息;-s -w 去除调试符号以缩减二进制体积
|
||||
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME)
|
||||
# 静态编译:关闭 CGO 并使用静态链接
|
||||
LINUX_LDFLAGS := -extldflags "-static"
|
||||
|
||||
.PHONY: build cross build-linux-amd64 build-linux-arm64 tidy run fmt vet clean help
|
||||
|
||||
## build: 本地构建当前平台二进制
|
||||
build:
|
||||
go build -ldflags "$(LDFLAGS)" -o $(APP) .
|
||||
|
||||
## cross: 交叉编译 Linux amd64 与 arm64(静态链接,适合容器/嵌入式部署)
|
||||
cross: build-linux-amd64 build-linux-arm64
|
||||
|
||||
## build-linux-amd64: 交叉编译 linux/amd64
|
||||
build-linux-amd64:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "$(LDFLAGS) $(LINUX_LDFLAGS)" -o bin/$(APP)-linux-amd64 .
|
||||
|
||||
## build-linux-arm64: 交叉编译 linux/arm64
|
||||
build-linux-arm64:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 \
|
||||
go build -ldflags "$(LDFLAGS) $(LINUX_LDFLAGS)" -o bin/$(APP)-linux-arm64 .
|
||||
|
||||
## tidy: 整理依赖
|
||||
tidy:
|
||||
go mod tidy
|
||||
|
||||
## run: 本地运行(默认连接 localhost:8080)
|
||||
run:
|
||||
go run . -server http://localhost:8080 -interval 10
|
||||
|
||||
## fmt: 格式化代码
|
||||
fmt:
|
||||
go fmt ./...
|
||||
|
||||
## vet: 静态检查
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
## clean: 清理构建产物
|
||||
clean:
|
||||
rm -rf bin $(APP)
|
||||
|
||||
## help: 显示帮助
|
||||
help:
|
||||
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //' | column -t -s ':'
|
||||
Reference in new issue
Block a user