通过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. javascript实现继承的一种方式

    function extend(Child, Parent) { var F = function(){}; F.prototype = Parent.prototype; Child.prototy ...

  2. zoj 2095 Divisor Summation

    和 hdu 1215 一个意思// 只是我 1坑了 1 时应该为0 #include <iostream> #include <math.h> #include <map ...

  3. HDU 5878 I Count Two Three

    I Count Two Three Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  4. [转] GIS二次开发(C#+AE)

    乘风莫邪 原文GIS二次开发(C#+AE) 此过程描述了使用ArcGIS控件建立和部署应用的方法和步骤. 你可以在下面的目录下找到相应的样例程序: <</FONT>安装目录>/ ...

  5. [Papers]NSE, $\pi$, Lorentz space [Suzuki, NA, 2012]

    $$\bex \sen{\pi}_{L^{s,\infty}(0,T;L^{q,\infty}(\bbR^3))} \leq \ve_*, \eex$$ with $$\bex \frac{2}{s} ...

  6. AppServ的安装与配置

    AppServ是一个软件集合,包括Apache(HTTP服务器软件).PHP(网页程序设计语言).MySQL(数据库管理系统软件).phpMyAdmin(图形界面的数据库管理软件)四个组成部分.App ...

  7. springmvc里面的中文乱码问题

    如果是以get方法提交的表单,则可以在comcat服务器的server.xml文件里面设置 <Connector connectionTimeout="20000" port ...

  8. Tkinter教程之Label篇

    本文转载自:http://blog.csdn.net/jcodeer/article/details/1811293 #Tkinter教程之Label篇'''1.Label的第一个例子text属性使用 ...

  9. Javascript手记-执行环境和作用域

    执行环境是javascript一个重要的概念,执行环境定义了变量有权访问其他数据决定了他们各自的行为,每个执行环境 都有一个与之关联的变量,环境中定义的所有变量和函数都保存在这个对象中,虽然我们编写的 ...

  10. Spark系列(五)Master主备切换机制

    Spark Master主备切换主要有两种机制,之中是基于文件系统,一种是基于Zookeeper.基于文件系统的主备切换机制需要在Active Master挂掉后手动切换到Standby Master ...