Installation Configuration zabbix 4.0 (a)

A, Zabbix components

(1) Zabbix Server: responsible for receiving report information Zabbix Agent or Zabbix Proxy sent, and is responsible for the organization configuration information, statistical information and operating data.

(2) Zabbix Database: a database for storing configuration information of all Zabbix monitoring data and the monitoring data comprises

a, historical data: the results of each sample, when saving a relatively short length

B, trend data: aggregate data, the data stored in the relatively long period

(3) Zabbix Web: Zabbix GUI interface to the administrator through the Web management interface to configure and view Zabbix Zabbix monitoring related information, can be deployed individually on a separate server.

(4) Zabbix Agent: deployed on the monitored host, is responsible for collecting data monitoring host, and sent to Zabbix Server or Zabbix Proxy.

(5) Zabbix Proxy: optional component, for a distributed control environment, to collect monitoring data in a local area Zabbix Agent and sent to the unified Zabbix Server.

Description: Under normal circumstances, the Zabbix Agent deployed to collect data on the monitored host, the host is responsible for reporting to a central monitoring center host that is master / agent model Master , responsible for monitoring the center console is called of ZABBIX Server , of ZABBIX Server from Zabbix Agent received information is stored in Zabbix Database , if the administrator needs to view a variety of monitoring information, you need to use PHP written of ZABBIX Web , and depends on the LAMP environment, regardless of ZABBIX Server , or of ZABBIX Web , are You need to connect to Zabbix Database access to relevant data.

Two, Zabbix commonly used terms:

(1) host: host, Zabbix monitoring needs to be an object, the host must belong to a host group.

(2) host group: host group, having the same properties, wherein the plurality of hosts, the role of logical units.

(3) item: monitored item, a specific monitoring index data, the data from the monitored object, the core Zabbix monitored item data collection is not monitored item no data, the relative monitored object, each monitoring by the term "key" is identified.

(4) key: the key, if you want to get monitored item of data, you must go through to obtain a key, Zabbix comes with some of the key, the key is often more common, you can monitor CPU, memory, hard disk and so on through these key common indicators, different indicators to obtain information, but if these built-in key monitoring requirements can not be met, you can also customize key, appropriate action by the custom key.

(5) trigger: trigger, an expression for evaluating a particular item within a monitored object in the received data is within a reasonable range, i.e. the threshold value, the received data amount reaches the threshold value, a trigger condition from "OK" into a "Problem", when the amount of data again return to a reasonable range, its status will change from "Problem" converted back "OK".

(6) event: event trigger when the state changes, the corresponding event is generated, changing from the state of the trigger event is generated is called "trigger event", ZABBIX, the trigger event into the event automatic discovery events, auto-enrollment events and internal events.

(7) action: action, refers to a method for processing a particular event defined in advance, comprising the operation (e.g., sending notifications) and condition (when the operation performed).

(8) escalation: Alarm Update, send an alarm or execute remote commands custom program, such as sending an alarm 5 minutes, 5 were inferior every transmission.

(9) media: media means or channel, sending a notification, etc., such as Email, Jabber, or SMS.

(10) notification: notification, send information about an event to the user through the selected media.

(11) remote command: remote command, the predefined command may be automatically executed when the host is monitored under a specific condition.

(12) template: Template for quick entry define a preset monitored set host, typically contains item, trigger, graph, screen, application, and low-level discovery rule, the template can be linked directly to a single host.

(13) application: Application set, a set of item.

(14) web scennario: web scene, for detecting the availability of a web site or a plurality of HTTP requests.

(15) frontend: front end, Zabbix the web interface.

Three, Zabbix support of communication:

(1) Agent: through a dedicated agent monitoring, and common master / agent model is similar, if supported monitored object corresponding Agent, top pick in this way.

(2) SSH / Telnet: communicating by the remote control protocol.

(3) SNMP: Simple Network Management Protocol, SNMP, SNMP protocol to communicate through the object being monitored, usually can not install the Agent on a router, switch this hardware, but hardware often supports SNMP protocol, SNMP is a the more distant species, prevailing protocols, most network devices support this protocol, SNMP protocol actually works can also be understood as a master / agent of work, but is built on SNMP Agent in these devices only.

(4) IPMI: Intelligent Platform Management Interface, Intelligent Platform Management Interface, IPMI interfaces by monitoring, via a standard IPMI hardware interface, monitoring the physical characteristics of the object being monitored, such as voltage, temperature, fan status, power status.

