Thursday 31 August 2017

How do I monitor Azure Service Fabric applications?

Microsft Azure Service Fabric is a distributed platform for building and hosting microservices. Service Fabric provides features like high availability, load-balancing, scaling, simple programming models, application lifecycle management, and more. Service Fabric clusters can be created in various environment types, including Azure and on-premises installations. The services can be built with different languages and frameworks, and can use any communication protocol.
Azure Service Fabric clusters use virtual machine scale sets (VMSS) in Microsoft Azure to provide scalability. The Dynatrace OneAgent Azure VM extension (which is currently in a beta release phase) must be installed to the VMSS via PowerShell.

Requirements

Get your Dynatrace environment ID and PaaS token

You need also to get your Dynatrace environment ID and 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.
  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, azurecloud-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.
For Windows based Service Fabric clusters, execute the following command. 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 oneAgentWindows
  --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 the server's address to the settings JSON. The value is the address only, without https:// and without any subpaths.
--settings "{\"server\":\"<Dynatrace Managed URL>\",\"tenantId\":\"<your environment ID>\",\"token\":\"<PaaS token>\"}"
For Linux-based Service Fabric clusters, replace oneAgentWindows with oneAgentLinux. Please note that Linux-based Service-Fabric cluster monitoring is currently available as a preview only—it is not currently recommended for use in production environments.

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 oneAgentWindows
  -Publisher dynatrace.ruxit
  -Type oneAgentWindows
  -TypeHandlerVersion 1.99
  -AutoUpgradeMinorVersion $true
  -Setting @{ "tenantId"="<your environment ID>"; "token"="<PaaS token>" }
  -VirtualMachineScaleSet $vmss
In case you are using Dynatrace Managed, please make sure to add the server's address to the settings JSON. The according value is the address only, without https:// and without any subpaths.
-Setting @{ "server"="<Dynatrace Managed URL>"; "tenantId"="<your environment ID>"; "token"="<PaaS token>" }
Update the VMSS in Azure.
Update-AzureRmVmss
  -ResourceGroupName "<resource group name>"
  -VirtualMachineScaleSet $vmss
  -Name "<VMSS name>"

Install Dynatrace OneAgent VM extension via ARM template

The following sample snippet shows how to add the Dynatrace OneAgent VM extension to your VM Scale Set ARM templates. Empty tags are shown for a better overview of the full ARM template, but left empty for brevity.
{
  "type": "Microsoft.Compute/virtualMachineScaleSets",
  "sku": {},
  "name": "[parameters('virtualMachineScaleSet_name')]",
  "apiVersion": "2016-04-30-preview",
  "location": "centralus",
  "tags": {},
  "properties": {
    "upgradePolicy": {},
    "virtualMachineProfile": {
      "osProfile": {},
      "storageProfile": {},
      "networkProfile": {},
      "extensionProfile": {
        "extensions": [
          {
            "properties": {
              "publisher": "dynatrace.ruxit",
              "type": "oneAgentLinux",
              "typeHandlerVersion": "1.99",
              "autoUpgradeMinorVersion": true,
              "settings": {
                "tenantId": "<your environment ID>",
                "token": "<PaaS token>"
              }
            },
            "name": "oneAgentLinux"
          }
        ]
      }
    }
  }
}
In case you are using Dynatrace Managed, please make sure to add the server's address to the settings JSON. The according value is the address only, without https:// and without any subpaths.
"settings": {
  "tenantId": "<your environment ID>",
  "token": "<PaaS token>",
  "server": "<Dynatrace Managed URL>"
}

Enable service monitoring for your processes

The services you deploy to Azure Service Fabric will be named in a way that's unique to your project.
To make sure that deep monitoring is enabled, including code-level visibility, please check the settings on monitored technologies. 
Scroll through the list of process groups and make sure that service monitoring is enabled for all our services deployed to Service Fabric. Typically, the naming scheme is similar to ProjectName.ServiceName.exe.
You'll also find several services that are actually Service Fabric internal services. These include FabricDCA.exeFabricFAS.exeFabricUS.exeServiceFabricNodeBootstrapAgent.exe, and many others. You can leave service monitoring disabled for these services as deep monitoring support isn't provided for them.
To enable deep monitoring, please restart all the services you enabled for monitoring.

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:
OneAgent deployment to on-premise Service Fabric clusters only requires you to install OneAgent on the underlying host. Any Service Fabric entities will then be detected automatically. Please follow the guidelines detailed above to enable service monitoring for your processes. Don't forget to restart your services to enable deep monitoring.

No comments:

Post a Comment