Zabbix is a fully featured open-source monitoring solution. I wanted to evaluate how easy it is to monitor an application server like WildFly.
First component to install is the server which also requires a database (PostgreSQL in my case). As it was already explained by Daniel’s blog, I will not go into too much details. For the server to be able to gather detailed information about WildFly, Zabbix requires a Java gateway. When Zabbix software repository is already setup, installation is easy:
dnf install zabbix-java-gateway
Java gateway will be a proxy to all JMX requests that Zabbix will send to JMX-enabled hosts.
Configuration file path for Java gateway is
/etc/zabbix/zabbix_java_gateway.conf. For my installation, I did not need to modify this one, but the main zabbix configuration file:
I modified as follow:
- Uncomment line 8 and put IP of Java Gateway server (hosted on same server as Zabbix server).
- Uncomment line 16 and put port of Java Gateway. 10052 is the default port.
- Uncomment line 24 and put 5.
File content look like this (extract):
[...] ### Option: JavaGateway # IP address (or hostname) of Zabbix Java gateway. # Only required if Java pollers are started. # # Mandatory: no # Default: JavaGateway=<***.***.***.***> ### Option: JavaGatewayPort # Port that Zabbix Java gateway listens on. # # Mandatory: no # Range: 1024-32767 # Default: JavaGatewayPort=10052 ### Option: StartJavaPollers # Number of pre-forked instances of Java pollers. # # Mandatory: no # Range: 0-1000 # Default: StartJavaPollers=5 [...]
For Java Gateway to connect to WildFly, it will require
jboss-client.jar library. It can be found under
bin/client in WildFly home directory and it must be copied in
/usr/share/zabbix-java-gateway/lib/ on Zabbix server.
zabbix-server service restart is required for configuration changes to be taken into account and a restart of
zabbix-java-gateway service for new library.
Add JMX Host
During my previous tests of Zabbix, I already added a host with a Zabbix agent into the configuration. Now, I want to add WildFly monitoring which will be done by a adding JMX interface. I need to go in hosts list and edit the host:
As you can see, I have added an extra template named WildFly Server by JMX as well as a JMX interface to my existing host. The port corresponds to WildFly management port.
Next, we need to define macros (ie. variables) for Java Gateway to connect to WildFly:
Finally, I click update.
After few seconds and a refresh, I can see that JMX interface become green as well:
After one more minute, I see new problems raised concerning datasource: They did not have statistics enabled. For that, I just need to enable that in WildFly configuration:
Likewise for Web subsystem Undertow:
After that, I can plot a graph for Request per second:
Note that provided template will only get metrics for http and not https as per discovery rule definition:
This comes from selected template. We could either create our own template or modify existing template, but this is another topic.