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

时间:2022-09-22 17:04:40

编者按:

  最近公司部分业务迁移机房,为了更方便的监控管理主机资源,决定上线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&period;2编译安装zabbix-3&period;0&period;4

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

  2. CentOS6&period;5安装zabbix3&period;0

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

  3. centos7&period;6下编译安装zabbix4&period;0&period;10长期支持版

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

  4. centos6&period;9 编译安装 zabbix-3&period;0&period;15

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

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

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

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

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

  7. centos6&period;5下编译安装mariadb-10&period;0&period;20

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

  8. 在centos6编译安装http-2&period;4

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

  9. Centos6&period;5安装Redis3&period;0备忘记录

    Centos6.5安装Redis3.0 1. 安装C编译环境 首先需要安装编译Redis的C环境,在命令行执行以下命令: [root@itzhouq32 tools] yum install gcc- ...

随机推荐

  1. Android log 管理工具

    1.logger 项目地址: https://github.com/orhanobut/logger 2.KLog 项目地址:https://github.com/ZhaoKaiQiang/KLog ...

  2. hp安装oracle报错解决

    hpux上安装oracle 11gR2刚开始报错:集群验证框架内部发生了错误 解决办法http://www.it165.net/database/html/201509/14181.html 将文件后 ...

  3. Asp&period;net 怎样去除表单多行文本框滚动条

    <textarea style="overflow:hidden;border-width:0px;">永远没有滚动条</textarea><text ...

  4. 如果jsp提交到action为空指针的话

    很严重的一点:表单<form>有没有添加一个method="post",如果表单的这个没有写,肯定是空指针, 哎,被这个坑爹的代码,查了好久,特此记录下

  5. Mac下好用的取色器 Sip

    总有很多东西,你只是望一眼就已经神魂颠倒.措施有这样的App做的真的是用心的很,养眼,触发你内心冲动的美感.先留下一个,备忘. 太精致了 操作简单,左上角的有心圆点击就可以在任何地方取色了,取色点会z ...

  6. Swift - 本地消息的推送通知(附样例)

    使用UILocalNotification可以很方便的实现消息的推送功能.我们可以设置这个消息的推送时间,推送内容等. 当推送时间一到,不管用户在桌面还是其他应用中,屏幕上方会都显示出推送消息. 1, ...

  7. 译文:Javascript-Functions

    个人理解+google翻译+有道翻译.如有错误,请指正.原文来自MDN:Functions Functions是javascript基本构建模块之一.每一个function是一个javascript程 ...

  8. linux中配置maven环境

    一 .  下载maven http://maven.apache.org/download.cgi 二.   将maven解压到你的工具文件夹下 如我是解压到:  /home/urc/tool下 三. ...

  9. 【转】HTML-based script和URL-based script两种脚本录制方式

    在Web(HTTP/HTML)录制中,有2种重要的录制模式.用户该选择那种录制模式呢?HTML-mode录制是缺省也是推荐的录制模式.它录制当前网页中的HTML动作.在录制会话过程中不会录制所有的资源 ...

  10. HDU 1219 AC Me

    strlen能不用就不用 #include<cstdio> #include<cstdlib> #include<iostream> #include<alg ...