nagios安装

1.确定Centos系统中是否安装如下软件包:
Apache
GCC compiler
GD development libraries
2.如果没有安装,则按如下方式进行安装:
yum -y install PHP(nagios3.2.0将页面从之前的html换成了php,首次安装需要先决条件php,如果不安装php,则有可能在输入完成nagios的登陆用户后,出现permission 的问题)
yum -y install httpd
yum -y install gcc
yum -y install glibc glibc-common
yum -y install gd gd-devel

3.创建一个nagios user并为其设置password
useradd nagios
passwd nagios
4.创建用户组并将nagios user和apache user加入到用户组中
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
5.下载nagios软件包及nagios插件
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz
如果下载不了,推荐去chinaunix网站下载
http://download.chinaunix.net/search/?key=&q=nagios&frmid=48
编译安装nagios
tar xzf nagios-3.0.6.tar.gz
cd nagios-3.0.6
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
7.配置web接口
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios
最好输入nagiosadmin
重启apache服务器,让刚才的配置生效。
8.安装nagios插件
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios group=nagios
make
make install
9.把nagios服务增加到服务清单中并设置开机自启动
chkconfig –add nagios
chkconfig nagios on
10.检查nagios服务器是否存在配置错误。
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
若没有错误信息就启动nagios服务器
service nagios start
11.在ie中输入
http://“nagios server ipaddress”/nagios/,测试nagios服务器是否已经能正确安装。
安装到此完成,之后做troubleshooting.

备注:templates.cfg里面
define host{            
 name                  linux-server
 use                 generic-host             
 check_period          24x7                   ;检查的周期(在时间配置文件定义timeperiods.cfg
 check_command              check-host-alive ;检测主机存活
 notification_period     24x7                   ;通知周期   
 notification_options      d,u,r                   ;通知的选项,d=down(宕机),u=unreacheable(无法连接),r=recover(恢复)
 contact_groups        admins               ;报警到admin组(在contacts.cfg)
 register                0       
 check_interval                  5 
 retry_interval                    1                 
 max_check_attempts        3                         ;故障后,最大尝试检测次数 
 normal_check_interval      2                         ;正常检查间隔,默认单位为分钟 
 notification_interval         30                      ;故障后,两次报警通知的间隔,默认单位为分钟
 retry_check_interval         2                          ;故障后重试的检查间隔,默认单位为分钟
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值