Cenos7 ++Zabbix监控(同个节点)

Zabbix大全(必看,包括server,agent安装):https://www.cnblogs.com/clsn/p/7885990.html

############ 更换zabbix新版本链接http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm ##########################

本环境使用epel源 rpm -iUvh http://mirrors.neusoft.edu.cn/epel//7/x86_64/e/epel-release-7-10.noarch.rpm

zabbix-server和zabbix-agent上在同一节点上

实验ip为:172.16.169.128

关闭防火墙或用iptables写入策略

1.安装必须软件包

yum -y install httpd mariadb mariadb-server php php-gd php-mysql php php-gd php-mysql php-bcmath php-mbstring

做apache和php的整合,修改apache的配置文件,默认首页设置为php

增加php应用的支持

重启httpd

2.配置zabbixzone package和GPG key

rpm -Uv http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

3.安装zabbix server 

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y

编辑/etc/httpd/conf.d/zabbix.conf

更改时区:

添加上海时区

重启httpd生效配置

开启mariadb

然后设置mysql密码

 

4.创建mariadb数据库和用户

create database zabbix character set utf8;

授权

grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

刷新权限

flush privileges; 

5.数据库导入zabbix  template

查看需要导入的数据表

登录zabbix数据库

mysql -uzabbix -pzabbix

使用zabbix数据库

use zabbix;

导入模板数据

source /usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql

source /usr/share/doc/zabbix-server-mysql-2.4.8/create/images.sql

source /usr/share/doc/zabbix-server-mysql-2.4.8/create/data.sql

6.配置zabbix server

vi /etc/zabbix/zabbix_server.conf

开启三个参数

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

7.配置zabbix-agent

vi /etc/zabbix/zabbix_agentd.conf

修改第85行添加zabbix-server的ip

Server=127.0.0.1 (因为是在同一节点上,所以ip写本机回环即可)

修改第126行

ServerActive=127.0.0.1 (因为是在同一节点上,所以ip写本机回环即可)

修改第137行

Hostname=127.0.0.1 (因为是在同一节点上,所以ip写本机回环即可)

8.修改PHP配置

修改php.ini为zabbix建议的设置

编辑文件/etc/php.ini

设置下面的几个参数

max_execution_time = 600

max_input_time = 600

memory_limit = 256

post_max_size = 32M

upload_max_filesize = 16M

date.timezone = Asia/Shanghai

9.修改Firewall和selinux设置

开放zabbix端口10050 和10051

firewall-cmd --permanent --add-port=10050/tcp

firewall-cmd --permanent --add-port=10051/tcp

重启firewall(测试阶段关闭防火墙)

systemctl restart firewalld

如果使用selinux,运行一下命令使apache可以和zabbix通信

启动zabbix-server和zabbix-agent,重启httpd,并设置开机自动启动

systemctl start zabbix-server

systemctl start zabbix-agent

systemctl restart httpd

systemctl restart mariadb

systemctl enable zabbix-server

systemctl enable zabbix-server

11.通过控制台配置zabbix

http://172.16.169.128/zabbix/setup.php

点击Test connection ,显示ok在继续

默认登录账号admin  密码zabbix

参考链接::

http://blog.51cto.com/koumm/1937290

http://www.cnblogs.com/bky185392793/p/7367434.html

http://blog.51cto.com/koumm/1936534

https://blog.csdn.net/yang00322/article/details/77895301

http://blog.51cto.com/sf1314/2122143  

https://www.awaimai.com/2120.html

猜你喜欢

转载自www.cnblogs.com/huanglinxin/p/9140477.html
今日推荐