Zabbix3.0界面焕然一新,一改10多年的老面孔,alpha4的更新具体记录下:Http://www.zabbix.com/rn3.0.0alpha4.PHPWhat's New in 3.0.0alp
Zabbix3.0界面焕然一新,一改10多年的老面孔,alpha4的更新具体记录下:Http://www.zabbix.com/rn3.0.0alpha4.PHP
What's New in 3.0.0alpha4
Zabbix 3.0安装过程与2.x的变化类似,但又少许需要注意的坑(以下标红的),否则会坑的不行。。。
基础环境:
Centos 6.6 X64
Nginx:1.9.7
Mysql:5.5.32
php:5.5.30( zabbix_3.0 要求php版本至少在5.4以上 )
一、Nginx安装:
1.rpm -qa pcre pcre-devel
2.yum install pcre pcre-devel openssl openssl-devel -y
3.mkdir -p /usr/local/nginx-1.9.7
4.useradd nginx -s /sbin/nologin -M
5../configure --user=nginx --group=nginx --prefix=/usr/local/nginx-1.9.7 --with-http_stub_status_module --with-http_ssl_module
make && make install
ln -s /usr/local/nginx-1.9.7 /usr/local/nginx
6.ls -l /usr/local/
7./usr/local/nginx/sbin/nginx
8.ps -ef|grep nginx
9.ss -lntup|grep nginx
[root@zabbix_3.0 conf]# egrep -v "#|^$" nginx.conf.default > nginx.conf
[root@zabbix_3.0 conf]# vim /usr/local/nginx/conf/nginx.conf
worker_processes 1;
error_log /usr/local/nginx/logs/error.log; --新增一行
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on; --新增一行
server {
listen 80;
server_name localhost;
access_log /usr/local/nginx/logs/access.log; --新增一行
root /usr/local/nginx/html; --更改为/usr/local/nginx/html,原来的值为html;
index index.php index.html index.htm; --加一个index.php
error_page 500 502 503 504 /50x.html;
location = /50x.html { --删除这行
root html; --删除这行
} --删除这行
--下面这部分新增加的内容
location ~ \.(php|php5)?$ {
#root /usr/local/nginx/html;
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;
}
}
}
10.为nginx提供 init脚本,新建文件/etc/rc.d/init.d/nginx,把以下内容复制到刚建的nginx文件下:
#!/bin/sh
#nx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# 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
# config: /etc/sysconfig/nginx
# 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 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /usr/local/nginx ] && . /usr/local/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
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
sleep 1
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 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
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
11.添加启动项并做成服务:
[root@localhost nginx-1.9.7]chmod +x /etc/rc.d/init.d/nginx
[root@localhost nginx-1.9.7]chkconfig --add nginx
[root@localhost nginx-1.9.7]chkconfig nginx on
[root@localhost php]# ps -A|grep nginx
62878 ? 00:00:00 nginx
62879 ? 00:00:00 nginx
二、mysql安装:二进制软件包(170多M)
# yum install tree nmap lrzsz dos2unix -y
# mkdir -p /usr/local/mysql-5.5.32
[root@zabbix_3.0]# tar -zxvf mysql-5.5.32-linux2.6-x86_64.tar.gz
[root@zabbix_3.0]# mv mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql-5.5.32
[root@zabbix_3.0]# ln -s /usr/local/mysql-5.5.32/ /usr/local/mysql
[root@zabbix_3.0]# useradd mysql -s /sbin/nologin -M
[root@zabbix_3.0]# chown -R mysql.mysql /usr/local/mysql
[root@zabbix_3.0]# cd /usr/local/mysql
[root@zabbix_3.0 mysql]
-- 创建系统表
# ./scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
--这步不用做sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
cp support-files/my-small.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
# source /etc/profile
[root@zabbix_3.0]# echo $PATH
/usr/local/mysql/bin:/usr/lib64/Qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@zabbix_3.0 application]# cp -a /application/mysql/binzabbix/alertscripts #zabbix运行脚本存放目录
LogFile=/var/log/zabbix-server/zabbix_server.log --更改Logfile的值为/var/log/zabbix-server/zabbix_server.log,原来的默认值为/tmp/zabbix_server.log
[root@oldboy zabbix-3.0.0]# vim /usr/local/zabbix/etc/zabbix_agentd.conf
LogFile=/var/log/zabbix-agentd/zabbix_agentd.log --更改Logfile的值为/var/log/zabbix-agentd/zabbix_agentd.log,原来的默认值为/tmp/zabbix_agentd.log
Hostname=test202
2.zabbix 3.0启动方式:
[root@oldboy zabbix-3.0.0]# cp /root/software /zabbix-3.0.0/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server #服务端
[root@oldboy zabbix-3.0.0]# cp /root/software/zabbix-3.0.0/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd #客户端
[root@oldboy zabbix-3.0.0]# vi /etc/rc.d/init.d/zabbix_server
# Zabbix-Directory
BASEDIR=/usr/local/zabbix --更改BASEDIR的值为/usr/local/zabbix,原来的值为/usr/local,如果安装时不指定--prefix,就默认安装在/usr/local,因为我安装zabbix在/usr/local/zabbix
同理,也把zabbix_agentd的BASEDIR的值改为/usr/local/zabbix
shell> zabbix_server
zabbix_server [15644]: cannot open "/var/log/zabbix-server/zabbix_server.log": [13] Permission denied
报错是权限的问题,将var/log/zabbix-server的目录及其下所有文件都设为zabbix用户和zabbix所属组即可
3.将/usr/local/zabbix/sbin目录、/usr/local/nginx/sbin目录、/usr/local/php/sbin目录也写入/etc/profile的环境变量PATH当中
# vi /etc/profile
export PATH=/usr/local/zabbix/sbin:/usr/local/nginx/sbin:/usr/local/php/sbin:/usr/local/mysql/bin:$PATH'
# source /etc/profile
4.然后启动php
[root@oldboy zabbix-3.0.0]# /usr/local/php/sbin/php-fpm
5.配置WEB环境:
[root@oldboy zabbix-3.0.0]# cd /root/software/zabbix-3.0.0/frontends
[root@oldboy zabbix-3.0.0]# cp -rf php /usr/local/nginx/html/zabbix
6.在浏览器里输入http://10.101.0.15/zabbix 回车
7.修改php.ini:(php5.5默认值较小)
vim /usr/local/php/lib/php.ini 主要为下面几个参数
--在vi里查找出上面的参数,再修改其值
PHP option post_max_size 16M --更改值为16M,原来的值为8M
PHP option max_execution_time 300 --更改值为300,原来的值为60
PHP option max_input_time 300 --更改值为300,原来的值为30
PHP time zone Asia/Shanghai --添加值为Asia/Shanghai,原来的值为空,并把前面的;去掉,使其生效
:x
8.这里修不修改端口都可,如果编译php时你没有带上 --with-mysqli=mysqlnd 你会悲剧的发现这里默认出现的是SQLite3,且无法更换。。。
9.需要给此目录下/usr/local/nginx/html/zabbix/conf的zabbix.conf.php w+x权限,否则install之前会报错需要下载conf,且赋权。
10.安装至此完毕。界面如下(是比以前好看了。。)
如果您觉得此篇文章对您有帮助,欢迎关注微信公众号:guestart的DBA学习笔记,您的支持是对我最大的鼓励!
--结束END--
本文标题: ZABBIX3.0在CentOS6.6上的安装部署
本文链接: https://lsjlt.com/news/39800.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0