编者按:

  最近公司部分业务迁移机房,为了更方便的监控管理主机资源,决定上线zabbix监控平台。运维人员使用2.4版本的进行部署,个人在业余时间尝鲜,使用zabbix3.0进行部署,整理文档如下,仅供参考!

一、系统环境准备:
  centos6.8最小化安装环境

  1.防火墙

 关闭selinux:
查看SELinux状态:
、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
、getenforce ##也可以用这个命令检查
关闭SELinux:
、临时关闭(不用重启机器):
setenforce ##设置SELinux 成为permissive模式
##setenforce 设置SELinux 成为enforcing模式
、修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可
关闭iptables或开放相关端口():
service iptables stop

防火墙设置

  2.安装yum源

 rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
vim /etc/yum.repos.d/rpmforge.repo #rpmforge国内源
### Name: RPMforge RPM Repository for RHEL - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://mirror.bjtu.edu.cn/repoforge/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://mirror.bjtu.edu.cn/repoforge/redhat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled =
protect =
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck =
rpm -Uvh http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm #mysql5.6 5.7 安装源

配置yum源

  3.依赖包更新安装:

 yum update &&\
yum -y install gcc gcc-c++ vim tree make cmake autoconf\
openssl openssl-devel openssl-clients curl curl-devel \
wget rsync expect readline readline-devel bison bison-devel \
pcre pcre-devel zlib-devel zlib freetype freetype-devel man \
lrzsz tar iostat bc zip unzip lvm2 sysstat

最小化安装系统常用软件安装

二、server端部署:

  1.LNMP平台构建:

    1)nginx-1.10.1稳定版本编译安装:

 下载源码包:
wget -P /usr/local/src http://nginx.org/download/nginx-1.10.1.tar.gz
依赖环境:
yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel gd-*
创建nginx用户及用户组并设置不允许登录系统:
groupadd -r nginx && useradd -s /sbin/nologin -g nginx -r nginx
编译安装:
./configure --prefix=/usr/local/nginx --lock-path=/usr/local/ \
nginx/nginx.lock --user=nginx --group=nginx \
--with-http_ssl_module --with-http_flv_module \
--with-http_stub_status_module --with-http_gzip_static_module \
--http-client-body-temp-path=/usr/local/nginx/client/ \
--http-proxy-temp-path=/usr/local/nginx/proxy/ \
--http-fastcgi-temp-path=/usr/local/nginx/fcgi/ \
--http-uwsgi-temp-path=/usr/local/nginx/uwsgi \
--http-scgi-temp-path=/usr/local/nginx/scgi --with-pcre \
--with-file-aio --with-http_image_filter_module && \
make && make install

nginx编译安装

vim /etc/init.d/nginx   chmod +x /etc/init.d/nginx && chkconfig nginx on
 #!/bin/bash
#
# Startup script for Nginx - this script starts and stops the nginx daemon
#
# chkconfig: -
# description: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx) NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx start() {
[ -x $nginx ] || exit
[ -f $NGINX_CONF_FILE ] || exit
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq ] && rm -f $lockfile
return $retval
} restart() {
configtest || return $?
stop
sleep
start
} reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
} force_reload() {
restart
} configtest() {
$nginx -t -c $NGINX_CONF_FILE
} rh_status() {
status $prog
} rh_status_q() {
rh_status >/dev/null >&
} case "$1" in
start)
rh_status_q && exit
$
;;
stop)
rh_status_q || exit
$
;;
restart|configtest)
$
;;
reload)
rh_status_q || exit
$
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit
esac

启动脚本配置

vim /usr/local/nginx/conf/nginx.conf
 user  nginx;
