Monitoring
Available monitoring beans
For monitoring the current status of the server, Xima® Formcycle provides a monitoring bean for each server type. It can be accessed and read via JMX by using tools such as for example JConsole.
The beans are registered under the following names:
- Frontend-Server
- de.xima.fc:type=FSMonitor,qualifier=<contextName>
- Master-Server
- de.xima.fc:type=MSMonitor,qualifier=<contextName>
The context name is the context name of the applications. It is necessary for supporting parallel installations of Xima® Formcycle on a server. By default, the context name is the name of Xima® Formcycle's WAR file, but it can be changed by modifying the context name parameter.
When starting the server, the current context name is logged. You may need to modify the logging settings to see the name. There are different monitoring attributes available for each bean, which are listed below.
Key | Description | Possible options |
---|---|---|
running | Whether the master server has been started successfully. | true | false |
db_connected | Whether the master server could establish a connection to the database. | true | false |
fs_connected | A map of the names of all frontend servers and whether they are connected to this master server | <serverName> : true | false |
fs_active | A map of the names of all frontend servers and whether this master server should attempt to establish a connection to that server automatically. | <serverName> : true | false |
fs_status | A map of the names of all frontend servers and the connection status of that server. | <serverName> : CONNECTED | NOT_CONNECTED | ERROR | RECONNECTING | DISCONNECTING | CONNECTING | AUTHENTICATING | WAIT_FOR_CONNECTION |
fs_disconnected_count | The number of frontend servers not connected to this master server | A non-negative number. |
fs_connected_count | The number of frontend servers connected to this master server | A non-negative number. |
Key | Description | Possible options |
---|---|---|
running | Whether the frontend server has been started successfully. | true | false |
connected | Whether this frontend server is connected to a master server. | true | false |
status | The connection status of this frontend server. | CONNECTED | NOT_CONNECTED | ERROR | RECONNECTING | DISCONNECTING | CONNECTING | AUTHENTICATING | WAIT_FOR_CONNECTION |
JSON REST API
The monitoring beans can also be accessed via a JSON REST API. This is done as follows:
JSON response
"timestamp":1440603508,
"status":200,
"request":{
"mbean":"de.xima.fc:qualifier=formcycle,type=MSMonitor",
"type":"read"
},
"value":{
"fs_active":{
"sas":true,
"localhost":false,
"mko":true
},
"fs_connected":{
"sas":false,
"localhost":false,
"mko":false
},
"db_connected":true,"fs_status":{
"sas":"ERROR",
"localhost":"NOT_CONNECTED",
"mko":"ERROR"
},
"fs_disconnected_count":3,
"fs_connected_count":0,
"running":true
}
}
URL
The monitoring servlet is available as the sub resource monitoring of the application context URL, eg. http://localhost/formcycle/
. This servlet processes the monitoring bean and provides the monitoring info as JSON. The servlet makes use of the framework Jolokia. Further servlet options provided by Jolokia are described on their org/reference/html/.
Nagios integration
The Nagios monitoring application may be used for reading and showing monitoring info as well by using the JSON REST API described above. This requires the Nagios plugin jmx4perl to be installed. A detailed installation instruction can be found on their website. This allows querying the JSON REST API with the corresponding commands.
Examples
Command
command_name check_jmx4perl
command_line check_jmx4perl --url $ARG1$ --mbean $ARG2$ --attribute $ARG3$ $ARG4$
}
Service definitions
define service{
use generic-service
host_name localhost
service_description MS:FS-connected-count
check_command check_jmx4perl!http://localhost/formcycle/monitoring/!de.xima.fc:type=MSMonitor,qualifier=formcycle!fs_disconnected_count!--warning 1 --critical 2
}
Querying the database connection status of the master server
use generic-service
host_name localhost
service_description MS:DB-connected
check_command check_jmx4perl!http://localhost/formcycle/monitoring/!de.xima.fc:type=MSMonitor,qualifier=formcycle!db_connected!--string --critical 'false'
}
Querying whether the frontend server localhost is connected to the master server
use generic-service
host_name localhost
service_description MS:FS-localhost
check_command check_jmx4perl!http://localhost/formcycle/monitoring/!de.xima.fc:type=MSMonitor,qualifier=formcycle!fs_connected!--path=localhost --string --critical 'false'
}
Querying the frontend server whether it is connected to a master server
use generic-service
host_name localhost
service_description FS:connected
check_command check_jmx4perl!http://localhost/frontend-server/monitoring/!de.xima.fc:type=FSMonitor,qualifier=frontend-server!connected!--string --critical 'false'
}
Running Nagios on a different server
For security concerns, the JSON REST API does not allow querying the monitoring info from other IP addresses, only from the local server. Running Nagios on a different server and querying the monitoring info is still possible, but requires some additional setup.
One option is to setup the routing accordingly or using a proxy.
Another options for using Nagios on a different server is by providing certain options to the monitoring servlet. The parameter policyLocation provides the servlet with the URL to a Jolokia policy file, which will be passed on to Jolokia. The monitoring servlet is an extends Jolokia standard servlet and all Jolokia-specific parameters can be used. A list of relevant parameters can be found website.
A third option is running Jolokia in parallel to Xima® Formcycle or the frontend server. Jolokia provides an application with a Java-EE agent for this purpose, documentation and download).
This agent does not possess any restrictions for read operations or control commands. However, as this represents a potential security issue, we strongly recommend to configure this agent for the server and network settings in use and restrict access as much as possible. For example, access should be restricted to the server running the Nagios application.
Jolokia provides more details on security-related options in their documentation.
When Jolokia is run parallel to Xima® Formcycle, the connection to the frontend server localhost must be modified as follows:
define service{
use generic-service
host_name fc-test
service_description MS:FS-localhost
check_command check_jmx4perl!http://fc-test/jolokia/!de.xima.fc:type=MSMonitor,qualifier=formcycle!fs_connected!--path=localhost --string --critical 'false'
}
{{/table}}