运维笔记之zabbix的yum安装
中小型规模网站集群架构:zabbix安装
: Ago linux运维群:https://hankbook.cn
1.安装zabbix
服务端安装
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
yum -y install httpd zabbix-web zabbix-server-mysql zabbix-web-mysql mysql-server
PHP安装
rpm -ivh http://repo.webtatic.com/yum/el6/x86_64/webtatic-release-6-6.noarch.rpm
yum -y install php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath
直接解决:
yum -y install httpd zabbix-web zabbix-server-mysql zabbix-web-mysql zabbix-get mysql-server php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath zabbix-get zabbix-java-gateway wqy-microhei-fonts net-snmp net-snmp-utils
修改mysql配置
\cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
启动MySQL
/etc/init.d/mysqld start
创建用户并授权
mysql
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';
flush privileges;
exit
导入数据文件
cd /usr/share/doc/zabbix-server-mysql-3.0.7
zcat create.sql.gz |mysql -uzabbix -pzabbix zabbix
相关数据修改
修改php配置文件
egrep -n "^post_max_size|^max_execution_time|^max_input_time|^date.timezone" /etc/php.ini
sed -i 's#max_execution_time = 30#max_execution_time = 300#;s#max_input_time = 60#max_input_time = 300#;s#post_max_size = 8M#post_max_size = 16M#;910a date.timezone = Asia/Shanghai' /etc/php.ini
修改zabbix_server配置文件
sed -i '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
网页文件
cp -R /usr/share/zabbix/ /var/www/html/
文件授权
chmod -R 755 /etc/zabbix/web
chown -R apache.apache /etc/zabbix/web
启动zabbix
echo "ServerName 127.0.0.1:80">>/etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
/etc/init.d/zabbix-server start
修改字符集,修改掉默认的字符集
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
安装客户端
yum localinstall http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-agent-3.0.7-1.el6.x86_64.rpm -y
修改配置文件
sed -i 's#Server=127.0.0.1#Server=172.16.1.41#' /etc/zabbix/zabbix_agentd.conf
重启服务
/etc/init.d/zabbix-agent restart
服务端检测
zabbix_get -s 172.16.1.41 -p 10050 -k "system.cpu.load[all,avg1]"