14

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

2
  • 5
    You may find the monitoring plugin helpful: wiki.jenkins-ci.org/display/JENKINS/Monitoring Commented Mar 1, 2017 at 14:18
  • 2
    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. Commented Oct 11, 2017 at 22:59

2 Answers 2

10

Have a look at the 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: Assaf Lavie (who first mentioned it in a comment, but for some reason didn't post that as an actual answer ...).

0
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 
2
  • 2
    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 Commented Mar 1, 2017 at 14:12
  • 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 Commented Nov 20, 2017 at 8:44

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.