Monitor Azure Arc-enabled Server Availability

SujinaSJ-1789 271 Reputation points
2024-07-03T10:25:28.4233333+00:00

Is there a way to monitor Arc-enabled Server availability using Azure Monitor? There is no metric alert available for arc servers. We tried using resource health alert but it is not triggered when the servers are stopped manually. Tried KQL based on Heartbeat but ratherthan VM availability its the AMA agent availability which gives false alerts when VM is in running state and moreover its autoresolved after the granularity period . Is there any other approach we could try for Arc enabled servers which will cover all scenarios like VM stopped from VM, portal, any health issues etc. TYIA

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,971 questions
Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
371 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ganeshkumar R 515 Reputation points
    2024-07-03T10:33:16.1333333+00:00

    Use Azure Resource Graph Explorer

    Azure Resource Graph can be used to query the state of your resources, including Arc-enabled servers. You can create a query to check the status of your VMs and create alerts based on these queries.

    Example Query

    resources
    | where type == "microsoft.hybridcompute/machines"
    | project name, status = properties.status.displayStatus
    | where status != "Running"
    

    You can set up an alert rule based on this query to notify you when the status of any Arc-enabled server is not "Running." Or else

    Use Custom Script for Monitoring.

    In scenarios where built-in monitoring tools fall short, you can deploy custom scripts to your Arc-enabled servers to periodically check their status and report back to Azure Monitor.

    Example Script

    Create a custom script that checks the VM status and logs it to Log Analytics or sends it to an Azure Function for further processing.

    #!/bin/bash
    # Check if the VM is running
    if systemctl is-active --quiet my-vm-service; then
        echo "VM is running"
    else
        echo "VM is stopped"
    fi
    

    Deploy this script using a cron job or a similar scheduling tool, and configure it to send logs to Azure Monitor.


0 additional answers

Sort by: Most helpful