Created
November 26, 2018 16:52
-
-
Save thcipriani/4a40d93337222f16e4e1dae1329f0487 to your computer and use it in GitHub Desktop.
Quick groovy script to check disk-space on a subset of integration machines via the script console.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.util.RemotingDiagnostics | |
def groovyScript = 'println "df -h /srv".execute().text' | |
def computerNamePrefix = 'integration-slave-' | |
for (slave in hudson.model.Hudson.instance.slaves) { | |
def computer = slave.computer | |
def computerName = computer.getName() | |
// Only check nodes that are named like integration-agents | |
if (!computerName.startsWith(computerNamePrefix)) { | |
continue | |
} | |
println "Checking ${computerName}..." | |
if (computer.isOffline()) { | |
println "${computerName} Offline..." | |
continue | |
} | |
println RemotingDiagnostics.executeGroovy( | |
groovyScript, | |
computer.getChannel() | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment