Zabbix_YUM

**************************************************************************************************
◆案例◆ YUM安装Zabbix
**************************************************************************************************

1.配置阿里yum源,与zabbix 源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

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


2.安装 LAMP + zabbix

yum -y install mariadb mariadb-server httpd php php-mysql

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


3.导入数据库

systemctl restart mariadb

mysql_secure_installation

mysql -uroot -p

mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123123';
mysql> quit;


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


4.编辑zabbix配置文件

vim /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password


5.拷贝zabbix图形界面,并设置权限

cp -a /usr/share/zabbix/* /var/www/html/
chmod 755 -R /var/www/html/*
chown apache.apache -R /var/www/html*


6.配置php参数


vim /etc/httpd/conf.d/zabbix.conf

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai


vim /etc/php.ini

date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = 0


7.启动所有服务

systemctl restart httpd
systemctl restart mariadb
systemctl restart zabbix-server
systemctl restart zabbix-agent

systemctl enable httpd
systemctl enable mariadb
systemctl enable zabbix-server
systemctl enable zabbix-agent


8.找回密码

update users set passwd=md5(123123) where name="Zabbix";


****************************************************************************
◆修改中文乱码问题◆
****************************************************************************

Win+R -> fonts -> 拷贝微软雅黑字体改名为 msyh.ttf

上传到 /usr/share/zabbix/fonts

修改配置文件

vim /usr/share/zabbix/include/defines.inc.php

修改 zabbix php 页面配置,将'graphfont' 修改为 msyh

define('ZBX_GRAPH_FONT_NAME', 'msyh');


****************************************************************************
◆监控一台客户端◆
****************************************************************************

客户端下载地址 http://repo.zabbix.com/zabbix/

安装客户端 rpm -ivh zabbix-agent-3.2.6-1.el6.x86_64.rpm


编辑配置文件

vim /etc/zabbix/zabbix_agentd.conf

Server=192.168.22.195 #填写Server的IP地址
ServerActive=192.168.22.195 #修改为Server的IP地址
Hostname=centos-001 #填写本机的HostName,Server端要与此名称同步
LogFile=/tmp/zabbix_agentd.log

/usr/sbin/zabbix_agentd #启动zabbix-agentd

猜你喜欢

转载自www.cnblogs.com/LyShark/p/9062895.html
今日推荐