1.1.1解决perl编译问题:
echo “export LC_ALL=C” >> /etc/profile
source /etc/profile
echo $LC_ALL
1.1.2解决系统时间同步
echo "*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1" >> /var/spool/cron/root
1.1.3安装基础包:
yum install gcc glibc-common -y
yum install gd gd-devel -y
yum install httpd php* -y
1.3创建需要的用户及组
useradd -m nagios useradd apache
uermod -s /sbin/nologin nagios
groupadd nacmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
编译安装naigos
./configure --with-command-group=nagcmd
make all;make install;make install-init;make install-config ;make install-commandmode
make install-webconf ;
编译安装的apache --with-httpd-conf=/usr/local/apache2/conf/extra要指定nagios的conf
创建nagios界面用户htpasswd -c /usr/local/nagios/etc/htpasswd.users user1根据nagios配置选择
修改监控报警email,sed -i ‘s#nagios@localhost#your@email .com /usr/local/nagios/etc/objects/contacts.cfg'
service sendemail start
安装插件软件包:
tar zxf nagios-plugins-1.4.13.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make如果出现错误error 2,需要加上--with-mysql=/usr/local/mysql
加入到开启启动 chkconfig --add nagios
验证配置文件:nagios -v /usr/local/nagios/etc/nagios.cfg
selinux需要把-t设为http的上下文
安装nrpe:make install-plugin;make install-daemon;makeinstalll-daemon-config服务端要安装,不然会缺少插件
来源:oschina
链接:https://my.oschina.net/u/2660522/blog/631311