通过yum安装Nagios
主监控机设置:
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-8.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 /etc/nagios/passwd nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
4、修改nagios.conf
修改保存用户密码文件
AuthUserFile /etc/nagios/passwd 修改成--> AuthUserFile /etc/nagios/htpasswd.users
保存退出
5、,要改变nagios所在目录rw的权限,命令如下。
先找出目录find / -name nagios
查看权限命令ls -l /usr/lib/nagios
非系统目录则添加rw权限
chown nagios.nagios /etc/logrotate.d/nagios
chmod g+w /etc/logrotate.d/nagios
chown -R nagios.nagios /etc/nagios
最后重起nagios:
/etc/init.d/nagios restart
再去更新设置,就能成功了!
6、启动apache与nagios
# /etc/init.d/httpd restart
# /etc/init.d/nagios start
7、登陆http://localhost/nagios/,输入用户密码后查看是否正常运行
注:别忘记了nagios后面那个/,不然……
发现iptables没加相应的端口
vi /etc/sysconfig/iptables
编辑一下,添加相应的端口;
service iptables restart
现在可以访问了;
--------------------------------------------------
--------------------------------------------------
被监控机设置:
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
其他机器如法炮制即可
通过yum安装Nagios相关推荐
- CentOS 6.5安装nagios
linux下nagios安装 系统环境:CentOS 6.5 安装包:httpd-2.2.12.tar.bz2 , pcre-8.30.tar.bz2 , php-5.4.6.tar.bz2 ...
- centos 5.4 x64 安装nagios 3.2.3
Nagios 安装 一 ,准备工作,最小化安装系统 系统版本 centos 5.4 http://www.verycd.com/topics/2776496/ nagios-3.2.3.tar htt ...
- CentOS7安装Nagios并配置出图详解
目录 开始之前 系统环境 监控内容 所需软件包 CentOS7重要变化 配置开发环境 同步时间 关闭Selinux 使用CRT上传软件包 安装邮件服务 监控主机安装 常用到的命令 安装nagios所需 ...
- centos6.4安装nagios—4.0.8
一.安装环境的配置 1.关闭防火墙. [root@Nagios ~]# service iptables stop 2.关闭SELinux [root@Nagios ~]# vim /etc/seli ...
- linux下安装nagios
本篇介绍在linux主机上安装nagios,监控本机. 实验环境:rhel5.6.nagios-3.2.3.tar.gz.nagios-plugins-1.4.15.tar.gz 实验过程: 本实验有 ...
- CentOS安装Nagios网络监视工具
Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员, ...
- CentOS7安装Nagios
一.nagios简介 Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一 ...
- 安装nagios中php安装报错 configure error xml2-config not foud
安装nagios时其中少不了角色php安装时报错: configure error xml2-config not foud. please check your libxm2 installatio ...
- linux环境中nagios(nagios core)安装?nagios安装?
linux环境中nagios(nagios core)安装?nagios安装? 需求描述: 最近准备给线上生产环境部署监控平台,对各个系统的资源使用情况,服务进行监控,采用nagios core版本进 ...
最新文章
- 千亿参数大模型时代,QQ浏览器团队十亿级小模型「摩天」登顶CLUE
- 关于Kotlin语法的异议
- Android平台调用WebService详解
- 算法提高课-图论-差分约束- AcWing 1169. 糖果:spfa求单源最短路、差分约束
- 声明对象_计算机各语言数据类型及对象声明之区别
- 内容分发网络(CDN) 是什么
- Oracle常用数据字典表
- python环形链表的使用
- bum报文_Vxlan学习笔记——原理
- jdk5.0下支持JSR-223的方法
- 计算机中缺失freeimage.dll,修复freeimage.dll
- 购物也能乐开花 淘宝搞笑评价集萃--2
- 微PE制作U盘启动盘步骤
- sd卡U盘异常检测程序
- 【在SpringBoot项目中使用Validation框架检查数据格式-常用的检查注解】
- 目标检测 | RCNN算法系列汇总+详解(包括Fast, Faster)
- k8s集群Deployment与Service+名称空间
- 【STM32F407】第4章 ThreadX FileX文件系统移植到STM32F407(SD卡)
- tp5insertAll和saveAll
- Java程序员日常积累-向大神学习(三)