nagios的搭建及配置----(上)
首先说下自己的搭建环境。RedHat6.4系统 nagios-4.0.7。关闭selinux和iptables服务
1,准备工作,安装好nagios所需要的软件
Apache
PHP
GCC compiler
GD development libraries
yum install httpd php gcc glibc glibc-common gd gd-devel
2,创建nagios使用的账号和组,首先要切换成管理员账号
[root@localhost ~]useradd -m nagios
[root@localhost ~]echo nagios |passwd --stdin nagios
[root@localhost ~]# groupadd nagcmd
[root@localhost ~]# usermod -aG nagcmd nagios
[root@localhost ~]# usermod -aG nagcmd apache
3,下载nagios和nagio-plugin
[root@localhost ~]#wgethttp://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
[root@localhost ~]#wgethttp://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
4,编译安装(Install binaries, init script, sample config files and set permissions on the external command directory.)
[root@localhost ~]#./configure --with-command-group=nagcmd
[root@localhost ~]#make all
[root@localhost ~]#make install
[root@localhost ~]#make install-init
[root@localhost ~]#make install-config
[root@localhost ~]#make install-commandmodes
[root@localhost ~]#make install-commandmode
5,自定义配置文件
[root@localhost ~]#vim /usr/local/nagios/etc/objects/contacts.cfg
配置管理员的邮箱地址,当监控到有问题时会发送邮件到管理员邮箱6,配置web界面管理接口,并创建登陆到nagios管理界面的账号密码,然后重启Apache服务,使配置文件生效[root@localhost~]#makeinstall-webconf[root@localhost~]#htpasswd-c/usr/local/nagios/etc/htpasswd.usersnagiosadmin//htpasswd.users的文件名称一定要写正确[root@localhost~]#servicehttpdrestart7,编译安装nagios-plugin[root@localhost~]#tar-zxvfnagios-plugins-2.0.3.tar.gz-C/usr/src/[root@localhost~]#cd/usr/src/nagios-plugins-2.0.3/[root@localhost~]#ls[root@localhost~]#./configure--with-nagios-user=nagios--with-nagios-group=nagios[root@localhost~]#make[root@localhost~]#makeinstall[root@localhost~]#cd[root@localhost~]#chkconfig--addnagios[root@localhost~]#chkconfignagioson[root@localhost~]#servicenagiosstart[root@localhost~]#servicenagiosrestart[root@localhost~]#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg//检查配置文件是否有错误或者警告,如果没有的话启动nagios服务[root@localhost~]#servicenagiosstart7,现在我们就可以测试nagios监控本机localhost的情况了,登陆serverip/nagios进去之后会让你输入方才htpasswd创建的用户名和密码(蓝色边框)我擦,图片怎么上传不了呀?上传不了图片就算了。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。