Note
In these examples, the Nagios installation directory may vary; typically it is in
/usr/local/nagios
, but it may not be this on all installations.
Similarily, the place to add configuration files Nagios directory is typically, but not
always, /usr/local/nagios/etc/objects
, which you may need to create if
it has not been created by the installation.
You can use commands defined in jmx_commands.cfg
file to monitor CXF services, Camel Context and Routes, ActiveMQ Broker, Topics and Queues.
In order to do it, you do not need to change template files
jmx_commands.cfg
, cxf.cfg
,
camel.cfg
, activemq.cfg
which already contain
all check definitions and commands for these entities. For your own application, we suggest
you add your own new_host.cfg
to monitor your own cxf service, camel
route, and so on, using cxf_host.cfg
,
camel_host.cfg
and activemq_host.cfg
as
samples.
The process is as follows (see Configure the Nagios plugin to monitor the sample applications for an example of following this process with the shipped examples):
Define
jolokia_host
in/etc/hosts
- this name is used in subsequent files, rather than hard-coding in the ip address.For configuration templates
jolokia_host
means the host that has the Jolokia agent installed and would be monitored by the jmx4perl plugin. For example:192.168.1.101 jolokia_host
Put the configuration files into the configuration folder, for example,
/usr/local/nagios/etc/objects/
or/etc/nagios3/etc/objects/
.The configuration files are in
<TalendRuntimePath>/add-ons/adapters/nagios
.Copy template and sample configuration files from this directory into, for example,
/usr/local/nagios/etc/objects/
or/etc/nagios3/etc/objects/
, for example:# cp -f <TalendRuntimePath>/add-ons/adapters/nagios/template/*.cfg /usr/local/nagios/etc/objects/
# cp -f <TalendRuntimePath>/add-ons/adapters/nagios/sample/*.cfg /usr/local/nagios/etc/objects/
Add the command configuration file to the existing
nagios.cfg
, here are some examples, which depend on where your installation puts config files:In
/usr/local/nagios/etc/nagios.cfg
, add this line:cfg_file=/usr/local/nagios/etc/objects/jmx_commands.cfg
Or in
/etc/nagios3/nagios.cfg
add this line:cfg_file=/etc/nagios3/etc/objects/jmx_commands.cfg
[Note: this step is not needed for samples, the shipped files are sufficient] Create host definitions file, for example
new_host.cfg
, by, for example, copyingjmx_host.cfg
. Note that you may need to edit it and add applications-specific service definitions.[Note: this step is not needed for samples, the shipped files are sufficient]
Add the file to the existing
nagios.cfg
, here are some examples, which depend on where your installation puts config files:In
/usr/local/nagios/etc/nagios.cfg
add this line:cfg_file=/usr/local/nagios/etc/objects/new_host.cfg
Or in
/etc/nagios3/nagios.cfg
add this line:cfg_file=/etc/nagios3/etc/objects/new_host.cfg
Define macros which will be used by
jmx_commands.cfg
in the existingresource.cfg
; here are some examples, which depend on where your installation puts config files:In
/usr/local/nagios/etc/resource.cfg
add these lines:# set the path which jmx4perl plugin installed $USER5$=/usr/local/src/jmx4perl/scripts # set the path to where to find configuration files $USER6$=/usr/local/nagios/etc/objects
Or in
/etc/nagios3/resource.cfg
add these lines:# set the path which jmx4perl plugin installed $USER5$=/usr/local/src/jmx4perl/scripts # set the path to where to find configuration files $USER6$=/etc/nagios3/etc/objects
Then, restart Nagios for the changes to take effect.
# service nagios restart
Note: the name of this service may vary, depending on which package you used to install Nagios, so it may be called, for example,
nagios3
, instead ofnagios
.