Nagios 服务端安装
第一步:修改YUM源码
cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
第二步:调整字符集
echo 'export LC_ALL=C'>> /etc/profile
source /etc/profile
echo $LC_ALL
第三部:关闭防火墙
/etc/init.d/iptables stop
/etc/init.d/iptables stop
chkconfig iptables off
setenforce 0 #临时生效
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config #永久生效
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
第四部:时间同步
/usr/sbin/ntpdate pool.ntp.org
echo '#time sync'>>/var/spool/cron/root
echo '*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1'>>/var/spool/cron/root
crontab -l
第五步:安装相关依赖库
yum install gcc glibc glibc-common -y
yum install gd gd-devel -y
yum install httpd php php-gd -y
yum install mysql* -y
第六步:创建NAGIOS用户和组
/usr/sbin/useradd -m nagios
/usr/sbin/groupadd nagcmd
#/usr/sbin/useradd apache ##如果不是yum安装的需要添加apache用户
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
第七步:安装NAGIOS软件
[ ! -d /home/lvnian/tools ] && mkdir /home/lvnian/tools -p
cd /home/lvnian/tools
tar xzf nagios-3.5.1.tar.gz
cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cd ../
第八步:配置web认证
用于打开web页面时,输入用户和密码登录
htpasswd -cb /usr/local/nagios/etc/htpasswd.users lvnian 123456
把密码文件生成在/usr/local/nagios/etc/htpasswd.users的原因是:
[iyunv@Nagios tools]# cat /etc/httpd/conf.d/nagios.conf |grep AuthUserFile
AuthUserFile /usr/local/nagios/etc/htpasswd.users
AuthUserFile /usr/local/nagios/etc/htpasswd.users
[iyunv@Nagios tools]#
第九步:安装ngios插件
cd /home/lvnian/tools
yum -y install perl-devel
tar zxf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make && make install
ls /usr/local/nagios/libexec/|wc -l
cd /home/lvnian/tools
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 ..
第十部:启动nagios
/etc/init.d/nagios start
/etc/init.d/httpd start
lsof -i tcp:80
ps -ef|grep nagios
打开http://10.0.0.3/nagios/ 即可进入nagios页面
输入用户名:lvnian
密码 : 123456
简单安装完成
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com