Zabbix的简单使用

时间:2023-03-09 03:33:43
Zabbix的简单使用

0. 卸载mariadb 安装mysql

方法 rpm -qa |grep mariadb

然后 rpm -e --nodeps mariadb*****

安装mysql

# 下载mysql源安装包

shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

# 安装mysql源

 shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm

安装mysql

yum install mysql-community-server

启动mysql
shell> systemctl start mysqld
设置开机自动启动 systemctl enable mysqld

查找默认的mysql临时密码:
grep 'temporary password' /var/log/mysqld.log 修改为新密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Test6530!'; 

默认配置文件路径: 
配置文件:/etc/my.cnf 
日志文件:/var/log//var/log/mysqld.log 
服务启动脚本:/usr/lib/systemd/system/mysqld.service 
socket文件:/var/run/mysqld/mysqld.pid 原作者目录: https://www.linuxidc.com/Linux/2016-09/135288.htm
 

1. 通过官网查找安装攻略

地址:https://www.zabbix.com/download

内容:

  1. a. Install Repository with MySQL database

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

    b. Install Zabbix server, frontend, agent

    # yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

    c. Create initial database

    # mysql -uroot -p
    password
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'Test6530!';
    mysql> quit;

    Import initial schema and data. You will be prompted to enter your newly created password.

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

    d. Configure the database for Zabbix server

    DBPassword=password

    e. Start Zabbix server and agent processes

    Start Zabbix server and agent processes and make it start at system boot:

    # systemctl restart zabbix-server zabbix-agent httpd
    # systemctl enable zabbix-server zabbix-agent httpd

    f. Configure PHP for Zabbix frontend

    Edit file /etc/httpd/conf.d/zabbix.conf, uncomment and set the right timezone for you.# php_value date.timezone Europe/Riga

    Now your Zabbix server is up and running!

  2. Configure Zabbix fronten

  3. 出现错误的解决
  4. zabbix_server: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
  5. yum install mysql-devel mysql-libs
  6. httpd 启动不起来 修改 /etc/httpd/conf里面的配置文件 将 ServerName locahost:80 修改一下。

一开始出现 php的连接错误

因为安装顺序的问题 重新安装一下  php-mysql-5.4.16-43.el7_4.1.x86_64

127 rpm -qa|grep php
128 rpm -qa|grep mysql
129 rpm -e php-mysql-5.4.16-43.el7_4.1.x86_64
130 rpm -e --nodeps php-mysql-5.4.16-43.el7_4.1.x86_64
131 yum install php-mysql-5.4.16-43.el7_4.1.x86_64

即可

然后web端进行安装.

基本上可用了

4. 添加ESXi主机