libtool --finish /u1/tool/php-5.4.8/libs
make&& make install
cp php.ini-development /usr/local/app/php/lib/php.ini
cd /usr/local/app/php/etc
cp php-fpm.conf.default php-fpm.conf
4)nagios安装:
mkdir /usr/local/nagios
groupadd nagios
useradd –g nagios nagios
chown -R nagios.nagios /usr/local/nagios
tar -zxvf nagios-2.9.tar.gz
cd nagios-2.9
./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include
make all
make install #安装主程序,CGI和HTML文件
make install-init #在/etc/rc.d/init.d安装启动脚本
make install-commandmode #配置目录权限
make install-config #安装示例配置文件,安装的路径是#/usr/local/nagios/etc
5)插件nagios-plugins安装:
tar -zxvf nagios-plugins-1.4.9.tar.gz
cd nagios-plugins-1.4.9
./configure --prefix=/usr/local/nagios/--enable-redhat-pthread-workaround
make && makeinstall
1)注意:在redhat系统上面安装可能出现configure时,到这里checking for redhat spopen problem...就不动了,所以需要在configure时再加上--enable-redhat-pthread-workaround;
6)插件nagiosgraph安装:
tar–zxvf nagiosgraph.tar.gz
cp–a nagiosgraph /usr/local/nagios/.
7)插件check_traffic安装:
tar –zxvf check_traffic.tar.gz
cpcheck_traffic/check_traffic /usr/local/nagios/libexec/.
8)插件nrpe安装:
tar –zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --enable-command-args
make all
make install-plugin
make install-daemon
make install-daemon-config
/usr/local/nagios/bin/nrpe-c /usr/local/nagios/etc/nrpe.cfg -d #启动nrpe服务
/usr/local/nagios/libexec/check_nrpe -H localhost #以下均为测试
/usr/local/nagios/libexec/check_nrpe -H 192.168.0.208 -c check_cpu
/usr/local/nagios/libexec/check_nrpe-H 192.168.0.208 -c check_mem
/usr/local/nagios/libexec/check_nrpe-H 192.168.0.208 -c check_disk -a /home
3、基本配置:
1)修改apache配置:
/usr/local/app/apache2/conf/httpd.conf
user nagios
group nagios
ServerName 192.168.0.201
index.php #不加此无法打开页面
AddType application/x-httpd-php .php .phtml #这两行是添加对php的支持
AddType application/x-httpd-php-source .phps
#setting for nagios
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
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
Require valid-user
#配置好后添加用户用如下命令:
/usr/local/app/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd test
New password:123456
Re-type new password: 123456
Adding password for user test
less /usr/local/nagios/etc/htpasswd #查看用户认证文件
test:OmWGEsBnoGpIc #格式:用户名:密码
三、被监控端的安装过程:
1)安装过程:
mkdir –p /usr/local/nagios
groupadd nagios
useradd nagios –d/usr/local/nagios –s /sbin/nologin –g nagios
yum install openssl openssl-devel
tar -zxvf nagios-plugins-1.4.9.tar.gz
cd nagios-plugins-1.4.9
./configure --enable-redhat-pthread-workaround
make && make install
chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
tar –zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --enable-command-args
make all
make install-plugin
make install-daemon
make install-daemon-config
cd /usr/local/nagios
vim start.sh
/usr/local/nagios/bin/nrpe -c/usr/local/nagios/etc/nrpe.cfg -d
chmod +x start.sh