Skip to main content Skip to complementary content

Syntax for adding metrics for monitoring

You can add the metrics for monitoring using the following steps and examples (these are already defined as much as possible for the shipped examples):


  1. Edit the applicable configuration file or template in the Talend Runtime.
  2. Define Check definition structures for the jmx4perl plugin, corresponding to the metrics that need to be monitored.
  3. Define one or more commands for Nagios, that make use of the check_jmx4perl command from the plugin.
  4. Describe a host and service definition for Nagios; the service definition needs to use the command defined in the previous step.

    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
      # checks for ActiveMQ metrics
      <Check Broker_TotalConsumerCount>
         MBean = org.apache.activemq:BrokerName=$0,Type=Broker
         Attribute =  TotalConsumerCount
         Name = TotalConsumerCount
         Warning 1000000
      (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
      Information noteNote:

      You need to specify the values of the check_command properties in a strict order:

      1. The name of command used to check the metric ("check_jmx4perl_activemq" from jmx_commands.cfg).
      2. The name of check you use, from jmx4perl configuration ("Broker_TotalConsumerCount" from activemq.cfg).
      3. The arguments for the command.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!