nagios快速部署

本文详细介绍了Apache、PHP、Nagios等软件的编译安装过程,包括配置选项说明,并提供了DNAT测试、Nagios插件及nrpe安装步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 编译安装apache

./configure –prefix=/usr/local/php \ –with-apxs2=/usr/local/apache/bin/apxs \ –with-config-file-path=/usr/local/php \ –enable-mbstring=all –disable-debug –enable-opcache –enable-soap –enable-shmop –enable-sockets –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-bcmath –enable-exif –enable-mysqlnd –enable-xml –enable-inline-optimization –enable-zip –with-iconv –with-zlib –with-curl –with-mcrypt –with-gd –with-xmlrpc –with-openssl –with-mysql=mysqlnd –with-mysqli=mysqlnd –enable-ftp –with-jpeg-dir –with-freetype-dir –with-png-dir –with-bz2 –with-xpm-dir –enable-mbregex –enable-mbstring

2. 编译安装php

./configure –prefix=/usr/local/php  –with-apxs2=/usr/local/apache246/bin/apxs –with-config-file-path=/usr/local/php –with-iconv-dir=/usr/local/libiconv1.14 –with-zlib –with-gd –with-mcrypt=/usr/local/libmcrypt-2.5.7 –with-mysql –with-mysqli –enable-mbstring –with-pcre-dir –with-pear=/usr/local/php/lib/php

3. DNAT测试

sudo /sbin/iptables -t nat -A PREROUTING -p tcp -d 192.168.0.246 –dport 80 -j DNAT –to-destination 192.168.85.224

4. 编译安装nagios

tar xvf nagios-4.6.1.tar.gz -C /usr/local/src/

cd /usr/local/src/nagios-4.6.1

groupadd nagcmd

useradd  nagios

usermod -a nagcmd nagios

./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-command-group=nagcmd –with-httpd-conf=/usr/local/apache246/conf/extra

make all

make install

make install-init

make install-config

make install-commandmode

make install-webconf

make install-exfoliation

make install-classicui

cp -R contrib/eventhandlers /usr/local/nagios/libexec/ chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

/usr/local/nagios/bin/nagios -V /usr/local/nagios/etc/nagios.cfg /etc/init.d/nagios start

/etc/init.d/httpd246 start

5. 添加验证用户

/usr/local/apache246/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

6. 安装nagios-plugin

wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz

tar xvf nagios-plugins-1.5.tar.gz -C /usr/local/src/

cd /usr/local/src/nagios-plugins-1.5/

./configure –with-nagios-user=nagios –with-nagios-group=nagios make make install

7. 使服务开机自启动

chkconfig –add nagios

chkconfig –level 35 nagios on

chkconfig –add httpd246

chkconfig –level httpd246 on

8. 在被监控的服务器上安装nrpe

wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar xvf nrpe-2.15.tar.gz -C /usr/local/src/
cd /usr/local/src/nrpe-2.15

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值