One SAP support prerequisite for running SAP on Azure, is that you must have Azure Enhanced Monitoring for Linux installed onto the Azure Linux VMs where your SAP application runs (including DB servers). Details are in SAP note 2015553.
In this brief post I show how to check if it is already installed, then how to install it, without needing to install the Powershell Azure Cmdlets.
What is Azure Enhanced Monitoring for Linux?
Azure Enhanced Monitoring for Linux (AEM) is an Azure VM extension installed onto the target Linux VM. The extension uses the Azure Instance Agent to pull additional telemetry information down onto the local VM, and places it into a file on the Linux file system called /var/lib/AzureEnhancedMonitor/PerfCounters .
This special file is pure ASCII text with data inside that is semi-colon separated. You can use Linux command line utilities to query information from the file (it’s readable by any user).
The file is parsed by the SAP Host Agent (also installed on every SAP VM) and made available in the monitoring memory segment used by the Netweaver ABAP stack, with the data being visible in transaction ST06 (OS06).
How to Check if AEM Is Installed
There are a number of ways to check if Azure Enhanced Monitoring for Linux is installed on a VM:
Inside the VM in Linux we can check for the existence of file: “/var/lib/AzureEnhancedMonitor/PerfCounters” Inside the VM in Linux we can check the extension home dir exists: “/var/lib/waagent/Microsoft.OSTCExtensions.AzureEnhancedMonitorForLinux-*” In the Azure Portal, we can check the status of the extension in the Azure Portal:
In the Azure Cloud Shell, we can either Test or Get the AEM Extension to see if it is installed:
Get-AzVMAEMExtension -ResourceGroupName <RG-NAME> -VMName <VM-Name>
Test-AzVMAEMExtension -ResourceGroupName <RG-NAME> -VMName <VM-Name>
Installing AEM
There are two ways to install the Azure Enhanced Monitoring for Linux extension into a VM:
Using local PowerShell (on your computer) with the Azure Cmdlets installed. You will need to have the rights on the local machine to perform the install of the Azure Cmdlets. I will not cover this method as it is quite tedious to setup and the chances are that your PowerShell is locked down by your company and will not allow you to install the required Cmdlets. Using Powershell in the Azure Portal Cloud Shell. This has all the required Cmdlets already installed, but to setup the Cloud Shell you will need rights in Azure to be able to create a Storage Account to use for your shell home location.
Out of the two options, I usually opt for the Cloud Shell. Once you have it setup, you will find you can use it for many other things and access it from anywhere! In this post I will be using Cloud Shell to do the installation.
To install the AEM extension, we use Powershell commands to do the following sequence of tasks:
Obtain our subscription context. Deploy the extension to the specific VM in the subscription.
Let’s start the Cloud Shell (NOTE: You will need a Storage Account for the Cloud Shell to work). Go to the Azure Portal and click the button on the button bar:
Make sure that you are in a PowerShell Shell:
We may need to switch to a specific subscription. We can list all subscriptions by calling Get-AzSubscription and filtering on the Id property:
Get-AzSubscription | Select-Object Id
We can then set the context of our Cloud Shell to the specific subscription Id as follows:
$context = Get-AzSubscription -SubscriptionId '<SubscriptionID>'
Set-AzContext -SubscriptionObject $context
Once the code has executed, we can check if the AEM extension is already installed:
Get-AzVMAEMExtension -ResourceGroupName <RG-NAME> -VMName <VM-Name>
If the AEM extension is already installed, then we will see output being returned from the Get command:
ResourceGroupName : UK-West
VMName : vm01
Name : AzureEnhancedMonitorForLinux
Location : ukwest
Etag : null
Publisher : Microsoft.OSTCExtensions
ExtensionType : AzureEnhancedMonitorForLinux
TypeHandlerVersion : 3.0
Id : /subscriptions/mybigid/resourceGroups/UK-West/providers/Microsoft.Compute/virtualMachines
/vm01/extensions/AzureEnhancedMonitorForLinux
PublicSettings : {
"cfg": [
{
"key": "vmsize",
"value": "Standard_D4s_v3"
},
{
"key": "vm.role",
"value": "IaaS"
},
{
"key": "vm.memory.isovercommitted",
"value": 0
},
{
"key": "vm.cpu.isovercommitted",
"value": 0
},
{
"key": "script.version",
"value": "3.0.0.0"
},
{
"key": "verbose",
"value": "0"
},
{
"key": "href",
"value": "http://aka.ms/sapaem"
},
{
"key": "vm.sla.throughput",
"value": 96
},
{
"key": "vm.sla.iops",
"value": 6400
},
{
"key": "wad.isenabled",
"value": 0
}
]
}
ProtectedSettings :
ProvisioningState : Succeeded
Statuses :
SubStatuses :
AutoUpgradeMinorVersion : True
ForceUpdateTag : 637516905202791108
EnableAutomaticUpgrade :
If the AEM extension is not installed, not output will be seen from the “Get” command. We can then install the AEM extension with the “Set-AzVMAEMExtension” command as follows:
Set-AzVMAEMExtension -ResourceGroupName <RG-NAME> -VMName <VM-Name>
The extension should be installed successfully. If you need to remove it, you can use the “Remove-AzVMAEMExtension” command.
There is a “Test” command that you can call to test the AEM:
Test-AzVMAEMExtension -ResourceGroupName <RG-NAME> -VMName <VM-Name>
Finally, if you want to see the additional command line options, then use the standard “Get-Help” as follows:
Get-Help Set-AzVMAEMExtension -Full
Issues with AEM
There’s one known issue with Azure Enhanced Monitoring for Linux, the number of data disks reported in the PerfCounters file seems to be limited to 9. This means that if you have more than 9 data disks, the performance data may not be visible in the file and therefore not visible in SAP. It’s possible a fix is on the way.
You may also be interested in: