一、安裝MySQLphp
#rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm #yum install -y mysql-server mysql-devel
service mysqld start mysql_secure_installation #MySQL安全配置嚮導 Enter current password for root (enter for none): <–初次運行直接回車 Set root password? [Y/n] <– 是否設置root用戶密碼,輸入y並回車或直接回車 Remove anonymous users? [Y/n] <– 是否刪除匿名用戶,生產環境建議刪除,因此直接回車 Disallow root login remotely? [Y/n] <–是否禁止root遠程登陸,根據本身的需求選擇Y/n並回車,建議禁止 Remove test database and access to it? [Y/n] <– 是否刪除test數據庫,直接回車 Reload privilege tables now? [Y/n] <– 是否從新加載權限表,直接回車
mysql -uroot -p mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix'; mysql> flush privileges; mysql> show databases;
更改數據庫配置文件,記得重啓服務mysql
#vim /etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock innodb_file_per_table = 1 character-set-server = utf8 #獨立表空間模式 innodb_file_per_table = 1 symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
二、安裝PHP5.6web
#rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm #yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap vim /etc/php.ini date.timezone = Asia/Shanghai
三、安裝依賴包和zabbix-server相關包sql
#yum -y install httpd libxml2-devel net-snmp-devel libcurl-devel #yum -y install OpenIPMI-libs #yum -y install fping #yum -y install iksemel #yum -y install zabbix-server zabbix-web #yum -y zabbix-mysql zabbix-agent zabbix-web-mysql #yum -y zabbix_get
4導入zabbix數據庫數據庫
#cd /usr/share/doc/zabbix-server-mysql-3.0.8/ #gunzip create.sql.gz #mysql -uzabbix -pzabbix zabbix < create.sql
五、建立vhost.conf文件vim
#cd /etc/http/conf.d/ #vim vhost.conf # Zabbix monitoring system php web frontend # Alias /zabbix /usr/share/zabbix <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all <IfModule mod_php5.c> php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value always_populate_raw_post_data -1 # php_value date.timezone Europe/Riga </IfModule> </Directory> <Directory "/usr/share/zabbix/conf"> Order deny,allow Deny from all <files *.php> Order deny,allow Deny from all </files> </Directory> <Directory "/usr/share/zabbix/app"> Order deny,allow Deny from all <files *.php> Order deny,allow Deny from all </files> </Directory> <Directory "/usr/share/zabbix/include"> Order deny,allow Deny from all <files *.php> Order deny,allow Deny from all </files> </Directory> <Directory "/usr/share/zabbix/local"> Order deny,allow Deny from all <files *.php> Order deny,allow Deny from all </files> </Directory>
建立/etc/httpd/conf.d/zabbix.conf文件安全
php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 32M php_value upload_max_filesize 2M php_value max_input_time 300 php_value always_populate_raw_post_data -1 php_value date.timezone Asia/Shanghai
啓動httpdbash
#/etc/init.d/httpd start
六、配置zabbix_server.conf文件app
#cat /etc/zabbix/zabbix_server.conf | egrep -v "^$|^#" LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 DebugLevel=3 PidFile=/var/run/zabbix/zabbix_server.pid ##DB的地址或計算機名 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix StartPollers=40 StartPollersUnreachable=20 StartTrappers=8 StartPingers=8 StartDiscoverers=8 StartHTTPPollers=8 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log HousekeepingFrequency=1 CacheSize=128M StartDBSyncers=8 HistoryCacheSize=32M HistoryIndexCacheSize=32M TrendCacheSize=8M ValueCacheSize=128M Timeout=30 TrapperTimeout=120 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000
啓動zabbix server服務frontend
#/etc/init.d/zabbix-server start
七、訪問zabbix web並配置
訪問http://$IP/zabbix 進行配置