修改主机名
添加主机映射
关闭内核安全机制
关闭防火墙
配置yum源
[root@zabbix-server ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@zabbix-server ~]# rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
-----------------------------------------------------------
安装mariadb-server
[root@zabbix-server ~]# yum -y install mariadb-server
[root@zabbix-server ~]# systemctl start mariadb
[root@zabbix-server ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@zabbix-server ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;ERROR 1007 (HY000): Can't create database 'zabbix'; database exists
MariaDB [(none)]> CREATE DATABASE zabbix_proxy character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> UPDATE mysql.user SET password = PASSWORD('zabbix') WHERE user = 'root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@'localhost' IDENTIFIED BY 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@'%' IDENTIFIED BY 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix_proxy.* TO 'zabbix'@'localhost' IDENTIFIED BY 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix_proxy.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| zabbix |
| zabbix_proxy |
+--------------------+
6 rows in set (0.00 sec)
MariaDB [(none)]> exit
-----------------------------------------------------------
安装zabbix-server-mysql-3.2.11 zabbix-web-mysql
[root@zabbix-server ~]# yum -y install zabbix-server-mysql-3.2.11 zabbix-web-mysql
-----------------------------------------------------------
初始化zabbix
[root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql-3.2.11/create.sql.gz | mysql -u zabbix -p zabbix
-----------------------------------------------------------
验证zabbix初始化状态
[root@zabbix-server ~]# mysql -u zabbix -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
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 |
| 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 |
+----------------------------+
127 rows in set (0.00 sec)
MariaDB [zabbix]> exit
[root@zabbix-server ~]# cp /etc/zabbix/zabbix_server.conf{,.bak}
[root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf
81 DBHost=localhost
91 DBName=zabbix
107 DBUser=zabbix
115 DBPassword=zabbix
[root@zabbix-server ~]# systemctl start zabbix-server.service
[root@zabbix-server ~]# systemctl enable zabbix-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@zabbix-server ~]# systemctl status zabbix-server.service
-----------------------------------------------------------
配置nginx
[root@zabbix-server ~]# cp /etc/nginx/nginx.conf{,.bak}
[root@zabbix-server ~]# cat /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
index index.html index.php;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
location ~ \.php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
-----------------------------------------------------------
修改php配置
[root@zabbix-server ~]# cp /etc/php.ini{,.bak}
[root@zabbix-server ~]# vim /etc/php.ini
672 post_max_size = 16M
384 max_execution_time = 300
394 max_input_time = 300
405 memory_limit = 128M
800 upload_max_filesize = 2M
878 date.timezone =Asia/Shanghai
-----------------------------------------------------------
复制web页面
[root@zabbix-server ~]# cp -rp /usr/share/zabbix/ /usr/share/nginx/html/
-----------------------------------------------------------
启动并设置开机自启动nginx和php
[root@zabbix-server ~]# systemctl start nginx.service php-fpm.service
[root@zabbix-server ~]# systemctl enable nginx.service php-fpm.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
确认nginx和php启动成功
1.查看状态是否running
[root@zabbix-server ~]# systemctl status nginx.service php-fpm.service
2.查看监听端口是否被监听
[root@zabbix-server ~]# netstat -anpt | grep 80
[root@zabbix-server ~]# netstat -anpt | grep 9000
-----------------------------------------------------------
安装zabbixWEB端。在浏览器输入http://192.168.50.11/zabbix
检测配置项
-----------------------------------------------------------
填写配置项,连接数据库
-----------------------------------------------------------
设置 Zabbix Server 的主机名及端口等信息
-----------------------------------------------------------
确认核对信息
-----------------------------------------------------------
完成安装web端
-----------------------------------------------------------
登录zabbix
-----------------------------------------------------------
登录成功
-----------------------------------------------------------
部署zabbix Agent
[root@zabbix-server ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
获取http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
准备中... ################################# [100%]
软件包 epel-release-7-14.noarch 已经安装
[root@zabbix-server ~]# rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
获取http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
准备中... ################################# [100%]
软件包 zabbix-release-3.2-1.el7.noarch 已经安装
[root@zabbix-agent01 ~]# yum -y install zabbix-agent
[root@zabbix-agent01 ~]# cp /etc/zabbix/zabbix_agentd.conf{,.bak}
[root@zabbix-agent01 ~]# vim /etc/zabbix/zabbix_agentd.conf
-----------------------------------------------------------
部署zabbix proxy
[root@zabbix-server ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
获取http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
准备中... ################################# [100%]
软件包 epel-release-7-14.noarch 已经安装
[root@zabbix-server ~]# rpm -Uvh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
获取http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
准备中... ################################# [100%]
正在升级/安装...
1:zabbix-release-3.4-1.el7.centos ################################# [ 50%]
正在清理/删除...
2:zabbix-release-3.2-1.el7 ################################# [100%]
[root@zabbix-agent02 ~]# yum -y install zabbix-proxy-mysql
[root@zabbix-agent02 ~]# yum -y install mariadb
[root@zabbix-agent02 ~]# zcat /usr/share/doc/zabbix-proxy-mysql-3.2.11/schema.sql.gz | mysql -h 192.168.50.11 -u zabbix zabbix_proxy -p
[root@zabbix-agent02 ~]# cp /etc/zabbix/zabbix_proxy.conf{,.bak}
[root@zabbix-agent02 ~]# vim /etc/zabbix/zabbix_proxy.conf
24 Server=192.168.50.11
43 Hostname=Zabbix Proxy
128 DBHost=192.168.50.11
139 DBName=zabbix_proxy
154 DBUser=zabbix
162 DBPassword=zabbix
176 DBPort=3306
[root@zabbix-agent02 ~]# systemctl start zabbix-proxy.service
[root@zabbix-agent02 ~]# systemctl enable zabbix-proxy.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-proxy.service to /usr/lib/systemd/system/zabbix-proxy.service.
[root@zabbix-agent02 ~]# systemctl status zabbix-proxy.service
[root@zabbix-agent02 ~]# yum -y install zabbix-agent
[root@zabbix-agent02 ~]# cp /etc/zabbix/zabbix_agentd.conf{,.bak}
[root@zabbix-agent02 ~]# vim /etc/zabbix/zabbix_agentd.conf
95 Server=192.168.50.13 ##找proxy服务器
136 ServerActive=192.168.50.13 ##
147 Hostname=Zabbix Agent on Proxy
-----------------------------------------------------------
zabbix前段配置
修改语言
F5刷新页面
添加主机
添加主机群组
添加代理
*:注意,这里如果ZBX不是绿色,重启zaabix-proxy zabbix-agent 两个服务,刷新web页面即可。
添加监控项