开源监控解决方案:ZABBIX部署实录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开源监控解决方案:ZABBIX部署实录相关的知识,希望对你有一定的参考价值。

安装 Apache HTTP Server 

[[email protected] ~]# groupadd apache
[[email protected] ~]# useradd apache -g apache -s /bin/nologin


[[email protected] ~]# tar zxvf apr-1.6.3.tar.gz 
[[email protected] ~]# cd apr-1.6.3
[[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/apr
[[email protected] apr-1.6.3]# make
[[email protected] apr-1.6.3]# make install


[[email protected] ~]# tar zxvf apr-util-1.6.1.tar.gz
[[email protected] apr-util-1.6.1]# ./configure --with-apr=/usr/local/apr/bin/apr-1-config
[[email protected] apr-util-1.6.1]# make
[[email protected] apr-util-1.6.1]# make install


[[email protected] ~]# tar zxvf pcre-8.41.tar.gz
[[email protected] ~]# cd pcre-8.41
[[email protected] pcre-8.41]# ./configure 
[[email protected] pcre-8.41]# make
[[email protected] pcre-8.41]# make install


[[email protected] ~]# tar zxvf httpd-2.4.29.tar.gz
[[email protected] ~]# cd httpd-2.4.29
[[email protected] httpd-2.4.29]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-ssl --enable-so --enable-cgi --enable-rewrite --with-pcre --with-zlib --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=worker --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config
[[email protected] httpd-2.4.29]# make
[[email protected] httpd-2.4.29]# make install


[[email protected] ~]# vi /etc/httpd/httpd.conf
PidFile  "/var/run/httpd.pid"
ServerName 192.168.1.201:80
User apache
Group apache


[[email protected] ~]# vi /etc/init.d/httpd
#!/bin/bash
 #
 # httpd        Startup script for the Apache HTTP Server
 #
 # chkconfig: - 85 15
 # description: Apache is a World Wide Web server.  It is used to serve  #        html files and CGI.
 # processname: httpd
 # config: /etc/httpd/conf/httpd.conf
 # config: /etc/sysconfig/httpd
 # pidfile: /var/run/httpd.pid
# Source function library.
 . /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
         . /etc/sysconfig/httpd
 fi
# Start httpd in the C locale by default.
 HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
 # mod_ssl needs a pass-phrase from the user.
 INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
 # with the thread-based "worker" MPM; BE WARNED that some modules may not
 # work correctly with a thread-based MPM; notably php will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
 apachectl=/usr/local/apache/bin/apachectl
 httpd=${HTTPD-/usr/local/apache/bin/httpd}
 prog=httpd
 pidfile=${PIDFILE-/var/run/httpd.pid}
 lockfile=${LOCKFILE-/var/lock/subsys/httpd}
 RETVAL=0
start() {
         echo -n $"Starting $prog: "
         LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && touch ${lockfile}
         return $RETVAL
 }
stop() {
   echo -n $"Stopping $prog: "
   killproc -p ${pidfile} -d 10 $httpd
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
 }
 reload() {
     echo -n $"Reloading $prog: "
     if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
         RETVAL=$?
         echo $"not reloading due to configuration syntax error"
         failure $"not reloading $httpd due to configuration syntax error"
     else
         killproc -p ${pidfile} $httpd -HUP
         RETVAL=$?
     fi
     echo
 }
# See how we were called.
 case "$1" in
   start)
   start
   ;;
   stop)
   stop
   ;;
   status)
         status -p ${pidfile} $httpd
   RETVAL=$?
   ;;
   restart)
   stop
   start
   ;;
   condrestart)
   if [ -f ${pidfile} ] ; then
     stop
     start
   fi
   ;;
   reload)
         reload
   ;;
   graceful|help|configtest|fullstatus)
   $apachectl [email protected]
   RETVAL=$?
   ;;
   *)
   echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
   exit 1
 esac
exit $RETVAL


[[email protected] ~]# chmod a+x /etc/init.d/httpd
[[email protected] ~]# chkconfig --add httpd
[[email protected] ~]# service httpd start
Starting httpd:                                            [  OK  ]
[[email protected] ~]# service httpd status
httpd (pid  2724) is running...
[[email protected] ~]# netstat -tunlp | grep httpd
tcp        0      0 :::80                       :::*                        LISTEN      2724/httpd


安装mysql  Server(略)


安装PHP

[[email protected] ~]# yum install -y gcc libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel libxml2-devel libcurl-devel

[[email protected] ~]# tar zxvf php-5.5.30.tar.gz
[[email protected] ~]# cd php-5.5.30
[[email protected] php-5.5.30]# ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gettext --with-gd --with-curl --with-freetype-dir --with-jpeg-dir --with-png-dir --enable-bcmath --enable-mbstring --enable-ctype --enable-xml --enable-sockets --enable-shared --disable-ipv6

[[email protected] php-5.5.30]# make && make install
[[email protected] php-5.5.30]# cp php.ini-production /etc/php.ini
[[email protected] php-5.5.30]#  vi /etc/php.ini 
date.timezone = Asia/Shanghai
max_execution_time = 300  
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = off





以上是关于开源监控解决方案:ZABBIX部署实录的主要内容,如果未能解决你的问题,请参考以下文章

开源监控解决方案:Icinga(Nagios)部署实录

开源监控解决方案:Observium部署实录

开源监控解决方案:Cacti部署实录

centos7.x下部署zabbix开源监控

监控服务zabbix部署

Zabbix监控部署!