文档详情

CentOS nagios实现主机监控 发短信到手机.doc

发布:2017-12-18约1.3万字共12页下载文档
文本预览下载声明
CentOS nagios实现主机监控 发短信到手机/aicom/blog/item/e314e8c4e91315a38226ac0a.html CentOS nagios实现主机监控 发短信到手机 主要参考资料:/nagios-cn/ 软件如下: CentOS 5.2,安装时怕又出现这依赖那依赖的,把develop tools选上,省事,硬盘也有地方。 nagios-3.0.3 nagios-plugin-1.4.13 gnokii,一个gnokii-0.6.28cvs,另一个0.6.12,分别测试的。 CentOS自带的httpd-2.2,看网上好多介绍都是用源码装httpd,我嫌麻烦。 一.建组建帐号 CODE: groupadd nagcmd useradd apache useradd nagios usermod -G nagcmd nagios usermod -G nagcmd apache 二.编译nagios-3.0.3 CODE: ./configure --with-command-group=nagcmd make all make install make install-init make install-commandmode make install-config 三.配置WEB接口 CODE: make install-web htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin ;创建一个登录WEB的帐号 四.装nagios-plugin-1.4.13 CODE: ./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install 五.将nagios加入服务并启动,同时启动apache CODE: chkconfig --add nagios chkconfig nagios on 验证nagios的安装 CODE: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 如果出现下面的提示就OK了 CODE: Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check [root@host nagios]# 启动nagios和apache服务 CODE: service nagios start service httpd start 六.禁用selinux 我登录WEB页面好几次都无法通过验证,仔细看了一下说明发现是selinux的问题。 CODE: #setenforce 0 这么改完不需要重启系统就可生效,Getenforce可看到permissive。但一重启就又得来一次,我的CentOs上也没别的,直接disable吧 CODE: [root@host nagios]# more /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # ?? enforcing - SELinux security policy is enforced. # ?? permissive - SELinux prints warnings instead of enforcing. # ?? disabled - SELinux is fully disabled. SELINUX=disabled 现在可以用http://IP/nagios来登录了,用户名nagiosadmin。不过这时什么设备、服务都没监控,就是个花架子。 我第一次安装成功时直接用http://ip登录的,之后再装,每次打开都是apache的默认页面,后来在论坛里“不是神不会猜的”jerrywjl指 导了一下,才登录成功。不过百思不得其解,第一次装的时候就老老实实地把步骤记下来了,以后都是把命令copy到屏幕上装的,为啥就不一样了?还是 jerrywjl说了,肯定有不一样的地方,机器不会骗我们。不管如何,能用就行。 七.定义联系人和联系人组。我定义了三个人,两个组。前两个人在第一组里,第三个人在第二组里。 CODE: #### 定义第一个联系人 define contact{ ?? ?? ?? ; ?? ?
显示全部
相似文档