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.
List of Slaves connected to master - Hudson
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.
1 Was looking for something like that. But under terms like "jenkins environmental variables" but with no luck. –
Cyanogen
Groovy script to get all computers:
def jenkins = Jenkins.instance
def computers = jenkins.computers
computers.each{
println "${it.displayName} ${it.hostName}"
}
looks nice! but where to get info what is "Jenkins" and why there is "instance"? Isn't it possible to write just:
Jenkins.instance.computers.each{println "${it.displayName} ${it.hostName}"}
? –
Preempt yes, you can write that. it's a matter of taste / coding style. –
Cohin
Look at http://hudson:8080/computer/
Thanks. I saw that. I can parse it and get it as part of my automated run. But wanted to know if there is more specific API for this. –
Abeyta
@Aviator: Look at openjey's answer. I kept this open in a browser windows because I seemed to remember that there is an API, but never got around digging for that info. Now openjey has answered that. –
Kresic
Where is the link in the UI to this? How was I suppose to know this –
Goiter
© 2022 - 2024 — McMap. All rights reserved.
+1
! I thought there was something like this, but never got around searching for it. – Kresic