
# WildFly Domain by JMX

## Overview

Official JMX Template for WildFly Domain Controller.


## Requirements

Zabbix version: 7.0 and higher.

## Tested versions

This template has been tested on:
- WildFly 22.6.0 

## Configuration

> Zabbix should be configured according to the instructions in the [Templates out of the box](https://www.zabbix.com/documentation/7.0/manual/config/templates_out_of_the_box) section.

## Setup

Metrics are collected by JMX.
This template works with Domain Controller.

1. Enable and configure JMX access to WildFly. See documentation for [instructions](https://docs.wildfly.org/23/Admin_Guide.html#JMX).
2. Copy jboss-client.jar from `/(wildfly,EAP,Jboss,AS)/bin/client` in to directory `/usr/share/zabbix-java-gateway/lib`
3. Restart Zabbix Java gateway
4. Set the user name and password in host macros {$WILDFLY.USER} and {$WILDFLY.PASSWORD}.
Depending on your server setup, you may need to specify a custom JMX scheme in macro {$WILDFLY.JMX.PROTOCOL} (default: remote+http)


### Macros used

|Name|Description|Default|
|----|-----------|-------|
|{$WILDFLY.USER}||`zabbix`|
|{$WILDFLY.PASSWORD}||`zabbix`|
|{$WILDFLY.JMX.PROTOCOL}||`remote+http`|
|{$WILDFLY.DEPLOYMENT.MATCHES}|
Filter of discoverable deployments
|`.*`|
|{$WILDFLY.DEPLOYMENT.NOT_MATCHES}|
Filter to exclude discovered deployments
|`CHANGE_IF_NEEDED`|
|{$WILDFLY.SERVER.MATCHES}|
Filter of discoverable servers
|`.*`|
|{$WILDFLY.SERVER.NOT_MATCHES}|
Filter to exclude discovered servers
|`CHANGE_IF_NEEDED`|

### Items

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Launch type|
The manner in which the server process was launched. Either "DOMAIN" for a domain mode server launched by a Host Controller, "STANDALONE" for a standalone server launched from the command line, or "EMBEDDED" for a standalone server launched as an embedded part of an application running in the same virtual machine.
|JMX agent|jmx["jboss.as:management-root=server","launchType"]
**Preprocessing**

- 
Discard unchanged with heartbeat: `3h`

|
|Name|
For standalone mode: The name of this server. If not set, defaults to the runtime value of InetAddress.getLocalHost().getHostName().

For domain mode: The name given to this domain
|JMX agent|jmx["jboss.as:management-root=server","name"]
**Preprocessing**

- 
Discard unchanged with heartbeat: `3h`

|
|Process type|
The type of process represented by this root resource.
|JMX agent|jmx["jboss.as:management-root=server","processType"]
**Preprocessing**

- 
Discard unchanged with heartbeat: `3h`

|
|Version|
The version of the WildFly Core based product release.
|JMX agent|jmx["jboss.as:management-root=server","productVersion"]
**Preprocessing**

- 
Discard unchanged with heartbeat: `3h`

|
|Uptime|
WildFly server uptime.
|JMX agent|jmx["java.lang:type=Runtime","Uptime"]
**Preprocessing**

- 
Custom multiplier: `0.001`

|

### Triggers

|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----------|--------|--------------------------------|
|WildFly Domain: WildFly: Version has changed|
WildFly version has changed. Acknowledge to close the problem manually.
|`last(/WildFly Domain by JMX/jmx["jboss.as:management-root=server","productVersion"],#1)<>last(/WildFly Domain by JMX/jmx["jboss.as:management-root=server","productVersion"],#2) and length(last(/WildFly Domain by JMX/jmx["jboss.as:management-root=server","productVersion"]))>0`|Info|**Manual close**: Yes|
|WildFly Domain: WildFly: Host has been restarted|
Uptime is less than 10 minutes.
|`last(/WildFly Domain by JMX/jmx["java.lang:type=Runtime","Uptime"])<10m`|Info|**Manual close**: Yes|

### LLD rule Deployments discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Deployments discovery|
Discovery deployments metrics.
|JMX agent|jmx.get[beans,"jboss.as.expr:deployment=*,server-group=*"]|

### Item prototypes for Deployments discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|WildFly deployment [{#DEPLOYMENT}]: Enabled|
Boolean indicating whether the deployment content is currently deployed in the runtime (or should be deployed in the runtime the next time the server starts).
|JMX agent|jmx["{#JMXOBJ}",enabled]
**Preprocessing**

- Boolean to decimal
- 
Discard unchanged with heartbeat: `3h`

|
|WildFly deployment [{#DEPLOYMENT}]: Managed|
Indicates if the deployment is managed (aka uses the ContentRepository).
|JMX agent|jmx["{#JMXOBJ}",managed]
**Preprocessing**

- Boolean to decimal
- 
Discard unchanged with heartbeat: `3h`

|

### LLD rule Servers discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Servers discovery|
Discovery instances in domain.
|JMX agent|jmx.get[beans,"jboss.as:host=master,server-config=*"]|

### Item prototypes for Servers discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Server {#SERVER}: Autostart|
Whether or not this server should be started when the Host Controller starts.
|JMX agent|jmx["{#JMXOBJ}",autoStart]
**Preprocessing**

- Boolean to decimal
- 
Discard unchanged with heartbeat: `3h`

|
|Server {#SERVER}: Status|
The current status of the server.
|JMX agent|jmx["{#JMXOBJ}",status]
**Preprocessing**

- 
Discard unchanged with heartbeat: `3h`

|
|Server {#SERVER}: Server group|
The name of a server group from the domain model.
|JMX agent|jmx["{#JMXOBJ}",group]
**Preprocessing**

- 
Discard unchanged with heartbeat: `3h`

|

### Trigger prototypes for Servers discovery

|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----------|--------|--------------------------------|
|WildFly Domain: Server {#SERVER}: Server status has changed|
Server status has changed. Acknowledge to close the problem manually.
|`last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",status],#1)<>last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",status],#2) and length(last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",status]))>0`|Warning|**Manual close**: Yes|
|WildFly Domain: Server {#SERVER}: Server group has changed|
Server group has changed. Acknowledge to close the problem manually.
|`last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",group],#1)<>last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",group],#2) and length(last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",group]))>0`|Info|**Manual close**: Yes|

## Feedback

Please report any issues with the template at [`https://support.zabbix.com`](https://support.zabbix.com)

You can also provide feedback, discuss the template, or ask for help at [`ZABBIX forums`](https://www.zabbix.com/forum/zabbix-suggestions-and-feedback)

