Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of Slaves connected to master - Hudson

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.

like image 711
vpram86 Avatar asked Jul 08 '10 09:07

vpram86


3 Answers

Groovy script to get all computers:

def jenkins = Jenkins.instance
def computers = jenkins.computers

computers.each{ 
  println "${it.displayName} ${it.hostName}"
}
like image 97
Tidhar Klein Orbach Avatar answered Oct 04 '22 04:10

Tidhar Klein Orbach


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 either XML or Python if you prefer these over JSON.

If you use just the API suffix, you'll get a short generic help page on the API.

like image 21
jey burrows Avatar answered Oct 04 '22 03:10

jey burrows


Look at http://hudson:8080/computer/

like image 25
sbi Avatar answered Oct 04 '22 03:10

sbi