nagios 的编译安装
yum install httpd php gcc glibc glibc-common gd gd-devel openssl openssl-devel -y
ubuntu 安装openssl-devel 是
apt-get 无法安装 openssl-devel请执行: sudo apt-get install openssl apache2 php gcc glibc glibc-common gb gd-devel
sudo apt-get install libssl-dev
/usr/sbin/useradd -M -s /sbin/nologin nagios
mkdir -p /opt/nagios_install_packages
cd /opt/nagios_install_packages
wget http://softlayer-dal.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.1/nagios-4.0.1.tar.gz
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
# nagios
tar -xf nagios-4.0.1.tar.gz
cd nagios-4.0.1
./configure --prefix=/usr/local/nagios
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
htpasswd -c -m /usr/local/nagios/etc/htpasswd nagios
service httpd restart
cd /opt
# plugins
tar -xf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --prefix=/usr/local/nagios/
make
make install
chkconfig --add nagios
chkconfig nagios on
service nagios start
-------------------------------------------------------------------
nrpe 的编译安装
#nrpe 的下载http://sourceforge.net/projects/nagios/files/nrpe-2.x/
wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download?use_mirror=hivelocity&r=&use_mirror=hivelocity
nrpe 在被监控服务端的安装
服务器监控:nrpe监控客户端安装
注:安装过程需要有root用户权限,关闭主机防火墙(或者开放5666端口)。
所需软件包:nagios-plugins-1.5.tar.gz
nrpe-2.15.tar.gz
安装环境说明:
nagios监控端IP:192.168.0.10
nrpe监控客户端IP:192.168.0.20
1、添加nagios用户
useradd nagios -s /sbin/nologin -M
注意:在ubuntu 中这样添加用户 useradd nagios -M -s /usr/sbin/nologin
2、安装过程
安装nrpe
tar zxvf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure --prefix=/usr/local/nrpe --enable-command-args
#make all
#make install-plugin
#make install-daemon
#make install-daemon-config
***以上安装完成后会在/usr/local/nrpe目录下产生bin、etc、libexec三个目录***
注意在ubuntu 下:
./configure --prefix=/usr/local/nrpe --enable-command-args --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
安装nagios插件
tar zxvf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --prefix=/usr/local/nrpe
make && make install
***以上安装完成后会在/usr/local/nrpe目录下产生libexec、share两个目录***
3、修改nrpe.cfg配置文件
allowed_hosts=127.0.0.1, 192.168.0.10
dont_blame_nrpe=1
定义命令,如:
command[check_tcp]=/usr/local/nrpe/libexec/check_tcp -p $ARG1$ -w $ARG2$ -c $ARG3$
4、修改目录/文件权限
chown -R nagios.nagios /usr/local/nrpe
5、启动nrpe守护进程
/usr/local/nrpe/bin/nrpe -c /usr/local/nrpe/etc/nrpe.cfg -d
6、nagios监控端测试nrpe是否安装成功
/usr/local/nagios/libexec/check_nrpe -H 192.168.0.20
如果返回“NRPE v2.15”即为已安装成功并启动
-------------------------------------------------------------------------
nrpe 在nagios 服务器器端的安装
tar zxvf nrpe-2.5.tar.gz
cd nrpe-2.5
./configure
make && make install-plugin
/usr/local/nagios/libexec/check_nrpe -H 被监控主机的IP
NRPE V.2.5
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。