Zabbix deployment (can be done)

  • Zabbix is ​​an enterprise-level distributed open source monitoring solution, software that can monitor various network parameters and server health and integrity.
  • Zabbix uses a flexible notification mechanism that allows users to configure email-based alerts for almost any event, so that they can quickly feedback server problems.
  • Based on the stored data, Zabbix provides excellent reporting and data visualization functions.
  • Zabbix collects monitoring data through C/S mode
  • Zabbix realizes web management through B/S mode
  • Official website: www.zabbix.com

Configure the monitoring server prerequisite environment
1. The firewall is closed

[root@server-zabbix ~]# systemctl stop firewalld.service 
[root@server-zabbix ~]# setenforce 0
[root@server-zabbix ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config 

Install zabbix software package
1. Configure YUM source

[root@server-zabbix ~]# wget  https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

[root@server-zabbix ~]# rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm 

2. Modify the zabbix.repo file to replace the official website address with the Tsinghua source address
// The default download of zabbix in the yum source is downloaded from the zabbix official website, which is slow, we change it to Tsinghua source

[root@server-zabbix ~]# vim /etc/yum.repos.d/zabbix.repo 
.....
:%s#http://repo.zabbix.com/#https://mirrors.tuna.tsinghua.edu.cn/zabbix/#g 
:%s#gpgcheck=1#gpgcheck=0#g

3. Add Alibaba source

[root@server-zabbix ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

4.安装zabbix-server-mysql zabbix-web-mysql

[root@server-zabbix ~]# yum -y install zabbix-server-mysql zabbix-web-mysql

5. Install mariadb

[root@server-zabbix ~]# yum -y install mariadb-server
[root@server-zabbix ~]# systemctl start mariadb.service
[root@server-zabbix ~]# systemctl enable mariadb.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

6. Initialize the database

[root@server-zabbix ~]# mysql_secure_installation 
Enter current password for root (enter for none): 
Set root password? [Y/n]   n 
Remove anonymous users? [Y/n]  y
Disallow root login remotely? [Y/n]  y
Remove test database and access to it? [Y/n]  y
Reload privilege tables now? [Y/n]  y

Database authorization
1. Create authorized users

[root@server-zabbix ~]# mysql

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;   
//zabbix库支持中文

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by '123456';  
//创建授权用户

Query OK, 0 rows affected (0.00 sec)

2. Import zabbix initial architecture data

[root@server-zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 123456

3. Enter the database to see if the data exists

[root@server-zabbix ~]# mysql -uzabbix -p123456

MariaDB [(none)]> use zabbix;

MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
| auditlog_details           |
| autoreg_host               |
| conditions                 |
| config                     |
| corr_condition             |
| corr_condition_group       |
| corr_condition_tag         |
| corr_condition_tagpair     |
| corr_condition_tagvalue    |
| corr_operation             |
| correlation                |
| dashboard                  |
| dashboard_user             |
| dashboard_usrgrp           |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| event_recovery             |
| event_suppress             |
| event_tag                  |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| history                    |
| history_log                |
| history_str                |
| history_text               |
| history_uint               |
| host_discovery             |
| host_inventory             |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| hstgrp                     |
| httpstep                   |
| httpstep_field             |
| httpstepitem               |
| httptest                   |
| httptest_field             |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| item_application_prototype |
| item_condition             |
| item_discovery             |
| item_preproc               |
| items                      |
| items_applications         |
| maintenance_tag            |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| mappings                   |
| media                      |
| media_type                 |
| opcommand                  |
| opcommand_grp              |
| opcommand_hst              |
| opconditions               |
| operations                 |
| opgroup                    |
| opinventory                |
| opmessage                  |
| opmessage_grp              |
| opmessage_usr              |
| optemplate                 |
| problem                    |
| problem_tag                |
| profiles                   |
| proxy_autoreg_host         |
| proxy_dhistory             |
| proxy_history              |
| regexps                    |
| rights                     |
| screen_user                |
| screen_usrgrp              |
| screens                    |
| screens_items              |
| scripts                    |
| service_alarms             |
| services                   |
| services_links             |
| services_times             |
| sessions                   |
| slides                     |
| slideshow_user             |
| slideshow_usrgrp           |
| slideshows                 |
| sysmap_element_trigger     |
| sysmap_element_url         |
| sysmap_shape               |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| tag_filter                 |
| task                       |
| task_acknowledge           |
| task_check_now             |
| task_close_problem         |
| task_remote_command        |
| task_remote_command_result |
| timeperiods                |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| trigger_tag                |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
| widget                     |
| widget_field               |
+----------------------------+
144 rows in set (0.00 sec)

Configure
zabbix to connect to the database 1. Modify the zabbix-server configuration file

[root@server-zabbix ~]# vim /etc/zabbix/zabbix_server.conf 
....
DBName=zabbix                 //数据库名
DBUser=zabbix                  //连接数据库用户名
DBPassword=123456             //用户密码

2. Start zabbix-server

[root@server-zabbix ~]# systemctl start zabbix-server.service 
[root@server-zabbix ~]# systemctl enable zabbix-server.service 
[root@server-zabbix ~]# netstat -anput | grep 10051

3. Configure the correct time zone for the zabbix front end

[root@server-zabbix ~]# vim /etc/httpd/conf.d/zabbix.conf 
... 
 <IfModule mod_php5.c>
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value max_input_vars 10000
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/Shanghai      //配置正确时区
    </IfModule>

4. Start the httpd service

[root@server-zabbix ~]# systemctl start httpd
[root@server-zabbix ~]# systemctl enable httpd

Browser access page
http://192.168.1.61/zabbix/
Insert picture description hereInsert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Set Chinese
Insert picture description here

Insert picture description here
Install agent server

[root@server-zabbix ~]# yum -y install zabbix-agent
[root@server-zabbix ~]# systemctl start zabbix-agent.service 
[root@server-zabbix ~]# systemctl enable zabbix-agent.service 

Insert picture description here
1. Install the zabbix-agent program on the monitored host

[root@client-zabbix ~]# wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.13-1.el7.x86_64.rpm

[root@client-zabbix ~]# rpm -ivh zabbix-agent-4.0.13-1.el7.x86_64.rpm 

2. Modify the zabbix-agent configuration file to specify the main server information

[root@client-zabbix ~]# vim /etc/zabbix/zabbix_agentd.conf 
...
Server=192.168.1.61  //指定zabbix-server端地址

3. Open zabbix-agent

[root@client-zabbix ~]# systemctl start zabbix-agent.service 
[root@client-zabbix ~]# systemctl enable zabbix-agent.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.

Create a host to
Insert picture description here
Insert picture description here
Insert picture description hereInsert picture description hereview monitoring information
Insert picture description hereInsert picture description here

Guess you like

Origin blog.csdn.net/weixin_45310323/article/details/113089773