2

I have a CLI micro service which has exposed endpoints

@Configuration
@EnableAutoConfiguration
@EnableConfigurationProperties
@ComponentScan
public class TestLauncher implements CommandLineRunner {
...
}

pom

<dependencyManagement>
        <dependencies>
                <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator </artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>

<dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
            <version>1.2.2</version>
</dependency>

Logs

o.s.b.a.e.jmx.EndpointMBeanExporter Registering beans for JMX exposure on startup
2014-11-13 16:12:59,067 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'environmentEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=environmentEndpoint]
2014-11-13 16:12:59,123 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'healthEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=healthEndpoint]
2014-11-13 16:12:59,135 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'beansEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=beansEndpoint]
2014-11-13 16:12:59,153 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'infoEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=infoEndpoint]
2014-11-13 16:12:59,161 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'metricsEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=metricsEndpoint]
2014-11-13 16:12:59,169 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'traceEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=traceEndpoint]
2014-11-13 16:12:59,176 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'dumpEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=dumpEndpoint]
2014-11-13 16:12:59,182 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'autoConfigurationAuditEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=autoConfigurationAuditEndpoint]
2014-11-13 16:12:59,195 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'shutdownEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=shutdownEndpoint]
2014-11-13 16:12:59,213 INFO [main] o.s.b.a.e.jmx.EndpointMBeanExporter Located managed bean 'configurationPropertiesReportEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=configurationPropertiesReportEndpoint]
2014-11-13 16:12:59,222 INFO [main] c.t.l.TestLauncher Program Started

application.properties

jolokia.config.debug=true
endpoints.jolokia.enabled=true
endpoints.jolokia.path=jolokia
spring.jmx.enabled=true
endpoints.jmx.enabled=true
management.port=9001
management.address=127.0.0.1

My app is up and working fine but i wanted to fetch these data points over HTTP using jolokia or make these available to my operational partners without the use of jcosole or jvisual vm over a browser like we can do for web spring boot projects. Can any one guide me to any links or tutorial to achieve the same

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Ashish Daga
  • 46
  • 1
  • 3
  • If you want http you need a server I'm afraid else you are limited to use JMX. You could use a JMX to HTTP bridge but you would either way need a HTTP server/servlet container. – M. Deinum Nov 13 '14 at 12:45
  • Hi Deinum , "Jolokia is a JMX-HTTP bridge giving an alternative method of accessing JMX beans" which is supported out of the box by spring-boot [link](http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-jmx.html#production-ready-jolokia) – Ashish Daga Nov 14 '14 at 07:22
  • Yes, but your app doesn't have the web server dependencies. – Dave Syer Nov 14 '14 at 09:32
  • Hi @M.Deinum ,Thanks added the `org.springframework.boot.spring-webmvc spring-boot-starter-web` and the jolokia endpoint works – Ashish Daga Nov 19 '14 at 13:57
  • but the endpoints like health /mappings /metrics /trace etc already exposed as a part of out of the box by boot so if I have several independent CommandLineRunners say A and B , not sure what the UI will distinguish between metrics of A and metrics of B, what i mean is how will it know what process in running .. I hope i make sense ! – Ashish Daga Nov 19 '14 at 14:04

0 Answers0