How to list the managed masters and the resources assissiated with it

Issue

  • I would like to list all the managed masters and the resources assissiated with it.

Environment

Resolution

You will need to run a groovy script on the Operations Center. Open CloudBees Core Cloud Operations Center, and continue to Manage Jenkins. Select Script Console. Run the following groovy script.

/**
 * List Managed Masters and its Resources
 */

def mms = Jenkins.instance.getAllItems(com.cloudbees.opscenter.server.model.ManagedMaster)

String outputFormat = "%-56s%-8s%-10s%-14s%-10s%s\n"
String output = String.format(outputFormat, 
    "Managed Master Full Display Name", "Id", "Cpus", "Memory[MB]", "Ratio", "Disk [GB]")
println(output)

mms.each {
  it.getPersistedState().resource.each { p -> 
    output = String.format(outputFormat, 
        it.getFullDisplayName(), it.id, p.getCpus(), p.getMemory(), p.getRatio(), p.getDisk())
    print(output)
  }
}
null
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.