手机版
你好,游客 登录 注册
背景:
阅读新闻

Ubuntu 11.10搭建和配置Nagios

[日期:2012-04-06] 来源:Linux社区  作者:高文龙 [字体:大 中 小]

回到 /usr/local/src

cd /usr/local/src

解压 nrpe-2.13.tar.gz

sudo tar zxvf nrpe-2.13.tar.gz

cd nrpe-2.13

编译nrpe

sudo./configure –prefix=/usr/local/nagios –with-ssl-inc=/usr/include –with-ssl-lib=/usr/lib/x86-linux-gnu

安装nrpe

sudo make all

sudo make install-plugin

sudo make install-daemon

sudo make install-daemon-config

sudo make install-xinetd

检查是否安装xinetd服务(一般没有安装)

sudodpkg -L xinetd

如果返回”未曾安装软件包xinetd“ 的提示,就需要安装xinetd服务

sudo apt-get install xinetd

将xinetd添加到启动级别中

sudo update-rc.dxinetd defaults

设为随机自启动

sudochkconfigxinetd on

编辑 /etc/services配置文件,添加nrpe的服务端口

sudo vim /etc/services

在尾行添加如下配置

nrpe 5666/tcp # NRPE Service Port

如果是被监控端,还需要编辑 /etc/xinted.d/nrpe

sudo vim /etc/xinetd.d/nrpe

only_from = 127.0.0.1 10.1.10.23(添加nagios的ip地址)

退出并保存

sudochkconfignrpe on

sudo /etc/init.d/xinetd restart

检查nrpe服务是否正常

sudonetstat -at | grepnrpe

如果返回“tcp 0 0 *:nrpe *:* LISTEN”,说明服务正常

启动服务

更改/usr/local/nagios目录的属主和属组

suduochown -R nagios.nagcmd /usr/local/nagios

将nagios添加到启动级别中

sudo update-rc.dnagios defaults

设为随机自启动

sudochkconfignagios on

启动nagios服务

sudo /etc/init.d/nagios start

重启 apache2服务

sudo /etc/init.d/apache2 restart

登录http://localhost/nagios查看页面是否正常

配置nagios主配置文件

sudo vim /usr/local/nagios/etc/nagios.cfg

添加所添加的配置文件

cfg_file=/usr/local/nagios/etc/objects/beyondsoft_servers.cfg

cfg_file=/usr/local/nagios/etc/objects/bys_servers_group.cfg

cfg_file=/usr/local/nagios/etc/objects/services.cfg

beyondsoft_servers.cfg是定义主机的配置文件

bys_servers_group.cfg是定义主机组的配置文件

services.cfg是定义服务并和主机组相关联的配置文件

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款