<p>As for workaround, the actual memory can be checked by invoking Groovy commands directly in <em>Script Console</em> (at <code>/computer/(master)/script</code>). Example command:</p>

<pre><code>println "free -m".execute().text
</code></pre>

CC BY-SA 3.0
2017-11-20T08:44:55.770Z
I am not sure if awk scripts can be executed via Jenkins script console. As I can see, Jenkins script console is for Groovy only
olyv
CC BY-SA 3.0
2017-03-01T14:12:37.937Z
Alternative command: `awk '/MemFree:/ { print $2}' /proc/meminfo` for kB free of ram only or alternative for Memory and Swap: `awk '/(Mem|Swap)Free:/ { print }' /proc/meminfo`
Tensibai
CC BY-SA 3.0
2017-03-01T14:08:25.377Z
2017-03-01T14:08:25.377Z
kenorb
<p>Have a look at the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Monitoring" rel="noreferrer">Monitoring</a> plugin. Here are some more details about it (from the linked page):</p>

<blockquote>
  <ul>
  <li>Charts of memory, cpu, system load average, http response times by day, week, month, year or custom period</li>
  <li>Statistics of http requests with mean response times, mean cpu times, mean response size by request and by day, week, month, year or custom period</li>
  <li>Errors and logs</li>
  <li>Current http requests</li>
  <li>Threads</li>
  <li>Heap histogram (instances and sizes by class)</li>
  <li>Http sessions</li>
  <li>Process list of OS</li>
  <li>MBeans</li>
  <li>Actions for GC, heap dump and invalidate session(s)</li>
  <li>Report in html or pdf</li>
  <li>In English, German, French, Portuguese or Chinese</li>
  <li>Jenkins security</li>
  <li>For Jenkins nodes (slaves in general):
  
  <ul>
  <li>The report for the nodes is available at <code>http://yourhost/monitoring/nodes</code></li>
  <li>Charts aggregated for all nodes of memory, cpu, system load average, number of running builds, build queue length, build times by period</li>
  <li>Detailed statistics of the build times and of the build steps by period</li>
  <li>Threads, process list and MBeans for each nodes</li>
  <li>Heap histogram aggregated for all nodes</li>
  </ul></li>
  <li>For each individual node (each node in <code>http://yourhost/computer</code>), reports and actions are available from the "Monitoring" page in the contextual menu or in the detail of the node:
  
  <ul>
  <li>Threads, process list, MBeans of that node only</li>
  <li>Heap histogram of that node</li>
  <li>Actions for GC, heap dump</li>
  </ul></li>
  <li>And more...</li>
  </ul>
</blockquote>

<p>Credits: <a href="https://devops.stackexchange.com/users/2/assaf-lavie">Assaf Lavie</a> (who first mentioned it in a comment, but for some reason didn't post that as an actual answer ...).</p>

CC BY-SA 3.0
2017-03-05T08:18:53.920Z
2017-03-05T08:18:53.920Z
2017-04-13T13:01:29.297Z
Pierre.Vriens
<p>In Jenkins when clicking on <em>Build Executor Status</em> I can only see free disk space related statistics (URI: <code>/computer</code>). How I can monitor free system memory (RAM) in Jenkins?</p>

<p>I'm asking, because sometimes when I had too many executors (despite having swap space configured, but not the one below), Jenkins was freezing or crashing a lot.</p>

<p><a href="https://i.sstatic.net/OcgtS.png" rel="noreferrer"><img src="https://i.sstatic.net/OcgtS.png" alt="Jenkins at /computer - Name, Architecture, Clock Difference, Free Disk Space, Free Swap Space, Free Temp Space, Response Time"></a></p>

CC BY-SA 3.0
2017-10-11T22:59:19.940Z
Side note: heavy swapping will bring even the most powerful servers to a crawl, slowing down all processes, including the Jenkins executors and local monitoring solutions. To make matters worse: the memory garbage collectors will also run slow, further feeding the condition. For decent performance I'd advice keeping the swap size small-ish, relying primarily on the actual RAM size when sharing the same server for multiple executors and avoiding heavy over-subscription.
Dan Cornilescu
CC BY-SA 3.0
2017-03-01T14:18:58.150Z
You may find the monitoring plugin helpful: https://wiki.jenkins-ci.org/display/JENKINS/Monitoring
Assaf Lavie
<jenkins><jenkins-plugins><monitoring>
How to check Jenkins build executor free memory?
kenorb
# How to check Jenkins build executor free memory?

(Asked by: username_0 on 2017-03-01)

In Jenkins when clicking on *Build Executor Status* I can only see free disk space related statistics (URI: `/computer`). How I can monitor free system memory (RAM) in Jenkins?

I'm asking, because sometimes when I had too many executors (despite having swap space configured, but not the one below), Jenkins was freezing or crashing a lot.

[![Jenkins at /computer - Name, Architecture, Clock Difference, Free Disk Space, Free Swap Space, Free Temp Space, Response Time](https://i.sstatic.net/OcgtS.png)](https://i.sstatic.net/OcgtS.png)

**Tags:** jenkins, jenkins-plugins, monitoring

> **Comments:**
> **username_2**: You may find the monitoring plugin helpful: https://wiki.jenkins-ci.org/display/JENKINS/Monitoring  
> **username_1**: Side note: heavy swapping will bring even the most powerful servers to a crawl, slowing down all processes, including the Jenkins executors and local monitoring solutions. To make matters worse: the memory garbage collectors will also run slow, further feeding the condition. For decent performance I'd advice keeping the swap size small-ish, relying primarily on the actual RAM size when sharing the same server for multiple executors and avoiding heavy over-subscription.  

---

## 2 answers

### Answer by username_5 on 2017-03-05. Score: 10 | Accepted answer

Have a look at the [Monitoring](https://wiki.jenkins-ci.org/display/JENKINS/Monitoring) plugin. Here are some more details about it (from the linked page):

> * Charts of memory, cpu, system load average, http response times by day, week, month, year or custom period
> * Statistics of http requests with mean response times, mean cpu times, mean response size by request and by day, week, month, year or custom period
> * Errors and logs
> * Current http requests
> * Threads
> * Heap histogram (instances and sizes by class)
> * Http sessions
> * Process list of OS
> * MBeans
> * Actions for GC, heap dump and invalidate session(s)
> * Report in html or pdf
> * In English, German, French, Portuguese or Chinese
> * Jenkins security
> * For Jenkins nodes (slaves in general):
>   + The report for the nodes is available at `http://yourhost/monitoring/nodes`
>   + Charts aggregated for all nodes of memory, cpu, system load average, number of running builds, build queue length, build times by period
>   + Detailed statistics of the build times and of the build steps by period
>   + Threads, process list and MBeans for each nodes
>   + Heap histogram aggregated for all nodes
> * For each individual node (each node in `http://yourhost/computer`), reports and actions are available from the "Monitoring" page in the contextual menu or in the detail of the node:
>   + Threads, process list, MBeans of that node only
>   + Heap histogram of that node
>   + Actions for GC, heap dump
> * And more...

Credits: [username_2](https://devops.stackexchange.com/users/2/assaf-lavie) (who first mentioned it in a comment, but for some reason didn't post that as an actual answer ...).


---

### Answer by username_0 on 2017-03-01. Score: 5

As for workaround, the actual memory can be checked by invoking Groovy commands directly in Script Console (at /computer/(master)/script). Example command:
println "free -m".execute().text

> **Comments:**
> **username_4**: Alternative command: `awk '/MemFree:/ { print $2}' /proc/meminfo` for kB free of ram only or alternative for Memory and Swap: `awk '/(Mem|Swap)Free:/ { print }' /proc/meminfo`  
> **username_3**: I am not sure if awk scripts can be executed via Jenkins script console. As I can see, Jenkins script console is for Groovy only  

---

