加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

教你在Ubuntu 11.10中搭建和配置Nagios

发布时间:2016-11-04 04:33:03 所属栏目:Linux 来源:网络整理
导读:我们都知道Nagios是一个监视系统运行状态和网络信息的监视系统。Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等。Nagios可运行在Linux/U

回到 /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 服务(一般没有安装)

sudo dpkg -L xinetd

查看本栏目更多精彩内容:http://www.bianceng.cn/OS/Linux/

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

sudo apt-get install xinetd

将xinetd添加到启动级别中

sudo update-rc.d xinetd defaults

设为随机自启动

sudo chkconfig xinetd 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地址)

退出并保存

sudo chkconfig nrpe on

sudo /etc/init.d/xinetd restart

检查nrpe服务是否正常

sudo netstat -at | grep nrpe

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

启动服务

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

suduo chown -R nagios.nagcmd /usr/local/nagios

将nagios添加到启动级别中

sudo update-rc.d nagios defaults

设为随机自启动

sudo chkconfig nagios 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/dsgrd_servers.cfg

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

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

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

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

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

教你在Ubuntu 11.10中搭建和配置Nagios

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读