样例视频实战:
http://www.roncoo.com/course/view/fb3050a5b34b42f39ccad83ebebc89c1
注意要点:
1
、关闭selinux
2
、php使用5.4以上,可以先查看php版本信息:
[root@BJ-monitor-h-01 src]# php -v
PHP 5.5.35 (cli) (built: Apr 27 2016 14:53:02)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
安装elep源:
rpm -Uvh
http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
加入Php版本不够高,可以用yum的remi库升级,默认epel源都没带有,基本上差不多,这里我们全程方便用rpm的方式安装。
rpm -Uvh
http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
安装php以及其他插件,php可以源码安装,以为要存放的数据库位置要制定好。
yum install make mysql-server httpd php mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml unixODBC-devel OpenIPMI-devel libxml2-devel
配置mysql,创建zabbix库,授权zabbix账户查看信息:
Create database zabbix
grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
Flush privileges;
安装php插件:
yum --enablerepo=remi,remi-php55 install mysql-devel libxml2-devel net-snmp-devel libcurl-devel
下载相关zabbix包,课程开始前最新的是3.0.3的包,预算下载:下载版本可以查看:
https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/
zabbix
安装:
[root@monitor zabbix-3.0.3]# ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc --prefix=/usr/local/zabbix
[root@monitor zabbix-3.0.3]# make && make install
Cd /usr/local/src/zabbix-3.0.3/database/mysql
[root@BJ-monitor-h-01 mysql]# ls
data.sql p_w_picpaths.sql schema.sql
导入三个库:
[root@BJ-monitor-h-01 mysql]# mysql -uzabbix -p zabbix < schema.sql
Enter password:
[root@BJ-monitor-h-01 mysql]# mysql -uzabbix -p zabbix < p_w_picpaths.sql
Enter password:
[root@BJ-monitor-h-01 mysql]# mysql -uzabbix -p zabbix < data.sql
复制到启动项:
cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/zabbix_server
cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/zabbix_agentd
修改配置文件位置:
[root@monitor zabbix-3.0.3]# cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/[root@monitor zabbix-3.0.3]# cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
修改两个配置文件把
[root@monitor zabbix-3.0.3]# vim /etc/init.d/zabbix_agentd
ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"
改成ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
[root@monitor zabbix-3.0.3]# vim /etc/init.d/zabbix_server
ZABBIX_BIN="/usr/local/sbin/zabbix_server"
改成ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
给脚本启动脚本赋予权限:
[root@cobbler zabbix-3.0.3]# chmod -R 755 /usr/local/zabbix/
[root@cobbler zabbix-3.0.3]# chmod 755 /etc/init.d/zabbix_server
# chown zabbix:zabbix /etc/init.d/zabbix_server
修改zabbix文件对应的数据库账号和密码:
vim
/usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动zabbix服务:
[root@monitor zabbix-3.0.3]# /etc/init.d/zabbix_server start
[root@monitor zabbix-3.0.3]# /etc/init.d/zabbix_agentd start
[root@monitor zabbix-3.0.3]# chkconfig zabbix_agentd on
[root@monitor zabbix-3.0.3]# chkconfig zabbix_server on
修改php相关配置文件:
vim /etc/php.ini
max_execution_time = 300
max_input_time = 300
date.timezone =Asia/Shanghai
post_max_size = 32M
重启httpd使php配置生效
[root@cobbler zabbix-3.0.3]# /etc/init.d/httpd restart
复制php项目到http目录下,并给相关权限:
[root@cobblerzabbix-3.0.3]#cp -rf frontends/php /var/www/html/zabbix
[root@monitor htdocs]# chown -R apache.apache /var/www/html/zabbix
9
、启动url访问即可:IP/zabbix
图一:
图二:
图三:
图4:
图六:
关注更多内容: