免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 949 | 回复: 0
打印 上一主题 下一主题

nagis 安装篇 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-21 16:16 |只看该作者 |倒序浏览

v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

  Normal
  0
  
  7.8 磅
  0
  2
  
   
   
   
   
   
   
   
  
  

Nagios 安装
1.       下载源软件  
www.nagios.org
   
www.apache.org


主要文件:
nagios-3.0.4.tar.gz
nagios-plugins-1.4.13.tar.gz
httpd-2.0.63.tar.gz
参考网站文档:
http://blog.chinaunix.net/u/28387/article_63200.html
http://blog.chinaunix.net/u/28387/article_63200.html
官方:
http://nagios.sourceforge.net/docs/3_0/
2.       nagios 服务器端安装
(1)       操作系统环境:
redhat AS5 64bit
update5 kernel:2.6.9.55

(2) 安装步骤
[root@wxserver2 nagios-3.0.4]# useradd
nagios
[root@wxserver2
nagios-3.0.4]# mkdir /usr/local/nagios
[root@wxserver2
nagios-3.0.4]# chown nagios.nagios /usr/local/nagios

tar zxvf  nagios-3.0.4.tar.gz
cd nagios-3.0.4
./configure –prefix=/usr/local/nagios
make all
make install
make install-config
make install-config
ls /usr/local/nagios

   /usr/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios
New password:
Re-type new password:
Adding password for user nagios

将nagios的信息加到apache中,打开/etc/httpd/conf/httpd.conf文件,在文件最后添加如下代码:

  
  ScriptAlias
  /nagios/cgi-bin /usr/local/nagios/sbin
   
  Options ExecCGI
  AllowOverride None
  
  Order allow,deny
  Allow from all
  AuthName
  "Nagios Access"
  AuthType Basic
  AuthUserFile
  /usr/local/nagios/etc/htpasswd.users
  Require valid-user
  
  
  
  Alias /nagios
  /usr/local/nagios/share
   
  Options None
  AllowOverride None
  
  Order allow,deny
  Allow from all
  AuthName
  "Nagios Access"
  AuthType Basic
  AuthUserFile
  /usr/local/nagios/etc/htpasswd.users
  Require valid-user
  
  
  
  



至此,nagios的WEB配置部分完成。继续

安装插件:
tar nagios-plugins-1.4.13
cd nagios-plugins-1.4.13
./configure –prefix=/usr/local/nagios       ###此步是指您的nagios的安装目录。
make;make install

检查一下:
ls /usr/local/nagios/libexec

测试:
./check_icmp -H
www.baidu.com
   

OK - www.baidu.com:
rta 33.632ms, lost 0%|rta=33.632ms;200.000;500.000;0; pl=0%;40;80;;
至此,插件安装完成,下面要修改配置文件:
由于我用的是3系列的版本,和网上田老师和
loesprite.cublog.cn
作者介绍的都是版本2的,不太一样,主要就是配置文件的目录有一点点区别,其他的配置都一样。
1.  Nagios.cfg 文件,这是nagios的主要配置文件:
我修改以下内容:
cfg_file=/usr/local/nagios/etc/objects/windows.cfg    #将此行启用,前面的注释符号去掉。因为我要监控的服务器都是WINDOWS平台的。

check_external_commands=0为check_external_commands=1 .这行的作用是允许在web界面下执行重启nagios、停止主机/服务检查等操作。版本3的,默认选项即可。
把command_check_interval的值从默认的1改成command_check_interval=10s(根据自己的情况定这个命令检查时间间隔,不要太长也不要太短)。为了测试需要,时间短些可以看到效果,要不等报警的邮件等的时间太长了。
2.  Cgi.cfg文件:
authorized_for_system_information=nagiosadmin,nagios
authorized_for_configuration_information=nagiosadmin,nagios
authorized_for_system_commands=nagios
//多个用户之间用逗号隔开
authorized_for_all_services=nagiosadmin,nagios
authorized_for_all_hosts=nagiosadmin,nagios
authorized_for_all_service_commands=nagiosadmin,nagios
authorized_for_all_host_commands=nagiosadmin,nagios

##nagios 这个用户是之前用/usr/local/apache/bin/htpasswd –c /usr/local/nagios/etc/htpasswd nagios 所生成的,这个要注意,不能随便加没有存在的验证用户,为了安全起见,不要添加过多的验证用户



[root@wxserver2 objects]#
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 3.0.4
Copyright (c) 1999-2008 Ethan Galstad
(http://www.nagios.org)
Last Modified: 10-15-2008
License: GPL

Reading configuration data...

Error in configuration file
'/usr/local/nagios/etc/nagios.cfg' - Line 551 (NULL value)

***> One or more problems was
encountered while processing the config files...

   
Check your configuration file(s) to ensure that they contain valid
   
directives and data defintions.
If you are upgrading from a previous
   
version of Nagios, you should be aware that some variables/definitions
   
may have been removed or modified in this version.  Make sure to read
   
the HTML documentation regarding the config files, as well as the
   
'Whats New' section to find out what has changed.

[root@wxserver2 objects]# vi ../nagios.cfg   #注意掉551行time_change_threshold=

[root@wxserver2 objects]#
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 3.0.4
Copyright (c) 1999-2008 Ethan Galstad
(http://www.nagios.org)
Last Modified: 10-15-2008
License: GPL

Reading configuration data...

Running pre-flight check on configuration
data...

Checking services...
      
Checked 15 services.
Checking hosts...
      
Checked 2 hosts.
Checking host groups...
      
Checked 2 host groups.
Checking service groups...
      
Checked 0 service groups.
Checking contacts...
      
Checked 1 contacts.
Checking contact groups...
      
Checked 1 contact groups.
Checking service escalations...
      
Checked 0 service escalations.
Checking service dependencies...
      
Checked 0 service dependencies.
Checking host escalations...
      
Checked 0 host escalations.
Checking host dependencies...
      
Checked 0 host dependencies.
Checking commands...
      
Checked 24 commands.
Checking time periods...
      
Checked 5 time periods.
Checking for circular paths between
hosts...
Checking for circular host and service
dependencies...
Checking global event handlers...
Checking obsessive compulsive processor
commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were
detected during the pre-flight check

[root@wxserver2 objects]#
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
启动发现,启动异常
查看share/nagios.log
文件,发现错误如下:
[1224570550] Error: Could not create
external command file '/usr/local/nagios/var/rw/nagios.cmd' as named pipe: (2)
-> No such file or directory.  If
this file already exists and you are sure that another copy of Nagios is not
running, you should delete this file.
[1224570550] Bailing out due to errors
encountered while trying to initialize the external command file... (PID=20619)
mkdir rw
chown nagios.nagios rw


[1224570746] Error: Cannot open main
configuration file '/usr/local/nagios/var/d' for reading!

Mkdir d
Chown nagios.nagios d

至此,nagios 可以暂时简陋的启动,可以看一下他的运行情况及状态。其他的进一步去设置:
需要过几分钟才能看到相关的状态信息。



此服务器做的别用处,SENDMAIL我早就关掉了。现在不能正常启动,发送邮件的情况可能看不到了。


               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/34688/showart_1331264.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP