jolokia_host is the host where the Jolokia agent is
installed, and is being monitored by the jmx4perl plugin.
You need to substitute this with a hostname or ip address for commands, or add
it to /etc/hosts as described in Preparing the configuration files for running with Nagios
(recommended).
Here are some corresponding examples of using these steps in the shipped
Talend software
configuration files. In particular, we look at the structures needed to define a
metric for monitoring Active MQ:
- First we look at the configuration file
<TalendRuntimePath>/add-ons/adapters/nagios/template/activemq.cfg
- In particular, look at a Check definition for ActiveMQ:
# Define server connection parameters
<Server tesb_activemq>
Url = http://jolokia_host:8161/jolokia
</Server>
# checks for ActiveMQ metrics
<Check Broker_TotalConsumerCount>
MBean = org.apache.activemq:BrokerName=$0,Type=Broker
Attribute = TotalConsumerCount
Name = TotalConsumerCount
Warning 1000000
</Check>
(See note about jolokia_host).
- Here is an example of a command definition, which is in the file
<TalendRuntimePath>/add-ons/adapters/nagios/template/jmx_commands.cfg:
# Define a command to monitor ActiveMQ using Nagios
# $USER5$ - user macros defining folder with check_jmx4perl
# $USER6$ - user macros defining folder with command configuration file
# $ARG1$ - check name which defined in activemq.cfg
# $ARG2$ - set broker name for activemq to be monitored
# $ARG3$ - set destination for queue to be monitored
# $ARG4$ - set destination for topic to be monitored
define command {
command_name check_jmx4perl_activemq
command_line $USER5$/check_jmx4perl \
--config $USER6$/activemq.cfg \
--server $HOSTNAME$ \
--check $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
Information noteNote: The command definition specifies the configuration file
activemq.cfg which contains all the check definitions
defined earlier.
Several arguments are used in this command;
setting their values is described in Preparing the configuration files for running with Nagios.
- In the following configuration example (in the file
<TalendRuntimePath>/add-ons/adapters/nagios/sample/activemq_host.cfg)
you can see how to describe the host and service definition for Nagios:
# Define a host
define host{
use activemq-host ; Name of host template to use.
; This host definition will inherit
; all the variables that are defined
; in (or inherited by) the linux-server
; host template definition.
host_name tesb_activemq
alias tesb_activemq
}
define service {
use generic-service
service_description Broker_TotalConsumerCount
display_name Broker_TotalConsumerCount:
check_interval 1
host_name tesb_activemq
check_command check_jmx4perl_activemq!Broker_TotalConsumer
Count!localhost!example.A!ActiveMQ.Advisory.Consumer.Queue.example.A
}
Information noteNote:
You need to specify the values of the check_command
properties in a strict order:
- The name of command used to check the metric
("check_jmx4perl_activemq" from
jmx_commands.cfg).
- The name of check you use, from jmx4perl configuration
("Broker_TotalConsumerCount" from
activemq.cfg).
- The arguments for the command.