worker_processes ;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log info;
pid logs/nginx.pid;
worker_rlimit_nofile ;
events {
use epoll;
worker_connections ;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout ;
gzip on;
server {
listen ;
server_name localhost;
charset utf-;
#access_log logs/access.log main;
location / {
root html;
index index.html index.htm index.php;
}
error_page /.html;
error_page /50x.html;
location = /50x.html {
root html;
}
location ~ ^(.+.php)(.*)$ {
allow 192.168.137.1;
deny all;
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

nginx.conf

    2)mysql-5.6.32编译安装:

 依赖环境:
yum install wget gcc* make openssl openssl-devel openssl-clients ncurses-devel -y
创建用户名/群组:
groupadd -r mysql && useradd -s /sbin/nologin -g mysql -r mysql
创建mysql数据存储路径:
mkdir -p /home/mysql/data && mkdir -p /home/mysql/var/log && chown -R mysql:mysql /home/mysql/
下载源码包:
wget -P /usr/local/src http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.32.tar.gz
wget -P /home/mysql http://120.52.73.48/jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
编译安装:
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/home/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE= \
-DWITH_ARCHIVE_STORAGE_ENGINE= \
-DWITH_BLACKHOLE_STORAGE_ENGINE= \
-DWITH_READLINE= \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP= \
-DMYSQL_UNIX_ADDR=/home/mysql/var/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_TCP_PORT= \
-DWITH_BOOST=/home/mysql/boost_1_59_0.tar.gz && \
make && make install
数据库初始化:
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/home/mysql/data --user=mysql --default-storage-engine=MyISAM

mysql编译安装

配置mysql配置文件 vim /etc/my.cnf
 [client]
default-character-set=utf8
auto-rehash
socket = /home/mysql/var/mysql.sock
[mysqld]
datadir=/home/mysql/data
socket=/home/mysql/var/mysql.sock
user=mysql
port =
skip-name-resolve
slow-query-log
long_query_time =
character-set-server=utf8
log-error=/home/mysql/var/log/mysqld.log
pid-file=/home/mysql/var/mysqld.pid
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=
[mysqld_safe]
log-error=/home/mysql/var/log/mysqld.log
pid-file=/home/mysql/var/mysqld.pid

my.cnf

 cp /usr/local/src/mysql-5.6./support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql && chkconfig mysql on

设置启动脚本

 echo "export PATH=\$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib" >> /etc/profile
source /etc/profile

配置数据库环境变量

 mysqladmin -u root password "test123"

配置mysql用户名密码

    3)php-5.6编译安装:

 yum -y install zlib-devel libxml2 libxml2-devel libjpeg-devel \
libiconv-devel freetype-devel libpng-devel gd gd-devel \
openssl openssl-devel curl-devel libxslt-devel libmcrypt-devel \
mhash mcrypt bzip2-devel bzip2 ncurses-devel

依赖环境

 wget -P /usr/local/src http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
./configure --prefix=/usr/local/libiconv && make && make install
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf && /sbin/ldconfig

依赖环境libiconv编译安装

 wget -P /usr/local/src http://cn2.php.net/distributions/php-5.6.24.tar.gz

下载源码包

 ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql/ \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-bz2 \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--with-xmlwriter-dir=/usr \
--with-xmlreader-dir=/usr \
--with-libdir=lib \
--with-gettext \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no && make && make install

编译安装

 cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/src/php-5.6./php.ini-production /usr/local/php/etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 16M/' /usr/local/php/etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/' /usr/local/php/etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/' /usr/local/php/etc/php.ini
sed -i 's/;date.timezone =/date.timezone = Asia\/Shanghai/' /usr/local/php/etc/php.ini
sed -i 's/mysqli.default_port = 3306/mysqli.default_port = 33070/' /usr/local/php/etc/php.ini
sed -i 's/mysqli.default_socket =/& \/home\/mysql\/var\/mysql.sock/' /usr/local/php/etc/php.ini
sed -i 's/mysqli.default_host =/& localhost/' /usr/local/php/etc/php.ini
sed -i 's/mysqli.default_user =/& zabbix/' /usr/local/php/etc/php.ini
sed -i 's/;always_populate_raw_post_data = -1/always_populate_raw_post_data = -1/' /usr/local/php/etc/php.ini

设置配置文件

配置启动脚本:vim /etc/init.d/php-fpm   chmod +x  /etc/init.d/php-fpm && chkconfig php-fpm on
 #!/bin/sh
# DateTime: --
# Author: lianbaikai
# site:http://www.ttlsa.com/html/3039.html
# chkconfig: -
# Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit phpfpm="/usr/local/php/sbin/php-fpm"
prog=$(basename ${phpfpm}) lockfile=/var/lock/subsys/phpfpm start() {
[ -x ${phpfpm} ] || exit
echo -n $"Starting $prog: "
daemon ${phpfpm}
retval=$?
echo
[ $retval -eq ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq ] && rm -f $lockfile
return $retval
} restart() {
configtest || return $?
stop
start
} reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc ${phpfpm} -HUP
RETVAL=$?
echo
} force_reload() {
restart
} configtest() {
${phpfpm} -t
} rh_status() {
status $prog
} rh_status_q() {
rh_status >/dev/null >&
} case "$1" in
start)
rh_status_q && exit
$
;;
stop)
rh_status_q || exit
$
;;
restart|configtest)
$
;;
reload)
rh_status_q || exit
$
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|configtest}"
exit
esac

