本文共 1897 字,大约阅读时间需要 6 分钟。
在CentOS 5.7环境中安装GD库,可以通过以下命令完成:
yum install gd* x86_64 gd-devel x86_64
可以通过以下命令安装并启动Apache:
yum install httpd/bin/initools -rchkconfig -level 3: on
从官方网站下载最新版本的Nagios、Nagios插件和nrpe:
wget http://www.nagios.org/download/nagios-3.3.1.tar.gzwget http://www.nagios.org/download/nagios-plugins-1.4.15.tar.gzwget http://www.nagios.org/download/addons/nrpe-2.13.tar.gz
将Nagios解压并安装:
tar -xzf nagios-3.3.1.tar.gzcd nagios-3.3.1make install
在Apache配置文件中添加以下内容:
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 
创建配置文件并重启Apache:
mkdir -p /usr/local/nagios/etc/htpasswdhtpasswd -c /usr/local/nagios/etc/htpasswd/users nagiosadminapachectl restart
使用vi编辑Nagios配置文件:
vi /usr/local/nagios/etc/nagios.cfg
修改配置文件中的email地址为您的实际邮箱地址。
安装并编译插件:
tar -xzf nagios-plugins-1.4.15.tar.gzcd nagios-plugins-1.4.15make install
在/usr/local/nagios/etc/objects/commands.cfg中添加以下内容:
define command{    command_name check_nrpe    command_line $USER1$/check_nrpe -H $HOSTADDRESS -c $ARG1}  chkconfig添加并启动服务:
chkconfig -level 3: onchkconfig nagios on
使用以下命令验证Nagios配置:
/usr/local/nagios/bin/nagios -v
将SELinux设为禁用状态:
setenforce 0
停止并禁用iptables:
service iptables stopchkconfig iptables off
访问Nagios服务器:
http://IP/nagios/
输入用户名和密码登录(用户名为nagiosadmin,密码已设置)。
nagios用户和nobody组,nagios用户用于运行Nagios,nobody用于运行Apache。/var/nagios,可根据需求调整。通过以上步骤,您可以成功在CentOS 5.7环境中安装并配置Nagios监控系统。
转载地址:http://pzcfk.baihongyu.com/