Add new Host
- sudo vi /usr/local/nagios/etc/objects/hosts.cfg
-
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg to verify if all newly made config are ok
define host{
use linux-server
host_name nagios
alias nagios
address 54.246.111.244
}
Add new Services
define service{
use local-service
host_name TOMCAT-SERVER2
service_description tomcat
check_command check_http_tomcat
}
How to add new plugin, new command and assign it to new host?
- Download the new plugin and install it on /usr/local/nagios/libexec
- create a command and add it on /usr/local/nagios/etc/objects/commands.cfg
For JMX Check
# CheckJMX
define command{
command_name check_jmx
command_line $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://$HOST
ADDRESS$:9009/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I Heap
MemoryUsage -J used -vvvv -w $ARG1$ -c $ARG2$
}
- to assign on new host go to /usr/local/nagios/etc/objects/hosts.cfg and
define service{
use local-service
host_name TOMCAT-SERVER2
service_description JMX
check_command check_jmx!15000000!1800000000
}