[root@monitor_aodun network-scripts]# vim ifcfg-em2
[root@monitor_aodun network-scripts]# cat ifcfg-em2
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=em2
DEVICE=em2
ONBOOT=no
IPADDR=192.168.193.180
NETMASK=255.255.255.0 
[root@monitor_aodun network-scripts]# systemctl restart network
[root@monitor_aodun network-scripts]# ifconfig
em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 125.211.210.180  netmask 255.255.255.192  broadcast 125.211.210.191
inet6 fe80::d6ae:52ff:fea7:fe62  prefixlen 64  scopeid 0x20<link>
ether d4:ae:52:a7:fe:62  txqueuelen 1000  (Ethernet)
RX packets 41  bytes 8543 (8.3 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 51  bytes 4058 (3.9 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
em2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
inet 192.168.193.180  netmask 255.255.255.0  broadcast 192.168.193.255
ether d4:ae:52:a7:fe:63  txqueuelen 1000  (Ethernet)
RX packets 0  bytes 0 (0.0 B)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 0  bytes 0 (0.0 B)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
inet 127.0.0.1  netmask 255.0.0.0
inet6 ::1  prefixlen 128  scopeid 0x10<host>
loop  txqueuelen 0  (Local Loopback)
RX packets 15204  bytes 4227698 (4.0 MiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 15204  bytes 4227698 (4.0 MiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@monitor_aodun network-scripts]# cd
[root@monitor_aodun ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 931.5G  0 disk 
├─sda1            8:1    0   500M  0 part /boot
├─sda2            8:2    0    50G  0 part /
└─sda3            8:3    0   875G  0 part 
└─centos-data 253:0    0   875G  0 lvm  
[root@monitor_aodun ~]# mkdir /data
[root@monitor_aodun ~]# vim /etc/fstab
[root@monitor_aodun ~]# grep -v ^# /etc/fstab
UUID=017db6f7-0eb3-4047-b55b-c440b37b7036 /                       xfs     defaults        0 0
UUID=541fd7d5-6e18-4d61-a548-58ba6c26e47d /boot                   xfs     defaults        0 0
/dev/centos/data    /data   xfs     defaults    0 0
[root@monitor_aodun ~]# mount -a
[root@monitor_aodun ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 931.5G  0 disk 
├─sda1            8:1    0   500M  0 part /boot
├─sda2            8:2    0    50G  0 part /
└─sda3            8:3    0   875G  0 part 
└─centos-data 253:0    0   875G  0 lvm  /data
[root@monitor_aodun ~]# mkdir -pv /data/{mysql,log/mariadb}
mkdir: created directory ‘/data/mysql’
mkdir: created directory ‘/data/log’
mkdir: created directory ‘/data/log/mariadb’
[root@monitor_aodun ~]# yum install -y mariadb-server
[root@monitor_aodun ~]# cp /etc/my.cnf{,.bak}
[root@monitor_aodun ~]# vim /etc/my.cnf
[root@monitor_aodun ~]# grep -v ^# /etc/my.cnf
[mysqld]
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
innodb_file_per_table
skip_name_resolve
event_scheduler=ON
max_allowed_packet=50M
open_files_limit=4096
max_connections=500
[mysqld_safe]
log-error=/data/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d
[root@monitor_aodun ~]# chown mysql:mysql /data/mysql/
[root@monitor_aodun ~]# chown mysql:mysql /data/log/mariadb/
[root@monitor_aodun ~]# ll /data/
total 0
drwxr-xr-x. 3 root  root  20 May 19 02:11 log
drwxr-xr-x. 2 mysql mysql  6 May 19 02:03 mysql
[root@monitor_aodun ~]# ll /data/log/
total 0
drwxr-xr-x. 2 mysql mysql 6 May 19 02:03 mariadb
[root@monitor_aodun ~]# ss -tnl
State       Recv-Q Send-Q                                 Local Address:Port                                                Peer Address:Port              
LISTEN      0      50           :3306                                                           :                  
LISTEN      0      100    127.0.0.1:25                                                             :                  
LISTEN      0      128         :22022                                                          :                  
LISTEN      0     0             ::1:25                                                            :::                  
LISTEN      0      128      :::22022                                                         :::
[root@monitor_aodun ~]# mysql_secure_installation
[root@monitor_aodun ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.52-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> create database zabbix;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by ‘zabbix@hehegame.com‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show grants for zabbix@localhost;
+---------------------------------------------------------------------------------------------------------------+
| Grants for zabbix@localhost                                                                                   |
+---------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO ‘zabbix‘@‘localhost‘ IDENTIFIED BY PASSWORD ‘FD810B324C560D38EB7E4BF80CD5FE680BC507D8‘ |
| GRANT ALL PRIVILEGES ON zabbix. TO ‘zabbix‘@‘localhost‘                                                    |
+---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]>
MariaDB [(none)]> quit
Bye
[root@monitor_aodun ~]# yum install -y zabbix-server-mysql.x86_64 zabbix-get.x86_64
[root@monitor_aodun ~]# rpm -ql zabbix-server-mysql
/etc/logrotate.d/zabbix-server
/etc/zabbix/zabbix_server.conf
/usr/lib/systemd/system/zabbix-server.service
/usr/lib/tmpfiles.d/zabbix-server.conf
/usr/lib/zabbix/alertscripts
/usr/lib/zabbix/externalscripts
/usr/sbin/zabbix_server_mysql
/usr/share/doc/zabbix-server-mysql-3.2.6
/usr/share/doc/zabbix-server-mysql-3.2.6/AUTHORS
/usr/share/doc/zabbix-server-mysql-3.2.6/COPYING
/usr/share/doc/zabbix-server-mysql-3.2.6/ChangeLog
/usr/share/doc/zabbix-server-mysql-3.2.6/NEWS
/usr/share/doc/zabbix-server-mysql-3.2.6/README
/usr/share/doc/zabbix-server-mysql-3.2.6/create.sql.gz
/usr/share/man/man8/zabbix_server.8.gz
/var/log/zabbix
/var/run/zabbix
[root@monitor_aodun ~]# gunzip /usr/share/doc/zabbix-server-mysql-3.2.6/create.sql.gz
[root@monitor_aodun ~]# ll /usr/share/doc/zabbix-server-mysql-3.2.6
total 3832
-rw-r--r--. 1 root root      98 May  5 10:50 AUTHORS
-rw-r--r--. 1 root root  752936 May  5 10:50 ChangeLog
-rw-r--r--. 1 root root   17990 May  5 10:50 COPYING
-rw-r--r--. 1 root root 3137133 May  5 20:23 create.sql
-rw-r--r--. 1 root root      52 May  5 10:50 NEWS
-rw-r--r--. 1 root root     188 May  5 10:50 README
[root@monitor_aodun ~]# mysql -h127.0.0.1 -uzabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-3.2.6/create.sql
Enter password: 
[root@monitor_aodun ~]# mysql -h127.0.0.1 -uzabbix -p zabbix -e ‘show tables‘
Enter password: 
+----------------------------+
| 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                |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| event_recovery             |
| event_tag                  |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| groups                     |
| history                    |
| history_log                |
| history_str                |
| history_text               |
| history_uint               |
| host_discovery             |
| host_inventory             |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| httpstep                   |
| httpstepitem               |
| httptest                   |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| item_application_prototype |
| item_condition             |
| item_discovery             |
| items                      |
| items_applications         |
| 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_url         |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| task                       |
| task_close_problem         |
| timeperiods                |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| trigger_tag                |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
+----------------------------+
[root@monitor_aodun ~]# cp /etc/zabbix/zabbix_server.conf{,.bak}
[root@monitor_aodun ~]# vim /etc/zabbix/zabbix_server.conf
[root@monitor_aodun ~]# grep -v ^# /etc/zabbix/zabbix_server.conf | tr -s [[:space:]]
使用浏览器打开server_ip/zabbix/setup.php页面进行zabbix-web-gui安装
检查安装环境是否满足
填写对应配置
信息确认页
成功安装后的提示信息
使用系统默认账户admin以及密码zabbix登录zabbix-web-gui
? 
至此,zabbix服务器端配置基本完成了,后续文章中将为大家分享如何创建监控项、如何定义触发器、如果使用报警功能、以及如何使用自写脚本实现定制业务项监控,直至实现一个完整的监控系统。
?? 
喜欢者请点赞加关注,错误之处,还请大家留言指正!
原文:http://blog.51cto.com/183530300/2085790