集群监控 Ubuntu上Nagios安装过

nagios监控企业集群

 

Nagios是一个监视系统运行状态和网络信息的监视系统。Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等

Nagios可运行在Linux/Unix平台之上,同时提供一个可选的基于浏览器的WEB界面以方便系统管理人员查看网络状态,各种系统问题,以及日志等等。

添加用户:
useradd -m nagios
passwd nagios

添加用户组,(注意:ubuntu8.04以后用户组已经存在)
groupadd nagios
usermod -G nagios nagios

安装相关软件:
apt-get install apache2 php5 libssl0.9.8 libssl-dev openssl

下载 Nagios Core、Nagios Plugins、Nagios Addons:
wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios-3.2.1/nagios-3.2.1.tar.gz
wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz

安装nagios主程序:
tar -xzvf nagios-3.2.1.tar.gz
cd nagios-3.2.1
./configure --prefix=/usr/local/nagios
make all
make install
make install-init # 安装初始化脚本可用/etc/init.d/nagios start启动nagios
make install-commandmode
make install-config

安装nagios-plugins:
tar -xzvf nagios-plugins-1.4.15.tar.gz
mkdir /usr/local/nagios-plugins
cd nagios-plugins-1.4.15
./configure --prefix=/usr/local/nagios-plugins
make all
make install
mv /usr/local/nagios-plugins/libexec /usr/local/nagios

安装nrpe:
tar -xzvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --enable-ssl --enable-command-args
make all
cp src/check_nrpe /usr/local/nagios/libexec

现在就可以启动nagios了:
/etc/init.d/nagios start

配置apache:
在apache的配置文件httpd.conf中追加
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin/
<Directory "/usr/local/nagios/sbin/">
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
Alias /nagios /usr/local/nagios/share/
<Directory "/usr/local/nagios/share">
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/.htpasswd
Require valid-user
</Directory>

生成用户名和密码:
/usr/bin/htpasswd -c /usr/local/nagios/etc/.htpasswd nagios

修改/usr/local/nagios/etc/cgi.cfg 修改use_authentication=1为use_authentication=0,即不用验证.不然有一些页面不会显示。

检查配置文件是否出错:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

 

Task: Restart Apache 2 Server /重启apache服务

# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart

 

测试 :  http://192.168.0.244/nagios/

您可以选择一种方式赞助本站