四、redis6 集群 zabbix监控【zabbix server、zabbix agent 安装】
一、zabbix server部署安装:
192.168.109.137
5.0 LTS
CentOS 7
MySQL
NGINX
参考官网:https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=nginx
基础安装,字体添加、优化等依据线上具体环境
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm yum clean all -y yum install zabbix-server-mysql zabbix-agent -y yum install centos-release-scl -y 编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository. [zabbix-frontend] ... enabled=1 ... yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl -y wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm yum -y install mysql57-community-release-el7-10.noarch.rpm yum -y install mysql-community-server 失败的软件包是:mysql-community-libs-compat-5.7.37-1.el7.x86_64 GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 到mysql官网下载校验文件 或者 修改配置跳过校验 修改对应安装版本的gpgcheck=0即可,默认值为1 /etc/yum.repos.d/mysql-community.repo ... [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/ enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql ... systemctl start mysqld.service systemctl status mysqld.service grep "password" /var/log/mysqld.log mysql -uroot -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password'; mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'wang!321WBC'; 可以通过以下命令修改默认密码的复杂度: set global validate_password_policy=LOW; 修改默认密码长度: set global validate_password_length=6; 命令查看mysql默认密码复杂度: SHOW VARIABLES LIKE 'validate_password%'; ###grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option; GRANT USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY 'wang!321WBC'; GRANT SELECT,EXECUTE ON *.* TO web_ngames@'%' IDENTIFIED BY 'wang!321WBC'; grant select,EXECUTE on *.* to select_ngames@'%' identified by 'wang!321WBC'; grant all privileges on *.* to ngames@'%' identified by 'wang!321WBC'; flush privileges; 重新登录mysql,然后输入status,查看mysql字符集信息: vim /etc/my.cnf 进入文件后,新增五行代码: [client] default-character-set=utf8 [mysqld] character-set-server=utf8 collation-server=utf8_general_ci service mysqld restart 创建初始数据库 确保数据库服务器已经启动并运行。 mysql -uroot -p mysql> create database zabbix character set utf8 collate utf8_bin; mysql> create user zabbix@localhost identified by 'wang!321WBC'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> quit; 导入初始架构和数据,系统将提示您输入新创建的密码。 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix 为Zabbix server配置数据库 编辑配置文件 vim /etc/zabbix/zabbix_server.conf DBPassword=wang!321WBC 为Zabbix前端配置PHP 编辑配置文件 vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf 取消注释并设置'listen'和'server_name'指令。 编辑配置文件 vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, add nginx to listen.acl_users directive. listen.acl_users = apache,nginx 然后取消注释并为您设置正确的时区 php_value[date.timezone] = Europe/Riga 改为 php_value[date.timezone] = Asia/Shanghai 启动Zabbix server和agent进程(crond所有机器同步时间) 0 */1 * * * ntpdate 1.north-america.pool.ntp.org&&hwclock --systohc 启动Zabbix server和agent进程,并为它们设置开机自启: systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm 修改注释nginx配置 vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf 这里简单注释了nginx.conf中的server{},启用/etc/opt/rh/rh-nginx116/nginx/conf.d中的zabbix.conf kill -HUP nginx的pid 配置Zabbix前端 连接到新安装的Zabbix前端: http://server_ip_or_name 根据Zabbix文件里步骤操作: Installing frontend 按页面提示配置 默认登陆名、密码:Admin/zabbix
二、zabbix agent部署安装:
192.168.109.139、192.168.109.140
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm yum clean all -y yum install zabbix-agent -y 编辑修改配置文件 grep -n '^'[a-Z] /etc/zabbix/zabbix_agentd.conf vim /etc/zabbix/zabbix_agentd.conf 13:PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=192.168.109.137 //zabbix服务器地址 ServerActive=192.168.109.137 //活跃服务器地址 #Hostname=zabbix_agent Hostname=192.168.109.139 Include=/etc/zabbix/zabbix_agentd.d/*.conf systemctl enable zabbix-agent.service systemctl restart zabbix-agent.service
添加主机(hosts)
configuration(组态,配置)–>Hosts(主机)–>Create host(创建主机)–>代理接口IP填本机IP–>连接模板–>添加