Database Reference
In-Depth Information
Thus, I can access the web browser via a URL in this form: http://hc1nn/nagios .
My example uses the name of the name node in my cluster, but it won't be accesssible until the Nagios server
is started after the configuration has been finalized. Therefore, on the Name Node server hc1nn, I edit the file /etc/
nagios/nagios.cfg, which is the configuration file for the central Nagios server component. I comment out the line that
defines the cfg_file value for localhost (I will later define each of the cluster servers explicitly.)
#cfg_file=/etc/nagios/objects/localhost.cfg
In the same file on hc1nn, I use the cfg_dir attribute to specify the directory location where Nagios will look for
the configuration files:
[root@hc1nn nagios]# grep "^cfg_dir" /etc/nagios/nagios.cfg
cfg_dir=/etc/nagios/conf.d
I go to this location and create empty configuration files for each of the servers in the cluster by using the Linux
touch command:
[root@hc1nn nagios]# cd /etc/nagios/conf.d
[root@hc1nn conf.d]# touch hc1r1m1.cfg
[root@hc1nn conf.d]# touch hc1r1m2.cfg
[root@hc1nn conf.d]# touch hc1r1m3.cfg
[root@hc1nn conf.d]# touch hc1nn.cfg
The contents of each of the server configuration files mirrors the following listing (to which I added line numbers
for easy reference). The important parts of a single server configuration file—in this case, hc1nn.cfg—are described
below. The file sections have been listed along with some text to describe their function. The sum of the numbered
configuration file parts forms a whole that Nagios uses to monitor and alert on a server.
The first entry defines the server details, while the later ones define such services as ping, ssh, and load. For
example, the host definition defines the hostname and its alias, plus its IP address:
1 define host {
2 use linux-server
3 host_name hc1nn
4 alias hc1nn
5 address 192.168.1.107
6 }
Each of the file's remaining entries define the services available to Nagios on the server. Notice that they take
advantage of the terms “generic-service” and “local-service.” These terms are templates specified in the file /etc/
nagios/objects/templates.cfg, and they provide a way of using pre-defined attributes for the service. For example, the
check_ping service (lines 8 to 13) defines the hostname to ping, hc1nn. In addition, it specifies an average roundtrip
time of 100 milliseconds and a packet loss of 20 percent will produce a warning message. A roundtrip time of 500
milliseconds and a packet loss of 60 percent will trigger a critical error. The commands referred to in the
check_command line (i.e., check_ping) are further defined in the file /etc/nagios/objects/commands.cfg.
8 define service {
9 use generic-service
10 host_name hc1nn
11 service_description PING
12 check_command check_ping!100.0,20%!500.0,60%
13 }
 
Search WWH ::




Custom Search