(5) JMX: Java Management Extensions, Java Management Extensions, JVM virtual machine monitor, the more frequently used in this way.

5, Zabbix modes of operation:

(1) Active mode: data acquisition End Zabbix Agent will send to the active pressure Zabbix Server, reduce the Zabbix Server.

(2) Passive mode: Zabbix Agent do not send data, but wait to pull over Zabbix Server data, the default is passive mode.

Description: Whether active mode or passive mode, are for Zabbix Agent is, the active mode and passive mode can co-exist

Fourth, the preparatory work:

1, Zabbix version of choice: https: //www.zabbix.com/life_cycle_and_release_policy

Note: It is recommended to select LTS ( Long Term Support , long-term support) version

2, Links:

(1) Zabbix Download: https: //www.zabbix.com/download/

(2) Zabbix 4.0 LTS Chinese product manual: https: //www.zabbix.com/documentation/4.0/zh/manual

3, demo environment:

IP

operating system

CPU name

Roles

192.168.11.206  

CentOS 7.6 x86_64

web01

Zabbix   Database、Zabbix   Server、Zabbix   Web、Zabbix   Agent

192.168.11.207

CentOS 7.6 x86_64

web02

Zabbix   Agent

192.168.11.208

CentOS 7.6 x86_64

proxy

Zabbix   Proxy

192.168.11.100

windows 10

node

Zabbix   Agent

4, all CentOS node performs the following operations:

(1) Close SELinux and firewalld

(2) Time synchronization configuration server

(3) configure the host name

(4) configure the hosts file:

# vim /etc/hosts

192.168.11.206 web01

192.168.11.207 web02

192.168.11.208 proxy

(5) arranged epel Source: # rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-7.noarch.rpm

(6) arranged in Zabbix yum source:

# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

# rpm -ql zabbix-release

# cat /dev/null > /etc/yum.repos.d/zabbix.repo

# vim /etc/yum.repos.d/zabbix.repo

5, zabbix-server environment LAMP node structures:

Description: of ZABBIX Web depends on the LAMP environment, install zabbix-Web-MySQL ( 4.0.16 ) package will automatically install the default httpd ( 2.4.6 ), PHP ( 5.4.16 ), zabbix-Web ( 4.0.16 ), etc. related packages, as used herein, yum installed PHP 7.2 version. CentOS 7.7 in MariaDB version is 5.5.64 , an earlier version, upgrade to MariaDB 10.4 after the import version create.sql when the file will be prompted to " ERROR 1118 (42000) AT Line 1278:. Row TOO size Large (> 8126) Changing some columns to TEXT or BLOB may help . In current row format, BLOB prefix of 0 bytes is stored inline."So Zabbix Database using MySQL 5.7 . Here no separate installation httpd , and Zabbix Database , of ZABBIX Server , of ZABBIX Web are deployed in zabbix-server node, the actual production environment can be deployed separately.

(1) installation configuration MySQL 5.7:

a, to see whether the system already exists MariaDB:

# rpm -qa | grep -i mariadb --> mariadb-libs-5.5.64-1.el7.x86_64

# yum -y remove mariadb-libs

b, installation mysql57-community-release-el7.rpm:

# rpm -ivh http://repo.mysql.com/mysql57-community-release-el7.rpm

NOTE: After the installation will /etc/yum.repos.d build directory mysql-community-source.repo and mysql-community.repo

c, install MySQL 5.7 related software packages:

# yum list all | grep mysql-community

# yum -y install mysql-community-client mysql-community-common mysql-community-devel mysql-community-libs mysql-community-libs-compat mysql-community-server mysql-community-test

d, initialization MySQL 5.7: # mysqld --initialize --user = mysql --datadir = / var / lib / mysql

Note: Before initialization sure that / var / lib / mysql directory is empty

e, modify the configuration file my.cnf:

# mv /etc/my.cnf /etc/my.cnf.bak

# vim /etc/my.cnf

[mysqld]

port=3306

socket=/var/lib/mysql/mysql.sock

DATA = / var / lib / mysql

pid-file=/var/run/mysqld/mysqld.pid

log-error=/var/log/mysqld.log

lower_case_table_names=1

character_set_server=utf8mb4

collation_server=utf8mb4_general_ci

innodb_file_per_table=1

skip_name_resolve=1

slow_query_log=1

slow_query_log_file=mysql-slow.log

symbolic-links=0

explicit_defaults_for_timestamp=1

server_id=1

sync_binlog=1

