Monitor Artifactory outbound connectionpools via JMX

tags: artifactory jmx groovy

Written on January 6, 2018

If you like to find out how many connections your Artifactory is using for dealing with its configured remote repositories, there is no obvious way to do that. Instead there’s a simple way to monitor the leased, pending, available and max connections via Artifactory’s built-in JMX-beans.

Software and versions:

name version download
Artifactory OSS 5.8.1
Groovy 2.4.12

Given an Artifactory instance with following configured remote repositories:

All you have to do is to configure the JAVA_OPTIONS for Artifactory ($ARTIFACTORY_HOME/bin/artifactory.default) with jmxremote options, e.g.:


In production I would recommend to use ssl with authentication ;-)

Then you can connect with your favourite JMX-Client:

This is nice, if you want to manually check this current situation. But if you need to continuously monitor the connections, you need a script:


def repoKeys = [

def connectionPoolDetailsPerRepo = [:]

String jmxServerUrl = 'service:jmx:rmi:///jndi/rmi://localhost:22222/jmxrmi'
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl)
MBeanServerConnection mBeanServerConnection = jmxConnector.getMBeanServerConnection()

repoKeys.each { repo ->
    String beanName = "org.jfrog.artifactory:instance=Artifactory, type=HTTPConnectionPool,prop=${repo}"
    try {
        def mbean = new GroovyMBean(server, beanName)
        def connectionPoolDetails = [:]
        connectionPoolDetails['Pending'] = mbean.getProperty("Pending")
        connectionPoolDetails['Leased'] = mbean.getProperty("Leased")
        connectionPoolDetails['Max'] = mbean.getProperty("Max")
        connectionPoolDetails['Available'] = mbean.getProperty("Available")
        connectionPoolDetailsPerRepo[repo] = connectionPoolDetails
    catch (IOException e) {
        println "Unable to connect to JVM"
    catch (InstanceNotFoundException e) {
        println "WARN: ${repo}: InstanceNotFoundException: ${e.message}"


println 'connection pool details per repo:'
connectionPoolDetailsPerRepo.each { repoKey, connectionDetails ->
    println "* ${repoKey}: ${connectionDetails}"

By executing the above script, the JMX beans for the given list of remote repositories are requested:

$ groovy artifactory-jmx.groovy
connection pool details per repo:
* repo1: [Pending:0, Leased:0, Max:50, Available:0]
* jcenter: [Pending:0, Leased:0, Max:50, Available:0]