基于centos 7.x 安装 zabbix 4.0TLS

一、安装

  1、apache服务

  yum install -y httpd httpd-devel php-devel openssl openssl-devel  

  2、使用yum方式安装zabbix

  安装方式见官方文档 https://www.zabbix.com/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql 

  3、安装mysql8.0.x数据库  

  安装方法见,另外一篇博文:https://www.cnblogs.com/bulh/articles/11254465.html

 

二、配置:

  1、mysql配置

  mysql -u root -p PASSWORD

  创建用户

  mysql> create user zabbix@"localhost"  identified by "password";

  mysql> grant all privileges on zabbix.*  to zabbx@"localhost";

  注:mysql 8.0.x 不适用 grant all privileges on zabbix.* to zabbix@localhost identified by 'password'; 这种写法,不知到为什么! 如果有成功的可以分享一下经验;

  创建数据库

  mysql> create database zabbix;

  导入数据库

  cp  /usr/share/doc/zabbix-server-mysql-4.0.10/create.sql.gz /down

  gunzip create.sql.gz

  mysql -u zabbix -p zabbix < /down/create.sql

  登陆数据库确认是否导入成功

  mysql -u root -p ‘password

  mysql> use zabbix;

  mysql> show tables;

  2、zabbix配置

  编辑 /etc/zabbix/zabbix_server.conf 配置文件

  DBHost=数据库IP

  DBName=数据库名

  DBUser=数据库用户名

  DBPassword=数据库用户名密码

  DBPort=数据库端口号

  注:pgsql注意配置 DBSchema=

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

  php_value date.timezone Europe/Riga #修改时区

  3、apache配置  

  按需调整配置监控端口及IP

  4、配置zabbix-agent客户端

  安装zabbix-agent

  去官网查找对应版本 https://www.zabbix.com/download ,尽量做到服务端和客户端版本统一 

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

  yum install zabbix-agent* -y

  vim vim /etc/zabbix/zabbix_agentd.conf    

    Server=127.0.0.1 #Server端的IP地址。

    ServerActive=127.0.0.1 # zabbix server 端口10051可以默认。

    Hostname=ZabbixServer #必须与zabbix server端创建主机时候输入的zabbix agent端的host name一致。

    Server和ServerActive都要根据实际情况指定zabbix server的IP地址。

    Server是用来允许zabbix  server的这个IP来主动取数据,ServerActive 是客户端主动提交数据给zabbix server端。

三、重启服务

  systemctl restart zabbix-server

  systemctl reload httpd   # httpd 服务重新载入配置即可,不是必需使用 restart

  systemctl start zabbix-agentd.server  #客户端需要使用

 

四、配置zabbix页面

  打开浏览器,使用 http://IP:port/zabbix方式,进行页面配置 

  默认账户:Admin # 区分大小写

  密码:zabbix

 

扩展:

1)、centos tab键自动补全功能不好用时,需要重新安装一下bash-completion软件包

2)、systemctl 命令中 添加开机启动,相当于做了一个“/usr/lib/systemd/system/*.server ” 到 " /etc/systemd/system/multi-user.target.wants/*.server" 软链接 

如:

# pwd
/etc/systemd/system/multi-user.target.wants

zabbix-server.service -> /usr/lib/systemd/system/zabbix-server.service

3)、设置开机自启,也可以编辑vim /etc/rc.d/rc.local  文件,添加如下格式

  /usr/local/zabbix/sbin/zabbix_server start

  /usr/local/zabbix/sbin/zabbix_agentd start

 

posted on 2019-07-31 11:24  步留痕  阅读(500)  评论(0)    收藏  举报

导航