2021-09-29

Azure VM agent is missing or not responding

I realized that one of my virtual machines is not correctly added to Microsoft Azure Automation Account Update Management. There was some problem with former membership to different WorkspaceId which prevented Portal wizard to add that machine update list. What to do? 

First the original error message

Error message in Updates(loganalytics) | Virtual machines
VM agent is missing or not responding. 

In this case, I knew what is the source of the problem since the original connected LogAnalytics object was deleted without unregistering the MicrosoftMonitoringAgent used on the virtual machine.

Second step check what configuration you have in your target VM 

az vm show --name <VMname> -g <ResourceGroupName> --query resources[].settings

Let's be more exast about value we are looing. Here you can extract path of Log Analytics Id

az vm show --name <VMname> -g <ResourceGroupName> --query resources[].settings.workspaceId

There I was able to see Id which was not correct. Do a cross-check with some properly configured Virtual machine to find the right value. 

Thirds step: We are going to replace that Id with a new one. VM is still operational during the action.
I realized that replacing the value removed the whole section resources from VM configuration which was not working anyway.

az vm update --name <VMname> -g <ResourceGroupName> --set resources[0].settings.workspaceId='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

Result check:
az vm show --name <VMname> -g <ResourceGroupName>

Forth step: Navigate in Azure Portal to Solution object which is called Updates(<Log Analytics Workspace Name>) click in the right column on the option Workspace Data Sources => Virtual machines, click on affected VM, and click to "Connect". All troubles should be resolved by that.

Result check:
az vm show --name <VMname> -g <ResourceGroupName> --query resources[].settings

You might also experience the error message "Agent has a problem" which I have still under investigation, but a general solution might require a reboot or even deallocation of the server. TBC...

Workaround to keep data collection working even when there is a problem with Agent: Install "desktop" software tool for Windows called Microsof Monitoring Agent (MMA) and link it with keys to LogAnalytics. Available also for linux.

Žádné komentáře :

Okomentovat

Dotaz, připomínka, oprava?
(pokud máte problém s vložením příspěvku, vyzkoušejte to v prohlížeči Chrome)