How do I monitor Docker Swarm applications on Azure Container Services?

Microsft Azure Container Services (ACS) is a distributed platform for building and hosting microservices. Azure Container Services enables you to use Docker Swarm as a container orchestration engine. This topic will walk you through getting your Docker Swarm cluster on ACS monitored by Dynatrace OneAgent.

Docker Swarm clusters on ACS use Virtual Machine Scale Sets (VMSS) in Microsoft Azure to provide scalability. The Dynatrace OneAgent Azure VM extension must be installed to the VMSS via PowerShell commandlets, Azure CLI, or an ARM template.

Requirements

Get your Dynatrace environment ID and PaaS token

You need to get your Dynatrace environment ID as well as a PaaS token.

  1. Login with your Dynatrace account.

  2. Select Deploy Dynatrace from the navigation menu.

  3. Click the Set up PaaS integration button.

  4. Your environment ID appears in the Environment ID text box. You'll need this ID to link your Dynatrace account with your PaaS environment. Click Copy to copy the ID to the clipboard. You can do this at any time by revisiting this page.

  5. To generate a PaaS token, click the Generate new token button. The PaaS token is essentially an API token that's used in combination with your environment ID to download Dynatrace OneAgent. As you'll see, there's also a default InstallerDownload token available that you can alternatively use. However, for security reasons, it's recommended that you create several discrete tokens for each environment you have.

  6. Type in a meaningful name for your PaaS token. A meaningful token name might be the name of the PaaS platform you want to monitor (for example, azure, cloud-foundry, or openshift). To view and manage your existing PaaS tokens, go to Settings -> Integration -> Platform as a Service.

  7. Click Generate to create the PaaS token. The newly created PaaS token will appear in the list below. Click Copy to copy the generated token to the clipboard. You can do this at any time by revisiting this page and clicking Show token next to the relevant PaaS token.

Install Dynatrace OneAgent VM extension via Azure CLI 2.0

Replace all values marked with <...> with your actual values.

Login to your Azure account. If you're using Azure Cloud Shell, you can skip this step.

az login

Add the VM extension to the VM scale sets.

Please note that the settings are submitted in JSON format, which requires proper escaping as the command is submitted as a string.

az vmss extension set
  -n oneAgentLinux
  --publisher dynatrace.ruxit
  -g "<resource group name>"
  --vmss-name "<VMSS name>"
  --settings "{\"tenantId\":\"<your environment ID>\",\"token\":\"<PaaS token>\"}"

If you're using Dynatrace Managed, be sure to add your Dynatrace Server address to the settings JSON. This needs to be set to https://<YourDynatraceServerURL>/e/<environmentID>/api.

--settings "{\"server\":\"<Dynatrace Server URL>\",\"tenantId\":\"<your environment ID>\",\"token\":\"<PaaS token>\"}"

Install Dynatrace OneAgent VM extension via PowerShell

Replace all values marked with <...> with your actual values.

Open a PowerShell window and sign in to your Microsoft Azure account.

Login-AzureRmAccount

Get the definition of the VMSS.

$vmss = Get-AzureRmVmss -ResourceGroupName "<resource group name>" -VMScaleSetName "<VMSS name>"

Add the Dynatrace OneAgent Azure VM extension to the VMSS definition.

Add-AzureRmVmssExtension
  -Name oneAgentLinux
  -Publisher dynatrace.ruxit
  -Type oneAgentWindows
  -TypeHandlerVersion 1.99
  -AutoUpgradeMinorVersion $true
  -Setting @{ "tenantId"="<your environment ID>"; "token"="<PaaS token>" }
  -VirtualMachineScaleSet $vmss

If you're running a Dynatrace Managed on-premises deployment, be sure to add your Dynatrace Server address to the settings JSON. This needs to be set to https://<YourDynatraceServerURL>/e/<environmentID>/api.

-Setting @{ "server"="<Dynatrace Server URL>"; "tenantId"="<your environment ID>"; "token"="<PaaS token>" }

Update the VMSS in Azure.

Update-AzureRmVmss
  -ResourceGroupName "<resource group name>"
  -VirtualMachineScaleSet $vmss
  -Name "<VMSS name>"

Grab a coffee

It takes a few minutes until the extension is deployed to all nodes of the cluster, but it should't take more than 10 minutes for a five-node cluster. Please watch the Dynatrace Host overview for new hosts to appear, as Azure Portal may not notify you that the deployment process has successfully completed.

Troubleshooting

If the VMSS nodes don't show up in the Dynatrace UI, restart all VMSS nodes.

Restart-AzureRmVmss -ResourceGroupName "<resource group name>" -VMScaleSetName "<VMSS name>"

Note:
Don't forget to restart your services to enable deep monitoring.