通过yum安装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的更多相关文章
- Nagios监控平台之一:在Centos上安装Nagios服务
1.安装依赖包 #yum install httpd httpd-devel php openssl-devel #yum install gcc glibc glibc-common #yum in ...
- Linux CentOS 6.5 yum安装MongoDB的操作
安装MongoDB的方法有很多种,可以源代码安装,在CentOS也可以用yum源安装的方法.由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法.64位CentOS下的安装步骤如下: 1.准 ...
- centos下安装nagios
摘要Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等. Nagios是一款开源的免费网络监视工具,能有效监控Wind ...
- CentOS 安装nagios
Nagios的介绍: 1.Nagios是一个监控系统运行状态和网络信息的监控系统.它能监控所指定的本地或远程主机的系统状态以及运行的服务,同时提供异常通知的功能. 2. Nagios可运行在Linux ...
- ubuntu下安装nagios
第一步安装apache root@root01-virtual-machine:/etc/apache2/conf-available# vi charset.conf 可修改apache服务器的编码 ...
- centos7安装nagios步骤
一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...
- centos7上安装nagios
前言:Nagios是一款开源的免费网络监视工具,可以监控Windows.Linux和Unix的主机状态,交换机路由器等网络设备,在系统或服务状态异常时发出邮件或短信报警,第一时间通知网站运维人员.流量 ...
- LDAP-openldap服务部署和测试(YUM安装)
1. 概述2. 服务端部署过程2.1 软件包说明2.2 部署过程2.3 配置过程3. 测试4. 生成LDIF格式文件4.1 安装migrationtools工具4.2 用migrationtools生 ...
- yum安装nagois
多少年前就装过了,今天再来用yum装一次,都忘干净了~~ 主监控机:CentOS 6.5 192.168.0.105被监控机:CentOS 6.5 192.168.0.107 主监控机设置:1.安装e ...
随机推荐
- 安装--SambaServce
参考地址:快跑蚂蚁的linux之旅--redhat安装配置samba实验win共享linux主机目录 1.使用rpm -qa|grep "samba",查看samba安装包是否安装 ...
- Ecshop ajax 局部刷新购物车功能
1.比如我们category.dwt 里有 <a href='flow.php'><SPAN id='cart_count_all'>{insert name='cart_in ...
- InnoDB一定会在索引中加上主键吗
InnoDB一定会在索引中加上主键吗 http://www.penglixun.com/tech/database/will_innodb_store_pk_in_index.html
- POJ 1042 Gone Fishing
题意:一个人要在n个湖中钓鱼,湖之间的路径是单向的,只能走1->2->3->...->n这一条线路,告诉你每个湖中一开始能钓到鱼的初始值,和每钓5分钟就减少的数量,以及湖之间的 ...
- xml-xml试题
ylbtech-doc:xml-xml试题 xml试题 1.A,xml试题返回顶部 01.{XML题目}关于XML声明正确的是.(选择1项) A)<!xml version=”1.0”!> ...
- (转载) VS编译duilib项目时候的错误解决方法整理
原文地址:http://blog.csdn.net/x356982611/article/details/30217473 @1:找不到Riched20.lib 用everything等软件搜索下磁盘 ...
- 提取数字、英文、中文、过滤重复字符等SQL函数(含判断字段是否有中文)
--SQL 判断字段值是否有中文 create function fun_getCN(@str nvarchar(4000)) returns nvarchar(4000) a ...
- 告别where 1=1 最佳方案分享
已经有2年没有用过where 1=1了,没想到换了家公司后,又让我看到了它.在网络上面搜索了一下,发现没有人提供一个比较好的方案来解决这一问题.很多人说可以让数据库的优化机制去处理,但是,我想对于大部 ...
- 【原】Storm学习资料推荐
4.Storm学习资料推荐 书籍: 英文: Learning Storm: Ankit Jain, Anand Nalya: 9781783981328: Amazon.com: Books Gett ...
- 优秀java开源项目与解决方案推荐与概论
http://www.oschina.net/project/lang/19/java http://www.open-open.com/ http://java-source.net/ https: ...