|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!1.创立nagios用户和用户组
[root@Centos~]#useradd-s/sbin/nologinnagios
[root@Centos~]#mkdir/usr/local/nagios
2.预备装置情况
[root@Centos~]#yuminstallCyphphttpdgccglibcglibc-commongdgd-develphp-develphp-mysqlmysqlmysql-serverphp-snmpphp-pdoperl-DBD-MYSQLphp-pearopenssl-devel
3.下载并装置nagios4.0
[root@Centos~]#cd/usr/local/
[root@Centos~]#wgethttp://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.0/nagios-4.0.0.tar.gz
[root@Centos~]#tar-zxvfnagios-4.0.0.tar.gz
[root@Centos~]#chown-Rnagios.nagios/usr/local/nagios
[root@Centos~]#cdnagios
[root@Centos~]#./configure--prefix=/usr/local/nagios
[root@Centos~]#makeall
[root@Centos~]#makeinstall
备注:{
makeinstall用来装置nagios的主法式,CGI和HTML文件
makeinstall-init敕令可以在/etc/rc.d/init.d目次下创立nagios启动剧本
makeinstall-commandmode敕令来设置装备摆设目次权限
makeinstall-cofig敕令用来装置nagios示例设置装备摆设文件,这里装置的路径是/usr/local/nagios/etc
makeinstall-webconf用来为nagiosweb接口装置apache设置装备摆设文件
}
[root@Centos~]#makeinstall-init
[root@Centos~]#makeinstall-commandmode
[root@Centos~]#makeinstall-cofig
[root@Centos~]#makeinstall-webconf
4.装置nagios的插件
[root@Centos~]#wgethttp://nchc.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz
[root@Centos~]#tar-zxvfnagios-plugins-1.4.16.tar.gz
[root@Centos~]#cdnagios-plugins-1.4.16
[root@Centos~]#./configure--prefix=/usr/local/nagios
[root@Centos~]#makeall&&makeinstall
5.设置装备摆设httpd和php
修正httpd的设置装备摆设文件/etc/httpd/conf/httpd.conf
找到以下两行
Userapache
Groupapache
修正为
Usernagios
Groupnagios
然后找到
DirectoryIndexindex.htmlindex.html.var
修正为
DirectoryIndexindex.htmlindex.html.varindex.php
再在其下增长以下行
AddTypeapplication/x-httpd-php.php
在设置装备摆设文件末尾增长以下信息:
#settingfornagios
ScriptAlias/nagios/cgi-bin"/usr/local/nagios/sbin"
<Directory"/usr/local/nagios/sbin">
AuthTypeBasic
OptionsExecCGI
AllowOverrideNone
Orderallow,deny
Allowfromall
AuthName"NagiosAccess"
AuthUserFile/usr/local/nagios/etc/htpasswd
Requirevalid-user
</Directory>
Alias/nagios"/usr/local/nagios/share"
<Directory"/usr/local/nagios/share">
AuthTypeBasic
OptionsNone
AllowOverrideNone
Orderallow,deny
Allowfromall
AuthName"nagiosAccess"
AuthUserFile/usr/local/nagios/etc/htpasswd
Requirevalid-user
</Directory>
ServerNamenagios:80
保留设置装备摆设文件
6.设置装备摆设hosts文件
因为我没有外部DNS办事器,所以只能编纂hosts文件
7.启动httpd办事
servicehttpdstart
8.新增验证文件
[root@Centosnagios]#/usr/bin/htpasswd-c/usr/local/nagios/etc/htpasswdArthur
Newpassword:(输出暗码)
Re-typenewpassword:(再输出一次暗码)
AddingpasswordforuserArthur
在/usr/local/nagios/etc下就会新增一个htpasswd验证文件
9.把nagios参加到启动办事选项中
chkconfig--level35nagioson
10.启动nagios办事
/etc/rc.d/init.d/nagiosstart或许servicenagiosstart
11.封闭SELINUX和IPTABLES
setenforce0
serviceiptablesstop
这是暂时封闭,重启后又会开启的!
12.拜访nagios
用阅读器输出nagios/nagios,然后输出帐号方才创立的arthur帐号和暗码,终究看到久背的页面
本文出自“谢海棠”博客,请务必保存此出处http://xiehaitang.blog.51cto.com/4914337/1301145
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们! |
|