innodb_flush_log_at_trx_commit=1

log_bin=mysql-bin

log_bin_index=mysql-bin.index

binlog_format=row

f, start MySQL:

# systemctl start mysqld

# systemctl status mysqld

# Ps aux | grep mysqld

# Ss -tunlp | grep -w: 3306

# tail -100 /var/log/mysqld.log

g, configure the boot from the start: # systemctl enable mysqld

h, view the root @ localhost user's initial password: # grep password /var/log/mysqld.log

i, Security Configuration Wizard: # mysql_secure_installation

j, authorized root users to remotely log in:

# mysql -uroot -p

mysql> create user root@'192.168.11.%' identified by '123456';

mysql> grant all on *.* to root@'192.168.11.%';

mysql> flush privileges;

#mysql -V

(2) Installation and Configuration PHP 7.2:

a, mounting webtatic-release.rpm: # rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

b, the relevant packages installed PHP 7.2:

# yum list all | grep php

# yum -y install mod_php72w php72w-cli php72w-common php72w-devel php72w-fpm php72w-gd php72w-ldap php72w-mbstring php72w-mysqlnd php72w-opcache php72w-xml

c, see the PHP version: # php -version

Five, zabbix-server node deployment Zabbix Server, Zabbix Web and Zabbix Agent:

1, deploying Zabbix Server:

(1) Installation zabbix-server-mysql package: # yum -y install zabbix-server-mysql

(2) View Zabbix Server version: # zabbix_server -V

(3) create a database and zabbix 'zbxuser'@'192.168.11.%' users, and to authorize 'zbxuser'@'192.168.11.%' user remote management:

# mysql -uroot -p

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> create user 'zbxuser'@'192.168.11.%' identified by '123456';

mysql> grant all on zabbix.* to 'zbxuser'@'192.168.11.%';

mysql> flush privileges;

(4) introducing create.sql files, initialization zabbix database (one of three following methods):

# zcat /usr/share/doc/zabbix-server-mysql-4.0.16/create.sql.gz | mysql -uzbxuser -h192.168.11.206 -p zabbix

or

# gzip -d /usr/share/doc/zabbix-server-mysql-4.0.16/create.sql.gz

mysql> use zabbix;

mysql> source /usr/share/doc/zabbix-server-mysql-4.0.16/create.sql

or

# gzip -d /usr/share/doc/zabbix-server-mysql-4.0.16/create.sql.gz

# mysql -uzbxuser -h192.168.11.206 -p zabbix < /usr/share/doc/zabbix-server-mysql-4.0.16/create.sql

Note: gzip -d automatically deleted after execution create.sql.gz file, retaining the decompression create.sql file

(5) checks whether the zabbix database to create the table:

# mysql -uzbxuser -h192.168.11.206 -p123456 -e 'use zabbix; show tables;' 2> /dev/null | wc -l

(6) modify zabbix_server.conf configuration file:

# rpm -ql zabbix-server-mysql

# cd /etc/zabbix

# cp zabbix_server.conf{,.bak}

# vim zabbix_server.conf

before fixing

Modified

#   ListenPort=10051

ListenPort=10051

#   LogType=file

LogType=file

LogFile=/var/log/zabbix/zabbix_server.log

Keep the default

LogFileSize=0

Keep the default

PidFile=/var/run/zabbix/zabbix_server.pid

Keep the default

#   DBHost=localhost

Dbःost = 192.168.11.206

DBName=zabbix

Keep the default

DBUser=zabbix

DBUser=zbxuser

#   DBPassword=

DBPassword=123456

#   DBSocket=

DBSocket=/var/lib/mysql/mysql.sock

#   DBPort=

DBPort=3306

#   ListenIP=127.0.0.1

ListenIP=192.168.11.206

AlertScriptsPath=/usr/lib/zabbix/alertscripts

Keep the default

ExternalScripts=/usr/lib/zabbix/externalscripts

Keep the default

#   FpingLocation=/usr/sbin/fping

FpingLocation=/usr/sbin/fping

#   AllowRoot=0

AllowRoot=0

# User=zabbix

User=zabbix

(7) to start Zabbix Server:

# systemctl start zabbix-server

# systemctl status zabbix-server

# Ps aux | grep zabbix_server

# Ss -tunlp | grep -w 10051

# tail -100 /var/log/zabbix/zabbix_server.log

(8) to configure the boot from Kai: # systemctl enable zabbix-server

2, deployment Zabbix Web:

(1) Installation zabbix-web-mysql package: # yum -y install zabbix-web-mysql

