Documentation ¶
Overview ¶
Package agent includes helpers related to the Datadog Agent on Windows
Package agent includes helpers related to the Datadog Agent on Windows
Index ¶
- Constants
- func GetAgentUserFromRegistry(host *components.RemoteHost) (string, string, error)
- func GetBetaMSIURL(version string, arch string) (string, error)
- func GetChannelURL(channel string) (string, error)
- func GetConfigRootFromRegistry(host *components.RemoteHost) (string, error)
- func GetDatadogAgentProductCode(host *components.RemoteHost) (string, error)
- func GetInstallPathFromRegistry(host *components.RemoteHost) (string, error)
- func GetLatestMSIURL(majorVersion string, arch string) string
- func GetMSIURL(channel string, version string, arch string) (string, error)
- func GetPipelineMSIURL(pipelineID string, majorVersion string, arch string) (string, error)
- func GetStableMSIURL(version string, arch string) (string, error)
- func HasValidDatadogCodeSignature(host *components.RemoteHost, path string) error
- func InstallAgent(host *components.RemoteHost, options ...InstallAgentOption) (string, error)
- func LookupArchFromEnv() (string, bool)
- func LookupChannelFromEnv() (string, bool)
- func LookupChannelURLFromEnv() (string, bool)
- func LookupVersionFromEnv() (string, bool)
- func RepairAllAgent(host *components.RemoteHost, args string, logPath string) error
- func TestAgentVersion(t *testing.T, expected string, actual string) bool
- func TestValidDatadogCodeSignatures(t *testing.T, host *components.RemoteHost, paths []string) bool
- func UninstallAgent(host *components.RemoteHost, logPath string) error
- type InstallAgentOption
- func WithAPIKey(apiKey string) InstallAgentOption
- func WithAPMEnabled(apmEnabled string) InstallAgentOption
- func WithAddLocal(addLocal string) InstallAgentOption
- func WithAgentUser(username string) InstallAgentOption
- func WithAgentUserPassword(password string) InstallAgentOption
- func WithApplicationDataDirectory(applicationDataDirectory string) InstallAgentOption
- func WithCmdPort(cmdPort string) InstallAgentOption
- func WithDdURL(ddURL string) InstallAgentOption
- func WithFakeIntake(fakeIntake *components.FakeIntake) InstallAgentOption
- func WithHostname(hostname string) InstallAgentOption
- func WithInstallLogFile(logFileName string) InstallAgentOption
- func WithLastStablePackage() InstallAgentOption
- func WithLogsDdURL(logsDdURL string) InstallAgentOption
- func WithLogsEnabled(logsEnabled string) InstallAgentOption
- func WithPackage(agentPackage *Package) InstallAgentOption
- func WithProcessDdURL(processDdURL string) InstallAgentOption
- func WithProcessDiscoveryEnabled(processDiscoveryEnabled string) InstallAgentOption
- func WithProcessEnabled(processEnabled string) InstallAgentOption
- func WithProjectLocation(projectLocation string) InstallAgentOption
- func WithProxyHost(proxyHost string) InstallAgentOption
- func WithProxyPassword(proxyPassword string) InstallAgentOption
- func WithProxyPort(proxyPort string) InstallAgentOption
- func WithProxyUser(proxyUser string) InstallAgentOption
- func WithSite(site string) InstallAgentOption
- func WithTags(tags string) InstallAgentOption
- func WithTraceDdURL(traceDdURL string) InstallAgentOption
- func WithValidAPIKey() InstallAgentOption
- func WithWixFailWhenDeferred() InstallAgentOption
- type InstallAgentParams
- type Package
Constants ¶
const ( // DatadogCodeSignatureThumbprint is the thumbprint of the Datadog Code Signing certificate // Valid From: May 2023 // Valid To: May 2025 DatadogCodeSignatureThumbprint = `B03F29CC07566505A718583E9270A6EE17678742` // RegistryKeyPath is the root registry key that the Datadog Agent uses to store some state RegistryKeyPath = "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent" // DefaultInstallPath is the default install path for the Datadog Agent DefaultInstallPath = `C:\Program Files\Datadog\Datadog Agent` // DefaultConfigRoot is the default config root for the Datadog Agent DefaultConfigRoot = `C:\ProgramData\Datadog` // DefaultAgentUserName is the default user name for the Datadog Agent DefaultAgentUserName = `ddagentuser` )
Variables ¶
This section is empty.
Functions ¶
func GetAgentUserFromRegistry ¶
func GetAgentUserFromRegistry(host *components.RemoteHost) (string, string, error)
GetAgentUserFromRegistry gets the domain and username that the agent was installed with from the registry
func GetBetaMSIURL ¶
GetBetaMSIURL returns the URL for the beta agent MSI majorVersion: 6, 7 arch: x86_64
func GetChannelURL ¶
GetChannelURL returns the URL for the channel name channel: beta, stable
func GetConfigRootFromRegistry ¶
func GetConfigRootFromRegistry(host *components.RemoteHost) (string, error)
GetConfigRootFromRegistry gets the config root from the registry, e.g. C:\ProgramData\Datadog
func GetDatadogAgentProductCode ¶
func GetDatadogAgentProductCode(host *components.RemoteHost) (string, error)
GetDatadogAgentProductCode returns the product code GUID for the Datadog Agent
func GetInstallPathFromRegistry ¶
func GetInstallPathFromRegistry(host *components.RemoteHost) (string, error)
GetInstallPathFromRegistry gets the install path from the registry, e.g. C:\Program Files\Datadog\Datadog Agent
func GetLatestMSIURL ¶
GetLatestMSIURL returns the URL for the latest agent MSI majorVersion: 6, 7 arch: x86_64
func GetMSIURL ¶
GetMSIURL returns the URL for the agent MSI channel: beta, stable majorVersion: 6, 7 arch: x86_64
func GetPipelineMSIURL ¶
GetPipelineMSIURL returns the URL for the agent MSI built by the pipeline majorVersion: 6, 7 arch: x86_64
func GetStableMSIURL ¶
GetStableMSIURL returns the URL for the stable agent MSI majorVersion: 6, 7 arch: x86_64
func HasValidDatadogCodeSignature ¶
func HasValidDatadogCodeSignature(host *components.RemoteHost, path string) error
HasValidDatadogCodeSignature an error if the file at the given path is not validy signed by the Datadog Code Signing certificate
func InstallAgent ¶
func InstallAgent(host *components.RemoteHost, options ...InstallAgentOption) (string, error)
InstallAgent installs the agent and returns the remote MSI path and any errors
func LookupArchFromEnv ¶
LookupArchFromEnv looks at environment variabes to select the agent arch, if the value is found it is returned along with true, otherwise a default value and false are returned.
WINDOWS_AGENT_ARCH: The arch of the agent, x86_64
Default arch: x86_64
func LookupChannelFromEnv ¶
LookupChannelFromEnv looks at environment variabes to select the agent channel, if the value is found it is returned along with true, otherwise a default value and false are returned.
WINDOWS_AGENT_CHANNEL: beta, stable
Default channel: stable
func LookupChannelURLFromEnv ¶
LookupChannelURLFromEnv looks at environment variabes to select the agent channel URL, if the value is found it is returned along with true, otherwise a default value and false are returned.
WINDOWS_AGENT_CHANNEL_URL: URL to installers_v2.json
See also LookupChannelFromEnv()
Default channel: stable
func LookupVersionFromEnv ¶
LookupVersionFromEnv looks at environment variabes to select the agent version, if the value is found it is returned along with true, otherwise a default value and false are returned.
In order of priority:
WINDOWS_AGENT_VERSION: The complete version, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7
AGENT_MAJOR_VERSION: The major version of the agent, 6 or 7
If only a major version is provided, the latest version of that major version is used.
Default version: 7
func RepairAllAgent ¶
func RepairAllAgent(host *components.RemoteHost, args string, logPath string) error
RepairAllAgent repairs the Datadog Agent
func TestAgentVersion ¶
TestAgentVersion compares the major.minor.patch-prefix parts of two agent versions
func TestValidDatadogCodeSignatures ¶
func TestValidDatadogCodeSignatures(t *testing.T, host *components.RemoteHost, paths []string) bool
TestValidDatadogCodeSignatures verifies that the files at the given paths are validly signed by the Datadog Code Signing certificate This test is skipped if the verify_code_signature parameter is set to false.
func UninstallAgent ¶
func UninstallAgent(host *components.RemoteHost, logPath string) error
UninstallAgent uninstalls the Datadog Agent
Types ¶
type InstallAgentOption ¶
type InstallAgentOption = func(*InstallAgentParams) error
InstallAgentOption is an optional function parameter type for InstallAgentParams options
func WithAPIKey ¶
func WithAPIKey(apiKey string) InstallAgentOption
WithAPIKey specifies the APIKEY parameter.
func WithAPMEnabled ¶ added in v0.54.0
func WithAPMEnabled(apmEnabled string) InstallAgentOption
WithAPMEnabled specifies the APM_ENABLED parameter.
func WithAddLocal ¶ added in v0.56.0
func WithAddLocal(addLocal string) InstallAgentOption
WithAddLocal specifies the ADDLOCAL parameter.
func WithAgentUser ¶
func WithAgentUser(username string) InstallAgentOption
WithAgentUser specifies the DDAGENTUSER_NAME parameter.
func WithAgentUserPassword ¶
func WithAgentUserPassword(password string) InstallAgentOption
WithAgentUserPassword specifies the DDAGENTUSER_PASSWORD parameter.
func WithApplicationDataDirectory ¶ added in v0.54.0
func WithApplicationDataDirectory(applicationDataDirectory string) InstallAgentOption
WithApplicationDataDirectory specifies the APPLICATIONDATADIRECTORY parameter.
func WithCmdPort ¶ added in v0.54.0
func WithCmdPort(cmdPort string) InstallAgentOption
WithCmdPort specifies the CMD_PORT parameter.
func WithDdURL ¶
func WithDdURL(ddURL string) InstallAgentOption
WithDdURL specifies the DD_URL parameter.
func WithFakeIntake ¶
func WithFakeIntake(fakeIntake *components.FakeIntake) InstallAgentOption
WithFakeIntake configures the Agent to use a fake intake URL.
func WithHostname ¶ added in v0.54.0
func WithHostname(hostname string) InstallAgentOption
WithHostname specifies the HOSTNAME parameter.
func WithInstallLogFile ¶
func WithInstallLogFile(logFileName string) InstallAgentOption
WithInstallLogFile specifies the file on the local test runner to save the MSI install logs.
func WithLastStablePackage ¶
func WithLastStablePackage() InstallAgentOption
WithLastStablePackage specifies to use the last stable installation package.
func WithLogsDdURL ¶ added in v0.54.0
func WithLogsDdURL(logsDdURL string) InstallAgentOption
WithLogsDdURL specifies the LOGS_DD_URL parameter.
func WithLogsEnabled ¶ added in v0.54.0
func WithLogsEnabled(logsEnabled string) InstallAgentOption
WithLogsEnabled specifies the LOGS_ENABLED parameter.
func WithPackage ¶
func WithPackage(agentPackage *Package) InstallAgentOption
WithPackage specifies the Agent installation package.
func WithProcessDdURL ¶ added in v0.54.0
func WithProcessDdURL(processDdURL string) InstallAgentOption
WithProcessDdURL specifies the PROCESS_DD_URL parameter.
func WithProcessDiscoveryEnabled ¶ added in v0.54.0
func WithProcessDiscoveryEnabled(processDiscoveryEnabled string) InstallAgentOption
WithProcessDiscoveryEnabled specifies the PROCESS_DISCOVERY_ENABLED parameter.
func WithProcessEnabled ¶ added in v0.54.0
func WithProcessEnabled(processEnabled string) InstallAgentOption
WithProcessEnabled specifies the PROCESS_ENABLED parameter, which controls process_collection.
func WithProjectLocation ¶ added in v0.54.0
func WithProjectLocation(projectLocation string) InstallAgentOption
WithProjectLocation specifies the PROJECTLOCATION parameter.
func WithProxyHost ¶ added in v0.54.0
func WithProxyHost(proxyHost string) InstallAgentOption
WithProxyHost specifies the PROXY_HOST parameter.
func WithProxyPassword ¶ added in v0.54.0
func WithProxyPassword(proxyPassword string) InstallAgentOption
WithProxyPassword specifies the PROXY_PASSWORD parameter.
func WithProxyPort ¶ added in v0.54.0
func WithProxyPort(proxyPort string) InstallAgentOption
WithProxyPort specifies the PROXY_PORT parameter.
func WithProxyUser ¶ added in v0.54.0
func WithProxyUser(proxyUser string) InstallAgentOption
WithProxyUser specifies the PROXY_USER parameter.
func WithSite ¶
func WithSite(site string) InstallAgentOption
WithSite specifies the SITE parameter.
func WithTags ¶ added in v0.54.0
func WithTags(tags string) InstallAgentOption
WithTags specifies the TAGS parameter.
func WithTraceDdURL ¶ added in v0.54.0
func WithTraceDdURL(traceDdURL string) InstallAgentOption
WithTraceDdURL specifies the TRACE_DD_URL parameter.
func WithValidAPIKey ¶
func WithValidAPIKey() InstallAgentOption
WithValidAPIKey sets a valid API key fetched from the runner secret store.
func WithWixFailWhenDeferred ¶
func WithWixFailWhenDeferred() InstallAgentOption
WithWixFailWhenDeferred sets the WixFailWhenDeferred parameter.
type InstallAgentParams ¶
type InstallAgentParams struct { Package *Package // Path on local test runner to save the MSI install log LocalInstallLogFile string msi.InstallAgentParams // Installer parameters WixFailWhenDeferred string `installer_arg:"WIXFAILWHENDEFERRED"` ProjectLocation string `installer_arg:"PROJECTLOCATION"` ApplicationDataDirectory string `installer_arg:"APPLICATIONDATADIRECTORY"` AddLocal string `installer_arg:"ADDLOCAL"` // Installer parameters for agent config APIKey string `installer_arg:"APIKEY"` Tags string `installer_arg:"TAGS"` Hostname string `installer_arg:"HOSTNAME"` CmdPort string `installer_arg:"CMD_PORT"` ProxyHost string `installer_arg:"PROXY_HOST"` ProxyPort string `installer_arg:"PROXY_PORT"` ProxyUser string `installer_arg:"PROXY_USER"` ProxyPassword string `installer_arg:"PROXY_PASSWORD"` LogsDdURL string `installer_arg:"LOGS_DD_URL"` ProcessDdURL string `installer_arg:"PROCESS_DD_URL"` TraceDdURL string `installer_arg:"TRACE_DD_URL"` LogsEnabled string `installer_arg:"LOGS_ENABLED"` ProcessEnabled string `installer_arg:"PROCESS_ENABLED"` ProcessDiscoveryEnabled string `installer_arg:"PROCESS_DISCOVERY_ENABLED"` APMEnabled string `installer_arg:"APM_ENABLED"` }
InstallAgentParams are the parameters used for installing the Agent using msiexec.
type Package ¶
type Package struct { // PipelineID is the pipeline ID used to lookup the MSI URL from the CI pipeline artifacts. PipelineID string // Channel is the channel used to lookup the MSI URL for the Version from the installers_v2.json file. Channel string // Version is the version of the MSI, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7 Version string // Arch is the architecture of the MSI, e.g. x86_64 Arch string // URL is the URL the MSI can be downloaded from URL string }
Package contains identifying information about an Agent MSI package.
func GetLastStablePackageFromEnv ¶
GetLastStablePackageFromEnv returns the latest stable agent MSI URL.
These environment variables are mutually exclusive, only one should be set, listed here in the order they are considered:
LAST_STABLE_WINDOWS_AGENT_MSI_URL: manually provided URL (all other parameters are informational only)
LAST_STABLE_VERSION: The complete version, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7, arch and channel are used
The value of LAST_STABLE_VERSION is set in release.json, and can be acquired by running: invoke release.get-release-json-value "last_stable::$AGENT_MAJOR_VERSION"
func GetPackageFromEnv ¶
GetPackageFromEnv looks at environment variabes to select the Agent MSI URL.
The returned Package contains the MSI URL and other identifying information. Some Package fields will be populated but may not be related to the returned URL. For example, if a URL is provided directly, the Channel, Version, and Arch fields have no effect on the returned URL. They are returned anyway so they can be used for other purposes, such as logging, stack name, instance options, test assertions, etc.
These environment variables are mutually exclusive, only one should be set, listed here in the order they are considered:
WINDOWS_AGENT_MSI_URL: manually provided URL (all other parameters are informational only)
E2E_PIPELINE_ID: use the URL from a specific CI pipeline, major version and arch are used, channel is blank
WINDOWS_AGENT_VERSION: The complete version, e.g. 7.49.0-1, 7.49.0-rc.3-1, or a major version, e.g. 7, arch and channel are used
Other environment variables:
WINDOWS_AGENT_CHANNEL: beta or stable
WINDOWS_AGENT_ARCH: The arch of the agent, x86_64
If a channel is not provided and the version contains `-rc.`, the beta channel is used.
See other Lookup*FromEnv functions for more options and details.
If none of the above are set, the latest stable version is used.
func (*Package) AgentVersion ¶
AgentVersion returns a string containing version number and the pre only, e.g. `0.0.0-beta.1`