Skip to content

Commit 355c1a8

Browse files
authored
Merge pull request #134 from netboxlabs/develop
release 🚚
2 parents 9340aa8 + 2521e96 commit 355c1a8

34 files changed

+1067
-584
lines changed

.github/golangci.yaml

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
modules-download-mode: readonly
4-
5-
output:
6-
formats: colored-line-number
7-
84
linters:
95
enable:
10-
- revive
11-
- errcheck
12-
- unused
13-
- staticcheck
14-
- ineffassign
15-
- govet
16-
- gosimple
176
- bodyclose
7+
- revive
8+
exclusions:
9+
generated: lax
10+
rules:
11+
- linters:
12+
- revive
13+
path: /*.go
14+
text: 'package-comments: should have a package comment'
15+
paths:
16+
- third_party$
17+
- builtin$
18+
- examples$
19+
severity:
20+
default: error
21+
formatters:
22+
enable:
1823
- gci
1924
- gofumpt
20-
21-
issues:
22-
exclude-use-default: false
23-
exclude-rules:
24-
- path: /*.go
25-
text: "package-comments: should have a package comment"
26-
linters:
27-
- revive
28-
29-
severity:
30-
default-severity: error
31-
32-
linters-settings:
33-
gci:
34-
sections:
35-
- standard
36-
- default
37-
- prefix(github.com/netboxlabs/orb-agent)
38-
custom-order: true
39-
go-fumpt:
40-
extra-rules: true
25+
settings:
26+
gci:
27+
sections:
28+
- standard
29+
- default
30+
- prefix(github.com/netboxlabs/orb-agent)
31+
custom-order: true
32+
exclusions:
33+
generated: lax
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$

.github/workflows/develop.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
contents: write
1313

1414
env:
15-
GO_VERSION: '1.23'
15+
GO_VERSION: '1.24'
1616

1717
jobs:
1818
build-and-push:

.github/workflows/lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
- name: Setup Go
1818
uses: actions/setup-go@v5
1919
with:
20-
go-version: '1.23.x'
20+
go-version: '1.24.x'
2121
check-latest: true
2222
- name: Lint
23-
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 #v6.1.1
23+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 #v8.0.0
2424
with:
25-
version: v1.62
25+
version: v2.1.6
2626
working-directory: .
2727
args: --config .github/golangci.yaml

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
env:
1616
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
SEMANTIC_RELEASE_PACKAGE: ${{ github.repository }}
18-
GO_VERSION: '1.23'
18+
GO_VERSION: '1.24'
1919
APP_NAME: orb-agent
2020

2121
permissions:
@@ -65,7 +65,7 @@ jobs:
6565
{ "message": "*", "release": "patch"},
6666
{ "message": "fix*", "release": "patch" },
6767
{ "message": "feat*", "release": "minor" },
68-
{ "message": "perf*", "release": "major" }
68+
{ "message": "major*", "release": "major" }
6969
]
7070
}],
7171
"@semantic-release/release-notes-generator",
@@ -210,7 +210,7 @@ jobs:
210210
{ "message": "*", "release": "patch"},
211211
{ "message": "fix*", "release": "patch" },
212212
{ "message": "feat*", "release": "minor" },
213-
{ "message": "perf*", "release": "major" }
213+
{ "message": "major*", "release": "major" }
214214
]
215215
}],
216216
"@semantic-release/release-notes-generator",

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup Go
3535
uses: actions/setup-go@v5
3636
with:
37-
go-version: '1.23.x'
37+
go-version: '1.24.x'
3838
check-latest: true
3939
- name: Run go build
4040
run: go build ./...

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
diode/
2+
orb-configs/
13
build/
2-
.vscode/
3-
.coverage/
4+
.coverage/

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
include agent/docker/.env
2-
3-
# expects to be set as env var
41
PRODUCTION_AGENT_REF_TAG ?= latest
52
PRODUCTION_AGENT_DEBUG_REF_TAG ?= latest-debug
63
REF_TAG ?= develop
74
DEBUG_REF_TAG ?= develop-debug
85
PKTVISOR_TAG ?= develop
96
PKTVISOR_DEBUG_TAG ?= develop-debug
7+
SNMP_DISCOVERY_TAG ?= latest
108
DOCKERHUB_REPO = netboxlabs
119
ORB_DOCKERHUB_REPO = netboxlabs
1210
BUILD_DIR = build
@@ -39,6 +37,9 @@ endif
3937
install-dev-tools:
4038
@go install github.com/mfridman/tparse@latest
4139

40+
.PHONY: deps
41+
deps:
42+
@go mod tidy
4243

4344
agent_bin:
4445
echo "ORB_VERSION: $(ORB_VERSION)-$(COMMIT_HASH)"
@@ -63,6 +64,7 @@ agent:
6364
docker build --no-cache \
6465
--build-arg GOARCH=$(GOARCH) \
6566
--build-arg PKTVISOR_TAG=$(PKTVISOR_TAG) \
67+
--build-arg SNMP_DISCOVERY_TAG=$(SNMP_DISCOVERY_TAG) \
6668
--tag=$(ORB_DOCKERHUB_REPO)/orb-agent:$(REF_TAG) \
6769
--tag=$(ORB_DOCKERHUB_REPO)/orb-agent:$(ORB_VERSION) \
6870
--tag=$(ORB_DOCKERHUB_REPO)/orb-agent:$(ORB_VERSION)-$(COMMIT_HASH) \
@@ -95,4 +97,4 @@ pull-latest-otel-collector-contrib:
9597
cp ./agent/backend/otel/otelcol-contrib .
9698
rm ./agent/backend/otel/otelcol_contrib.tar.gz
9799
rm ./agent/backend/otel/LICENSE
98-
rm ./agent/backend/otel/README.md
100+
rm ./agent/backend/otel/README.md

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ orb:
6060
network_discovery:
6161
...
6262
```
63-
Only the `network_discovery`, `device_discovery` and `worker` backends are currently supported. They do not require any special configuration.
63+
Only the `network_discovery`, `device_discovery`, `worker` and `snmp_discovery` backends are currently supported. They do not require any special configuration.
6464
- [Device Discovery](./docs/backends/device_discovery.md)
6565
- [Network Discovery](./docs/backends/network_discovery.md)
6666
- [Worker](./docs/backends/worker.md)
67+
- [SNMP Discovery](./docs/backends/snmp_discovery.md)
6768

6869
#### Common
6970
A special `common` subsection under `backends` defines configuration settings that are shared with all backends. Currently, it supports passing [diode](https://github.com/netboxlabs/diode) server settings to all backends.
@@ -95,6 +96,9 @@ orb:
9596
worker:
9697
worker_policy_1:
9798
# see docs/backends/worker.md
99+
snmp_discovery:
100+
snmp_policy_1:
101+
# see docs/backends/snmp.md
98102
```
99103

100104
## Running the agent

agent/backend/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ func (c *CmdWrapper) Status() CmdStatus {
8181

8282
// GetStdout returns the stdout channel
8383
func (c *CmdWrapper) GetStdout() <-chan string {
84-
return c.Cmd.Stdout
84+
return c.Stdout
8585
}
8686

8787
// GetStderr returns the stderr channel
8888
func (c *CmdWrapper) GetStderr() <-chan string {
89-
return c.Cmd.Stderr
89+
return c.Stderr
9090
}

agent/backend/devicediscovery/device_discovery.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type deviceDiscoveryBackend struct {
4343
diodeClientID string
4444
diodeClientSecret string
4545
diodeAppNamePrefix string
46+
diodeOtelEndpoint string
4647

4748
startTime time.Time
4849
proc backend.Commander
@@ -84,6 +85,12 @@ func (d *deviceDiscoveryBackend) Configure(logger *slog.Logger, repo policies.Po
8485
d.diodeClientSecret = common.Diode.ClientSecret
8586
d.diodeAppNamePrefix = common.Diode.AgentName
8687

88+
if common.Otel.Grpc != "" {
89+
d.diodeOtelEndpoint = common.Otel.Grpc
90+
d.logger.Info("device-discovery using OTLP metrics endpoint",
91+
slog.String("endpoint", d.diodeOtelEndpoint))
92+
}
93+
8794
return nil
8895
}
8996

@@ -112,6 +119,10 @@ func (d *deviceDiscoveryBackend) Start(ctx context.Context, cancelFunc context.C
112119
"--diode-app-name-prefix", d.diodeAppNamePrefix,
113120
}
114121

122+
if d.diodeOtelEndpoint != "" {
123+
pvOptions = append(pvOptions, "--otel-endpoint", d.diodeOtelEndpoint)
124+
}
125+
115126
d.logger.Info("device-discovery startup", slog.Any("arguments", pvOptions))
116127

117128
pvOptions[9] = d.diodeClientSecret

0 commit comments

Comments
 (0)