Nagios是一个系统和网络监控软件,它可以监测所指定的主机和服务,并在出现问题以及问题恢复后发出报警。Nagios最早是被设计运行于Linux环境下的,但在大多数Unix操作系统下也可以使用。同时它是一个开源软件,我们可以免费获得它的源码,和使用它。Nagios是个不错的系统监控软件,应用的范围也比较广泛。
本文将介绍Nagios在Solaris10操做系统下的安装过程,其中包括,源码的编译、安装;Apache的安装、Nagios CGI的配置;Nagios监控配置等。
本文参考了Nagios的官方文档和Nagios社区的文章,以及互联网上其他人的相关帖子。
环境、资源准备
gcc-3.4.6-sol10-x86-local.gz
libiconv-1.11-sol10-x86-local.gz
libintl-3.4.0-sol10-x86-local.gz
make-3.81-sol10-x86-local.gz
openssl-0.9.8h-sol10-x86-local.gz
gd-2.0.35-sol10-x86-local.gz
httpd-2.2.4.tar.gz
nagios-3.0.3.tar.gz
nagios-plugins-1.4.11.tar.gz
nrpe-2.12.tar.gz
1.安装Nagios
# groupadd nagios
# useradd -g nagios -d /usr/local/nagios nagios
# gunzip ./nagios-3.0.6.tar.gz
# tar xvf ./nagios-3.0.6.tar.gz
# cd ./nagios-3.0.6.tar.gz
# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios \
--with-nagios-group=nagios --with-gd-lib=/usr/sfw/lib \
--with-gd-inc=/usr/sfw/include
# make all
# make fullinstall
# make install-config
2.安装openssl
# gunzip ./openssl-0.9.8j-sol10-sparc-local.gz
# pkgadd -d ./openssl-0.9.8j-sol10-sparc-local
# export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH
3.安装Nagios Plugins
# gunzip ./nagios-plugins-1.4.13.tar.gz
# tar xvf ./nagios-plugins-1.4.13.tar
# cd nagios-plugins-1.4.13
# ./configure --without-MySQL --prefix=/usr/local/nagios --with-openssl=/usr/local/ssl
# make
# make install
# make clean
# chown -R nagios:nagios /usr/local/nagios/libexec
4.配置Apache
在/etc/apache2/httpd.conf文件追加如下内容
#setting for nagios
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
<Directory "/usr/local/nagios/sbin">
AuthType Basic
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
Alias /nagios /usr/local/nagios/share
<Directory "/usr/local/nagios/share">
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>