1、安装PHP及扩展包
rpm-Uvhhttp://mirror.webtatic.com/yum/el6/latest.rpm yum-yinstallPHP56wPHP56w-gdPHP56w-MysqLPHP56w-bcmathPHP56w-mbstringPHP56w-xmlPHP56w-ldap
2、安装MysqL及配置
rpm-ivhhttp://dev.MysqL.com/get/MysqL-community-release-el6-5.noarch.rpm yuminstall-yMysqL-serverMysqL-devel /etc/init.d/MysqLdstart MysqL_secure_installation
Entercurrentpasswordforroot(enterfornone):<�C初次运行直接回车 Setrootpassword?[Y/n]<�C是否设置root用户密码,输入y并回车或直接回车 Removeanonymoususers?[Y/n]<�C是否删除匿名用户,生产环境建议删除,所以直接回车 Disallowrootloginremotely?[Y/n]<�C是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 Removetestdatabaseandaccesstoit?[Y/n]<�C是否删除test数据库,直接回车 Reloadprivilegetablesnow?[Y/n]<�C是否重新加载权限表,直接回车
MysqL-uroot-pzabbix MysqL>CREATEDATABASEzabbixCHARACTERSETutf8COLLATEutf8_bin; MysqL>GRANTALLPRIVILEGESONzabbix.*TOzabbix@localhostIDENTIFIEDBY'zabbix'; MysqL>flushprivileges; MysqL>showdatabases;
#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
重启MysqL服务
/etc/init.d/MysqLdrestart StoppingMysqLd:[OK] StartingMysqLd:[OK] chkconfigMysqLdon
3、安装依赖包
yum-yinstalllibcurl-devellibxml2-develnet-snmpnet-snmp-devel yum-yinstallhttpdOpenIPMI-libsfpingiksemel
4、更新libcurl,如果不更新,发送邮件告警会失败,下面的链接中有详细的信息
http://www.iyunv.com/thread-261219-1-1.html
rpm-ivhcity-fan.org-release-1-13.rhel6.noarch.rpm
curl-V curl7.19.7(x86_64-redhat-linux-gnu)libcurl/7.19.7NSS/3.21BasicECCzlib/1.2.3libidn/1.18libssh2/1.4.2 Protocols:tftpftptelnetdictldapldapshttpfilehttpsftpsscpsftp Features:GSS-NegotiateIDNIPv6LargefileNTLMSSLlibz curl-V curl7.53.1(x86_64-redhat-linux-gnu)libcurl/7.53.1OpenSSL/1.0.1ezlib/1.2.3c-ares/1.12.0libssh2/1.8.0nghttp2/1.6.0 Protocols:dictfileftpftpsgopherhttphttpsimapimapsldapldapspop3pop3srtspscpsftpsmbsmbssmtpsmtpstelnettftp Features:AsynchDNSIPv6LargefileGSS-APIKerberosSPNEGONTLMNTLM_WBSSLlibzHTTP2UnixSocketsHTTPS-proxyMetalink
5、下载源码包
下载地址:http://www.zabbix.com/download
6、安装
tar -zxf zabbix-3.0.8.tar.gz
cd zabbix-3.0.8
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-MysqL --with-net-snmp --with-libcurl --with-libxml2
make && make install
7、拷贝服务启动脚本到/etc/init.d/目录
cpmisc/init.d/fedora/core/zabbix_server/etc/init.d/ cpmisc/init.d/fedora/core/zabbix_agentd/etc/init.d/
MysqL-uzabbix-pzabbix-hlocalhostzabbix<database/MysqL/schema.sql MysqL-uzabbix-pzabbix-hlocalhostzabbix<database/MysqL/images.sql MysqL-uzabbix-pzabbix-hlocalhostzabbix<database/MysqL/data.sql
9、创建软连接
ln-s/usr/local/zabbix/etc/etc/zabbix
10、修改PHP配置,我这里是将修改后的配置用单独的文件保存
cd/etc/httpd/conf.d vimzabbix.conf
PHP_valuemax_execution_time300 PHP_valuememory_limit128M PHP_valuepost_max_size32M PHP_valueupload_max_filesize2M PHP_valuemax_input_time300 PHP_valuealways_populate_raw_post_data-1 PHP_valuedate.timezoneAsia/Shanghai
11、创建zabbix目录
mkdir/var/www/html/zabbix cp-R/usr/local/src/zabbix-3.0.8/frontends/PHP/*/var/www/html/zabbix/ chown-Rapache:apache/var/www/html/zabbix
12、创建log目录
mkdir/var/log/zabbix
配置日志切割
cat/etc/logrotate.d/zabbix-agent
/var/log/zabbix/zabbix_agentd.log{ weekly rotate12 compress delaycompress missingok notifempty create0664zabbixzabbix }
cat/etc/logrotate.d/zabbix-server
/var/log/zabbix/zabbix_server.log{ weekly rotate12 compress delaycompress missingok notifempty create0664zabbixzabbix }
13、修改zabbix_server.conf配置文件,修改后的配置如下,这是生产用的配置,内存都调高了.使用root用户启动zabbix server
LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid 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 AllowRoot=1
14、修改zabbix_agent.conf配置文件,修改后的配置如下(使用root用户启动zabbix agent)
LogFile=/var/log/zabbix/zabbix.agent.log Server=127.0.0.1 ServerActive=127.0.0.1 Hostname=Zabbixserver AllowRoot=1 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
15、设置zabbix agent和zabbix server服务开机启动
chkconfig--addzabbix_server chkconfig--addzabbix_agentd chkconfigzabbix_serveron chkconfigzabbix_agentdon /etc/init.d/zabbix_serverstart /etc/init.d/zabbix_agentdstart
16、启动apache服务
/etc/init.d/httpdstart chkconfighttpdon
17、登录zabbix web进行配置
配置zabbix数据库的密码
不用配置,直接下一步
不用配置,下一步
配置完成