zabbix3.4监控系统安装部署

系统运维

 

1. 修改主机名

vim /etc/hostname ,修改为zabbix-server

 

2. 网卡配置

vim /etc/sysconfig/network-scripts/ifcfg-eno16780032

 

3. 关闭防火墙和selinux

systemctl stop firewalld.service

systemctl disable firewalld.service

 

4. 关闭selinux

vim /etc/selinux/config,修改为:SELINUX=disabled

 

5. 初始化系统(内核优化等,非必选)

 

6. 配置yum源

rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

yum clean all

yum makecache

 

7. 安装zabbix服务端

yum -y install zabbix-server-mysql zabbix-web-Mysql zabbix-agent

 

8. 启动zabbix-server zabbix-agent httpd

systemctl restart zabbix-server zabbix-agent httpd

systemctl enable zabbix-server zabbix-agent httpd

 

9. 下载数据库服务端和客户端

wget https://CDN.MYSQL.com/archives/mysql-5.6/MySQL-server-5.6.43-1.el7.x86_64.rpm

wget https://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-client-5.6.43-1.el7.x86_64.rpm

 

10. 数据库服务端和客户端安装

rpm -ivh MySQL-server-5.6.43-1.el7.x86_64.rpm –force -nodeps

rpm -ivh MySQL-client-5.6.43-1.el7.x86_64.rpm –force –nodeps

 

11. 创建相关目录及目录授权

mkdir -p /data/mysql/

chown -R mysql.mysql /data/mysql/

 

12. 修改数据库配置文件

vim /etc/my.cnf

 

[client]

port                           = 3306

socket                         = /data/mysql/mysql.sock

 

[mysqld]

user                           = mysql

port                           = 3306

character-set-server           = utf8

default-storage-engine         = InnoDB

socket                         = /data/mysql/mysql.sock

pid-file                       = /data/mysql/mysql.pid

 

# DATA STORAGE #

datadir                        = /data/mysql/

innodb_data_file_path          = ibdata1:1024M:autoextend

innodb_data_home_dir           = /data/mysql/

innodb_log_group_home_dir      = /data/mysql/

 

# LOGGING #

log-error                      = /data/mysql/mysql-error.log

log-queries-not-using-indexes  = 0

slow-query-log                 = 1

long_query_time                = 2

slow-query-log-file            = /data/mysql/mysql-slow.log

lower_case_table_names         = 1

skip-grant-tables

 

13.初始化数据库

/usr/bin/mysql_install_db –user=mysql –datadir=/data/mysql –pid-file=/data/mysql/mysql.pid

 

14. 启动数据库及设置root密码

/etc/init.d/mysql restart

mysqladmin -h 127.0.0.1 -uroot -p password

 

15. 登录数据库,mysql -uroot -p

 

16. 创建zabbix数据库 zabbix数据库的密码为zabbix

create database zabbix character set utf8 collate utf8_bin;

grant all privileges on zabbix.* to zabbix@localhost identified by \’zabbix\’

 

17. 导入数据库

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

 

18. 编辑Zabbix前端PHP配置,主要是更改时区

vim /etc/httpd/conf.d/zabbix.conf

修改此行:php_value date.timezone Asia/Shanghai

systemctl restart httpd

19. 浏览器访问并配置

http://192.168.8.133/zabbix/ 

 

20. 修改为中文界面

 

在Adminstration–>Users下面找到对应的用户,点进去,找到Language,选择Chinese(zh_CN),更新后,刷新页面即可切换为中文界面。

 

 

21. zabbix客户端安装配置

 

centos7:

 

rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

 

yum -y install  zabbix-agent

systemctl enable zabbix-agent

 

sed -i \’s/Server=127.0.0.1/Server=192.168.8.133/\’ /etc/zabbix/zabbix_agentd.conf

sed -i \’s/ServerActive=127.0.0.1/ServerActive==192.168.8.133/\’ /etc/zabbix/zabbix_agentd.conf

echo 192.168.8.133    Zabbix server >> /etc/hosts

 

systemctl restart  zabbix-agent

 

centos6:

 

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm

 

yum install zabbix-agent

chkconfig zabbix-agent on

 

sed -i \’s/Server=127.0.0.1/Server=192.168.8.133/\’ /etc/zabbix/zabbix_agentd.conf

sed -i \’s/ServerActive=127.0.0.1/ServerActive==192.168.8.133/\’ /etc/zabbix/zabbix_agentd.conf

echo 192.168.8.133    Zabbix server >> /etc/hosts

 

service zabbix-agent start

配置zabbix-server服务器的hosts

vim /etc/hosts

包含服务端和所有客户端的主机

根据监控需要完成监控项目的配置

新网虚拟主机

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注