php-fpm

  

  2.zabbix-server安装:

 wget -P /usr/local/src http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gz

下载源码

 groupadd -r zabbix && useradd -s /sbin/nologin -g zabbix -r zabbix

创建用户/群组

 ./configure --prefix=/usr/local/zabbix/ --enable-server \
--enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config \
--with-net-snmp --with-libcurl \
--with-libxml2 --enable-proxy --enable-snmp --with-mbstring && \
make && make install

编译安装

 cp /usr/local/src/zabbix-3.0./misc/init.d/fedora/core5/zabbix_* /etc/init.d/
sed -i 's/ZABBIX_BIN=\"\/usr\/local\//&zabbix\//' zabbix_server
sed -i 's/ZABBIX_BIN=\"\/usr\/local\//&zabbix\//' zabbix_agentd

配置启动脚本

 $mysql -uroot -p
mysql>create database zabbix default charset utf8;
mysql>GRANT ALL PRIVILEGES ON *.* TO zabbix@'localhost' IDENTIFIED BY 'test123' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
mysql>exit;
$mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0./database/mysql/schema.sql
$mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0./database/mysql/images.sql
$mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0./database/mysql/data.sql

数据库初始化(使用zabbix用户管理数据库,且关闭远程连接)

 cp -fr /usr/local/src/zabbix-3.0./frontends/php /usr/local/nginx/html/zabbix
ln -s /usr/local/mysql/lib/libmysqlclient* /lib64/

配置前端页面

 vim /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=test123
DBPort=

设置配置文件

 复制华文楷体字体文件(simkai.ttf) /usr/local/nginx/html/zabbix/fonts
sed -i 's/DejaVuSans/simkai/g' /usr/local/nginx/html/zabbix/include/defines.inc.php

配置前端字体

 service zabbix_server start
service php-fpm start
service mysql start
service nginx start
web访问192.168.137./zabbix
dbhost localhost
dbname zabbix
dbuser zabbix
dbpasswd test123

网页端安装

三、代理端部署:

四、客户端部署:

  

【原文】centos6.5编译安装zabbix3.0和中文支持整理文档

