Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
bbe6527
adds support for snmp discovery
jajeffries Apr 8, 2025
6c3a4ed
tidy up Makefile
jajeffries Apr 8, 2025
cef3de6
adds snmp agent to dockerfile
jajeffries Apr 8, 2025
d03799a
removes unused file
jajeffries Apr 8, 2025
9acd915
fixes merge errors
jajeffries Apr 9, 2025
3aec493
adds tests for snmp discovery
jajeffries Apr 9, 2025
328e9e2
feat: add openteletry metrics support for each backend
leoparente May 1, 2025
a654a6f
Merge pull request #102 from netboxlabs/feat/OBS-579-metrics-support
leoparente May 6, 2025
2c8530c
fix: device-discovery remove scope site from prefix
leoparente May 7, 2025
a2af3a2
Merge pull request #105 from netboxlabs/fix/remove-default-site-for-p…
leoparente May 7, 2025
8e7e5bd
feat: add skip tls to git config manager
leoparente May 19, 2025
080c238
Merge pull request #112 from netboxlabs/feat/OBS-1027-add-skip-tls-ce…
leoparente May 19, 2025
5f421d7
fix: apply skipTLS to every git call
leoparente May 20, 2025
05acd4d
Merge pull request #113 from netboxlabs/fix/propagate-skip-tls
leoparente May 20, 2025
98925d5
chore: bump go version to 1.24.2
leoparente May 20, 2025
179315e
golangci fix
leoparente May 20, 2025
b35f58a
remove output to use default
leoparente May 20, 2025
b697220
migrate golint
leoparente May 20, 2025
c8efb61
run lint fix
leoparente May 20, 2025
4b72240
remove backup
leoparente May 20, 2025
6b79813
Merge pull request #114 from netboxlabs/chore/bump-go-version
leoparente May 21, 2025
9acdd6f
Merge pull request #116 from netboxlabs/chore/update-docs-sample
leoparente May 22, 2025
47ab702
feat: solve secrets on config and backends setup data (#93)
leoparente Apr 9, 2025
ee1d871
chore(deps): bump golang.org/x/net from 0.36.0 to 0.38.0 in the go_mo…
dependabot[bot] Apr 17, 2025
3e5b55d
perf: support diode oauth2 (#97)
leoparente Apr 24, 2025
f26aebb
chore: update docs (#99)
leoparente Apr 25, 2025
6a7f9f9
adds snmp tag params
jajeffries May 28, 2025
3414ed3
migrate to diode sdk 1.0.0
jajeffries May 28, 2025
0d6c07d
adds snmp documentation
jajeffries May 28, 2025
c088bd0
adds sample mapping and device files to docs
jajeffries May 28, 2025
cf7405d
adds snmp config samples
jajeffries May 28, 2025
dc5d573
Merge remote-tracking branch 'origin/develop' into initial_snmp_support
jajeffries May 28, 2025
aeeb9f7
Simplifies loop
jajeffries May 28, 2025
8945180
fixes broken merge
jajeffries May 28, 2025
303159b
corrects typo in example config
jajeffries May 28, 2025
31b1985
stops diode client secret from being output
jajeffries May 28, 2025
9a8507c
Merge pull request #92 from netboxlabs/initial_snmp_support
jajeffries May 29, 2025
396038c
chore: update network discovery docs (#120)
leoparente Jun 4, 2025
fb6e318
chore: cleanup agent entrypoint (#121)
leoparente Jun 5, 2025
20b824d
chore: add device-discovery docs for YAML anchors/aliases (#124)
leoparente Jun 9, 2025
98ee83e
chore(deps): bump github.com/cloudflare/circl from 1.6.0 to 1.6.1 in …
dependabot[bot] Jun 11, 2025
84dafb5
updates documentation for snmp-discovery policy and explains device m…
jajeffries Jun 19, 2025
e4d82cd
Merge pull request #127 from netboxlabs/improve_snmp_docs
rboucher-me Jun 19, 2025
cc9e63f
bundle the lookup extensions in orb-agent image
jajeffries Jun 20, 2025
b023b6b
Merge pull request #129 from netboxlabs/bundle_lookup_extensions
jajeffries Jun 20, 2025
3fd5430
feat: adds snmp to docs (#128)
jajeffries Jun 20, 2025
f4b54fd
doc: updates docs to clarify the lookup_extensions_dir property (#130)
jajeffries Jun 20, 2025
2521e96
feat: proper semantic release major tag (#133)
leoparente Jun 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 30 additions & 33 deletions .github/golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
version: "2"
run:
timeout: 5m
modules-download-mode: readonly

output:
formats: colored-line-number

linters:
enable:
- revive
- errcheck
- unused
- staticcheck
- ineffassign
- govet
- gosimple
- bodyclose
- revive
exclusions:
generated: lax
rules:
- linters:
- revive
path: /*.go
text: 'package-comments: should have a package comment'
paths:
- third_party$
- builtin$
- examples$
severity:
default: error
formatters:
enable:
- gci
- gofumpt

issues:
exclude-use-default: false
exclude-rules:
- path: /*.go
text: "package-comments: should have a package comment"
linters:
- revive

severity:
default-severity: error

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/netboxlabs/orb-agent)
custom-order: true
go-fumpt:
extra-rules: true
settings:
gci:
sections:
- standard
- default
- prefix(github.com/netboxlabs/orb-agent)
custom-order: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion .github/workflows/develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
contents: write

env:
GO_VERSION: '1.23'
GO_VERSION: '1.24'

jobs:
build-and-push:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
go-version: '1.24.x'
check-latest: true
- name: Lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 #v6.1.1
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 #v8.0.0
with:
version: v1.62
version: v2.1.6
working-directory: .
args: --config .github/golangci.yaml
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEMANTIC_RELEASE_PACKAGE: ${{ github.repository }}
GO_VERSION: '1.23'
GO_VERSION: '1.24'
APP_NAME: orb-agent

permissions:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
{ "message": "*", "release": "patch"},
{ "message": "fix*", "release": "patch" },
{ "message": "feat*", "release": "minor" },
{ "message": "perf*", "release": "major" }
{ "message": "major*", "release": "major" }
]
}],
"@semantic-release/release-notes-generator",
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
{ "message": "*", "release": "patch"},
{ "message": "fix*", "release": "patch" },
{ "message": "feat*", "release": "minor" },
{ "message": "perf*", "release": "major" }
{ "message": "major*", "release": "major" }
]
}],
"@semantic-release/release-notes-generator",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
go-version: '1.24.x'
check-latest: true
- name: Run go build
run: go build ./...
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
diode/
orb-configs/
build/
.vscode/
.coverage/
.coverage/
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
include agent/docker/.env

# expects to be set as env var
PRODUCTION_AGENT_REF_TAG ?= latest
PRODUCTION_AGENT_DEBUG_REF_TAG ?= latest-debug
REF_TAG ?= develop
DEBUG_REF_TAG ?= develop-debug
PKTVISOR_TAG ?= develop
PKTVISOR_DEBUG_TAG ?= develop-debug
SNMP_DISCOVERY_TAG ?= latest
DOCKERHUB_REPO = netboxlabs
ORB_DOCKERHUB_REPO = netboxlabs
BUILD_DIR = build
Expand Down Expand Up @@ -39,6 +37,9 @@ endif
install-dev-tools:
@go install github.com/mfridman/tparse@latest

.PHONY: deps
deps:
@go mod tidy

agent_bin:
echo "ORB_VERSION: $(ORB_VERSION)-$(COMMIT_HASH)"
Expand All @@ -63,6 +64,7 @@ agent:
docker build --no-cache \
--build-arg GOARCH=$(GOARCH) \
--build-arg PKTVISOR_TAG=$(PKTVISOR_TAG) \
--build-arg SNMP_DISCOVERY_TAG=$(SNMP_DISCOVERY_TAG) \
--tag=$(ORB_DOCKERHUB_REPO)/orb-agent:$(REF_TAG) \
--tag=$(ORB_DOCKERHUB_REPO)/orb-agent:$(ORB_VERSION) \
--tag=$(ORB_DOCKERHUB_REPO)/orb-agent:$(ORB_VERSION)-$(COMMIT_HASH) \
Expand Down Expand Up @@ -95,4 +97,4 @@ pull-latest-otel-collector-contrib:
cp ./agent/backend/otel/otelcol-contrib .
rm ./agent/backend/otel/otelcol_contrib.tar.gz
rm ./agent/backend/otel/LICENSE
rm ./agent/backend/otel/README.md
rm ./agent/backend/otel/README.md
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ orb:
network_discovery:
...
```
Only the `network_discovery`, `device_discovery` and `worker` backends are currently supported. They do not require any special configuration.
Only the `network_discovery`, `device_discovery`, `worker` and `snmp_discovery` backends are currently supported. They do not require any special configuration.
- [Device Discovery](./docs/backends/device_discovery.md)
- [Network Discovery](./docs/backends/network_discovery.md)
- [Worker](./docs/backends/worker.md)
- [SNMP Discovery](./docs/backends/snmp_discovery.md)

#### Common
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.
Expand Down Expand Up @@ -95,6 +96,9 @@ orb:
worker:
worker_policy_1:
# see docs/backends/worker.md
snmp_discovery:
snmp_policy_1:
# see docs/backends/snmp.md
```

## Running the agent
Expand Down
4 changes: 2 additions & 2 deletions agent/backend/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ func (c *CmdWrapper) Status() CmdStatus {

// GetStdout returns the stdout channel
func (c *CmdWrapper) GetStdout() <-chan string {
return c.Cmd.Stdout
return c.Stdout
}

// GetStderr returns the stderr channel
func (c *CmdWrapper) GetStderr() <-chan string {
return c.Cmd.Stderr
return c.Stderr
}
11 changes: 11 additions & 0 deletions agent/backend/devicediscovery/device_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type deviceDiscoveryBackend struct {
diodeClientID string
diodeClientSecret string
diodeAppNamePrefix string
diodeOtelEndpoint string

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

if common.Otel.Grpc != "" {
d.diodeOtelEndpoint = common.Otel.Grpc
d.logger.Info("device-discovery using OTLP metrics endpoint",
slog.String("endpoint", d.diodeOtelEndpoint))
}

return nil
}

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

if d.diodeOtelEndpoint != "" {
pvOptions = append(pvOptions, "--otel-endpoint", d.diodeOtelEndpoint)
}

d.logger.Info("device-discovery startup", slog.Any("arguments", pvOptions))

pvOptions[9] = d.diodeClientSecret
Expand Down
7 changes: 4 additions & 3 deletions agent/backend/devicediscovery/device_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestDeviceDiscoveryBackendStart(t *testing.T) {

if r.URL.Path == "/api/v1/status" {
response := StatusResponse{
Version: "1.3.4",
Version: "1.3.5",
StartTime: "2023-10-01T12:00:00Z",
UpTime: 123.456,
}
Expand All @@ -54,7 +54,8 @@ func TestDeviceDiscoveryBackendStart(t *testing.T) {
return
}
} else if strings.Contains(r.URL.Path, "/api/v1/policies") {
if r.Method == http.MethodPost {
switch r.Method {
case http.MethodPost:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand All @@ -65,7 +66,7 @@ func TestDeviceDiscoveryBackendStart(t *testing.T) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
} else if r.Method == http.MethodDelete {
case http.MethodDelete:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand Down
11 changes: 11 additions & 0 deletions agent/backend/networkdiscovery/network_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type networkDiscoveryBackend struct {
diodeClientID string
diodeClientSecret string
diodeAppNamePrefix string
diodeOtelEndpoint string

startTime time.Time
proc backend.Commander
Expand Down Expand Up @@ -84,6 +85,12 @@ func (d *networkDiscoveryBackend) Configure(logger *slog.Logger, repo policies.P
d.diodeClientSecret = common.Diode.ClientSecret
d.diodeAppNamePrefix = common.Diode.AgentName

if common.Otel.Grpc != "" {
d.diodeOtelEndpoint = common.Otel.Grpc
d.logger.Info("network-discovery using OTLP metrics endpoint",
slog.String("endpoint", d.diodeOtelEndpoint))
}

return nil
}

Expand Down Expand Up @@ -112,6 +119,10 @@ func (d *networkDiscoveryBackend) Start(ctx context.Context, cancelFunc context.
"--diode-app-name-prefix", d.diodeAppNamePrefix,
}

if d.diodeOtelEndpoint != "" {
pvOptions = append(pvOptions, "--otel-endpoint", d.diodeOtelEndpoint)
}

d.logger.Info("network-discovery startup", slog.Any("arguments", pvOptions))

pvOptions[9] = d.diodeClientSecret
Expand Down
5 changes: 3 additions & 2 deletions agent/backend/networkdiscovery/network_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func TestNetworkDiscoveryBackendStart(t *testing.T) {
return
}
} else if strings.Contains(r.URL.Path, "/api/v1/policies") {
if r.Method == http.MethodPost {
switch r.Method {
case http.MethodPost:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand All @@ -65,7 +66,7 @@ func TestNetworkDiscoveryBackendStart(t *testing.T) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
} else if r.Method == http.MethodDelete {
case http.MethodDelete:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand Down
5 changes: 3 additions & 2 deletions agent/backend/otel/otel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func TestOpenTelemetryBackendStart(t *testing.T) {
return
}
} else if strings.Contains(r.URL.Path, "/api/v1/policies") {
if r.Method == http.MethodPost {
switch r.Method {
case http.MethodPost:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand All @@ -66,7 +67,7 @@ func TestOpenTelemetryBackendStart(t *testing.T) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
} else if r.Method == http.MethodDelete {
case http.MethodDelete:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand Down
15 changes: 12 additions & 3 deletions agent/backend/pktvisor/pktvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"log/slog"
"net/http"
"net/url"
"os"
"os/exec"
"strconv"
Expand Down Expand Up @@ -302,9 +303,17 @@ func (p *pktvisorBackend) Configure(logger *slog.Logger, repo policies.PolicyRep

p.configFile = tmpFile.Name()

if common.Otel.Host != "" && common.Otel.Port != 0 {
p.otelReceiverHost = common.Otel.Host
p.otelReceiverPort = common.Otel.Port
if common.Otel.HTTP != "" {
uri, err := url.Parse(common.Otel.HTTP)
if err != nil {
return fmt.Errorf("failed to parse otel receiver http url: %w", err)
}
p.otelReceiverHost = uri.Hostname()
port, err := strconv.Atoi(uri.Port())
if err != nil {
return fmt.Errorf("failed to parse otel receiver port: %w", err)
}
p.otelReceiverPort = port
p.logger.Info("configured otel receiver host", slog.String("host", p.otelReceiverHost),
slog.Int("port", p.otelReceiverPort))
}
Expand Down
5 changes: 3 additions & 2 deletions agent/backend/pktvisor/pktvisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func TestPktvisorBackendStart(t *testing.T) {
return
}
} else if strings.Contains(r.URL.Path, "/api/v1/policies") {
if r.Method == http.MethodPost {
switch r.Method {
case http.MethodPost:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand All @@ -65,7 +66,7 @@ func TestPktvisorBackendStart(t *testing.T) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
} else if r.Method == http.MethodDelete {
case http.MethodDelete:
w.WriteHeader(http.StatusOK)
response := map[string]any{
"status": "success",
Expand Down
Loading
Loading