(2) modify the httpd.conf configuration file:

# vim /etc/httpd/conf/httpd.conf

before fixing

Modified

#ServerName  

www.example.com:80

ServerName  

192.168.11.206:80

(3) start httpd:

# systemctl start httpd

# systemctl status httpd

# ps aux | grep httpd

# ss -tunlp | grep -w :80

(4)配置开机自启:# systemctl enable httpd

(5)浏览器访问http://192.168.11.206/zabbix #安装zabbix

说明:/etc/httpd/conf.d/zabbix.conf配置文件中已针对PHP 5.4优化,但目前安装的是PHP 7.2,需要修改/etc/php.ini配置文件,Zabbix相关PHP网页全存放在/usr/share/zabbix目录下

# vim /etc/php.ini

修改前

修改后

post_max_size   = 8M

post_max_size   = 16M

max_execution_time   = 30

max_execution_time   = 300

max_input_time   = 60

max_input_time   = 300

;date.timezone   =

date.timezone   = Asia/Shanghai

重启httpd:# systemctl restart httpd

刷新网页,必须所有的检查项都为“OK”才能继续:

安装后生成的配置文件:/etc/zabbix/web/zabbix.conf.php

登录Zabbix Web,用户名Admin   密码zabbix

3、Zabbix Web简单配置:

(1)修改Admin用户默认密码:

Administration --> Users --> Admin --> Change password 

(2)禁用guest用户:

Administration --> User groups --> 勾选Guests --> Disable

Administration --> Users --> guest用户的状态已变为Disabled

(3)修改刷新不支持项的时间间隔:

Administration --> General --> Other --> Refresh unsupported items默认10m修改为30s --> Update

(4)调整每页显示的行数,默认为50行:

Admin--> User --> Rows per page (200)--> Update

(5)开启前端消息声音:

Admin --> Messaging --> Frontend messaging[勾上√,全选] --> Update

4、部署Zabbix Agent:

出现ZBX没有变绿,是因为没有安装Zabbix agent

(1)安装zabbix-agent软件包:# yum -y install zabbix-agent

(2)修改zabbix_agentd.conf配置文件:

# cd /etc/zabbix

# cp zabbix_agentd.conf{,.bak}

# vim zabbix_agentd.conf

修改前

修改后

PidFile=/var/run/zabbix/zabbix_agentd.pid

保持默认

# LogType=file

LogType=file

LogFile=/var/log/zabbix/zabbix_agentd.log

保持默认

LogFileSize=0

保持默认

# EnableRemoteCommands=0

EnableRemoteCommands=1

Server=127.0.0.1

Server=192.168.11.206

# ListenPort=10050

ListenPort=10050

# ListenIP=0.0.0.0

ListenIP=192.168.11.206

ServerActive=127.0.0.1

ServerActive=192.168.11.206

Hostname=Zabbix server

Hostname=zabbix-server

# AllowRoot=0

AllowRoot=0

# User=zabbix

User=zabbix

Include=/etc/zabbix/zabbix_agentd.d/*.conf

保持默认

# UnsafeUserParameters=0

UnsafeUserParameters=1

说明:

Server:使用于被动模式,指定允许哪台Zabbix Server主动拉取当前Zabbix Agent的数据,此IPZabbix ServerIP,实现基于IP的访问控制,如果有多个IP,使用逗号分隔。

ServerActive:使用于主动模式,指定Zabbix Agent将信息主动推送至哪台Zabbix Server,如果有多个IP,使用逗号分隔。

(3)启动Zabbix Agent:

# systemctl start zabbix-agent

# systemctl status zabbix-agent

# ps aux | grep zabbix_agent

# ss -tunlp | grep -w 10050

# tail -100 /var/log/zabbix/zabbix_agentd.log

(4)配置开机自启:# systemctl enable zabbix-agent

5、配置Zabbix Web:

Configuration --> Hosts --> Zabbix server --> Update

 

 

修改前

修改后

Host   name: Zabbix server

Host   name: zabbix-server

Visible   name:

Visible   name: Zabbix server

IP   address: 127.0.0.1

IP   address: 192.168.11.206

说明:上述Zabbix Web中的Host name值要与该节点的主机名,以及/etc/zabbix/zabbix_agentd.conf配置文件中的Hostname参数值三者相同

 

 备注:zabbix-server节点完成对自身状态的监控;

Guess you like

Origin www.cnblogs.com/comprehensive/p/12217570.html