1. LNMP基础环境搭建:

  nginx-1.9.11环境编译安装:参考 http://www.cnblogs.com/songqingbo/articles/5355025.html

  

    location / {
root html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.(php|php5)?$ {
root /usr/local/nginx/html/zabbix;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

  mysql-5.6.20编译安装:参考 http://www.cnblogs.com/songqingbo/articles/5355025.html

  php-5.6编译安装:

   依赖环境 

1.yum -y install zlib-devel libxml2-devel libjpeg-devel libiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel
2.wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz && cd libiconv-1.14 && ./configure --prefix=/usr/local/libiconv && make && make install && cd ../
3.yum -y install libmcrypt-devel mhash mcrypt

  编译安装:

./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql/ \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-bz2 \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--with-xmlwriter-dir=/usr \
--with-xmlreader-dir=/usr \
--with-libdir=lib64 \
--with-gettext \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no make && make install

  配置php配置文件:

vim /application/php/lib/php.ini 主要为下面几个参数
PHP option post_max_size 16M
PHP option max_execution_time 300
PHP option max_input_time 300
PHP time zone Asia/Shanghai

  配置启动脚本: /etc/init.d/php-fpm   chmod +x  /etc/init.d/php-fpm && chkconfig php-fpm on

#!/bin/sh
# DateTime: 2013-09-16
# Author: lianbaikai
# site:http://www.ttlsa.com/html/3039.html
# chkconfig: - 84 16
# Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0 phpfpm="/usr/local/php/sbin/php-fpm"
prog=$(basename ${phpfpm}) lockfile=/var/lock/subsys/phpfpm start() {
[ -x ${phpfpm} ] || exit 5
echo -n $"Starting $prog: "
daemon ${phpfpm}
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
} restart() {
configtest || return $?
stop
start
} reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc ${phpfpm} -HUP
RETVAL=$?
echo
} force_reload() {
restart
} configtest() {
${phpfpm} -t
} rh_status() {
status $prog
} rh_status_q() {
rh_status >/dev/null 2>&1
} case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|configtest}"
exit 2
esac

2. 编译安装zabbix_server

 源码包下载

cd /usr/local/src && wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.0/zabbix-3.0.0.tar.gz 

 依赖环境

yum install net-snmp-devel OpenIPMI-devel openssl-devel fping-devel libcurl-devel perl-DBI gcc -y

 添加用户

mkdir -p /usr/local/zabbix3.0/lib/
useradd -d /usr/local/zabbix3.0/lib/zabbix -s /sbin/nologin zabbix

  编译安装

./configure --prefix=/usr/local/zabbix3.0 --enable-server  --enable-agent --with-mysql --enable-ipv6 --with-net-snmp--with-libcurl --with-libxml2 && make install

  权限

chown –R zabbix.zabbix /usr/local/zabbix3.0

  增加端口

vim /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper

  数据库初始化

mysql> create database zabbix characterset utf8;
mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zabbixtest' with grant option;
mysql> flush privileges; mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/schema.sql
mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/images.sql
mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/data.sql

  配置文件识别:/usr/local/zabbix3.0/etc/zabbix_server.conf   zabbix_agentd.conf

  配置启动脚本:

zabbix_server

#!/bin/bash
#
# /etc/rc.d/init.d/zabbix_server
#
# Starts the zabbix_server daemon
#
# chkconfig: - 95 5
# description: Zabbix Monitoring Server
# processname: zabbix_server
# pidfile: /tmp/zabbix_server.pid # Modified for Zabbix 2.0.0
# May 2012, Zabbix SIA # Source function library. . /etc/init.d/functions RETVAL=0
prog="Zabbix Server"
ZABBIX_BIN="/usr/local/zabbix3.0/sbin/zabbix_server" if [ ! -x ${ZABBIX_BIN} ] ; then
echo -n "${ZABBIX_BIN} not installed! "
# Tell the user this has skipped
exit 5
fi start() {
echo -n $"Starting $prog: "
daemon $ZABBIX_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_server
echo
} stop() {
echo -n $"Stopping $prog: "
killproc $ZABBIX_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix_server
echo
} case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
stop
sleep 10
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/zabbix_server ]; then
stop
start
fi
;;
status)
status $ZABBIX_BIN
RETVAL=$?
;;
*)
echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}"
exit 1
esac exit $RETVAL

  zabbix_agentd

