Update README

This commit is contained in:
Pim van Pelt
2025-06-17 00:59:57 +02:00
parent 1ddc77ec73
commit a73c7cbf91

View File

@ -21,40 +21,49 @@ VPP Stats Socket → VPP Stats Client → Interface MIB → AgentX → SNMPd
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** (`agentx/`): Handles AgentX protocol connection and MIB registration
4. **Main Application**: Orchestrates the components and handles configuration
1. **VPP Stats Client** (`src/vppstats/`): Connects to VPP stats socket and retrieves interface counters
2. **Interface MIB** (`src/ifmib/`): Maps VPP statistics to SNMP IF-MIB structure
3. **AgentX Client** (`src/agentx/`): Handles AgentX protocol connection and MIB registration
4. **Main Application** (`src/main.go`): Orchestrates the components and handles configuration
## Build Instructions
### Development Build
```bash
go build -o govpp-snmp-agentx .
# Build the binary
make build
# Run tests
make test
```
### Static Binary Build
### Manual Build
For deployment without Go runtime dependencies:
If you prefer to use Go directly:
```bash
# Linux static binary
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 govpp-snmp-agentx-linux-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o govpp-snmp-agentx-linux-arm64 .
cd src && go build -o ../govpp-snmp-agentx .
```
### Release Build with Version Info
### Debian Package
Build a Debian package for easy installation and deployment:
```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 govpp-snmp-agentx .
# Build the Debian package
make pkg-deb
# Install the package
sudo dpkg -i ../govpp-snmp-agentx_*.deb
```
The Debian package includes:
- Binary installed to `/usr/sbin/govpp-snmp-agentx`
- Systemd service file
- Configuration file at `/etc/default/govpp-snmp-agentx`
- Manual page
## Usage
### Basic Usage