I am trying to get the number of builds in the Jenkins Build Queue.
May I know the Jenkins command to get the number of builds running in the queue ?
That's easy to do with Jenkins Script Console:
println Hudson.instance.queue.items.length
// => 2
Also that's possible to execute groovy script remotely. For example, from command line:
$ curl -u username:password -d "script=println Hudson.instance.queue.items.length" jenkins_url/scriptText
2
Note: user with specified username should have access to Jenkins Script Console.