#!/bin/bash
#
# /etc/rc.d/init.d/zabbix_agentd
#
# Starts the zabbix_agentd daemon
#
# chkconfig: - 95 5
# description: Zabbix Monitoring Agent
# processname: zabbix_agentd
# pidfile: /tmp/zabbix_agentd.pid # Modified for Zabbix 2.0.0
# May 2012, Zabbix SIA # Source function library. . /etc/init.d/functions RETVAL=0
prog="Zabbix Agent"
ZABBIX_BIN="/usr/local/zabbix3.0/sbin/zabbix_agentd" if [ ! -x ${ZABBIX_BIN} ] ; then
echo -n "${ZABBIX_BIN} not installed! "
# Tell the user this has skipped
exit 5
fi start() {
echo -n $"Starting $prog: "
daemon $ZABBIX_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_agentd
echo
} stop() {
echo -n $"Stopping $prog: "
killproc $ZABBIX_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix_agentd
echo
} case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
stop
sleep 10
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/zabbix_agentd ]; then
stop
start
fi
;;
status)
status $ZABBIX_BIN
RETVAL=$?
;;
*)
echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}"
exit 1
esac exit $RETVAL

  其他相关配置参考:

http://www.tuicool.com/articles/JRVVniM
http://www.mamicode.com/info-detail-1223031.html
http://www.360doc.com/content/14/0330/19/8085797_364996162.shtml

  配置中文支持参考:http://www.ttlsa.com/zabbix/zabbix-display-chinese/

3.zabbix_proxy安装配置:

  编译安装同server,增加一个新的参数--enable-proxy

  zabbix_proxy启动脚本

#!/bin/sh
# chkconfig: 345 95 95
# desctription: Zabbix Proxy
# Zabbix
# Copyright (C) 2001-2013 Zabbix SIA
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Start/Stop the Zabbix agent daemon.
# Place a startup script in /sbin/init.d, and link to it from /sbin/rc[023].d SERVICE="Zabbix proxy"
DAEMON=/usr/local/zabbix3.0/sbin/zabbix_proxy
PIDFILE=/tmp/zabbix_agentd.pid
BASEDIR=/usr/local/zabbix3.0
ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_proxy
case $1 in
'start')
if [ -x ${DAEMON} ]
then
$DAEMON
# Error checking here would be good...
echo "${SERVICE} started."
else
echo "Can't find file ${DAEMON}."
echo "${SERVICE} NOT started."
fi
;;
'stop')
if [ -s ${PIDFILE} ]
then
if kill `cat ${PIDFILE}` >/dev/null 2>&1
then
echo "${SERVICE} terminated."
rm -f ${PIDFILE}
fi
fi
;;
'restart')
$0 stop
sleep 10
$0 start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
esac

  相关详细配置请参考: 

http://www.2cto.com/os/201401/273888.html
http://www.tuicool.com/articles/zMZrUjU
http://blog.chinaunix.net/uid-23500957-id-4919835.html

4.常见问题汇总:

  Error connecting to database: No such file or directory

  解决办法:http://www.bubuko.com/infodetail-1149825.html

  Zabbix 中文汉化及出现乱码解决办法

  解决办法:http://www.linuxidc.com/Linux/2015-05/117208.htm

5.监控平台接入

  http://www.onealert.com/open/alert/overview.jsp 

6.zabbix编译安装自动化脚本:

  http://www.dwhd.org/20150519_162243.html 

