首页 > 代码库 > Zabbix应用之Server/Agent部署
Zabbix应用之Server/Agent部署
1 2 3 4 5 | 环境: OS Version:CentOS 6.5 x86_64位 采用最小化安装,系统经过了基本优化 selinux 为关闭状态,iptables 为无限制模式 主机名:zabbix-master-rj I P :10.1.1.1 |
1 2 3 4 | [root@zabbix-master-rj /root ] #iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT [root@zabbix-master-rj /root ] #iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT [root@zabbix-master-rj /root ] #iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT [root@zabbix-master-rj /root ] #iptables -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT |
1 2 | [root@zabbix-master-rj /root ] #chcon -R -t httpd_sys_content_rw_t /usr/share/zabbix/conf [root@zabbix-master-rj /root ] #setsebool -P httpd_can_network_connect=true[root@zabbix-master-rj /root]#semanage port -a -t http_port_t -p tcp 10051 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [root@zabbix-master-rj /root ] # rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm[root@zabbix-master-rj /root]# yum clean all [root@zabbix-master-rj /root ] # yum list|grep zabbix22 zabbix22.x86_64 2.2.1-5.el6 epel zabbix22-agent.x86_64 2.2.1-5.el6 epel zabbix22-dbfiles-mysql.noarch 2.2.1-5.el6 epel zabbix22-dbfiles-pgsql.noarch 2.2.1-5.el6 epel zabbix22-dbfiles-sqlite3.noarch 2.2.1-5.el6 epel zabbix22-proxy.noarch 2.2.1-5.el6 epel zabbix22-proxy-mysql.x86_64 2.2.1-5.el6 epel zabbix22-proxy-pgsql.x86_64 2.2.1-5.el6 epel zabbix22-proxy-sqlite3.x86_64 2.2.1-5.el6 epel zabbix22-server.noarch 2.2.1-5.el6 epel zabbix22-server-mysql.x86_64 2.2.1-5.el6 epel zabbix22-server-pgsql.x86_64 2.2.1-5.el6 epel zabbix22-web.noarch 2.2.1-5.el6 epel zabbix22-web-mysql.noarch 2.2.1-5.el6 epel zabbix22-web-pgsql.noarch 2.2.1-5.el6 epel |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | [root@zabbix-master-rj /root ] # yum install zabbix22.x86_64 zabbix22-agent.x86_64 zabbix22-dbfiles-mysql.noarch zabbix22-server.noarch zabbix22-server-mysql.x86_64 zabbix22-web.noarch zabbix22-web-mysql.noarch -y=======================================================================================================================================Package Arch Version Repository Size=======================================================================================================================================Installing: zabbix22 x86_64 2.2.1-5.el6 epel 197 k zabbix22-agent x86_64 2.2.1-5.el6 epel 149 k zabbix22-dbfiles-mysql noarch 2.2.1-5.el6 epel 1.1 M zabbix22-server noarch 2.2.1-5.el6 epel 20 k zabbix22-server-mysql x86_64 2.2.1-5.el6 epel 405 k zabbix22-web noarch 2.2.1-5.el6 epel 4.2 M zabbix22-web-mysql noarch 2.2.1-5.el6 epel 9.6 k Installing for dependencies: OpenIPMI-libs x86_64 2.0.16-14.el6 base 473 k apr x86_64 1.3.9-5.el6_2 base 123 k apr-util x86_64 1.3.9-3.el6_0.1 base 87 k apr-util-ldap x86_64 1.3.9-3.el6_0.1 base 15 k fping x86_64 2.4b2-10.el6 epel 31 k httpd x86_64 2.2.15-31.el6.centos updates2 824 k httpd-tools x86_64 2.2.15-31.el6.centos updates2 73 k iksemel x86_64 1.4-2.el6 epel 48 k libXpm x86_64 3.5.10-2.el6 base 51 k lm_sensors-libs x86_64 3.1.1-17.el6 base 38 k net-snmp-libs x86_64 1:5.5-49.el6_5.4 updates2 1.5 M php x86_64 5.3.3-27.el6_5.2 updates2 1.1 M php-bcmath x86_64 5.3.3-27.el6_5.2 updates2 36 k php-cli x86_64 5.3.3-27.el6_5.2 updates2 2.2 M php-common x86_64 5.3.3-27.el6_5.2 updates2 526 k php-gd x86_64 5.3.3-27.el6_5.2 updates2 108 k php-ldap x86_64 5.3.3-27.el6_5.2 updates2 40 k php-mbstring x86_64 5.3.3-27.el6_5.2 updates2 457 k php-mysql x86_64 5.3.3-27.el6_5.2 updates2 83 k php-pdo x86_64 5.3.3-27.el6_5.2 updates2 77 k php-xml x86_64 5.3.3-27.el6_5.2 updates2 105 k unixODBC x86_64 2.2.14-12.el6_3 base 378 k Transaction Summary=======================================================================================================================================Install 29 Package(s) |
1 2 3 4 5 6 7 8 | [root@zabbix-master-rj /root ] # /etc/init.d/mysqld start [root@zabbix-master-rj /root ] # mysql -uroot -p mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; mysql> GRANT ALL ON zabbix.* TO opszabbix@ ‘10.1.1.%‘ IDENTIFIED BY ‘opszabbix‘ ; [root@zabbix-master-rj /root ] # ls /usr/share/zabbix-mysql/*sql -rw-r--r--. 1 root root 970301 Jan 29 2014 /usr/share/zabbix-mysql/data .sql -rw-r--r--. 1 root root 1978341 Dec 9 2013 /usr/share/zabbix-mysql/images .sql -rw-r--r--. 1 root root 106560 Dec 9 2013 /usr/share/zabbix-mysql/schema .sql |
1 2 3 | [root@zabbix-master-rj /root ] # mysql -uopszabbix -popszabbix zabbix < /usr/share/zabbix-mysql/schema.sql [root@zabbix-master-rj /root ] # mysql -uopszabbix -popszabbix zabbix < /usr/share/zabbix-mysql/images.sql [root@zabbix-master-rj /root ] # mysql -uopszabbix -popszabbix zabbix < /usr/share/zabbix-mysql/data.sql |
1 2 | [root@zabbix-master-rj /root ] # /etc/init.d/httpd start [root@zabbix-master-rj /root ] # /etc/init.d/zabbix-server start |
1 2 | [root@zabbix-master-rj /root ] # grep ‘^post_max_size|^max_execution_time|^max_input_time|^date.timezone‘ /etc/php.ini max_execution_time = 300max_input_time = 300post_max_size = 16Mdate.timezone = Asia /Shanghai |
1 2 3 4 5 6 7 8 9 10 11 12 | [root@zabbix-master-rj /root ] # cat /etc/zabbix/web/zabbix.conf.php <?php // Zabbix GUI configuration fileglobal $DB; $DB[ ‘TYPE‘ ] = ‘MYSQL‘ ; # zabbix server使用的数据库类型 $DB[ ‘SERVER‘ ] = ‘10.1.1.1‘ ; # zabbix server使用的数据库IP地址 $DB[ ‘PORT‘ ] = ‘3306‘ ; # zabbix server使用的数据库的端口 $DB[ ‘DATABASE‘ ] = ‘zabbix‘ ; # zabbix server使用的数据库的库名 $DB[ ‘USER‘ ] = ‘opszabbix‘ ; # zabbix server所使用的数据库用户 $DB[ ‘PASSWORD‘ ] = ‘6a7b3efb855df9c‘ ; # 经过加密的数据库用户密码// SCHEMA is relevant only for IBM_DB2 database$DB[‘SCHEMA‘] = ‘‘; # 如果你使用DB2的数据库时,这一项配置才有用 $ZBX_SERVER = ‘localhost‘ ; # zabbix server所在的IP地址 $ZBX_SERVER_PORT = ‘10051‘ ; # zabbix server 的 端口号 $ZBX_SERVER_NAME = ‘zabbix-master-rj‘ ; # zabbix server 的主机名 $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;?> |
1 | [root@agent /root ] # chkconfig zabbix-server on |
1 | [root@agent-node-rj /root ] # rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm[root@agent-node-rj /root]# yum clean all |
1 | [root@agent-node-rj /root ] # yum install zabbix22.x86_64 zabbix22-agent.x86_64 |
1 2 3 4 | [root@agent-node-rj /root ] # # grep ‘^Server|^ServerActive|^Hostname‘ /etc/zabbix_agentd.conf Server=10.1.1.120 # 被动模式,允许哪台服务器连接Agent ServerActive=10.1.1.120 # 主动模式,向哪台服务器传送数据 Hostname=agent-node-rj # agent端的主机名 |
1 2 | [root@agent-node-rj /root ] # chkconfig zabbix-agentd on [root@agent-node-rj /root ] # /etc/init.d/zabbix-agentd start |
萌萌的IT人
Zabbix应用之Server/Agent部署
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。