Mục tiêu thực hành:
- Định nghĩa các Hosts và Services cần giám sát trên Nagios v4.1.1.
- Kiểm tra trạng thái Ping Status tới các Hosts tại giao diện Nagios WebPage.
Các bước triển khai:
Định nghĩa các Hosts và Services cần giám sát trên Nagios v4.1.1.
- Khởi tạo thư mục hosts và services.
[root@localhost objects]# cd /usr/local/nagios/etc[root@localhost etc]# mkdir hosts services[root@localhost etc]# chown nagios:nagios hosts/ services/[root@localhost etc]# ls -altotal 64drwxrwxr-x. 5 nagios nagios 125 May 27 06:21 .drwxr-xr-x. 9 root root 94 May 26 22:17 ..-rw-rw-r--. 1 nagios nagios 12267 May 26 22:13 cgi.cfgdrwxr-xr-x. 2 nagios nagios 6 May 27 06:21 hosts-rw-r--r--. 1 root root 50 May 26 22:15 htpasswd.users-rw-rw-r--. 1 nagios nagios 44831 May 26 22:13 nagios.cfgdrwxrwxr-x. 2 nagios nagios 167 May 27 06:21 objects-rw-rw----. 1 nagios nagios 1312 May 26 22:13 resource.cfgdrwxr-xr-x. 2 nagios nagios 6 May 27 06:21 services[root@localhost etc]#
[root@localhost etc]# yum install nano -y[root@localhost etc]# nano -c /usr/local/nagios/etc/nagios.cfg
[root@localhost etc]# service nagios restartRestarting nagios (via systemctl): [ OK ][root@localhost etc]# service nagios statusnagios (pid 16179) is running...[root@localhost etc]#
- Định nghĩa host.
nano /usr/local/nagios/etc/hosts/host1.cfg
define host{name linux-boxuse generic-hostcheck_period 24x7check_interval 5retry_interval 1max_check_attempts 5check_command check-host-alivenotification_interval 30notification_period 24x7notification_options d,rcontact_groups adminsregister 0}define host{use linux-boxhost_name MX84alias Gatewayaddress 192.168.100.254}
- Định nghĩa services.
nano /usr/local/nagios/etc/services/host1.cfg
define service{use generic-servicehost_name MX84service_description PINGcheck_command check-host-alive}
[root@localhost objects]# service nagios restartRestarting nagios (via systemctl): [ OK ][root@localhost objects]# service nagios statusnagios (pid 16351) is running...[root@localhost objects]#
0 comments