Compare commits
2 Commits
ccc2b5ad4d
...
0d19d50d62
Author | SHA1 | Date | |
---|---|---|---|
|
0d19d50d62 | ||
|
686bbe46b0 |
11
Makefile
11
Makefile
@@ -1,6 +1,6 @@
|
|||||||
PROG = govpp-snmp-agentx
|
PROG = govpp-snmp-agentx
|
||||||
|
|
||||||
.PHONY: build test clean pkg-deb
|
.PHONY: build test clean pkg-deb sync-version
|
||||||
|
|
||||||
# Build the binary
|
# Build the binary
|
||||||
build:
|
build:
|
||||||
@@ -17,6 +17,13 @@ clean:
|
|||||||
rm -rf debian/.debhelper debian/.gocache debian/go debian/$(PROG) debian/files debian/*.substvars debian/debhelper-build-stamp
|
rm -rf debian/.debhelper debian/.gocache debian/go debian/$(PROG) debian/files debian/*.substvars debian/debhelper-build-stamp
|
||||||
rm -f ../$(PROG)_*.deb ../$(PROG)_*.changes ../$(PROG)_*.buildinfo
|
rm -f ../$(PROG)_*.deb ../$(PROG)_*.changes ../$(PROG)_*.buildinfo
|
||||||
|
|
||||||
|
# Sync version from debian/changelog to main.go
|
||||||
|
sync-version:
|
||||||
|
@echo "Syncing version from debian/changelog to main.go..."
|
||||||
|
@VERSION=$$(head -1 debian/changelog | sed -n 's/.*(\([^)]*\)).*/\1/p'); \
|
||||||
|
sed -i 's/^const Version = ".*"/const Version = "'"$$VERSION"'"/' src/main.go; \
|
||||||
|
echo "Updated Version const to: $$VERSION"
|
||||||
|
|
||||||
# Build Debian package
|
# Build Debian package
|
||||||
pkg-deb:
|
pkg-deb: sync-version
|
||||||
fakeroot dpkg-buildpackage -us -uc -b
|
fakeroot dpkg-buildpackage -us -uc -b
|
||||||
|
18
debian/changelog
vendored
18
debian/changelog
vendored
@@ -1,3 +1,21 @@
|
|||||||
|
govpp-snmp-agentx (1.1.2-1) bookworm; urgency=medium
|
||||||
|
|
||||||
|
* Add startup version logging to INFO log level
|
||||||
|
* Implement automatic version synchronization between debian/changelog and main.go
|
||||||
|
* Add make sync-version target for manual version syncing
|
||||||
|
* Ensure version consistency across package and application code
|
||||||
|
|
||||||
|
-- Pim van Pelt <pim@ipng.ch> Sun, 23 Jun 2025 00:20:00 +0000
|
||||||
|
|
||||||
|
govpp-snmp-agentx (1.1.1-1) bookworm; urgency=medium
|
||||||
|
|
||||||
|
* Add IF-MIB::ifHighSpeed field (OID 1.3.6.1.2.1.31.1.1.1.15)
|
||||||
|
* Populate ifHighSpeed with interface speed in Megabits per second
|
||||||
|
* Implement conditional ifSpeed population (skip for speeds > 2.5Gbps)
|
||||||
|
* Improve SNMP compliance for high-speed interface reporting
|
||||||
|
|
||||||
|
-- Pim van Pelt <pim@ipng.ch> Sun, 23 Jun 2025 00:10:00 +0000
|
||||||
|
|
||||||
govpp-snmp-agentx (1.1.0-1) bookworm; urgency=medium
|
govpp-snmp-agentx (1.1.0-1) bookworm; urgency=medium
|
||||||
|
|
||||||
* Add interface event monitoring with VPP API integration
|
* Add interface event monitoring with VPP API integration
|
||||||
|
@@ -244,6 +244,62 @@ snmpwalk -v2c -c public localhost 1.3.6.1.2.1.1
|
|||||||
snmpwalk -v2c -c public localhost 1.3.6.1.2.1.31.1.1.1
|
snmpwalk -v2c -c public localhost 1.3.6.1.2.1.31.1.1.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Building and Releasing
|
||||||
|
|
||||||
|
### Build Targets
|
||||||
|
|
||||||
|
The project uses a Makefile with the following targets:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build the binary
|
||||||
|
make build
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
make test
|
||||||
|
|
||||||
|
# Clean build artifacts
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Sync version from debian/changelog to main.go
|
||||||
|
make sync-version
|
||||||
|
|
||||||
|
# Build Debian package (includes automatic version sync)
|
||||||
|
make pkg-deb
|
||||||
|
```
|
||||||
|
|
||||||
|
### Release Process
|
||||||
|
|
||||||
|
To cut a new release, follow these steps in order:
|
||||||
|
|
||||||
|
1. **Update debian/changelog** with the new version and changelog entries:
|
||||||
|
```bash
|
||||||
|
# Edit debian/changelog manually
|
||||||
|
vim debian/changelog
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Sync version to main.go**:
|
||||||
|
```bash
|
||||||
|
make sync-version
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Build the package**:
|
||||||
|
```bash
|
||||||
|
make pkg-deb
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Commit all changes together**:
|
||||||
|
```bash
|
||||||
|
git add debian/changelog src/main.go
|
||||||
|
git commit -m "Cut release X.Y.Z-A"
|
||||||
|
git tag vX.Y.Z-A
|
||||||
|
```
|
||||||
|
|
||||||
|
### Version Synchronization
|
||||||
|
|
||||||
|
The build system automatically ensures that the version in `debian/changelog` matches the version constant in `src/main.go`. The `make pkg-deb` target automatically calls `make sync-version` before building to maintain consistency.
|
||||||
|
|
||||||
|
**Important**: Always update `debian/changelog` first, as this is the authoritative source for the version number. The `make sync-version` target extracts the version from the first line of the changelog and updates the `Version` constant in `src/main.go`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project uses the LGPL 3.0 licensed go-agentx library. It has been modified due to a bug,
|
This project uses the LGPL 3.0 licensed go-agentx library. It has been modified due to a bug,
|
||||||
|
@@ -60,6 +60,7 @@ import (
|
|||||||
// ifHCOutUcastPkts .11 - Counter64
|
// ifHCOutUcastPkts .11 - Counter64
|
||||||
// ifHCOutMulticastPkts .12 - Counter64
|
// ifHCOutMulticastPkts .12 - Counter64
|
||||||
// ifHCOutBroadcastPkts .13 - Counter64
|
// ifHCOutBroadcastPkts .13 - Counter64
|
||||||
|
// ifHighSpeed .15 - Gauge32 (interface speed in Mbps)
|
||||||
// ifAlias .18 - DisplayString
|
// ifAlias .18 - DisplayString
|
||||||
|
|
||||||
const ifEntryOID = "1.3.6.1.2.1.2.2.1"
|
const ifEntryOID = "1.3.6.1.2.1.2.2.1"
|
||||||
@@ -231,14 +232,19 @@ func (m *InterfaceMIB) addIfEntry(iface *api.InterfaceCounters, idx int) {
|
|||||||
item.Type = pdu.VariableTypeInteger
|
item.Type = pdu.VariableTypeInteger
|
||||||
item.Value = mtu
|
item.Value = mtu
|
||||||
|
|
||||||
// ifSpeed (.5) - Use real speed if available, otherwise default to 1Gbps
|
// ifSpeed (.5) - Only populate for speeds <= 2.5Gbps (legacy field limitation)
|
||||||
speed := uint32(1000000000)
|
if details != nil && details.Speed > 0 && details.Speed <= 2500000000 {
|
||||||
if details != nil && details.Speed > 0 {
|
// Use real speed for interfaces <= 2.5Gbps
|
||||||
speed = uint32(details.Speed)
|
item = m.handler.Add(fmt.Sprintf("%s.5.%d", ifEntryOID, idx))
|
||||||
|
item.Type = pdu.VariableTypeGauge32
|
||||||
|
item.Value = uint32(details.Speed)
|
||||||
|
} else if details == nil || details.Speed == 0 {
|
||||||
|
// Default to 1Gbps when speed is unknown
|
||||||
|
item = m.handler.Add(fmt.Sprintf("%s.5.%d", ifEntryOID, idx))
|
||||||
|
item.Type = pdu.VariableTypeGauge32
|
||||||
|
item.Value = uint32(1000000000)
|
||||||
}
|
}
|
||||||
item = m.handler.Add(fmt.Sprintf("%s.5.%d", ifEntryOID, idx))
|
// For speeds > 2.5Gbps, don't populate ifSpeed field at all
|
||||||
item.Type = pdu.VariableTypeGauge32
|
|
||||||
item.Value = speed
|
|
||||||
|
|
||||||
// ifPhysAddress (.6) - Use real MAC address if available
|
// ifPhysAddress (.6) - Use real MAC address if available
|
||||||
macAddr := ""
|
macAddr := ""
|
||||||
@@ -411,6 +417,16 @@ func (m *InterfaceMIB) addIfXTable(iface *api.InterfaceCounters, idx int) {
|
|||||||
item.Type = pdu.VariableTypeCounter64
|
item.Type = pdu.VariableTypeCounter64
|
||||||
item.Value = iface.TxBroadcast.Packets
|
item.Value = iface.TxBroadcast.Packets
|
||||||
|
|
||||||
|
// ifHighSpeed (.15) - Interface speed in Megabits per second
|
||||||
|
details := m.interfaceDetails[iface.InterfaceIndex]
|
||||||
|
speedMbps := uint32(1000) // default 1 Gbps = 1000 Mbps
|
||||||
|
if details != nil && details.Speed > 0 {
|
||||||
|
speedMbps = uint32(details.Speed / 1000000) // Convert bps to Mbps
|
||||||
|
}
|
||||||
|
item = m.handler.Add(fmt.Sprintf("%s.15.%d", ifXTableOID, idx))
|
||||||
|
item.Type = pdu.VariableTypeGauge32
|
||||||
|
item.Value = speedMbps
|
||||||
|
|
||||||
// ifAlias (.18) - Interface description/alias
|
// ifAlias (.18) - Interface description/alias
|
||||||
item = m.handler.Add(fmt.Sprintf("%s.18.%d", ifXTableOID, idx))
|
item = m.handler.Add(fmt.Sprintf("%s.18.%d", ifXTableOID, idx))
|
||||||
item.Type = pdu.VariableTypeOctetString
|
item.Type = pdu.VariableTypeOctetString
|
||||||
|
@@ -16,6 +16,8 @@ import (
|
|||||||
"govpp-snmp-agentx/vpp"
|
"govpp-snmp-agentx/vpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const Version = "1.1.2-1"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
debug := flag.Bool("debug", false, "Enable debug logging")
|
debug := flag.Bool("debug", false, "Enable debug logging")
|
||||||
vppcfg := flag.String("vppcfg", "", "VPP configuration YAML file to read interface descriptions from")
|
vppcfg := flag.String("vppcfg", "", "VPP configuration YAML file to read interface descriptions from")
|
||||||
@@ -24,6 +26,9 @@ func main() {
|
|||||||
// Set global debug flag
|
// Set global debug flag
|
||||||
config.Debug = *debug
|
config.Debug = *debug
|
||||||
|
|
||||||
|
// Log startup message with version
|
||||||
|
logger.Printf("Starting govpp-snmp-agentx version %s", Version)
|
||||||
|
|
||||||
// Create the interface MIB
|
// Create the interface MIB
|
||||||
interfaceMIB := ifmib.NewInterfaceMIB()
|
interfaceMIB := ifmib.NewInterfaceMIB()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user