安装配置Nagios
1、首先下载相关安装包
nagios-2.9.tar.gz、nagios-plugins-1.4.9.tar.gz、nrpe-2.8.1.tar.gz
NSClient++-0.2.7.zip 该安装包用于windows客户端
前三个包下载地址:http://www.nagios.org
后一个包下载地址:http://sourceforge.net/projects/nscplus
2、开始安装
tar -zxvf nagios-2.9.tar.gz -C /usr/src/
cd /usr/src/nagios-2.9
./configure --prefix=/usr/local/nagios
使用make all查看安装步骤
*** Compile finished ***
If the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):
make install
This installs the main program, CGIs, and HTML files
使用make install来安装主程序、CGI和HTML文件
make install-init
This installs the init script in /etc/rc.d/init.d
使用make install-init 来安装主程序/etc/rc.d/init.d 安装启动脚本
make install-commandmode
- This installs and configures permissions on the
directory for holding the external command file
使用make install-commandmode来配置目录权限
make install-config
- This installs *SAMPLE* config files in /usr/local/nagios/etc
You'll have to modify these sample files before you can
use Nagios. Read the HTML documentation for more info
on doing this. Pay particular attention to the docs on
object configuration files, as they determine what/how
things get monitored!
使用make install-config来安装示例配置文件,安装路径是/usr/local/nagios/etc.
*** Support Notes *******************************************
If you have questions about configuring or running Nagios,
please make sure that you:
- Look at the sample config files
- Read the HTML documentation
- Read the FAQs online at [url]http://www.nagios.org/faqs[/url]
before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you. This might include:
- What version of Nagios you are using
- What version of the plugins you are using
- Relevant snippets from your config files
- Relevant error messages from the Nagios log file
For more information on obtaining support for Nagios, visit:
[url]http://www.nagios.org/support/[/url]
*************************************************************
Enjoy.
很多人都不注意安装过程中输出的信息、直到make install出错了才到处找人求救、而实际上输出包含很多有价值的信息,例如安装路径、版本、每一步做什么、接下来的步骤等。尤其是输出的最后一屏信息,建议大家好下
2.1、增加用户、修改权限
useradd nagios
mkdir /usr/local/nagios
chown nagios.nagios /usr/local/nagios
2.2、开始执行make install、make install-init、make install-commandmode、make install-config
验证程序是否被正确安装、查看/usr/local/nagios/下面是否有etc、bin、sbin、share、var。如果存在在说明被正确安装
2.3、安装插件
tar -zxvf nagios-plugins-1.4.9.tar.gz -C /usr/src/
cd /usr/src/nagios-plugins-1.4.9
./configure --prefix=/usr/local/nagios/ && make && make install
ls /usr/local/nagios/libexec/ 查看所有安装的插件都在该目录下
2.4、将apache运行的用户添加到nagios这个组里面去
grep ^User /usr/local/apache2/conf/httpd.conf
我用的是apache用户,usermod -G nagios apache
2.5、修改apache的配置文、添加如下内容
vi /usr/local/apache2/conf/httpd.conf
#setting for nagios 20070707
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
<Directory "/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
//用于此目录访问验证的密码
Require valid-user
</Directory>
Alias /nagios /usr/local/nagios/share
<Directory "/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
//用于此目录访问验证的密码
Require valid-user
</Directory>
2.6、增加验证用户账号
/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd test
基本安装完成,测试访问http://192.168.0.111/nagios
3、开始配置