centos安装nagios服务端
系统:centos 5.8
需要的软件包:nagios-cn-3.2.3.tar.bz2 nagios-plugins-1.4.15.tar.gz nrpe-2.12.tar.gz
1.安装nagios和nrpe依赖包
yum -y install httpd php gcc glibc glibc-common gd gd-devel openssl openssl-devel bzip2
2.安装nagios
wget http://sourceforge.net/projects/nagios-cn/files/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2/download
useradd nagios
groupadd nagios
groupadd -g nagios nagios
groupadd nagcmd
usermod -g nagcmd nagios
usermod -g nagcmd apache
passwd nagios
tar jxf nagios-cn-3.2.3.tar.bz2 && cd nagios-cn-3.2.3
./configure --with-group=nagios --with-user=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
sed -i 's/use_authentication=1/use_authentication=0/g' /usr/local/nagios/etc/cgi.cfg
htpasswd -b /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin
3.启动nagios,并设置开机自启动
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/sbin/service nagios start
chkconfig --add nagios
chkconfig nagios on
4.安装nagios-plugin
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download
tar zxf nagios-plugins-1.4.15.tar.gz && cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
5.安装nrpe
wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz
tar zxf nrpe-2.12.tar.gz && cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
sed -i 's/allowed_hosts=127.0.0.1/allowed_hosts=192.168.10.100/g' /usr/local/nagios/etc/nrpe.cfg
ps:授权nagios服务端有权访问nrpe主机,在allowed_hosts处填写nagios服务端的ip,设置多个IP用,(逗号)隔开 1.1.1.1,1.1.1.2
6.启动nrpe,并设置开机启动
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" >> /etc/rc.d/rc.local
7.测试
/usr/local/nagios/libexec/check_nrpe -H localhost
ps:运行正常,将返回nrpe的版本号
8.重启 apache nagios nrpe 所有服务
service httpd restart
service nagios restart
killall nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
9.iptables放过nrpe端口
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
service iptables save
service iptables restart
10.这里基本上就成功了,图片倒是显示正常,但监控页面页面不对,css路径需要做好链接
mkdir -p /usr/local/nagios/share/nagios
ln -s /usr/local/nagios/share/images /usr/local/nagios/share/nagios/images
ln -s /usr/local/nagios/share/stylesheets /usr/local/nagios/share/nagios/stylesheets
好了,nagios服务端就搞定了.
需要的软件包:nagios-cn-3.2.3.tar.bz2 nagios-plugins-1.4.15.tar.gz nrpe-2.12.tar.gz
1.安装nagios和nrpe依赖包
yum -y install httpd php gcc glibc glibc-common gd gd-devel openssl openssl-devel bzip2
2.安装nagios
wget http://sourceforge.net/projects/nagios-cn/files/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2/download
useradd nagios
groupadd nagios
groupadd -g nagios nagios
groupadd nagcmd
usermod -g nagcmd nagios
usermod -g nagcmd apache
passwd nagios
tar jxf nagios-cn-3.2.3.tar.bz2 && cd nagios-cn-3.2.3
./configure --with-group=nagios --with-user=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
sed -i 's/use_authentication=1/use_authentication=0/g' /usr/local/nagios/etc/cgi.cfg
htpasswd -b /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin
3.启动nagios,并设置开机自启动
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/sbin/service nagios start
chkconfig --add nagios
chkconfig nagios on
4.安装nagios-plugin
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download
tar zxf nagios-plugins-1.4.15.tar.gz && cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
5.安装nrpe
wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz
tar zxf nrpe-2.12.tar.gz && cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
sed -i 's/allowed_hosts=127.0.0.1/allowed_hosts=192.168.10.100/g' /usr/local/nagios/etc/nrpe.cfg
ps:授权nagios服务端有权访问nrpe主机,在allowed_hosts处填写nagios服务端的ip,设置多个IP用,(逗号)隔开 1.1.1.1,1.1.1.2
6.启动nrpe,并设置开机启动
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" >> /etc/rc.d/rc.local
7.测试
/usr/local/nagios/libexec/check_nrpe -H localhost
ps:运行正常,将返回nrpe的版本号
8.重启 apache nagios nrpe 所有服务
service httpd restart
service nagios restart
killall nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
9.iptables放过nrpe端口
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
service iptables save
service iptables restart
10.这里基本上就成功了,图片倒是显示正常,但监控页面页面不对,css路径需要做好链接
mkdir -p /usr/local/nagios/share/nagios
ln -s /usr/local/nagios/share/images /usr/local/nagios/share/nagios/images
ln -s /usr/local/nagios/share/stylesheets /usr/local/nagios/share/nagios/stylesheets
好了,nagios服务端就搞定了.
评论: