How to use Probe Command on a Node?


I want to prevent my node to be allocated if Disk Usage is over 80%


  • CloudBees Jenkins Enterprise
  • CloudBees Jenkins Operations Center


First, Node Monitoring can be configured at Manage Jenkins/Manage Nodes/Configure. The default Free Space Threshold is set to 1GB which means that nodes are not allocated if the amount of Free Space is under 1GB. This is a setup for all agents.

A way to monitor a specific thread is to use the Nodes Plus Plugin. A probe command can be specified to decide whether or not a node is able to accept tasks. If the command returns an exit code other than 0, the agent cannot accept tasks. The best way to use this feature is to create a script on the agent machine and launch it as a probe command.


I want to prevent my unix node from being allocated if the Disk Usage is over 80%.

The following command gives me the file system usage on the machine:

my-agent:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/disk1      233G  138G   96G  60% /

My $AGENT_HOME is located on /dev/disk1 so I can workout a command like the following to grab the usage value (Use% is the fifth value in the line) of this disk:

my-agent:~$ df -h | grep /dev/disk1 | awk '{print $5}' | sed 's/%//g'

I can then create a located under $AGENT_HOME to exit with error code -1 when my disk usage is over 80%:

CURRENT=$(df -h | grep /dev/disk1 | awk '{print $5}' | sed 's/%//g')

if [ $CURRENT -gt $THRESHOLD ]; then
    exit -1

I configure my node with the probe as following:


Have more questions?


  • 0
    mark.kenneally Kenneally

    When I tried this it did not just stop the affected node from taking on new jobs, it stopped other nodes from taking on jobs too.

Please sign in to leave a comment.