move agentx into its own directory, simplify main.go

This commit is contained in:
Pim van Pelt
2025-06-10 13:28:30 +02:00
parent 458168e308
commit 467975b9d6
3 changed files with 64 additions and 33 deletions

View File

@ -17,11 +17,12 @@ A Go application that bridges VPP (Vector Packet Processing) interface statistic
VPP Stats Socket → VPP Stats Client → Interface MIB → AgentX → SNMP Master Agent
```
The application consists of three main components:
The application consists of four main components:
1. **VPP Stats Client** (`vppstats/`): Connects to VPP stats socket and retrieves interface counters
2. **Interface MIB** (`ifmib/`): Maps VPP statistics to SNMP IF-MIB structure
3. **AgentX Client**: Registers with SNMP master agent to serve the MIB data
3. **AgentX Client** (`agentx/`): Handles AgentX protocol connection and MIB registration
4. **Main Application**: Orchestrates the components and handles configuration
## Build Instructions
@ -61,10 +62,10 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${
./vpp-snmp-agent
# Run with custom AgentX address
./vpp-snmp-agent -agentx-addr 127.0.0.1:705
./vpp-snmp-agent -agentx.addr 127.0.0.1:705
# Run with Unix socket AgentX connection
./vpp-snmp-agent -agentx-addr /var/agentx/master
./vpp-snmp-agent -agentx.addr /var/agentx/master
```
### Command Line Flags
@ -73,10 +74,15 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${
| Flag | Default | Description |
|------|---------|-------------|
| `-agentx-addr` | `localhost:705` | AgentX master agent address (hostname:port or Unix socket path) |
| `-debug` | `false` | Enable debug logging |
| `-vppcfg` | `""` | VPP configuration YAML file to read interface descriptions from |
#### AgentX Module Flags
| Flag | Default | Description |
|------|---------|-------------|
| `-agentx.addr` | `localhost:705` | AgentX master agent address (hostname:port or Unix socket path) |
#### VPP Statistics Module Flags
| Flag | Default | Description |
@ -105,7 +111,7 @@ CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION} -X main.buildTime=${
# Full configuration
./vpp-snmp-agent \
-agentx-addr /var/agentx/master \
-agentx.addr /var/agentx/master \
-debug \
-vppcfg /etc/vpp/vppcfg.yaml \
-vppstats.addr /var/run/vpp/stats.sock \