Skip to content

Instantly share code, notes, and snippets.

@andrewmatveychuk
Last active July 17, 2023 18:30
Show Gist options
  • Select an option

  • Save andrewmatveychuk/f9eb8444ea28d405adbc386677258d84 to your computer and use it in GitHub Desktop.

Select an option

Save andrewmatveychuk/f9eb8444ea28d405adbc386677258d84 to your computer and use it in GitHub Desktop.

Revisions

  1. andrewmatveychuk revised this gist Mar 22, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion datadogConfiguration.ps1
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Configuration datadogConfiguration {
    #Download location for Datadog Monitoring agent package
    $datadogAgentPackageLocalPath = "C:\Deploy\datadog-agent-7-latest.amd64.msi"

    Node $AllNodes.NodeName {
    Node localhost {

    #region Datadog Monitoring agent

  2. andrewmatveychuk created this gist Mar 22, 2020.
    50 changes: 50 additions & 0 deletions datadogConfiguration.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    Configuration datadogConfiguration {

    #Importing required DSC resources
    Import-DscResource -ModuleName PSDesiredStateConfiguration
    Import-DscResource -ModuleName xPSDesiredStateConfiguration

    #Getting the configuration parameters for deployment
    $datadogAPIKey = Get-AutomationVariable -Name "datadogAPIKey"
    $datadogSite = Get-AutomationVariable -Name "datadogSite"

    #Download location for Datadog Monitoring agent package
    $datadogAgentPackageLocalPath = "C:\Deploy\datadog-agent-7-latest.amd64.msi"

    Node $AllNodes.NodeName {

    #region Datadog Monitoring agent

    #Download installation file for Datadog Monitoring agent
    xRemoteFile datadogAgentPackage {
    Uri = "https://s3.amazonaws.com/ddagent-windows-stable/datadog-agent-7-latest.amd64.msi"
    DestinationPath = $datadogAgentPackageLocalPath
    }

    #Installing Datadog Monitoring agent on a host
    xPackage datadogAgent {
    Name = "Datadog Agent"
    Ensure = "Present"
    Path = $datadogAgentPackageLocalPath
    Arguments = "APIKEY=" + $datadogAPIKey + " SITE=" + $datadogSite
    ProductId = "6AFE2B52-EB1F-4D0D-8C22-E1003ADA1196"
    DependsOn = "[xRemoteFile]datadogAgentPackage"
    }

    #Verifying that the agent service is running
    xService datadogAgentService {
    Name = "datadogagent"
    Ensure = "Present"
    State = "Running"
    DependsOn = "[xPackage]datadogAgent"
    }

    #Logging the installation in the event log (Microsoft-Windows-Desired State Configuration/Analytic event log)
    Log datadogAgentInstalled {
    Message = "Datadog Monitoring Agent has been successfully installed."
    DependsOn = "[xPackage]datadogAgent"
    }

    #endregion
    }
    }