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

<p><code>https://www.myjenkins.com/computer/api/json</code></p>

<p><a href="https://i.sstatic.net/wf6Cg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wf6Cg.png" alt="Json Sample"></a></p>

CC BY-SA 3.0
2018-02-27T19:19:27.537Z
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
CC BY-SA 3.0
2018-02-27T17:52:59.913Z
2018-02-27T17:52:59.913Z
gmsantos
<p>Is there an easy way to get a count of how many agents are currently up? I know I can go to <code>www.myjenkins.com/computer/</code> to see the agents, but counting them manually is tedious. </p>

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

<jenkins>
Count of currently active jenkins agents
Alex
# Count of currently active jenkins agents

(Asked by: username_0 on 2018-02-27)

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?

**Tags:** jenkins


---

## 1 answers

### Answer by username_1 on 2018-02-27. Score: 3 | Accepted answer

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](https://i.sstatic.net/wf6Cg.png)](https://i.sstatic.net/wf6Cg.png)

> **Comments:**
> **username_0**: 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.  

---

