{"id":2684,"date":"2016-05-14T22:32:56","date_gmt":"2016-05-14T14:32:56","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2684"},"modified":"2016-05-14T22:32:56","modified_gmt":"2016-05-14T14:32:56","slug":"%e5%9c%a8centos-6%e4%b8%8b%e4%bb%8e%e6%ba%90%e7%a0%81%e5%ae%89%e8%a3%85zabbix","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2684.html","title":{"rendered":"\u5728CentOS 6\u4e0b\u4ece\u6e90\u7801\u5b89\u88c5Zabbix"},"content":{"rendered":"<p>=Start=<\/p>\n<h6>\u7f18\u7531\uff1a<\/h6>\n<p>\u6d4b\u8bd5\u9700\u8981\uff1b\u7814\u7a76\u9700\u8981\u3002<\/p>\n<h5>\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n<p>Zabbix\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f51\u7edc\u548c\u5e94\u7528\u76d1\u63a7\u8f6f\u4ef6\u3002Zabbix\u63d0\u4f9bagent\u5e76\u901a\u8fc7 SNMP, TCP \u548c ICMP \u6765\u68c0\u67e5\/\u76d1\u63a7\u8fdc\u7aef\u7684\u4e3b\u673a\u3002\u4e0b\u9762\u662f\u6211\u6839\u636e\u5b98\u7f51\u4ecb\u7ecd\u548c\u5b9e\u9645\u64cd\u4f5c\u603b\u7ed3\u7684\u4e00\u4e2a\u8f83\u4e3a\u5408\u7406\u7684\u6e90\u7801\u5b89\u88c5Zabbix\u7684\u6d41\u7a0b\uff1a<\/p>\n<p>\u4e00\u3001\u5b89\u88c5 Zabbix \u540e\u53f0\u8fdb\u7a0b<\/p>\n<h6>0.\u5b89\u88c5\u4f9d\u8d56<\/h6>\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5b8c\u5168\u5b89\u88c5Zabbix\u9700\u8981\u57fa\u4e8eLAMP\u6216LNMP\u73af\u5883(\u56e0\u4e3aZabbix\u6709Web\u754c\u9762\u4e14\u9700\u8981\u548c\u6570\u636e\u5e93\u6253\u4ea4\u9053\uff0c\u5e76\u4e14Zabbix\u7684Web\u754c\u9762\u662f\u7528PHP\u5199\u7684)\uff0c\u6240\u4ee5\uff0c\u8981\u5b8c\u6574\u7684\u5b89\u88c5Zabbix\u9700\u8981\u5148\u5b89\u88c5\u4e00\u4e9b\u4f9d\u8d56\uff08Apache\u3001MySQL\/Percona\u3001PHP\u3001curl\u3001snmp\u3001fping\u3001\u2026\u2026\uff09\uff1a<\/p>\n<pre class=\"lang:default decode:true \"># yum install httpd httpd-devel\n# yum install mysql mysql-server \u6216 # yum install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-devel-55\n# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml php-bcmath\n# yum install libcurl-devel libxml2-devel net-snmp-devel fping<\/pre>\n<p>\u542f\u52a8Apache\u548cMySQL\uff1a<\/p>\n<pre class=\"lang:default decode:true \"># \/etc\/init.d\/httpd start\n# \/etc\/init.d\/mysql start<\/pre>\n<p>\u5bf9\u521a\u5b89\u88c5\u7684MySQL\u8fdb\u884c\u4e00\u4e9b\u5b89\u5168\u8bbe\u7f6e\uff1a<\/p>\n<pre class=\"lang:default decode:true \"># mysql_secure_installation<\/pre>\n<h6>1.\u6e90\u7801\u4e0b\u8f7d<\/h6>\n<pre class=\"lang:default decode:true \"># wget http:\/\/sourceforge.net\/projects\/zabbix\/files\/ZABBIX%20Latest%20Stable\/3.0.1\/zabbix-3.0.1.tar.gz\n# tar zxf zabbix-3.0.1.tar.gz\n# cd zabbix-3.0.1<\/pre>\n<h6>2.\u521b\u5efaZabbix\u4e13\u7528\u8d26\u6237<\/h6>\n<pre class=\"lang:default decode:true \"># groupadd zabbix\n# useradd -g zabbix zabbix<\/pre>\n<h6>3.\u521b\u5efaZabbix\u7684\u6570\u636e\u5e93<\/h6>\n<pre class=\"lang:default decode:true\"># mysql -u&lt;username&gt; -p&lt;password&gt;\nmysql&gt; create database zabbix character set utf8 collate utf8_bin;\nmysql&gt; quit;\n# mysql -u&lt;username&gt; -p&lt;password&gt; zabbix &lt; database\/mysql\/schema.sql\n\n#\u5982\u679c\u662f\u4e3aZabbix proxy\u521b\u5efa\u6570\u636e\u5e93\uff0c\u90a3\u4e0b\u9762\u7684\u6b65\u9aa4\u5176\u5b9e\u5c31\u53ef\u4ee5\u4e0d\u7528\u6267\u884c\u4e86\n# mysql -u&lt;username&gt; -p&lt;password&gt; zabbix &lt; database\/mysql\/images.sql\n# mysql -u&lt;username&gt; -p&lt;password&gt; zabbix &lt; database\/mysql\/data.sql<\/pre>\n<h6>4.\u7f16\u8bd1 &amp; \u5b89\u88c5<\/h6>\n<pre class=\"lang:default decode:true \"># .\/configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2\n# make install<\/pre>\n<h6>5.\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<\/h6>\n<pre class=\"lang:default decode:true\"># vim \/usr\/local\/etc\/zabbix_server.conf\nLogFile=\/tmp\/zabbix_server.log\nDebugLevel=3  #\u5982\u679c\u5728\u6d4b\u8bd5\u73af\u5883\u4e2d\u9700\u8981\u8fdb\u884c\u8c03\u8bd5\uff0c\u53ef\u4ee5\u5c063\u4fee\u6539\u62104\nDBHost=localhost\nDBName=zabbix\nDBUser=zabbix\nDBPassword=zabbix<\/pre>\n<pre class=\"lang:default decode:true\"># vim \/usr\/local\/etc\/zabbix_agentd.conf\nLogFile=\/tmp\/zabbix_agentd.log\nDebugLevel=3  #\u5982\u679c\u5728\u6d4b\u8bd5\u73af\u5883\u4e2d\u9700\u8981\u8fdb\u884c\u8c03\u8bd5\uff0c\u53ef\u4ee5\u5c063\u4fee\u6539\u62104\nServer=127.0.0.1\nServerActive=127.0.0.1\nHostname=Zabbix server<\/pre>\n<h6>6.\u542f\u52a8\u540e\u53f0\u8fdb\u7a0b<\/h6>\n<pre class=\"lang:default decode:true\"># zabbix_server\n# zabbix_agentd<\/pre>\n<h6>7.\u5176\u5b83(\u8c03\u8bd5\u2026\u2026)<\/h6>\n<pre class=\"lang:default decode:true\"># \u53ef\u4ee5\u901a\u8fc7\/tmp\/zabbix*\u7684log\u6587\u4ef6\u8c03\u8bd5\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u8fd0\u884c\u60c5\u51b5\u3002\u5982\u679c\u542f\u52a8\u6210\u529f\uff0c\u670d\u52a1\u4f1a\u76d1\u542c\u76f8\u5e94\u7aef\u53e3\n# netstat -lntp | grep \"zabbix\"\n# ps aux | grep \"zabbix\"<\/pre>\n<p>\u4e8c\u3001\u5b89\u88c5 Zabbix \u7684Web\u754c\u9762<\/p>\n<h6>0.\u62f7\u8d1dPHP\u6587\u4ef6\u81f3Web\u76ee\u5f55<\/h6>\n<p><span style=\"color: #ff0000;\"><strong>RHEL\u7cfbLinux\u7cfb\u7edf\u4e2d\u7528yum\u5b89\u88c5\u7684Apache\u7684Web\u76ee\u5f55\u9ed8\u8ba4\u4e3a<\/strong><\/span>\u300c\/var\/www\/html\u300d<br \/>\n<span style=\"color: #ff0000;\">\u5982\u679c\u662f\u4ece\u6e90\u7801\u5b89\u88c5\u7684Apache\uff0c\u5219Web\u76ee\u5f55\u9ed8\u8ba4\u4e3a<\/span>\u300c\/usr\/local\/apache2\/htdocs\u300d<\/p>\n<pre class=\"lang:default decode:true \"># mkdir -p \/var\/www\/html\/zabbix\n# cd frontends\/php\n# cp -a . \/var\/www\/html\/zabbix<\/pre>\n<pre class=\"lang:default decode:true \"># cp \/var\/www\/html\/zabbix\/conf\/zabbix.conf.php.example \/var\/www\/html\/zabbix\/conf\/zabbix.conf.php\n# vim \/var\/www\/html\/zabbix\/conf\/zabbix.conf.php\n$DB[\"DATABASE\"] = 'zabbix';\n$DB[\"USER\"] = 'root';\n$DB[\"PASSWORD\"] = 'password';<\/pre>\n<h6>1.\u4fee\u6539PHP\u914d\u7f6e\u6587\u4ef6<\/h6>\n<pre class=\"lang:default decode:true\"># \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u300cphp --ini\u300d\u67e5\u770bPHP\u7684\u914d\u7f6e\u6587\u4ef6\u5728\u54ea\uff0c\u7136\u540e\u7f16\u8f91\u5982\u4e0b\u9879\u76ee\u7684\u503c\uff1a\nmemory_limit = 128M\npost_max_size = 16M\nupload_max_filesize = 2M\nmax_execution_time = 300\nmax_input_time = 300\ndate.timezone = Asia\/Shanghai<\/pre>\n<h6>2.<span style=\"color: #ff0000;\"><strong>\u767b\u5f55\u5e76\u4fee\u6539\u9ed8\u8ba4\u5bc6\u7801<\/strong><\/span><\/h6>\n<pre class=\"lang:default decode:true\">#\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/&lt;server_ip_or_name&gt;\/zabbix\n\u7528\u9ed8\u8ba4\u7684\u7528\u6237\u540d\u3001\u5bc6\u7801\u4e3a\u300cAdmin:zabbix\u300d\u8fdb\u884c\u767b\u5f55\n\n#\u7136\u540e\u8bbf\u95ee http:\/\/&lt;server_ip_or_name&gt;\/zabbix\/profile.php\n\u4fee\u6539\u9ed8\u8ba4\u7684\u5bc6\u7801(\u8bf7\u8bbe\u7f6e\u590d\u6742\u5bc6\u7801\uff01\uff01\uff01)<\/pre>\n<h6>3.\u5176\u5b83<\/h6>\n<p>\u6ce8\u610f\u5173\u6ce8Apache\u7684\u65e5\u5fd7\u6587\u4ef6\u300c\/var\/log\/httpd\/error_log\u300d\u65b9\u4fbf\u8fdb\u884c\u67e5\u9519\u3002<\/p>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/en.wikipedia.org\/wiki\/Zabbix\">http:\/\/en.wikipedia.org\/wiki\/Zabbix<\/a><\/li>\n<li><a href=\"https:\/\/www.zabbix.com\/documentation\/3.0\/manual\/installation\/install\">[\u5b98\u7f51]\u4ece\u6e90\u7801\u5b89\u88c5Zabbix<\/a><\/li>\n<li><a href=\"http:\/\/tecadmin.net\/install-zabbix-network-monitoring-on-centos-rhel-and-fedora\/\">How To Install Zabbix Server 3.0 on CentOS\/RHEL 7\/6\/5<\/a><\/li>\n<li><a href=\"http:\/\/zhmin.blog.51cto.com\/5402080\/1586680\">CentOS 6.5 \u4e0b\u5b89\u88c5 Zabbix 2.4<\/a><\/li>\n<li><a href=\"http:\/\/tecadmin.net\/add-host-zabbix-server-monitor\/\">\u5411Zabbix\u670d\u52a1\u7aef\u6dfb\u52a0\u8981\u76d1\u63a7\u7684\u4e3b\u673a<\/a><\/li>\n<li><a href=\"https:\/\/www.zabbix.com\/documentation\/2.2\/manual\/quickstart\/login\">Zabbix\u7684\u7528\u6237\u7ba1\u7406<\/a><\/li>\n<li>Zabbix\u4e0b\u8f7d<br \/>\n<a href=\"https:\/\/sourceforge.net\/projects\/zabbix\/files\/\">https:\/\/sourceforge.net\/projects\/zabbix\/files\/<\/a><br \/>\n<a href=\"http:\/\/www.zabbix.com\/download.php\">http:\/\/www.zabbix.com\/download.php<\/a><\/li>\n<li><a href=\"http:\/\/www.linuxidc.com\/Linux\/2014-05\/102257.htm\">Zabbix\u7684\u914d\u7f6e<\/a><\/li>\n<li><a href=\"http:\/\/www.answ.cc\/?post=16\">\u5173\u4e8eZabbix\u540e\u53f0\u547d\u4ee4\u6267\u884c\u7684\u5229\u7528<\/a><\/li>\n<li><a href=\"http:\/\/manfred12.blog.51cto.com\/137312\/1036469\">Zabbix \u76d1\u63a7\u670d\u52a1\u5668\u642d\u5efa<\/a><\/li>\n<\/ul>\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u6d4b\u8bd5\u9700\u8981\uff1b\u7814\u7a76\u9700\u8981\u3002 \u53c2\u8003\u89e3\u7b54\uff1a Zabbix\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f51\u7edc\u548c\u5e94\u7528\u76d1\u63a7\u8f6f\u4ef6\u3002Zabb [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11,12],"tags":[30,605],"class_list":["post-2684","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","category-tools","tag-linux","tag-zabbix"],"views":7160,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2684"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2684\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}