nagios主控端搭建

#####yum安装依赖环境####
echo 'export LC_ALL=C'>> /etc/profile
tail -1 /etc/profile
source /etc/profile
yum install ntp -y
/usr/sbin/ntpdate pool.ntp.org
yum install gcc glibc glibc-common -y
yum install httpd php php-gd -y


####创建nagios用户组#####
/usr/sbin/useradd -M nagios
/usr/sbin/useradd apache -M -s /sbin/nologin
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache


#####编译安装nagios######
tar xzf nagios-3.2.0.tar.gz
cd nagios-3.2.0
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cd ../


####创建http用户并设置密码####
htpasswd -c /usr/local/nagios/etc/htpasswd.users jc
密码设置123456


####编译安装nagios插件####
tar zxf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure  --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make && make install
cd ..
ls /usr/local/nagios/libexec/|wc -l


####添加至开机启动########
chkconfig --add nagios
chkconfig --level 3 nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

####启动nagios服务####
/etc/init.d/nagios restart
ps -ef|grep nagios|grep -v grep
/etc/init.d/httpd restart


####编译安装nrpe插件#####
tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
cd ../


本文出自 “liunx系统” 博客,谢绝转载!

你可能感兴趣的:(nagios主控端)