azure-devopsbuild-agentazure-devops-self-hosted-agent

How to monitor VSTS agent availability


We have multiple on-site build agents attached to our VSTS instance, and would like to implement monitor their availability. That is, not just that their services are running, but also that they can connect to VSTS, since we have had some issues with the proxy previously.

I have checked the VSTS API documentation, but I couldn't find a call that would return whether a particular agent is online. Basically what I would need to do is integrate the green/red indicator that's available in VSTS when you go to the agent pool management page. I don't want to do web scraping, and I know I could check the agent log (and that's what I have in mind as last resort), but it would be good to have a prettier solution.

Does anyone have any ideas? Is there an API I missed? Or can you talk to the agent directly and ask it whether it is currently connected to VSTS?


Solution

  • You can use this api to get the status of agent:

    https://XXX.visualstudio.com/_apis/distributedtask/pools/[pool id]/agents
    

    A related thread: TFS 2015 api remove agent from pool with powershell