3

Is there an easy way to get a count of how many agents are currently up? I know I can go to www.myjenkins.com/computer/ to see the agents, but counting them manually is tedious.

Is there an API call or something I can run in the script console that just outputs the count for me?

1 Answer 1

3

You can sufix computer/ with api/json and run some script on this response. Count the computers array or group by some one of his attributes, like idle or offline.

https://www.myjenkins.com/computer/api/json

Json Sample

1
  • 1
    To add to your (correct) answer, it turns out it's easy enough to either isolate by totalExecutors and do the math yourself (ie, divide by how many executors per agent), or grep the api results for the displayName of your agents and count that result.
    – Alex
    Commented Feb 27, 2018 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.