客户端
nrpe-2.15.tar.gz
nagios-plugins-2.0.2.tar.gz
服务端
nagios-4.0.8.tar.gz
nrpe-2.15.tar.gz
nagios-plugins-2.0.2.tar.gz
服务端不安装nrpe-2.15.tar.gz包会报错/usr/local/nagios/libexec/check_nrpe, ... failed. errno is 2: No such file or directory
服务器端需要安装下面三个包,客户端只需要安装后两个包:
Nagios Core nagios-4.0.8.tar.gz
Nagios Plugins nagios-plugins-2.0.2.tar.gz
Nagios Addons nrpe-2.15.tar.gz
NSClient++也是Nagios Addons中的一种
下载地址
nagios-4.0.8.tar.gz和nrpe-2.15.tar.gz
http://sourceforge.net/projects/nagios/files/
nagios-plugins-2.0.2.tar.gz
http://www.nagios.org/download/plugins
客户端安装
参考NRPE.pdf中Remote Host Setup
其中/etc/xinetd.d/nrpe文件的only_from填写是本机127.0.0.1和服务器端的IP
1、useradd nagios
passwd nagios
2、tar -xzvf nagios-plugins-2.0.2.tar.gz
cd nagios-plugins-2.0.2
./configure
make
make install
3、chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
4、yum install xinetd
5、tar -zxvf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
6、vi /etc/xinetd.d/nrpe
only_from=127.0.0.1 服务端IP
比如:only_from = 127.0.0.1 192.168.30.190
vi /etc/services
nrpe 5666/tcp # NRPE
7、service xinetd restart
netstat -at | grep nrpe结果如下即可
tcp 0 0 *:nrpe *:* LISTEN
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1返回如下结果即可
NRPE v2.15
8、如果客户端配置了防火墙,vi /etc/sysconfig/iptables添加如下5666端口例外的规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
服务端安装
参考https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source-96.html或
https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source-96.html#CentOS或
http://blog.51cto.com/guojiping/1293933
百度关键字《Quickstart · Nagios Core Documentation》
1、关闭SELINUX安全检查,即getenforce命令的结果不能是Enforcing
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
2、安装必要的补丁包
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix
3、编译nagios服务端rpm包nagios-4.0.8.tar.gz
tar xzf nagioscore.tar.gz
cd nagioscore-nagios-4.4.1/
./configure
make all
4、创建nagios用户,并把apache用户加入nagios组
useradd nagios
usermod -a -G nagios apache
5、继续上面3之后的编译安装
make install
make install-daemoninit
make install-commandmode
make install-config
make install-webconf
6、把apache加入自启动,关闭防火墙或把80端口放入防火墙白名单
chkconfig --level 2345 httpd on
service iptales stop
7、创建nagios的web登录账户nagiosadmin
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
8、启动apache和nagios
service httpd start
service nagios start
9、登录nagios服务器的web界面
http://IP/nagios/
10、再安装
nrpe-2.15.tar.gz
nagios-plugins-2.0.2.tar.gz
11、重启nagios
service nagios restart
如果不想监控服务器本机,就把服务器端/usr/local/nagios/etc/nagios.cfg中的配置cfg_file=/usr/local/nagios/etc/objects/localhost.cfg注释掉
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-2199963/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30126024/viewspace-2199963/