You can check the status of any private build agent configured under agent pools in Azure DevOps.
But if you want to monitor it using Azure Automation then you can create a PowerShell Runbook and use the WebRequest explained here to setup scheduled monitoring and alerting (via email).
>>First you have to get the Pool details under which the build agent is registered/configured. Run the below request to get the results
It will show output as shown
>> Now using this Pool Id we will find all the build agent Ids registered under this Pool. Run the request
The results will be
Now ‘id’ value is agentid. You can see the status value is also shown here. But we will run request specifically for the AgentId to get the details.
>> Now using the AgentId you can get the status of the agent. Run the below request
This way you can get the status of the build agent which can be monitored by scheduling a PowerShell Runbook using Azure Automation.
The PowerShell script will look like