How to list the managed controllers and its resources

Article ID:360028137611
1 minute readKnowledge base

Issue

  • I want to list all the managed controllers and the resources associated 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 controllers 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 controller 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
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.