centos6编译安装zabbix3.0和中文支持整理文档的更多相关文章

  1. centos7.2编译安装zabbix-3.0.4

    安装zabbix-3.0.4 #安装必备的包 yum -y install gcc* make php php-gd php-mysql php-bcmath php-mbstring php-xml ...

  2. CentOS6.5安装zabbix3.0

    Server端 搭建LAMP(Linux+Apache+Mysql+PHP)环境 1.安装MySQL #安装地址:https://dev.mysql.com/downloads/repo/yum/ y ...

  3. centos7.6下编译安装zabbix4.0.10长期支持版

    一.安装数据库,这里使用的是percona-server5..24版本 配置如下 [root@zabbix4_clone:~]# cat /etc/my.cnf # Example MySQL con ...

  4. centos6.9 编译安装 zabbix-3.0.15

    本文采用编译安装,请在zabbix官网下载所需版本.此处安装版本是:zabbix-3.0.15.tar.gz 操作系统:centos 6.9 一.安装mysqlmysql-community-libs ...

  5. centos6.2安装桌面环境 与中文支持

    yum groupinstall "X Window System" //安装Xorgyum groupinstall "Desktop" //安装GNOMEy ...

  6. 在 CentOS6 上安装 Zabbix3.0 Agent 并开启客户端自动注册

    #!/bin/bash # # .配置yum源 # cat /etc/redhat-release |grep -i centos |grep '6.[[:digit:]]' &>/de ...

  7. centos6.5下编译安装mariadb-10.0.20

    源码编译安装mariadb-10.0.20.tar.gz 一.安装cmake编译工具 跨平台编译器 # yum install -y gcc* # yum install -y cmake 解决依赖关 ...

  8. Centos6.9 安装zabbix3.4 过程

    Centos6.9 安装zabbix3.4 过程 1.安装apache httpd 一开始忘记截图(略...) # yun install httpd 完成后,启动httpd服务 # service ...

  9. 在centos6编译安装http-2.4

    在centos6 编译安装httpd-2.4 安装httpd-2.4 Ü 依赖于apr-1.4+, apr-util-1.4+, [apr-iconv] Ü apr: : apache portabl ...

随机推荐

  1. python中高阶函数与装饰器(2)

    函数返回值为内置函数名: def sum(*args):    def sum_in():        ax = 0        for n in args:            ax = ax ...

  2. maven添加docker插件无法引入,运行时报错 No plugin found for prefix 'docker'

    maven 安装不上docker插件,运行 提示:docker:bulid时No plugin found for prefix 'docker' 原因是maven不能识别 docker-maven- ...

  3. python---基础知识回顾(十)进程和线程(py2中自定义线程池和py3中的线程池使用)

    一:自定义线程池的实现 前戏: 在进行自定义线程池前,先了解下Queue队列 队列中可以存放基础数据类型,也可以存放类,对象等特殊数据类型 from queue import Queue class ...

  4. 戴尔R720xd服务器系统安装前期环境实现

    型号:R720xd 开启服务器,Ctrl+R进入raid配置 配置完raid后F2对硬盘进行格式化 保存并重启 F11进入BIOS选项设置U盘启动 选择U盘启动 开始进行系统安装!

  5. ZeroMQ API(一) 总序

    序 zeromq是一个轻量级的消息库.它扩展了标准的套接字接口,其特性与传统的消息中间件不同,zeromq提供异步消息队列.多消息传递模式.消息过滤(订阅).无缝访问多个传输协议等的抽象. 本系列AP ...

  6. git 第一次关联远程仓库

    1.首先需要先git pull origin master 2.然后合并两个无关的仓库 git pull origin master --allow-unrelated-histories

  7. python学习笔记3-函数,判断负小数

    一.函数 def hello(file_name,content): #形参file_name content f=open(file_name,'a+') f.seek(0) f.write(con ...

  8. transform 动画效果

    http://www.css88.com/tool/css3Preview/Transform.html transform的含义是:改变,使…变形:转换 transform的属性包括:rotate( ...

  9. mysql 增加字段脚本,以及删除主键约束的脚本,存储过程

    //增加一个库下面所有表的row_id和其他9个字段的存过 DELIMITER $$ USE `erptest`$$ DROP PROCEDURE IF EXISTS `UPTABLE`$$ CREA ...

  10. Linux修改主机名【转】

    一.永久修改修改/etc/sysconfig/network,在里面指定主机名称HOSTNAME=然后执行命令hostname 主机名这个时候可以注销一下系统,再重登录之后就行了. 或者修改/etc/ ...