Deployment of Zabbix learning Server/Agent, zabbixagent
Recently, the company needs a monitoring system. The previous monitoring system was Nagios. I have never been in touch with Nagios before, but I did some research later. Compared to several popular monitoring systems on the market, Zabbix is better.
The following describes the deployment process of Zabbix Server and Zabbix Agent.
Environment: OS Version: CentOS 6.5 x86_64-bit minimal installation. selinux is disabled after basic optimization, and iptables is the unrestricted mode Host Name: zabbix-master-rj
I P: 10.1.1.1
Note:
If iptables cannot be disabled, you can configure it as follows:
[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
If selinux cannot be disabled, configure as follows:
[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. Zabbix Server deployment
1Prepare the epel yum Source
[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 zabbix22zabbix22.x86_64 2.2.1-5.el6 epelzabbix22-agent.x86_64 2.2.1-5.el6 epelzabbix22-dbfiles-mysql.noarch 2.2.1-5.el6 epelzabbix22-dbfiles-pgsql.noarch 2.2.1-5.el6 epelzabbix22-dbfiles-sqlite3.noarch 2.2.1-5.el6 epelzabbix22-proxy.noarch 2.2.1-5.el6 epelzabbix22-proxy-mysql.x86_64 2.2.1-5.el6 epelzabbix22-proxy-pgsql.x86_64 2.2.1-5.el6 epelzabbix22-proxy-sqlite3.x86_64 2.2.1-5.el6 epelzabbix22-server.noarch 2.2.1-5.el6 epelzabbix22-server-mysql.x86_64 2.2.1-5.el6 epelzabbix22-server-pgsql.x86_64 2.2.1-5.el6 epelzabbix22-web.noarch 2.2.1-5.el6 epelzabbix22-web-mysql.noarch 2.2.1-5.el6 epelzabbix22-web-pgsql.noarch 2.2.1-5.el6 epel
2Install zabbix server 2.2.1
[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 kzabbix22-agent x86_64 2.2.1-5.el6 epel 149 kzabbix22-dbfiles-mysql noarch 2.2.1-5.el6 epel 1.1 Mzabbix22-server noarch 2.2.1-5.el6 epel 20 kzabbix22-server-mysql x86_64 2.2.1-5.el6 epel 405 kzabbix22-web noarch 2.2.1-5.el6 epel 4.2 Mzabbix22-web-mysql noarch 2.2.1-5.el6 epel 9.6 kInstalling for dependencies:OpenIPMI-libs x86_64 2.0.16-14.el6 base 473 kapr x86_64 1.3.9-5.el6_2 base 123 kapr-util x86_64 1.3.9-3.el6_0.1 base 87 kapr-util-ldap x86_64 1.3.9-3.el6_0.1 base 15 kfping x86_64 2.4b2-10.el6 epel 31 khttpd x86_64 2.2.15-31.el6.centos updates2 824 khttpd-tools x86_64 2.2.15-31.el6.centos updates2 73 kiksemel x86_64 1.4-2.el6 epel 48 klibXpm x86_64 3.5.10-2.el6 base 51 klm_sensors-libs x86_64 3.1.1-17.el6 base 38 knet-snmp-libs x86_64 1:5.5-49.el6_5.4 updates2 1.5 Mphp x86_64 5.3.3-27.el6_5.2 updates2 1.1 Mphp-bcmath x86_64 5.3.3-27.el6_5.2 updates2 36 kphp-cli x86_64 5.3.3-27.el6_5.2 updates2 2.2 Mphp-common x86_64 5.3.3-27.el6_5.2 updates2 526 kphp-gd x86_64 5.3.3-27.el6_5.2 updates2 108 kphp-ldap x86_64 5.3.3-27.el6_5.2 updates2 40 kphp-mbstring x86_64 5.3.3-27.el6_5.2 updates2 457 kphp-mysql x86_64 5.3.3-27.el6_5.2 updates2 83 kphp-pdo x86_64 5.3.3-27.el6_5.2 updates2 77 kphp-xml x86_64 5.3.3-27.el6_5.2 updates2 105 kunixODBC x86_64 2.2.14-12.el6_3 base 378 kTransaction Summary=======================================================================================================================================Install 29 Package(s)
3Configure the database (zabbix supports MySQL, PostgreSQL, and Oracle. Here we use the MySQL database as an example)
[root@zabbix-master-rj /root]# /etc/init.d/mysqld start[root@zabbix-master-rj /root]# mysql -uroot -pmysql> 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
Import these three SQL files in sequence
[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
4Install Zabbix Web GUI
[root@zabbix-master-rj /root]# /etc/init.d/httpd start[root@zabbix-master-rj /root]# /etc/init.d/zabbix-server start
Enter the IP address of the server that your zabbix22-web.noarch is installed on the browser, such as http: // 172.16.100.2/zabbix. After opening the file, click the button!
This prompt indicates that the php configuration does not meet the zabbix installation requirements. At this time, you need to modify the related configuration items of php.
Here are the modified php configuration items!
[root@zabbix-master-rj /root]# grep '^post_max_size|^max_execution_time|^max_input_time|^date.timezone' /etc/php.inimax_execution_time = 300max_input_time = 300post_max_size = 16Mdate.timezone = Asia/Shanghai
If you cannot connect to the MySQL database, troubleshoot the problem as follows:
1. First, check whether the local iptables limits port 3306.
2. Check whether selinux of the local machine is disabled.
3. Check whether the MySQL database authorization is normal.
OK. In this step, the Zabbix Server installation is complete. During the installation process, the configuration items we entered are displayed in the/etc/zabbix/web/zabbix. conf. php file!
[Root @ zabbix-master-rj/root] # cat/etc/zabbix/web/zabbix. conf. php <? Php // Zabbix GUI configuration fileglobal $ DB; $ DB ['type'] = 'mysql'; # database TYPE used by zabbix server $ DB ['server'] = '10. 1.1.1 '; # Database IP address used by zabbix server $ DB ['Port'] = '123 '; # port of the DATABASE used by zabbix server $ DB ['database'] = 'zabbix'; # DATABASE Name of the DATABASE used by zabbix server $ DB ['user'] = 'opszabbix '; # Database User $ DB ['Password'] = '6a7b3efb855df9c' used by zabbix server '; # Encrypted database User Password // SCHEMA is relevant only for IBM_DB2 database $ DB ['sche MA '] = ''; # This configuration is useful only when you use the DB2 database $ ZBX_SERVER = 'localhost '; # zabbix server IP address $ ZBX_SERVER_PORT = '000000'; # zabbix server port number $ ZBX_SERVER_NAME = 'zabbix-master-rj '; # zabbix server host name $ IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;?>
5First Login
Log on to the http: // 172.16.100.2/zabbix address. After Zabbix Server is installed, the default Administrator is Admin and the password is zabbix.
The logon interface is as follows:
6Configure auto-start upon startup
[root@agent /root]# chkconfig zabbix-server on
2. Zabbix Agent deployment
1Prepare the epel yum Source
[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
2Install Zabbix Agent
[root@agent-node-rj /root]# yum install zabbix22.x86_64 zabbix22-agent.x86_64
3Configure Zabbix Agent
[Root @ agent-node-rj/root] # grep '^ Server | ^ ServerActive | ^ Hostname'/etc/zabbix_agentd.confServer = 10.1.1.120 # passive mode, which server is allowed to connect to AgentServerActive = 10.1.1.120 # active mode, and which server is allowed to transmit data Hostname = agent-node-rj # agent host name
4, Start the service, and Configure Automatic startup
[root@agent-node-rj /root]# chkconfig zabbix-agentd on[root@agent-node-rj /root]# /etc/init.d/zabbix-agentd start
OK!
The above is the deployment of Zabbix Server and Zabbix Agent!
Zabbix monitors the linux agent and adds metric items. What settings need to be made in zabbix-agentdconf?
Add a key in agent. conf, which is the last example of agent. conf. After adding the key, you can monitor the key you set.
Zabbix is used to monitor applications. If the application CPU usage reaches a certain level, the zabbix server cannot receive the monitoring data ··
After the CPU usage of the monitored machine is high, it cannot communicate, and all the data cannot be monitored.