I am working on a automation script to find the %age space left or utilized on a slave node. I did find the function to get the remaining space (http://javadoc.jenkins-ci.org/hudson/node_monitors/DiskSpaceMonitorDescriptor.DiskSpace.html#toHtml%28%29), but couldn't find anything to get the total space or the %age.
Just wanted to know if there is a method in jenkins API that can server my requirement.
I've had the same problem and resolved it using the FilePath class (http://javadoc.jenkins.io/hudson/FilePath.html).
With this example you can iterate on all the slave nodes to get the free space percentage:
You will get something like:
SLAVE_NAME free space percentage: N%
Hope it helps.