Rename from govpp-snmp-exmaple to govpp-snmp-agentx; Also rename the binary + README

This commit is contained in:
Pim van Pelt
2025-06-10 13:41:14 +02:00
parent 467975b9d6
commit 478168584d
8 changed files with 26 additions and 27 deletions

3
.gitignore vendored
View File

@ -1,3 +1,2 @@
vpp-snmp-agent govpp-snmp-agentx
govpp-snmp-example
vppcfg.yaml vppcfg.yaml

View File

@ -29,7 +29,7 @@ The application consists of four main components:
### Development Build ### Development Build
```bash ```bash
go build -o vpp-snmp-agent . go build -o govpp-snmp-agentx .
``` ```
### Static Binary Build ### Static Binary Build
@ -38,11 +38,11 @@ For deployment without Go runtime dependencies:
```bash ```bash
# Linux static binary # 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 # 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=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 vpp-snmp-agent-linux-arm64 . CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o govpp-snmp-agentx-linux-arm64 .
``` ```
### Release Build with Version Info ### Release Build with Version Info
@ -50,7 +50,7 @@ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static
```bash ```bash
VERSION=$(git describe --tags --always --dirty) VERSION=$(git describe --tags --always --dirty)
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S') 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 ## Usage
@ -59,13 +59,13 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${
```bash ```bash
# Run with default settings # Run with default settings
./vpp-snmp-agent ./govpp-snmp-agentx
# Run with custom AgentX address # 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 # 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 ### Command Line Flags
@ -95,22 +95,22 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${
```bash ```bash
# Enable debug logging # Enable debug logging
./vpp-snmp-agent -debug ./govpp-snmp-agentx -debug
# Custom polling interval (5 seconds) # Custom polling interval (5 seconds)
./vpp-snmp-agent -vppstats.period 5 ./govpp-snmp-agentx -vppstats.period 5
# Custom VPP stats socket # 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) # 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 # 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 # Full configuration
./vpp-snmp-agent \ ./govpp-snmp-agentx \
-agentx.addr /var/agentx/master \ -agentx.addr /var/agentx/master \
-debug \ -debug \
-vppcfg /etc/vpp/vppcfg.yaml \ -vppcfg /etc/vpp/vppcfg.yaml \

View File

@ -7,8 +7,8 @@ import (
"github.com/posteo/go-agentx" "github.com/posteo/go-agentx"
"govpp-snmp-example/ifmib" "govpp-snmp-agentx/ifmib"
"govpp-snmp-example/logger" "govpp-snmp-agentx/logger"
) )
var ( var (

2
go.mod
View File

@ -1,4 +1,4 @@
module govpp-snmp-example module govpp-snmp-agentx
go 1.23.8 go 1.23.8

View File

@ -12,8 +12,8 @@ import (
"go.fd.io/govpp/api" "go.fd.io/govpp/api"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"govpp-snmp-example/logger" "govpp-snmp-agentx/logger"
"govpp-snmp-example/vppstats" "govpp-snmp-agentx/vppstats"
) )
// IF-MIB OID bases: // IF-MIB OID bases:

View File

@ -6,7 +6,7 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"govpp-snmp-example/config" "govpp-snmp-agentx/config"
) )
// logf logs a message with automatic caller information (file:function) // logf logs a message with automatic caller information (file:function)

View File

@ -4,10 +4,10 @@ import (
"flag" "flag"
"log" "log"
"govpp-snmp-example/agentx" "govpp-snmp-agentx/agentx"
"govpp-snmp-example/config" "govpp-snmp-agentx/config"
"govpp-snmp-example/ifmib" "govpp-snmp-agentx/ifmib"
"govpp-snmp-example/vppstats" "govpp-snmp-agentx/vppstats"
) )
func main() { func main() {

View File

@ -9,7 +9,7 @@ import (
"go.fd.io/govpp/api" "go.fd.io/govpp/api"
"go.fd.io/govpp/core" "go.fd.io/govpp/core"
"govpp-snmp-example/logger" "govpp-snmp-agentx/logger"
) )
type StatsCallback func(*api.InterfaceStats) type StatsCallback func(*api.InterfaceStats)