通过yum安装Nagios
2012年04月05日 ⁄ Nagios ⁄ 暂无评论
 
 

前提先自行安装好Apache+php

测试环境
主监控机:CentOS 6.0
被监控机:CentOS 6.2

主监控机设置:
1、安装epel
# cat /etc/issue
CentOS release 6.0 (Final)
Kernel \r on an \m

# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
2、安装nagios、nagios-plugin与nrpe (nagios 3.3.1版本)
# yum install nagios nagios-plugins nagios-plugins-all nagios-plugins-nrpe nrpe

3、创建一个nagiosadmin 的用户用于Nagios的WEB接口登录,用户认证配置
# htpasswd -c /usr/local/nagios/etc/htpasswd.users admin
New password:
Re-type new password:
Adding password for user nagiosadmin

4、修改nagios.conf
修改保存用户密码文件
AuthUserFile /etc/nagios/passwd 修改成--> AuthUserFile /etc/nagios/htpasswd.users
保存退出

5、修改cgi.cfg文件,找到use_authentication=1 这行,把1改成0

6、启动apache与nagios
# /etc/init.d/httpd restart
# /etc/init.d/nagios start

7、登陆http://localhost/nagios/,输入用户密码后查看是否正常运行
注:别忘记了nagios后面那个/,不然……

被监控机设置:
1、安装需要软件
# yum install nagios-plugins nagios-plugins-nrpe nrpe

2、配置nrpe
# vi /etc/nagios/nrpe.cfg 修改监控机的地址或域名
allowed_hosts=127.0.0.1,192.168.5.11

3、修改/etc/hosts.allow增加监控机ip
# echo 'nrpe:192.168.5.22' >> /etc/hosts.allow

4、检查 NRPE 是否正常:
# /usr/lib/nagios/plugins/check_nrpe -H 192.168.5.11
NRPE v2.12
查看相应的端口:netstat -an |grep 5666
防火墙开启5666 允许局域网IP或固定IP连接

5、启动 NRPE 守护进程:
# /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d

在回到监控机:
添加nrpe的定义
# vi commands.cfg
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

增加主机监控配置项11.cfg
define host{
use linux-server
host_name 192.168.5.11
alias 192.168.5.11
address 192.168.5.11
}
define service{
use generic-service
host_name 192.168.5.11
service_description load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name 192.168.5.11
service_description PING
check_command check_ping!100.0,20%!200.0,50%
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.5.11
service_description FTP
check_command check_ftp!21
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.5.11
service_description SSH
check_command check_ssh
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.5.11
service_description HTTP
check_command check_http
max_check_attempts 5
normal_check_interval 1
}

并把11.cfg添加到nagios主配置项
# echo "cfg_file=/etc/nagios/objects/11.cfg" >> /etc/nagios/nagios.cfg
其他机器如法炮制即可

重启监控机nagios查看效果,关于短信通知参考另外一篇文章 http://blog.51bbo.com/archives/651

通过yum安装Nagios的更多相关文章

  1. Nagios监控平台之一:在Centos上安装Nagios服务

    1.安装依赖包 #yum install httpd httpd-devel php openssl-devel #yum install gcc glibc glibc-common #yum in ...

  2. Linux CentOS 6.5 yum安装MongoDB的操作

    安装MongoDB的方法有很多种,可以源代码安装,在CentOS也可以用yum源安装的方法.由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法.64位CentOS下的安装步骤如下: 1.准 ...

  3. centos下安装nagios

    摘要Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等. Nagios是一款开源的免费网络监视工具,能有效监控Wind ...

  4. CentOS 安装nagios

    Nagios的介绍: 1.Nagios是一个监控系统运行状态和网络信息的监控系统.它能监控所指定的本地或远程主机的系统状态以及运行的服务,同时提供异常通知的功能. 2. Nagios可运行在Linux ...

  5. ubuntu下安装nagios

    第一步安装apache root@root01-virtual-machine:/etc/apache2/conf-available# vi charset.conf 可修改apache服务器的编码 ...

  6. centos7安装nagios步骤

    一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...

  7. centos7上安装nagios

    前言:Nagios是一款开源的免费网络监视工具,可以监控Windows.Linux和Unix的主机状态,交换机路由器等网络设备,在系统或服务状态异常时发出邮件或短信报警,第一时间通知网站运维人员.流量 ...

  8. LDAP-openldap服务部署和测试(YUM安装)

    1. 概述2. 服务端部署过程2.1 软件包说明2.2 部署过程2.3 配置过程3. 测试4. 生成LDIF格式文件4.1 安装migrationtools工具4.2 用migrationtools生 ...

  9. yum安装nagois

    多少年前就装过了,今天再来用yum装一次,都忘干净了~~ 主监控机:CentOS 6.5 192.168.0.105被监控机:CentOS 6.5 192.168.0.107 主监控机设置:1.安装e ...

随机推荐

  1. How to delete a team project from Team Foundation Service (tfs.visualstudio.com)

    C:\project>tfsdeleteproject /collection:https://buckh-test2.visualstudio.com/DefaultCollection Te ...

  2. RPi 2B Raspbian SD卡内部架构

    /***************************************************************************** * RPi 2B Raspbian SD卡 ...

  3. HTML5全球普及加速:有望终结iOS与安卓界限【转】

    HTML5或将成为未来移动互联网时代的颠覆者. 5年前,当第一台iPhone诞生时,乔布斯断然拒绝了FlashPlayer,而选择HTML5(新型网页标准)取代Flash的功能.他曾预言,“虽然现阶段 ...

  4. IO负载高的来源定位

    前言: 在一般运维工作中经常会遇到这么一个场景,服务器的IO负载很高(iostat中的util),但是无法快速的定位到IO负载的来源进程和来源文件导致无法进行相应的策略来解决问题. 这个现象在MySQ ...

  5. 类装载器ClassLoader

    类装载器工作机制 类装载器就是寻找类的节码文件并构造出类在JVM内部表示对象的组件.在Java中,类装载器把一个类装入JVM中,要经过以下步骤: [1.]装载:查找和导入Class文件: [2.]链接 ...

  6. 《C++ primer》--第10章

    习题10.21 解释map和set容器的差别,以及他们各自适用的情况. 解答: map容器和set容器的差别在于: map容器是键-值对的集合,而set容器只是键的集合: map类型适用于需要了解键与 ...

  7. 有关T-SQL的10个好习惯(转)

    1. 在生产环境中不要出现Select * 这一点我想大家已经是比较熟知了,这样的错误相信会犯的人不会太多.但我这里还是要说一下. 不使用Select *的原因主要不是坊间所流传的将*解析成具体的列需 ...

  8. [OFBiz]开发 二

    1.svn中check出的apache-ofbiz-10.04(svn_2010-04-01代码备分)由于它的所有文件都不含有中文,所以Eclipse使用什么编码方式都可以(ISO, GBK, UTF ...

  9. 深入学习Android有关网络连接的内容

    基于实际项目中碰到的些许问题,开始重新深入学习Android网络连接有关知识. Android的4.1.2版本的AndroidHttpClient模块setSoTimeout之后实际超时时间和设置的时 ...

  10. Struts2动态调用DMI及错误解决方法

    在Strust2中action可以定义自己的方法,调用方法有两种方式,一种方式是struts.xml中指定method来表示需要用到的方法, 但是这种方法缺点在于如果你的Action中有很多方法则要多 ...