Nagios 配置指南(1)(5)
千辛万苦,终于把这些配置给做好保存,现在几乎有点迫不及待了,运行程序/usr/local/nagios –v /usr/local/nagios/etc/nagios.cfg来检查所有配置文件的正确性。如果十分幸运的话,运行完毕将在输出尾部出现
- Total Warnings: 0
- Total Errors: 0
- Things look okay - No serious problems were detected during the pre-flight check
这样的情况,大功告成;但我却没有这么幸运,修改了好多个地方才成功。不过值得庆幸的是,这个校验的错误报告时非常有用的(不象有的系统的帮助文档中看不中用)。看我故意设置的一个错误产生的输出:
- [root@netmonitor nagios]# bin/nagios -v etc/nagios.cfg
- Nagios 2.5
- Copyright (c) 1999-2006 Ethan Galstad ([url]http://www.nagios.org[/url])
- Last Modified: 07-13-2006
- License: GPL
- Reading configuration data...
- Error: Could not find any host matching 'nagios-server'
- Error: Could not expand member hosts specified in hostgroup (config file '/usr/local/nagios/etc/hostgroups.cfg', starting on line 2)
它告诉我配置文件在什么位置产生错误(实际上我故意在配置文件里加了一个注释符号来测试)。验证通过以后,就可以执行命令/usr/local/nagios –d /usr/local/nagios/etc/nagios.cfg 把nagios作为守护进程。然后用ps –aux | grep nagios 看进程是否处于运行状态。到这一步,nagios服务基本上算是配置完毕。做hosts.cfg、services.cfg等配置时,可以运用一些小技巧来减少出错的概率:如先定义少许的主机、服务,待校验无误后再追加。
通过文章详细的描述,我们都应该学会nagios配置,为自己的系统保驾护航!
评论暂时关闭