问题
Is there a way to find it programatically? I need this as part of an automated run; So this would be very helpful if there is an existing remote API call which can give this.
回答1:
You don't need to parse the HTML - most of the Hudson pages can be turned into API calls by adding URL suffix, e.g.
Make GET calls to:
http://hudson:8080/computer/api/json
switch the json for xml or python if you prefer over json
if you use just the api suffix, you'll get a short generic help page on the api
回答2:
Groovy script to get all computers:
def jenkins = Jenkins.instance
def computers = jenkins.computers
computers.each{
println "${it.displayName} ${it.hostName}"
}
回答3:
Look at http://hudson:8080/computer/
来源:https://stackoverflow.com/questions/3202270/list-of-slaves-connected-to-master-hudson