使用jolokia监视Spring启动CLI应用程序的JMX端点

时间:2014-11-13 11:22:52

标签: spring-boot jmx jolokia

我有一个CLI微服务,它有暴露的端点

@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>

日志

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

我的应用程序运行良好,但我想使用jolokia通过HTTP获取这些数据点,或者将这些数据点提供给我的运营合作伙伴,而无需在浏览器上使用jcosole或jvisual vm,就像我们可以为web spring boot项目做的那样。 任何人都可以引导我到任何链接或教程来实现相同的

0 个答案:

没有答案