From 478168584d4bd7b658d29a5f6e3f9cdadc42274d Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Tue, 10 Jun 2025 13:41:14 +0200 Subject: [PATCH] Rename from govpp-snmp-exmaple to govpp-snmp-agentx; Also rename the binary + README --- .gitignore | 3 +-- README.md | 28 ++++++++++++++-------------- agentx/agentx.go | 4 ++-- go.mod | 2 +- ifmib/ifmib.go | 4 ++-- logger/logger.go | 2 +- main.go | 8 ++++---- vppstats/stats.go | 2 +- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 93a406b..8a28538 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -vpp-snmp-agent -govpp-snmp-example +govpp-snmp-agentx vppcfg.yaml diff --git a/README.md b/README.md index b83c5fc..c1a797f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The application consists of four main components: ### Development Build ```bash -go build -o vpp-snmp-agent . +go build -o govpp-snmp-agentx . ``` ### Static Binary Build @@ -38,11 +38,11 @@ For deployment without Go runtime dependencies: ```bash # Linux static binary -CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o vpp-snmp-agent . +CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o govpp-snmp-agentx . # Cross-compile for different architectures -CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o vpp-snmp-agent-linux-amd64 . -CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o vpp-snmp-agent-linux-arm64 . +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o govpp-snmp-agentx-linux-amd64 . +CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o govpp-snmp-agentx-linux-arm64 . ``` ### Release Build with Version Info @@ -50,7 +50,7 @@ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static ```bash VERSION=$(git describe --tags --always --dirty) BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S') -CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" -o vpp-snmp-agent . +CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" -o govpp-snmp-agentx . ``` ## Usage @@ -59,13 +59,13 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${ ```bash # Run with default settings -./vpp-snmp-agent +./govpp-snmp-agentx # Run with custom AgentX address -./vpp-snmp-agent -agentx.addr 127.0.0.1:705 +./govpp-snmp-agentx -agentx.addr 127.0.0.1:705 # Run with Unix socket AgentX connection -./vpp-snmp-agent -agentx.addr /var/agentx/master +./govpp-snmp-agentx -agentx.addr /var/agentx/master ``` ### Command Line Flags @@ -95,22 +95,22 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${ ```bash # Enable debug logging -./vpp-snmp-agent -debug +./govpp-snmp-agentx -debug # Custom polling interval (5 seconds) -./vpp-snmp-agent -vppstats.period 5 +./govpp-snmp-agentx -vppstats.period 5 # Custom VPP stats socket -./vpp-snmp-agent -vppstats.addr /custom/path/stats.sock +./govpp-snmp-agentx -vppstats.addr /custom/path/stats.sock # Custom interface index offset (start at 2000) -./vpp-snmp-agent -vppstats.ifindex-offset 2000 +./govpp-snmp-agentx -vppstats.ifindex-offset 2000 # With VPP configuration file for interface descriptions -./vpp-snmp-agent -vppcfg /etc/vpp/vppcfg.yaml +./govpp-snmp-agentx -vppcfg /etc/vpp/vppcfg.yaml # Full configuration -./vpp-snmp-agent \ +./govpp-snmp-agentx \ -agentx.addr /var/agentx/master \ -debug \ -vppcfg /etc/vpp/vppcfg.yaml \ diff --git a/agentx/agentx.go b/agentx/agentx.go index 1170e0d..898355d 100644 --- a/agentx/agentx.go +++ b/agentx/agentx.go @@ -7,8 +7,8 @@ import ( "github.com/posteo/go-agentx" - "govpp-snmp-example/ifmib" - "govpp-snmp-example/logger" + "govpp-snmp-agentx/ifmib" + "govpp-snmp-agentx/logger" ) var ( diff --git a/go.mod b/go.mod index 3e14401..99ee127 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module govpp-snmp-example +module govpp-snmp-agentx go 1.23.8 diff --git a/ifmib/ifmib.go b/ifmib/ifmib.go index 7b819d0..6c777f4 100644 --- a/ifmib/ifmib.go +++ b/ifmib/ifmib.go @@ -12,8 +12,8 @@ import ( "go.fd.io/govpp/api" "gopkg.in/yaml.v3" - "govpp-snmp-example/logger" - "govpp-snmp-example/vppstats" + "govpp-snmp-agentx/logger" + "govpp-snmp-agentx/vppstats" ) // IF-MIB OID bases: diff --git a/logger/logger.go b/logger/logger.go index 91ac627..1ef2e54 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -6,7 +6,7 @@ import ( "path/filepath" "runtime" - "govpp-snmp-example/config" + "govpp-snmp-agentx/config" ) // logf logs a message with automatic caller information (file:function) diff --git a/main.go b/main.go index 3b03808..e206af2 100644 --- a/main.go +++ b/main.go @@ -4,10 +4,10 @@ import ( "flag" "log" - "govpp-snmp-example/agentx" - "govpp-snmp-example/config" - "govpp-snmp-example/ifmib" - "govpp-snmp-example/vppstats" + "govpp-snmp-agentx/agentx" + "govpp-snmp-agentx/config" + "govpp-snmp-agentx/ifmib" + "govpp-snmp-agentx/vppstats" ) func main() { diff --git a/vppstats/stats.go b/vppstats/stats.go index 38d9baa..75f6d23 100644 --- a/vppstats/stats.go +++ b/vppstats/stats.go @@ -9,7 +9,7 @@ import ( "go.fd.io/govpp/api" "go.fd.io/govpp/core" - "govpp-snmp-example/logger" + "govpp-snmp-agentx/logger" ) type StatsCallback func(*api.InterfaceStats)