jmxtrans / jmxtrans-agent

Java Agent based JMX metrics exporter.
MIT License
178 stars 110 forks source link

Typo in XML configuration results in lots of log noise #106

Closed bodgit closed 2 years ago

bodgit commented 7 years ago

I added jmxtrans-agent to a Java process (a Confluence install) and I had as part of the configuration the following small typo in the configuration:

<jmxtrans-agent>
  <queries>
    <!-- 8< snip 8< -->
    <query objectname="java.nio:type=BufferPool,name=*" attribute="TotalCapacity" resultAlias="jvm.buffers.%name%.capacity"/>
  </queries>
  <!-- 8< snip 8< -->
</jmxtrans-agent>

i.e. I had objectname instead of objectName. This resulted in lots of log noise like the following:

2017-06-08 10:05:36.505 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.Query - Failed to fetch attribute for 'Standalone:j2eeType=Servlet,WebModule=//localhost/,name=status-servlet,J2EEApplication=none,J2EEServer=none'#TotalCapacity, exception:  Cannot find attribute TotalCapacity for StandardEngine[Standalone].StandardHost[localhost].StandardContext[].StandardWrapper[status-servlet]
2017-06-08 10:05:36.505 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.Query - Failed to fetch attribute for 'Standalone:type=MBeanFactory'#TotalCapacity, exception:  Cannot find attribute TotalCapacity for org.apache.catalina.mbeans.MBeanFactory@516ed85c
2017-06-08 10:05:36.505 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.Query - Failed to fetch attribute for 'Confluence:name=MailTaskQueue'#TotalCapacity, exception: getAttribute failed: ModelMBeanAttributeInfo not found for TotalCapacity
2017-06-08 10:05:36.505 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.Query - Failed to fetch attribute for 'Standalone:j2eeType=Servlet,WebModule=//localhost/,name=default,J2EEApplication=none,J2EEServer=none'#TotalCapacity, exception:  Cannot find attribute TotalCapacity for StandardEngine[Standalone].StandardHost[localhost].StandardContext[].StandardWrapper[default]

As it tries to find the TotalCapacity attribute for every bean. This gets repeated every collectIntervalInSeconds and rapidly fills the logs up.

Is there a need where the objectName attribute is ever optional? Or is it possible to have some XML validation performed on the configuration file so any unknown attributes cause an error/exception?