郑重声明:本文只说明linux被监控机上部署nagios插件实行监控目的。至于监控机怎么部署nagios请参考别的文档,谢谢!

一、首先说说linux被监控机上部署nagios(开源)、openmanage(DELL)的插件吧,步骤比较简单。

有如下四个源码包:(当然版本可以自行选择)

将下载的源码包上传到/home/nagios目录下,如图所示:

1、/home/nagios/nagios-plugins-1.4.14.tar.gz
2、/home/nagios/nrpe-2.12.tar.gz
3、/home/nagios/OM_6.1.0_ManNode_A00.tar.gz
4、/home/nagios/Check_openmanage-3.5.8.tar.gz
-------------------------------------------------
1、安装nagios插件
useradd nagios -s /sbin/nologin
cd /home/nagios

wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz

tar zxvf nagios-plugins-2.0.tar.gz
cd nagios-plugins-2.0

./configure --prefix=/usr/local/nagios --enable-redhat-pthread-workaround
make
make install(注意观察输出结果是否有报错信息)
chown -R nagios:nagios /usr/loacl/nagios
-------------------------------------------------


2、安装openssl-devel  (centos系统)

yum -y install openssl-devel


3、安装nrpe
cd /home/nagios

wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz

tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --prefix=/usr/local/nagios

make all
make install-plugin
make install-daemon
make install-daemon-config
编译安装完成后修改nrpe.cfg配置文件
vi /usr/local/nagios/etc/nrpe.cfg
将79行allowed_hosts=127.0.0.1修改为
allowed_hosts=127.0.0.1,192.168.15.28(192.168.15.28为监控主机IP地址)
继续添加NRPE的监控命令,可以将配置文件默认的监控命令全部删除,加上如下内容:
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 500 -c 200 -p /
command[check_df]=/usr/local/nagios/libexec/check_disk -w 500 -c 200 -p /
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 350 -c 400
---------------------------------------------------
4、启动nrpe服务
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
-------------------------------------------------------------------
5、本机测试nrpe.cfg里面定义的命令没有错误,正常显示nrpe的版本号
/usr/local/nagios/libexec/check_nrpe -H localhost(有的可能提示ssl错误如下,可以忽略)
CHECK_NRPE: Error - Could not complete SSL handshake.
----------------------------------------------------------------------
6、安装DELL工具(此工具是用火狐浏览器查看服务器的运行状态的),安装完毕后可以用火狐浏览器输入

https://ip:1311即可输入用户名和密码登陆进去查看
cd /home/nagios
tar zxvf OM_6.1.0_ManNode_A00.tar.gz
cd linux/supportscripts/
sh srvadmin-install.sh -x
srvadmin-services.sh start
srvadmin-services.sh enable
-------------------------------------------------------------------
7、安装openmanage(此工具好比部署在nagios当中的一个小插件而已)
cd /home/nagios

wget http://folk.uio.no/trondham/software/files/check_openmanage-3.7.11.tar.gz

tar zxvf check_openmanage-3.5.8.tar.gz
cd check_openmanage-3.5.8
cp check_openmanage /usr/local/nagios/libexec
vi /usr/local/nagios/etc/nrpe.cfg
在NRPE监控命令下添加如下内容:
command[check_omsa]=/usr/local/nagios/libexec/check_openmanage -b ctrl_fw=ALL\/ctrl_driver=ALL -p
killall -9 nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
ps -ef | grep nrpe(检查进程是否存在)
至此部署过程结束!!!