By default, Zabbix has 5 processes:
Zabbix_agent zabbix_get zabbix_proxy Zabbix_sender Zabbix_server, another zabbix_java_gateway is optional, this requires additional installation.
ZABBIX_AGENTD: Client daemon, which collects client data such as CPU load, memory, hard disk usage, etc.
The Zabbix_get:zabbix tool, which is used separately, usually executes commands to obtain remote client information on the server or proxy side. Usually the user is wrongly discharged. For example, on the server side, we can use Zabbix_get to get the contents of the client to troubleshoot by getting the client's memory data.
The Zabbix_sender:zabbix tool, used to send data to a server or proxy, is typically used for lengthy checks. Many checks are very time consuming, resulting in Zabbix timeouts. So we use sender to commit the data after the script has finished executing.
Zabbix_server:zabbix Server daemon. Zabbix_agentd, Zabbix_get, Zabbix_sender, Zabbix_proxy, Zabbix_java_gateway data are ultimately submitted to the server
Note: Of course, is not the data are actively submitted to zabbix_server, there are some servers actively to fetch data.
Zabbix_proxy:zabbix the agent daemon process. Functionally similar to server, the only difference is that it is just a broker that needs to submit/be submitted to the server for the collected data.
A feature introduced after the zabbix_java_geteway:zabbix2.0. As the name implies: Java gateway, similar to AGENTD, but only for the Java aspect. It is important to note that it can only proactively fetch data, not passively. Its data will eventually be given to the server or proxy.
Time synchronization:
[Email protected]_server ~]# crontab-e00 * * */usr/sbin/ntpdate-u 192.168.1.62 #zabbix_server IP
Requires an environment LNMP or lamp environment, where ZABBIX has special requirements for PHP parameter PHP modules:
./configure --prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-bz2--with-curl-- Enable-ftp--enable-sockets--disable-ipv6--with-gd--with-jpeg-dir=/usr/local--with-png-dir=/usr/local-- With-freetype-dir=/usr/local--enable-gd-native-ttf--with-iconv-dir=/usr/local--enable-mbstring-- Enable-calendar--with-gettext--with-libxml-dir=/usr/local--with-zlib--with-pdo-mysql=mysqlnd--with-mysqli= Mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-libdir=lib64--enable-bcmath
If there is an error when make, it may be: http://www.cnblogs.com/bass6/p/5512035.html
Parameter Settings for PHP:
VI php.ini
Max_execution_time = 300memory_limit = 123mpost_max_size = 16mupload_max_filesize = 2mmax_input_time = 300date.timezone P RC
Zabbix Service-Side installation:
All versions: http://www.zabbix.com/download.php
[Email protected]_server ~]# Yum install-y net-snmp-devel libxml2-devel libcurl-devel #一 pre-installed dependencies
[Email protected]_server zabbix-3.0.3]# pwd/usr/local/src/zabbix-3.0.3[[email protected]_server zabbix-3.0.3]# LSACLOCAL.M4 ChangeLog config.sub database INSTALL makefile.in newsauthors Compile Configure Depcomp install-sh man readmebin conf configure.ac frontends M4 Misc srcbuild config.guess COPYING include makefile.am missing upgrades
[Email protected]_server zabbix-3.0.3]#/configure--prefix=/usr/local/zabbix-3.0.3--enable-server--enable-agent --with-mysql--with-net-snmp--with-libcurl--WITH-LIBXML2
Zabbix server generally acts as two roles: Server,agent, so the above configuration parameters are also added--enable-agent. Note: Please install the Mysql,snmp,curl Development Library.
Error:
Configure:error:MySQL Library not found
[Email protected]_server zabbix-3.0.3]# Yum Install Mysql-devel
Problem Solving!
[[Email Protected]_server zabbix-3.0.3]# make && make install
To create a user:
Security considerations Zabbix only runs with ordinary users, and if your current user is called bass, then you run him and he uses the bass identity. But if you run Zabbix in the root environment, ZABBIX will actively use the Zabbix user to run it. But if your system does not have Zabbix users, this requires a new one:
[Email protected]_server ~]# groupadd zabbix[[email protected]_server ~]# useradd-g Zabbix Zabbix
Initialize the database:
Zabbix server and proxy require a database, angent not required. In particular, it is important to note that proxy imports only one SQL file, and the server is 3 SQL files.
Mysql> CREATE DATABASE Zabbix default CharSet UTF8; Query OK, 1 row Affected (0.00 sec)
# mysql-uroot-pttlsapwd Zabbix < database/mysql/schema.sql# mysql-uroot-pttlsapwd Zabbix < database/mysql/images . sql# Mysql-uroot-ppttlsapwd Zabbix < Database/mysql/data.sql
Mysql> Show databases;+--------------------+| Database |+--------------------+| information_schema | | mysql | | performance_schema | | Test | | zabbix |+--------------------+5 rows in Set (0.00 sec)
Configuration Zabbix:
[Email protected]_server etc]# lszabbix_agentd.conf zabbix_agentd.conf.d zabbix_server.conf zabbix_ Server.conf.d
# vim/etc/zabbix/zabbix_server.confdbname=zabbixdbuser=zabbixdbpassword=123456dbport=3306
[Email protected]_server ~]# ln-s/usr/local/zabbix-3.0.3/sbin/*/usr/local/sbin/[[email protected]_server ~]# ln-s/u sr/local/zabbix-3.0.3/bin/*/usr/local/bin/
[[Email Protected]_server ~]# Find/-name mysql_config/usr/bin/mysql_config/usr/local/src/mysql-5.5.20/scripts/ Mysql_config/usr/local/mysql/bin/mysql_config/usr/lib64/mysql/mysql_config
If you do not have mysql_config, you need to install Mysql-devel
To add a port for the Zabbix service:
[Email protected]_server ~]# vi/etc/services #追加下面代码
Zabbix-agent 10050/tcp # Zabbix Agent
Zabbix-agent 10050/UDP # Zabbix Agent
Zabbix-trapper 10051/tcp # Zabbix Trapper
Zabbix-trapper 10051/UDP # Zabbix Trapper
To modify the Zabbix configuration file:
[Email protected]_server ~]# cd/usr/local/zabbix-3.0.3/etc[[email protected]_server etc]# lszabbix_agentd.conf ZABBIX_SERVER.CONFZABBIX_AGENTD.CONF.D zabbix_server.conf.d[[email protected]_server etc]# pwd/usr/local/ Zabbix-3.0.3/etc[[email Protected]_server etc]# VI zabbix_server.conf
Vi/usr/local/zabbix/etc/zabbix_server.confdbname=zabbix #数据库名称DBUser =zabbix #数据库用户名DBPassword =123456 #数据库密码
# # Option:dbhost
# Database host name.
# If set to localhost, sockets are used for MySQL.
# If set to empty string, socket was used for PostgreSQL.
#
# Mandatory:no
# Default:
# Dbhost=localhost
IP of the DBHOST=192.168.1.117#DB database
Alertscriptspath=/usr/local/zabbix/share/zabbix/alertscripts #zabbix运行脚本存放目录
[Email protected]_server etc]# vi/usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
Plus:
include=/usr/local/zabbix/etc/zabbixagentd.conf.d/
# unsafeuserparameters=0
Unsafeuserparameters=1
[Email protected]_server etc]# cp/usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_server/etc/rc.d/ Init.d/zabbix_server[[email Protected]_server etc]# Cp/usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_ Agentd/etc/rc.d/init.d/zabbix_agentd[[email protected]_server etc]# chmod +x/etc/rc.d/init.d/zabbix_server [[Email Protected]_server etc]# chmod +x/etc/rc.d/init.d/zabbix_agent [[email protected]_server etc]# chkconfig zabbix_server On[[email protected]_server etc]# chkconfig zabbix_agent on
Modify the Zabbix installation directory in the Zabbix boot script :
[Email protected]_server etc]# Vi/etc/rc.d/init.d/zabbix_server # zabbix-directorybasedir=/usr/local/zabbix-3.0.3/ #zabbix安装目录
[Email protected]_server etc]# Vi/etc/rc.d/init.d/zabbix_agentd
# zabbix-directory basedir=/usr/local/zabbix-3.0.3/#编辑客户端配置文件
[Email protected]_server nginx]# cp-r/usr/local/src/zabbix
/frontends/php/usr/html/
[Email protected]_server nginx]# cd/usr/html/[[email protected]_server html]# ls50x.html index.html index.php php[[email protected]_server html]# mkdir zabbix[[email protected]_server html]# ls50x.html index.html index.php php zabbix[[email protected]_server html]# mv Php/zabbix/[[email protected]_server html]# ls50x.html index.html index.php zabbix[[email protected]_server html]# chown Www.www-R/usr/html/ Zabbix
[Email protected]_server etc]# service zabbix_agentd startstarting zabbix_agentd: [ OK ][[email Protected]_server etc]# Service zabbix_server startstarting zabbix_server: [ OK
First look at PHP with the location of the php.ini file by <?php phpinfo ();
Visible is in/usr/local/php/etc/php.ini if every no cp/etc/php.ini/usr/local/php/etc/
[Email protected]_server etc]# Vi/etc/php.ini
Post_max_size = 16mmax_execution_time = 300max_input_time = 300
[Email protected]_server etc]# vi/usr/local/php/etc/php-fpm.conf
Request_terminate_timeout = 300
[Email protected]_server php]# service PHP-FPM restart
Gracefully shutting down php-fpm. Done
Starting php-fpm Done
[Email protected]_server php]# whereis phpphp:/etc/php.d/etc/php.ini/usr/lib64/php/usr/loca
[Email protected]_server php]# pwd/usr/html/zabbix/php
http://192.168.1.122/zabbix/php/setup.php
Mysql> Show databases;+--------------------+| Database |+--------------------+| information_schema | | mysql | | performance_schema | | Test | | zabbix |+--------------------+5 rows in Set (0.07 sec) Mysql> grant all privileges on zabbix.* to [email protected] "%" IDE Ntified by "123456"; Query OK, 0 rows Affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)
[Email protected] tmp]# SCP zabbix.conf.php [email protected]:/usr/html/zabbix/php/conf/zabbix.conf.php[email Protected] ' s password:zabbix.conf.php 100% 423 0.4kb/s
Pay attention to zabbix.conf.php permissions!! (I gave it to 777.)
Zabbix Default login account: admin
Zabbix Default login Password: Zabbix
Note: SELinux must be closed or will error!!!
[[Email protected]_server php]# Setenforce 0
[Email protected]_server ~]# NETSTAT-LNUTP
Active Internet connections (only servers)
Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2192/zabbix_agentd
TCP 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 2854/zabbix_server
TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1486/php-fpm
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2665/mysqld
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1924/nginx
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1510/sshd
TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1853/master
TCP 0 0::: $:::* LISTEN 1510/sshd
TCP 0 0:: 1:25:::* LISTEN 1853/master
UDP 0 0 0.0.0.0:68 0.0.0.0:* 1244/dhclient
UDP 0 0 0.0.0.0:636 0.0.0.0:* 1323/portreserve
Note: Look at Zabbix's log
Zabbix (one: Zabbix service side)