Skip to content

Commit

Permalink
Revert "[SNMP] Componentize SNMP traps server (#19789)" (#20773)
Browse files Browse the repository at this point in the history
This reverts commit 679f6ca.
  • Loading branch information
Slavek Kabrda authored Nov 10, 2023
1 parent 749288b commit fa5e6ea
Show file tree
Hide file tree
Showing 50 changed files with 978 additions and 1,478 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
/comp/otelcol @DataDog/opentelemetry
/comp/process @DataDog/processes
/comp/remote-config @DataDog/remote-config
/comp/snmptraps @DataDog/network-device-monitoring
/comp/systray @DataDog/windows-agent
/comp/trace @DataDog/agent-apm
/comp/checks/agentcrashdetect @DataDog/windows-kernel-integrations
Expand Down
14 changes: 10 additions & 4 deletions cmd/agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/DataDog/datadog-agent/cmd/manager"
"github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer"
netflowServer "github.com/DataDog/datadog-agent/comp/netflow/server"
snmptrapsServer "github.com/DataDog/datadog-agent/comp/snmptraps/server"

// checks implemented as components

Expand Down Expand Up @@ -66,7 +65,6 @@ import (
"github.com/DataDog/datadog-agent/comp/otelcol"
otelcollector "github.com/DataDog/datadog-agent/comp/otelcol/collector"
"github.com/DataDog/datadog-agent/comp/remote-config/rcclient"
"github.com/DataDog/datadog-agent/comp/snmptraps"
"github.com/DataDog/datadog-agent/pkg/aggregator"
"github.com/DataDog/datadog-agent/pkg/api/healthprobe"
"github.com/DataDog/datadog-agent/pkg/autodiscovery/providers"
Expand All @@ -80,6 +78,7 @@ import (
pkgMetadata "github.com/DataDog/datadog-agent/pkg/metadata"
"github.com/DataDog/datadog-agent/pkg/pidfile"
"github.com/DataDog/datadog-agent/pkg/serializer"
"github.com/DataDog/datadog-agent/pkg/snmp/traps"
"github.com/DataDog/datadog-agent/pkg/status"
"github.com/DataDog/datadog-agent/pkg/status/health"
pkgTelemetry "github.com/DataDog/datadog-agent/pkg/telemetry"
Expand Down Expand Up @@ -198,7 +197,6 @@ func run(log log.Component,
hostMetadata host.Component,
invAgent inventoryagent.Component,
_ netflowServer.Component,
_ snmptrapsServer.Component,
_ langDetectionCl.Component,
) error {
defer func() {
Expand Down Expand Up @@ -308,7 +306,6 @@ func getSharedFxOption() fx.Option {
}),
ndmtmp.Bundle,
netflow.Bundle,
snmptraps.Bundle,
)
}

Expand Down Expand Up @@ -511,6 +508,14 @@ func startAgent(
pkgTelemetry.RegisterStatsSender(sender)
}

// Start SNMP trap server
if traps.IsEnabled(pkgconfig.Datadog) {
err = traps.StartServer(hostnameDetected, demultiplexer, pkgconfig.Datadog, log)
if err != nil {
log.Errorf("Failed to start snmp-traps server: %s", err)
}
}

// Detect Cloud Provider
go cloudproviders.DetectCloudProvider(context.Background())

Expand Down Expand Up @@ -590,6 +595,7 @@ func stopAgent(cliParams *cliParams, server dogstatsdServer.Component, demultipl
if common.MetadataScheduler != nil {
common.MetadataScheduler.Stop()
}
traps.StopServer()
api.StopServer()
clcrunnerapi.StopCLCRunnerServer()
jmx.StopJmxfetch()
Expand Down
2 changes: 0 additions & 2 deletions cmd/agent/subcommands/run/command_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer"
"github.com/DataDog/datadog-agent/comp/checks/agentcrashdetect"
"github.com/DataDog/datadog-agent/comp/checks/agentcrashdetect/agentcrashdetectimpl"
trapserver "github.com/DataDog/datadog-agent/comp/snmptraps/server"
comptraceconfig "github.com/DataDog/datadog-agent/comp/trace/config"

// core components
Expand Down Expand Up @@ -83,7 +82,6 @@ func StartAgentWithDefaults(ctxChan <-chan context.Context) (<-chan error, error
hostMetadata host.Component,
invAgent inventoryagent.Component,
_ netflowServer.Component,
_ trapserver.Component,
) error {

defer StopAgentWithDefaults(server, demultiplexer)
Expand Down
41 changes: 0 additions & 41 deletions comp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,47 +250,6 @@ supported Datadog intakes.



## [comp/snmptraps](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps) (Component Bundle)

*Datadog Team*: network-device-monitoring

Package snmptraps implements the a server that listens for SNMP trap data
and sends it to the backend.

### [comp/snmptraps/config](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/config)

Package config implements the configuration type for the traps server and
a component that provides it.

### [comp/snmptraps/formatter](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/formatter)

Package formatter provides a component for formatting SNMP traps.

### [comp/snmptraps/forwarder](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/forwarder)

Package forwarder defines a component that receives trap data from the
listener component, formats it properly, and sends it to the backend.

### [comp/snmptraps/listener](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/listener)

Package listener implements a component that listens for SNMP messages,
parses them, and publishes messages on a channel.

### [comp/snmptraps/oidresolver](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/oidresolver)

Package oidresolver resolves OIDs

### [comp/snmptraps/server](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/server)

Package server implements a component that runs the traps server.
It listens for SNMP trap messages on a configured port, parses and
reformats them, and sends the resulting data to the backend.

### [comp/snmptraps/status](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/snmptraps/status)

Package status exposes the expvars we use for status tracking to the
component system.

## [comp/systray](https://pkg.go.dev/github.com/DataDog/dd-agent-comp-experiments/comp/systray) (Component Bundle)

*Datadog Team*: windows-agent
Expand Down
32 changes: 0 additions & 32 deletions comp/snmptraps/bundle.go

This file was deleted.

27 changes: 0 additions & 27 deletions comp/snmptraps/bundle_test.go

This file was deleted.

15 changes: 0 additions & 15 deletions comp/snmptraps/config/component.go

This file was deleted.

Loading

0 comments on commit fa5e6ea

Please sign in to comment.