准备工作
1、系统环境要求
在部署Zabbix-server 3.0之前,需要确保您的CentOS 6.9系统满足以下环境要求:
CPU:至少1个核心
内存:至少256MB
磁盘空间:至少8GB可用空间
网络:支持IPv4和IPv6
安装依赖包
在部署Zabbix-server 3.0之前,需要先安装一些必要的依赖包,在终端中执行以下命令:
sudo yum install -y epel-release sudo yum install -y wget git net-tools openssl-devel libxml2-devel libxslt-devel ncurses-devel postgresql-libs postgresql-devel
下载并安装Zabbix-server 3.0
在官方网站(https://www.zabbix.com/download)下载Zabbix-server 3.0的源码包或者RPM包,这里我们以源码包为例,执行以下命令:
wget https://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm sudo rpm -ivh zabbix-release-3.0-1.el6.noarch.rpm
接下来,安装Zabbix-server 3.0:
sudo yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
配置Zabbix-server 3.0
1、创建Zabbix数据库和用户
我们需要创建一个用于存储Zabbix数据的MySQL数据库和一个用于连接该数据库的用户,执行以下命令:
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql --ldatadir=/var/lib/mysql --skip-testdb --rndfile=/dev/urandom sudo mysql -uroot -pcreate database zabbix character set utf8 collate utf8_bin; create user 'zabbix'@'localhost' identified by 'zabbix'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; flush privileges; exit;
接下来,修改Zabbix-server的配置文件,指定刚刚创建的数据库和用户,打开/etc/zabbix/zabbix_server.conf
文件,找到以下两行:
DBPassword=your_password DBName=your_database_name DBUser=your_database_user
将your_password
、your_database_name
和your_database_user
替换为实际的值,重启Zabbix-server服务:
sudo systemctl restart zabbix-server
2、配置Zabbix-server连接到Zabbix数据库的相关信息
在/etc/zabbix/zabbix_server.conf
文件中,找到以下几行:
DBHost=localhost DBPort=3306 DBName=your_database_name DBUser=your_database_user DBPassword=your_password PHPParams=--default-charset=utf8 --enable-jsonp --disable-xmlrpc --allowurlfopen=On --uploadfiles=On --allowremotepwdchanges=Off --authmethod=DB --with-mysqli=on --with-pdo=off --with-pgsql=off --with-sqlite3=off --host=localhost --port=3306 --socket="/var/run/mysqld/mysqld.sock" --pid="/var/run/mysqld/mysqld.pid" --log="/var/log/zabbix/zabbix_server.log" --logfile="/var/log/zabbix/zabbix_server.log" --config="/etc/zabbix/zabbix_server.conf" --configfile="/etc/zabbix/zabbix_server.conf" --datadir="/var/lib/zabbix" --tmpdir="/tmp" ZBX_HOSTNAME="%h" ZBX_SERVER_PORT="10050" ZBX_SERVER_ADDR="%h:10050" ZBX_SERVER_PROTO="http" ZBX_USE_TLS="tls" ZBX_CACHE_DB="$DBName" ZBX_LANGUAGE="en" ZBX_DEFAULT_HOSTNAME="$ZBX_HOSTNAME" ZBX_SERVER_ID="5" ZBX_SERVER_TIMEZONE="Etc/UTC" ZBX_SERVER_NAME="Zabbix server (CentOS 6.9)" ZBX_SERVER_DESCRIPTION="Zabbix server installed on a Linux system with the following parameters: $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20" ZBX_VERSION="3.0" ZBX_PLUGIN_DIR="/usr/lib64/zabbix/plugins" ZBX_PLUGINS="agent,alert,autodiscovery,graphite,ipmi,jira,lld,nagios,openmetrics,pgsql,presence,sapr,sender,textfile,trends,webhooks,zapi,zdaemon" ZBX_IMAGES_DIR="/usr/share/doc/zabbix-server-stable/html" ZBX_IMAGES="^(graphite|netplugin).png" ZBX_JMX="" ZBX_JVMFLAGS="-Djava.awt.headless=true" ZBX_JAVA="/usr/bin/java" ZBX_LOGFILE="/var/log/zabbix/zabbix_java.log" ZBX_LOGLEVEL="INFO" ZBX_LOGSPLITTING="Y" ZBX_LOGSEVERITY="ALL" ZBX_LOGTOSYSLOG="n" ZBX_NOTIFICATIONS="email,jabberid,pop3,smtp,teamcity,webhook,wineventlog" ZBX_REPORTING="jabberid,email,teamcity,webhook,wineventlog" ZBX_ADMINS="Admin@example.com" ZBX_FRONTENDS="apache2" ZBX_AUTHPASSWD="" ZBX_ADMINPASSWD="" ZBX_USERS="Admin User" ZBX_HOSTS="Host Name" ZBX_TAGS="Tag Key" ZBX_HOSTGROUPS="Group Name)" (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) (optional) "$ZBBXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$" "$ZABBIXSERVER$") [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] [可选] "(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(required)(
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/141107.html