Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-4583

Java Gateway not generates valid lld macro names during bean discovery

XMLWordPrintable

      The same problem is in this (CLOSED) issue https://support.zabbix.com/browse/ZBX-12705. But we need name of datasource for better readable in item. We found another problems with this “-“ pattern in other JMX path, this little change solved everything. This fix replace problem paterns.
       
      Symptoms:
      V3.4.0-V3.4.4 Java Gateway

      [ root @ tst-monit-001 ~ ] # ./zabbix_get_jmx.sh 'jmx.discovery[beans,"jboss.as:subsystem=datasources,data-source=*,statistics=pool"]' | jq '.data[0].value | fromjson | .data'

      Output:

      [
        {
          "{#JMXDOMAIN}": "jboss.as",
          "{#JMXDATA-SOURCE}": "NAV_DS",
          "{#JMXSUBSYSTEM}": "datasources",
          "{#JMXSTATISTICS}": "pool",
          "{#JMXOBJ}": "jboss.as:subsystem=datasources,data-source=NAV_DS,statistics=pool"
        }

      This is exactly the same problem like in the issue.
       
      V3.4.5+ Java Gateway
      [ root @ tst-monit-001 ~ ] # ./zabbix_get_jmx.sh 'jmx.discovery[beans,"jboss.as:subsystem=datasources,data-source=*,statistics=pool"]' | jq '.data[0].value | fromjson | .data'
      [
        {
          "{#JMXDOMAIN}": “jboss.as",
          "{#JMXSUBSYSTEM}": "datasources",
          "{#JMXSTATISTICS}": "pool",
          "{#JMXOBJ}": "jboss.as:subsystem=datasources,data-source=NAV_DS,statistics=pool"
        },
       
      As you can see there is no possibility to read name of Datasource. I can only use {#JMXOBJ} to name it.
       
      My version is (recompiled 3.4.9)

      *What I change in this file is: ** *JMXItemChecker.java

      274 // This is changed for replace special characters
      275 //String key = property.getKey().toUpperCase();
      276 String key = property.getKey().toUpperCase().replace('-', '_’);
       
      Result:

      [ root @ tst-monit-001 ~ ] # ./zabbix_get_jmx.sh 'jmx.discovery[beans,"jboss.as:subsystem=datasources,data-source=*,statistics=pool"]' | jq '.data[0].value | fromjson | .data'

      Output:

      [
        {
          "{#JMXDOMAIN}": "jboss.as",
          "{#JMXDATA_SOURCE}": "NAV_DS",
          "{#JMXSUBSYSTEM}": "datasources",
          "{#JMXSTATISTICS}": "pool",
          "{#JMXOBJ}": "jboss.as:subsystem=datasources,data-source=NAV_DS,statistics=pool"
        }
      {#JMXDATA_SOURCE} is valid for zabbix macros

       
      I attached screenshoots from zabbix. There is a difference between name of datasource as you can see .

            Unassigned Unassigned
            tomas.hermanek Tomáš Heřmánek
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: