Ad Widget

Collapse

[JMX agent]: Parameterizing "object name" in item key/name with macros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sivy310
    Junior Member
    • Aug 2013
    • 15

    #1

    [JMX agent]: Parameterizing "object name" in item key/name with macros

    Hey,

    I'm trying to create templates for monitoring tomcat instances using zabbix-java-gateway.

    I'd like to parameterize following parts in name and keys with MACROS:

    Name: connectionCount_{$TP_HTTPS}
    Key: jmx["Catalina:type=ThreadPool,name={$TP_HTTPS}",connec tionCount]

    The problem is that object name in my case includes double quotas inside, like:

    Catalina:type=ThreadPool,name="http-bio-8081"

    When I configured the key manually, as below (by escaping double quotas):

    jmx["Catalina:type=ThreadPool,name=\"http-bio-8081\"",acceptorThreadCount]

    it works fine. But even when I add macro with escaped double quotas:

    {$TP_HTTPS} = \"http-bio-8081\"

    I got error from tomcat:
    Invalid character '"' in value part of property
    and item turns to "Not supported".

    Another issue with this approach is that I want to have a name dependent on the same macro, which looks really bad with escaped quotas.

    Do you have any ideas how to fix it?

    I found this thread:


    but it also says only about escaping quotas.

    Thanks in advance,
    Wojtek
  • sivy310
    Junior Member
    • Aug 2013
    • 15

    #2
    Any ideas?

    Comment

    • tiarnaigh
      Junior Member
      • Sep 2013
      • 27

      #3
      Hey sivy310.
      Not sure if I can help as such with the MACROS part, but on the JMX stuff I've ran into a few issues also over time trying to pull specific fields which have single vs. double quotes etc. and having a nightmare trying to pull back these values via Zabbix.

      One thing which I found really useful was running a command-line checker of the query first using "cmdline-jmxclient-0.10.3.jar", and from there turning this into its' corresponding Zabbix form. For example:

      [root@zbx2srv0 ~]# java -jar /sys_apps_01/java/jdk1.7.0_21/bin/cmdline-jmxclient-0.10.3.jar - remoteAgent0:jmxPortNumber 'infinispan:component=Statistics,manager="payments CacheManager",name="currencyRatesCache(repl_sync)" ,type=Cache'
      Attributes:
      removeHits: Number of cache removal hits (type=long)
      misses: Number of cache attribute misses (type=long)
      statisticsEnabled: Enables or disables the gathering of statistics by this component (type=boolean)
      removeMisses: Number of cache removals where keys were not found (type=long)
      evictions: Number of cache eviction operations (type=long)
      elapsedTime: Number of seconds since cache started (type=long)
      numberOfEntries: Number of entries currently in the cache (type=int)
      hitRatio: Percentage hit/(hit+miss) ratio for the cache (type=double)
      stores: number of cache attribute put operations (type=long)
      hits: Number of cache attribute hits (type=long)
      averageReadTime: Average number of milliseconds for a read operation on the cache (type=long)
      timeSinceReset: Number of seconds since the cache statistics were last reset (type=long)
      averageWriteTime: Average number of milliseconds for a write operation in the cache (type=long)
      readWriteRatio: read/writes ratio for the cache (type=double)
      Operations:
      resetStatistics: Resets statistics gathered by this component
      Parameters 0, return type=void



      [root@zbx2srv0 ~]# java -jar /sys_apps_01/java/jdk1.7.0_21/bin/cmdline-jmxclient-0.10.3.jar - remoteAgent0:jmxPortNumber 'infinispan:component=Statistics,manager="payments CacheManager",name="currencyRatesCache(repl_sync)" ,type=Cache' numberOfEntries
      05/20/2016 05:18:20 -0500 org.archive.jmx.Client numberOfEntries: 0


      This then becomes the below key in Zabbix template:

      jmx["infinispan:component=Statistics,manager=\"payment sCacheManager\",name=\"currencyRatesCache(repl_syn c)\",type=Cache", "numberOfEntries"]

      As you can see, you need to escape the double quotes in the body of the query as I have done before but this does work effectively.

      In my case, I created an InfiniSpan template for JBoss EAP5.1 and added several metrics like the above to this which are then polled on a 5 min basis. Takes a while to figure out the initial formatting, but for me at least being able to validate first with the cmdline-jmxclient-0.10.3.jar certainly helped a lot.

      Hope this helps,
      M

      Comment

      Working...