英文:
Unable to see Mbean in browser but able to see it in Jconsole
问题
我正在尝试使用JMX导出来通过Mbean导出一些自定义变量。我可以在jconsole中看到Mbean,但这些属性在localhost:port\metrics中不可用。尝试过白名单对象名称、更改规则中的模式,但似乎都不起作用。
不确定bean是否被正确暴露:/
英文:
I trying to use JMX Export to export some custom variables via Mbean. I am able to see the Mbean in jconsole but those attributes are not available in localhost:port\metrics. Tried whitelisting object name, changing patterns in rules but nothing seems to work.
Not sure if bean is exposed properly :/
package com.test;
public interface ApplicationInfoMXBean {
public String getEnv();
}
package com.test;
public class ApplicationInfoImp implements ApplicationInfoMXBean{
@Override
public String getEnv() {
return "XX";
}
Bean declaration:
MBeanServer mbeanServer=ManagementFactory.getPlatformMBeanServer();
ApplicationInfoMXBean appInfoObj=new ApplicationInfoImp();
ObjectName objName=new ObjectName("com.test:type=basic,name=ApplicationInfoImp");
mbeanServer.registerMBean(appInfoObj, objName);
config.yaml
rules:
- pattern: ".*"
答案1
得分: 1
Prometheus JMX exporter不导出MBean字符串属性,因为它们不真正是指标。
英文:
The Prometheus JMX exporter doesn't export MBean String attributes since these aren't really metrics.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论