标签: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 ~]#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
[root@localhost ~]#wget http://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 ~]#make install-webconf [root@localhost ~]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin //htpasswd.users的文件名称一定要写正确 [root@localhost ~]#service httpd restart 7,编译安装nagios-plugin [root@localhost ~]#tar -zxvf nagios-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 ~]#make install [root@localhost ~]#cd [root@localhost ~]#chkconfig --add nagios [root@localhost ~]#chkconfig nagios on [root@localhost ~]#service nagios start [root@localhost ~]#service nagios restart [root@localhost ~]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //检查配置文件是否有错误或者警告,如果没有的话启动nagios服务 [root@localhost ~]#service nagios start 7,现在我们就可以测试nagios监控本机localhost的情况了,登陆 server ip/nagios 进去之后会让你输入方才htpasswd创建的用户名和密码(蓝色边框) 我擦,图片怎么上传不了呀?上传不了图片就算了。
本文出自 “linux菜鸟” 博客,请务必保留此出处http://ludihua.blog.51cto.com/4601284/1536113
nagios的搭建及配置----(上),布布扣,bubuko.com
标签:nagios的搭建及配置
原文地址:http://ludihua.blog.51cto.com/4601284/1536113