[root@svr-alert ~]#yum update -y && yum groupinstall "Development Tools" -y [root@svr-alert ~]#yum install vim wget net-tools -y [root@svr-alert ~]#vim /etc/sysconfig/selinux => Disabled [root@svr-alert ~]# systemctl stop firewalld [root@svr-alert ~]#systemctl disable firewalld
[1] Cài package:
[root@svr-alert ~]#yum install perl wget httpd php gcc glibc glibc-common gd gd-devel [root@svr-alert ~]#yum install openssl-devel xinetd make net-snmp libpng-devel libjpeg-turbo-devel
[2]Tạo user:
[root@svr-alert ~]# useradd -m nagios [root@svr-alert ~]# passwd nagios (nagios) [root@svr-alert ~]# groupadd nagcmd [root@svr-alert ~]# usermod -a -G nagcmd nagios && usermod -a -G nagcmd apache
[3]Cài đặt Nagios Core:
[root@svr-alert ~]# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz [root@svr-alert ~]# tar -zxvf nagios-4.3.4.tar.gz [root@svr-alert ~]# cd nagios-4.3.4 [root@svr-alert nagios-4.3.4]#./configure –-with-command-group=nagcmd [root@svr-alert nagios-4.3.4]#make all [root@svr-alert nagios-4.3.2]#make install [root@svr-alert nagios-4.3.4]#make install-init [root@svr-alert nagios-4.3.4]#make install-config [root@svr-alert nagios-4.3.4]#make install-commandmode [root@svr-alert nagios-4.3.4]#make install-webconf
Đặt password login Nagios web:
[root@svr-alert nagios-4.3.4]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (nagiosa123) [root@svr-alert nagios-4.3.4]#systemctl restart httpd
[4]Cài đặt Nagios plugin:
[root@svr-alert ~]# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz [root@svr-alert ~]# tar xzvf nagios-plugins-2.2.1.tar.gz [root@svr-alert ~]# cd nagios-plugins-2.2.1 [root@svr-alert nagios-plugins-2.2.1]#yum install bind-utils net-snmp net-snmp-devel net-snmp-utils net-snmp-perl perl-Net-SNMP [root@svr-alert nagios-plugins-2.2.1]#./configure --with-nagios-user=nagios --with-nagios-group=nagios [root@svr-alert nagios-plugins-2.2.1]#make && make install
[5]Cài NRPE (more):
Trong trường hợp bạn có dùng check_nrpe thì cài như sau:
Trong trường hợp bạn có dùng check_nrpe thì cài như sau:
[root@svr-alert ~]# tar -zxvf nrpe-3.2.0.tar.gz [root@svr-alert ~]# cd nrpe-3.2.0 [root@svr-alert nrpe-3.2.0]#./configure [root@svr-alert nrpe-3.2.0]#make all [root@svr-alert nrpe-3.2.0]#make install-plugin
- Add check_nrpe trong command.cfg
[root@svr-alert ~]#vim /usr/local/nagios/etc/objects/commands.cfg
- #Add command end file:
define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
- Test “check_nrpe”:
#/usr/local/nagios/libexec/check_nrpe -H IP_remote => Output: NRPE v.xxx => OK
[6]Khởi start dịch vụ:
[root@svr-alert ~]# systemctl restart httpd [root@svr-alert ~]# systemctl enable httpd [root@svr-alert ~]# chkconfig --add nagios [root@svr-alert ~]# chkconfig --level 35 nagios on
- Kểm tra config
[root@svr-alert ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg [root@svr-alert ~]# systemctl start nagios
Không có nhận xét nào:
Đăng nhận xét