nagios监控系统安装及配置
Nagios通常由一个主程序(Nagios)、一个插件程序(Nagios-plugins)和四个可选的ADDON(NRPE、NSCA、NSClient++和NDOUtils)组成。Ngios的监控工作都是通过插件实现的,因此,Nagios和Nagios-plugins是服务器端工作所必须的组件,而四个ADDON中
1、NRPE:用来监控远程linux/unix主机上执行脚本插件以实现对这些主机资源的监控
2、NSCA:用来让被监控的远程linux/unix主机主动将监控信息发送给Nagios服务器(这在冗余监控模式中特别要用到)
3、NSClient++:用来监控windows主机是安装在windows主机上的组件
4、NDOUtils:是用来将Nagios的配置信息和个event产生的数据存入数据库,以实现这些数据的快速检索和处理
这四个ADDON(附件)中,NRPE和NSClient++工作与客户端,NDOUtils工作于服务器端,而NSCA则于鏊同事安装在服务器端和客户端
nagios安装
一、安装nagios需要的rpm包:
# yum -y install httpd php mysql-devel php-mysql
二、添加nagios运行所需要的用户和组
# groupadd nagcmd
# useradd -G nagcmd nagios
# passwd nagios
把apache加入到nagcmd组,以便于在通过web interface操作nagios时能够具有足够的权限
# usermod -a -G nagcmd apache
三、编译nagios:
# tar -zxvf nagios-3.5.0.tar.gz
# ./configure --sysconfdir=/etc/nagios --with-command-group=nagcmd --enable-event-broker
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
在httpd的配置文件目录(conf.d)中创建nagios的Web程序配置文件
# make install-webconf
--sysconfdir=/etc/nagios 配置文件的位置
--enable-event-broker 可以使用你NDOUtils连接mysql数据库的
四、为email指定您想用来接收nagios警告信息的邮件地址,默认是本机的nagios用户
# vim /etc/nagios/objects/contacts.cfg
五、创建一个登录nagios web程序的用户,这个账号在以后通过web登陆nagios认证是所用:
# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
六、selinux会组织cgi脚本的运行,要么关闭selinux
# setenforce 0
或者执行下面的两个命令
# chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin
# chcon -R -t httpd_sys_content_t /usr/local/nagios/share
启动apache服务:
# /etc/init.d/httpd start
七、如果源码安装apache是遇到如下问题
./configure --prefix=/usr/local/apache 报错
error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
解决方法
cp -fr apr-1.4.8 ./httpd-2.4.6/srclib/apr
cp -fr apr-util-1.5.2 ./httpd-2.4.6/srclib/apr-util
./configure --prefix=/usr/local/apache 继续报错
解决办法安装pcre
安装pcre报错error: You need a C++ compiler for C++ support.
安装c++编译器
yum install -y gcc gcc-c++
八、编译、安装nagios-plugins
nagios的所有监控工作都是通过插件完成的,因此,在启动nagios之前还需要为其安装官方提供的插件
# tar zxvf nagios-plugins-1.4.16.tar.gz
# cd nagios-plugins-1.4.16
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install
九、将nagios添加到服务列表中并设置为开机自启动
# chkconfig --add nagios
# chkconfig nagios on 2345
十、启动nagios
# /etc/init.d/nagios start
到此为止nagios的页面就可以访问了可以登录
利用nrpe监控linux主机
一、安装nagios-plugins
# tar -zxvf nagios-plugins-1.4.16.tar.gz
# cd nagios-plugins-1.4.16
# useradd -s /sbin/nologin -r nagios
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make all
# make install
二、安装nrpe
# tar -zxvf nrpe-2.15.tar.gz
# cd nrpe-2.15
# ./configure --with-nrep-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
三、启动nrpe进程
# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d
四、编写nrped启动脚本,设置开机自启动
# vim /etc/init.d/nrped 加入如下内容
#!/bin/sh
nrpe_num=`ps aux | grep /bin/nrpe | grep -v grep | wc -l`
case $1 in
start)
if [ $nrpe_num -eq 1 ]
then
echo "Error:nrpe is running."
else
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
echo "nrpe started successfully."
fi
;;
stop)
if [ $nrpe_num -eq 1 ]
then
nrpe_pid=`ps aux | grep /bin/nrpe | grep -v grep | awk '{print $2}'`
kill -9 $nrpe_pid
echo "nrpe stoped successfully."
else
echo "Error:nrpe is stoping."
fi
;;
restart)
if [ $nrpe_num -eq 1 ]
then
nrpe_pid=`ps aux | grep /bin/nrpe | grep -v grep | awk '{print $2}'`
kill -9 $nrpe_pid
echo "nrpe stoped successfully."
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
echo "nrpe started successfully."
else
echo "Error:nrpe is stoping"
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
echo "nrpe started successfully."
fi
esac
赋予nrped执行权限:
# chmod 755 nrped
# chkconfig --add nrped
# chkconfig --list nrped
如果2345是关闭
# chkconfig --level 2345 nrped on
五、服务端也要安装nrpe
# ./configure --sysconfdir=/etc/nagios --with-nrep-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
本人习惯:服务端的配置文件全部都在etc目录下,client端的文件一般放在源码文件中,所以在服务端编译的时候都指定了配置文件的路径,而在客户端并未指定配置文件目录
其余部分和client端一样
利用NSClient++监控windows主机
需要准备的插件:
NSClient++-0.3.8-x64
Allowed hosts:允许谁检测
NSClient password:fanjinbao;通过什么密码来监控
运行NSClient++后检查是否开启了12489的端口
nagios监控系统安装及配置的更多相关文章
- 在Nginx中搭建Nagios监控平台
本文只做Nginx下Nagiox安装的说明,其它关于Nagios监控的详细配置请参考我的另一篇文章[Ubuntu 10.04下构建Nagios监控平台] Nagios依赖PHP环境和perl环境.由于 ...
- 网站监控系统安装部署(zabbix,nagios)
zabbix分布式监控系统安装部署 官方网站链接 https://www.zabbix.com/documentation/2.0/manual/installation 安装环境说明 参考地址 ht ...
- Nagios学习实践系列——配置研究[监控当前服务器]
其实上篇Nagios学习实践系列——基本安装篇只是安装了Nagios基本组件,虽然能够打开主页,但是如果不配置相关配置文件文件,那么左边菜单很多页面都打不开,相当于只是一个空壳子.接下来,我们来学习研 ...
- Nagios+pnp4nagios+rrdtool 安装配置nagios被监控端NRPE配置(二)
NRPE监控插件基础 NRPE总共由两部分组成: (1).check_nrpe插件,运行在监控主机上. (2).NRPE daemon,运行在远程的linux主机上(通常就是被监控机) 整个的监控过程 ...
- Nagios 系统监控基本安装配置过程详解
Nagios 是一款免费的开源 IT 基础设施监控系统,功能强大,灵活性强,能有效监控 Windows.Linux.VMware 和 Unix 主机状态,交换机.路由器等网络设置等.一旦主机或服务状态 ...
- Nagios监控的部署与配置
[安装Nagios] yum install -y httpd httpd-devel httpd-tools mysql mysql-devel mysql-server php php-devel ...
- Linux监控一之Nagios的安装与配置
一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...
- Nagios 监控系统架设全攻略
Nagios 全名为(Nagios Ain’t Goona Insist on Saintood),最初项目名字是 NetSaint.它是一款免费的开源 IT 基础设施监控系统,其功能强大,灵活性强, ...
- Nagios监控平台搭建
Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员, ...
随机推荐
- 前端开发week3
开发工具学习ing... lesscss 框架 lesscss是一种动态样式语言,属于css预处理语言的一种,它使用类似css的语法,为css的赋予了动态语言的特性,如变量.继承.运算.函数等,更方便 ...
- stella mccartney falabella foldover tote a few eye observed
Lately, the particular Heyuan City Courtroom retrial, in order to commit the criminal offense of cou ...
- HBase查找一条数据的过程
HBase中的Client如何路由到正确的RegionServer 在HBase中,大部分的操作都是在RegionServer完成的,Client端想要插入,删除,查询数据都需要先找到相应的 Regi ...
- 0x7c95caa2指令引用的0x00000000内存 该内存不能read
出现这样的错误,往往和动态库有关系! 解决方法:
- jquery 触发/失去焦点事件例子详解
触发焦点: $("Element").focus() 触发每一个匹配元素获得焦点事件. $("Element").focus(function) 事件会在获得焦 ...
- Java学习1 - java 历史
Sun的Java语言开发小组成立于1991年,其目的是开拓消费类电子产品市场,例如:交互式电视,烤面包箱等.Sun内部人员把这个项目称为 Green,那时World Wide Web还在图纸上呢.该小 ...
- org.springframework.beans.MutablePropertyValues.add
最近在项目中,通过maven引入其他包时,启动报错如下: [ERROR][2016-10-08 14:01:20.716]Context initialization failed[org.sprin ...
- Vector和ArrayList的比较
今天研究了一下Vector和ArrayList的源码,又加深了对这两个类的理解. List接口下一共实现了三个类:ArrayList,Vector,LinkedList.LinkedList就不多说了 ...
- echo, print, print_r
echo 不是函数,没有返回值,因此只是用作输出的话会更快 print 和 print_r 有返回值,区别在于: print 用于打印一个字符串,print_r 可以打印一些复合类型,如: $arr= ...
- python bytes to string
python bytes 转化成 string 会遇到如下错误: codec can't decode byte 0xff in position 5: illegal multibyte seque ...