基本准备
yum -y install httpd php mysql-devel php-mysql 安装需要的包
groupadd nagcmd 创建nagios的管理组
useradd –g nagcmd nagios 将nagios添加到组nagioscmd内
usermod -a -G nagcmd apache 将apache加入到组nagcmd内
yum –y install gcc 编译安装的需要 安装httpd【apache环境】
[root@zhangpub]# tar zxvf nagios-3.0.6.tar.gz
[root@localhosthttpd-2.2.6]# cd /var/ftp/upload/httpd-2.2.6
[root@localhosthttpd-2.2.6]# ./configure --prefix=/usr/local/apache
[root@localhosthttpd-2.2.6]# make
[root@localhosthttpd-2.2.6]# make install
[root@localhost httpd-2.2.6]#service httpd start
Starting httpd: httpd: Could notreliably determine the server's fully qualified domain name, usinglocalhost.localdomain for ServerName
(98)Address already in use:make_sock: could not bind to address [::]:80
(98)Address already in use:make_sock: could not bind to address 0.0.0.0:80
no listening sockets available,shutting down
Unable to open logs
[FAILED]
[root@localhost httpd-2.2.6]#(98)Address already in use: make_sock: could not bind to address [::]:80
-bash: syntax error nearunexpected token `Address'
[root@localhost httpd-2.2.6]#(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
-bash: syntax error nearunexpected token `Address'
If the main program and CGIscompiled without any errors, you
can continue with installingNagios as follows (type 'make'
without any arguments for a listof all possible options):
make install
- This installs the main program, CGIs,and HTML files
make install-init
- This installs the init script in/etc/rc.d/init.d
makeinstall-commandmode
- This installs and configures permissionson the
directory for holding the externalcommand file
makeinstall-config
- This installs *SAMPLE* config files in/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios/etc
You'll have to modify these sample filesbefore 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 theydetermine what/how
things get monitored!
makeinstall-webconf
- This installs the Apache config file forthe Nagios
web interface
*** Support Notes*******************************************
编译安装
make all 安装主程序、CGI和HTML文件
make install 在/etc/rc.d/init.d 安装启动脚本
make install-init 把nagios做成一个运行脚本,使nagios随系统开机启动,这是一个很方便的措施。
make install-commendmode 来配置目录权限
make install-config 把配置文件的例子复制到nagios的安装目录
make install-webconf 创建一个nagiosadmin的用户用于nagios的web接口登录
htpasswd-c /etc/nagios/htpasswd.users nagiosadmin
Newpassword:
Re-typenew password:
Addingpassword for user nagiosadmin
配置密码。
service httpd restart 启动apache服务
chkconfig --add nagios 将nagios加入到服务中
chkconfig nagios on 开机启动
servicenagios start
Nagios-plugins 安装
[root@localhost upload]# tar zxvf nagios-plugins-1.4.13 解压
[root@localhost upload]# cd nagios-plugins-1.4.13 进入文件夹
[root@localhost nagios-plugins-1.4.13]#./configure--with-nagios-user=nagios --with-nagios-group=nagios 执行配置
[root@localhost nagios-plugins-1.4.13]# make 进行编译安装
[root@localhostnagios-plugins-1.4.13]# make install
[root@localhostnagios-plugins-1.4.13]# service nagios restart