Querying JMX items manually

Creating items on the server and then waiting for them to be updated through the gateway can be quite cumbersome if we don't know the exact parameters beforehand. We could query the gateway manually using netcat and similar tools, but that's not that easy either. There was an easier method with zabbix_get, but since 3.0.7, zabbix_get can no longer be used to query data from the Zabbix Java gateway.

There are some good community solutions, which can be found at https://www.zabbix.org/wiki/Docs/howto/zabbix_get_jmx.

Another good solution is to use tools such as JConsole. This tool comes with the standard JDK.

Let's connect to the JMX interface by just running jconsole and in the Remote Process field, add the IP and the port to connect to our machine. Keep the username and password empty, as we configured our Java gateway with the authenticate=false option. For other applications, you should add a password in your production environment:

When you are finished, click on Connect and ignore the warning about SSL.

Let's have a look where we can find our HeapMemoryUsage item:

  1. Click on MBeansjava.lang | Memory | HeapMemoryUsage.
  2. In the right-hand pane, you can see the attribute value with the HeapMemoryUsage name and the javax.management.openmbean.CompositeDataSupport value:

This is not telling us much, so let's double-click on the value, javax.management.openmbean.CompositeDataSupport. A box will open and show us the possible names with their respective values. In the following screenshot we will see a list of items that can be used with there respective values. The value from that item should match with what we monitored in our JMX item used heap memory attribute, for example we can monitor HeapMemoryUsage committed, init max or used values in this case.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.163.58