参考文档:https://www.centos.bz/2017/11/centos-7%E5%AE%89%E8%A3%85zabbix-3-4/
Zabbix 3.4 支持Centos 7。貌似不支持6.9.
更多详细内容请参考官方说明文档,详细的安装要求不贴出来了。
https://www.zabbix.com/documentation/3.4/zh/manual/installation/requirements
虚拟机配置 双核 8G内存
检查当前版本
rpm -qa zabbix-web-mysql
rpm -qa zabbix-server-mysql
卸载当前版本
yum remove zabbix-server-mysql zabbix-web-mysql -y
yum remove zabbix-release -y
yum clean all
sudo yum -y update
sudo sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
sudo systemctl stop firewalld.service && systemctl disable firewalld.service
完成3、4两步,重启一下。
sudo rpm -Uvh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
可以从https://dev.mysql.com/downloads/file/?id=470281下载
先装mysql
sudo yum install mysql-* --skip-broken 有冲突的软件跳过
安装Apache
sudo yum -y install httpd
systemctl start httpd.service #启动
systemctl stop httpd.service #停止
systemctl restart httpd.service #重启
systemctl enable httpd.service #开机启动
systemctl disable httpd.service #开机不启动
安装php
sudo yum install php
安装php扩展
sudo yum install php-mysqlnd php-gd libjpeg* php-snmp php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash php-common php-ctype php-xml php-xmlreader php-xmlwriter php-session php-mbstring php-gettext php-ldap php-mysqli --skip-broken
sudo yum install wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC
sudo vim /etc/my.cnf 不然没权限保存
在文件最后添加以下内容:
innodb_file_per_table = 1
innodb_status_file = 1
innodb_buffer_pool_size = 6G
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 64M
innodb_support_xa = 0
default-storage-engine = innodb
bulk_insert_buffer_size = 8M
join_buffer_size = 16M
max_heap_table_size = 32M
tmp_table_size = 32M
max_tmp_tables = 48
read_buffer_size = 32M
read_rnd_buffer_size = 16M
key_buffer_size = 32M
thread_cache_size = 32
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_rollback_on_timeout = 1
query_cache_size = 16M
query_cache_limit = 16M
collation_server = utf8_bin
character_set_server = utf8
注:原则上 innodb_buffer_pool_size 需要设置为主机内存的 80%,如果主机内存不是 8GB,以上参数可依据相应比例进行调整,例如主机内存为 16GB,则 innodb_buffer_pool_size 建议设置为 12GB,innodb_log_buffer_size 建议设置为 32M,innodb_log_file_size 建议设置为 128M,以此类推。请注意innodb_buffer_pool_size的值必须是整数,例如主机内存是4G,那么innodb_buffer_pool_size可以设置为3G,而不能设置为3.2G
sudo systemctl enable mysqld && systemctl start mysqld
grep 'temporary password' /var/log/mysqld.log
JtZizq!Rl6E+
配置开始时会用到第 09获取的初始密码,建议修改为自定义密码,其它选项选择 y 即可
mysql_secure_installation
密码改为:Aa123456,.
sudo systemctl restart mysqld
mysql -u root -p(需要输入第 10步中设置的自定义密码)
create database zabbix character set utf8 collate utf8_general_ci; #创建数据库
create user zabbix@'%' identified by 'xmuidXMUID@2019'; #创建用户和密码
grant all privileges on zabbix.* to zabbix@'%'; #赋权
flush privileges;
exit;
sudo rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/
sudo yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-java-gateway zabbix-web
cd /usr/share/doc/zabbix-server-mysql-3.4.3
zcat create.sql.gz | mysql -uroot zabbix -p(需要输入第 10 步中设置的自定义密码)
sudo vim /etc/zabbix/zabbix_server.conf 这个配置要一遍过
主要是以下几个选项参数需要设置(8GB 内存为例):
DBPassword 配置为第 12 步第 3 行中设置的自定义密码
CacheSize=512M
(CacheSize在371行)
HistoryCacheSize=128M
(HistoryCacheSize在397行)
HistoryIndexCacheSize=128M
(HistoryIndexCacheSize在405行)
TrendCacheSize=128M
(TrendCacheSize在414行)
ValueCacheSize=256M
(ValueCacheSize在425行)
Timeout=30
(Timeout在432
其它参数保持默认值即可
如果需要监控VMware虚拟机,则还需要设置以下选项参数:
StartVMwareCollectors=2
(StartVMwareCollectors在272行
VMwareCacheSize=256M
(VMwareCacheSize 在298行)
VMwareTimeout=300
(VMwareTimeout在306行)
sudo vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 600
php_value memory_limit 256M
php_value post_max_size 32M
php_value upload_max_filesize 32M
php_value max_input_time 600
php_value always_populate_raw_post_data -1
date.timezone 去掉注释符号#,并将值修改为 Asia/Shanghai
systemctl stop mysqld && reboot
sudo systemctl start httpd && systemctl start zabbix-server
20、在浏览器中输入 http://zbx监控服务器的IP地址/zabbix,进行 zabbix 的页面初始化配置
这个页面PHP设置要求全部OK
如果密码输错,是跳转不到下一步的。密码是前面设置的 Qingdao@2017
注:第4步的”Zabbix server detail”页面中,”Name”处可填写对此监控系统的描述性文字,支持中文,有点像网站的名称。
然后选择 Administrator –> Users –> Admin
原文出处:azurew -> http://www.azurew.com/6513.html
一.安装Zabbix_agent 服务
1.安装zabbix yum源
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2.安装Zabbix_agent
yum install zabbix-agent -y
3.修改配置文件
vim /etc/zabbix/zabbix_agentd.conf
# zabbix server端IP
Server=127.0.0.1
# zabbix server端IP
ServerActive=127.0.0.1
# zabbix客户端主机名
Hostname=Zabbix server
4.启动zabbix_agent服务
systemctl start zabbix-agent.service
二.web端添加操作
登陆zabbix-server Web界面,Configuration-->Hosts-->Create host
点击Templates 设置关联模板Template OS Linux 并add。
现在去Configuration--> Hosts中查看刚刚新加的主机,availability已经变成绿色了,代表成功了。如下:
完成!!!