Debian安装Nagios 监控服务器

下载nagios跟nagios的插件 nagios-plugins
首先要安装这篇文章里”基于Debian的LAMP组合 linux+apache+mysql+php“提到的东东,省了不少事情。

wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.12.tar.gz

wget http://prdownloads.sourceforge.net/nagios/nagios-3.0.3.tar.gz

添加nagios用户:
useradd nagios

新建nagios文件夹:
mkdir /usr/local/nagios

赋予该文件夹相应权限:
chown nagios.nagios /usr/local/nagios

解压缩
tar zxvf nagios-3.0.3.tar.gz

进入文件夹
cd nagios-3.0.3

安装到 /usr/local/nagios 文件夹
./configure -prefix=/usr/local/nagios

看到这个提示
type ‘make all’ to compile the main program and CGIs.

你就直接
make all

安装 make install

make install-commandmode

make install-config

make install-init

回到目录,然后安装nagios插件
tar zxvf nagios-plugins-1.4.12.tar.gz

cd nagios-plugins-1.4.12
./configure -prefix=/usr/local/nagios

make

make install

创建web访问nagios的用户
/usr/local/apache/bin/htpasswd–c /usr/local/nagios/etc/htpasswd nagiosadmin

接着输入两次nagiosadmin的密码

cd /etc/apache2/sites-available
cp default default.bak
vi default

复制下面的内容

——————–

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Alias /nagios /usr/local/nagios/share
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

——————–

检查nagios配置文件有没有出错
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

如果页面提示错误
Error: Could not read object configuration data!
或者提示找不到 status.dat文件
运行
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

强帖留名: