Ad Widget

Collapse

Add tabular data support to the Zabbix Java Gateway.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drgr33n
    Junior Member
    • Dec 2015
    • 13

    #1

    Add tabular data support to the Zabbix Java Gateway.

    While making the move from Zabbix3x to Zabbix4x, I've been adding a few bits and tweaking the LLD rules, etc. While inspecting available beans exposed by a Tomcat instance, I noticed ava.lang:type=GarbageCollector MXBean has a LastGcInfo attribute that is a CompositeData value, which interesting has some sub-values called memoryUsageAfterGc and memoryUsageBeforeGc, which expose the javax.management.openmbean.TabularData interface. Each table exposes each heap and non-heap memory pool using the name of its java.lang:type=MemoryPool as the TabularData key. The memory pool is a CompositeData value that can be further examined with Attribute dot notation. for example:

    Code:
    LastGcInfo.memoryUsageAfterGc = {
        ( G1 Old Gen ) = {
            key = G1 Old Gen;
            value = {
                committed = 937426944;
                init = 1017118720;
                max = 3221225472;
                used = 827967488;
           };
        };
       ( G1 Perm Gen ) = {
            key = G1 Perm Gen;
            value = {
                committed = 98566144;
                init = 20971520;
                max = 536870912;
                used = 97732464;
            };
        };
        ( Code Cache ) = {
            key = Code Cache;
            value = {
               committed = 11599872;
               init = 2555904;
               max = 50331648;
               used = 11381888;
            };
        };
        ( G1 Eden Space ) = {
            key = G1 Eden Space;
            value = {
               committed = 127926272;
               init = 56623104;
               max = -1;
               used = 0;
            };
        };
        ( G1 Survivor Space ) = {
            key = G1 Survivor Space;
            value = {
               committed = 8388608;
               init = 0;
               max = -1;
               used = 8388608;
            };
        };
    };
    Unfortunately, Zabbix didn't support tabular datatypes. After a bit of research, I stumbled across this post from 2015 where some guy had submitted a patch to support, enabling tabular datatypes https://support.zabbix.com/browse/ZBXNEXT-2727. This didn't work for every scenario including grabbing the attributes above. I've taken this patch and tweaked it to work for the Composite structure above. It' would be nice to see this included at some point I'm not a developer so it may need cleaning up but I can confirm this works on v4.2.

    You can get the attribute the same way as you normally would using dot notation. For eg: jmx["java.lang:type=GarbageCollector,name=G1 Young Generation","LastGcInfo.memoryUsageBeforeGc.Code Cache.max"]

    Click image for larger version  Name:	Screenshot from 2019-05-20 10-37-47.png Views:	1 Size:	116.1 KB ID:	379172

    Click image for larger version  Name:	Screenshot from 2019-05-16 15-19-48.png Views:	1 Size:	68.4 KB ID:	379060


    Click image for larger version  Name:	Screenshot from 2019-05-16 15-22-06.png Views:	1 Size:	142.0 KB ID:	379061

    Click image for larger version  Name:	Screenshot from 2019-05-16 15-22-44.png Views:	1 Size:	145.7 KB ID:	379062

    PATCH: http://dpaste.com/3Z9MGX8


    If it doesn't make it in, at least people have the option to use my patch if they like.
    Last edited by drgr33n; 20-05-2019, 11:48.
Working...