作者:z漫步云端j | 来源:互联网 | 2014-05-28 09:40
#基础支持gccglibcglibc-commongdgd-develuseradd-mnagios#添加一个名为nagios的用户用以专门跑nagiospasswdnagios#设置密码groupaddnagcmd#添加nagcmd用户组,用以通过web页面提交外部控制命令usermod-a-Gnagcmdnagio
#基础支持 gcc glibc glibc-common gd gd-devel
useradd -m nagios #添加一个名为nagios的用户用以专门跑nagios
passwd nagios #设置密码
groupadd nagcmd #添加nagcmd用户组,用以通过web页面提交外部控制命令
usermod -a -G nagcmd nagios #将nagios用户加入nagcmd组
usermod -a -G nagcmd
nginx #将
nginx用户加入nagcmd组
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
wget http://nagios.manubulon.com/nagios-snmp-plugins.1.1.1.tgz
tar zxvf nagios-3.2.0.tar.gz
tar zxvf nagios-plugins-1.4.13.tar.gz
tar zxvf nagios-snmp-plugins.1.1.1.tgz
cd nagios-3.2.0
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
这时nagios本身已基本安装完成
vi /usr/local/nagios/etc/objects/contacts.cfg #修改nagiosadmin这行其中的邮件地址为你的email地址,以将报警邮件发到你的邮箱
#make install-webconf #安装nagios的web接口
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
#设置登陆web界面时HTTP验证的账号密码
#因为我是用nginx,所以上面三行不执行,自己手工改nginx配置
cd ..
cd nagios-plugins-1.4.13
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
cd ..
cd nagios_plugins
#安装perl所用组件
perl -MCPAN -e shell
cpan> install Net::SNMP
./install.sh #一路回车
#nagios全套安装完毕
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg #检测nagios的配置是否正确
/etc/init.d/nagios start
/etc/init.d/nginx start
nagios要用cgi-bin,关于nginx上的cgi-bin配置可参考 nginx配置cgi-bin运行perl