无法在浏览器中看到 Mbean,但可以在 Jconsole 中看到。

huangapple go评论51阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月9日 00:51:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76434103.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定