CentOS7+zabbix 3.0+mysql5.5安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7+zabbix 3.0+mysql5.5安装相关的知识,希望对你有一定的参考价值。
一、准备Yum源,这里我们使用官方的Yum源
zabbix 3.0没有了zabbix_server这个包而是直接整合进zabbix_server_mysql里面
# rpm -Uivh # yum clean all # yum makecache
二、安装zabbix各组件
服务端
# yum install zabbix-agent zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql {zabbix-agent|zabbix-sender}
安装mysql
# groupadd -r -g 306 mysql # useradd -g 306 -u 306 -r -M mysql # tar -xf mysql-5.5.28-linux2.6-x86_64.tar.gz -C /usr/local/# cd /usr/local/ # chown -R mysql.mysql ./*# mkdir /data/mysql5.5.28 # chown -R mysql.mysql /data/mysql5.5.28 # scripts/mysql_install_db --datadir=/data/mysql5.5.28 --user=mysql
my.cnf配置
# cp my-small.cnf /etc/my.cnf[client] port = 3306socket = /data/mysql5.5.28/mysql.sock [mysqld] port = 3306socket = /data/mysql5.5.28/mysql.sock server-id = 1log-bin=mysql-bin pid-file = /data/mysql5.5.28/mysql.pid innodb-file-per-table = 1datadir = /data/mysql5.5.28[mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M [mysqlhotcopy] interactive-timeout
cp mysqld 并加入自动启动
# cp mysql.server /etc/init.d/mysqld # chmod +x /etc/init.d/mysqld # chkconfig --add mysqld # chkconfig mysqld --listmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off# service mysqld start
创建zabbix库并授权
# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 560Server version: 5.5.28-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type ‘help; ‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MySQL [(none)]> CREATE DATABASE zabbix; MySQL [(none)]> GRANT ALL ON zabbix.* TO [email protected]‘127.0.0.1‘ IDENTIFIED BY ‘zabbixpass‘; MySQL [(none)]> FLUSH PRIVILEGES;
客户端:
# yum install zabbix-sender zabbix-agent -y
三、配置zabbix并启动
zabbix-server:
# grep -v "^#" zabbix_server.conf ListenPort=10051 SourceIP=172.16.0.2 LogFile=/var/log/zabbix/zabbix_server.log PidFile=/var/run/zabbix/zabbix_server.pid DBHost=127.0.0.1DBName=zabbix DBUser=zabbix DBPassword=zabbixpass DBSocket=/data/mysql5.5.28/mysql.sock StartPollers=2 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log Timeout=4AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000# systemctl start zabbix-server.service
zabbix-web:
# rpm -qf zabbix.conf zabbix-web-3.0.5-1.el7.noarch # grep "Asia/Shanghai" /etc/httpd/conf.d/zabbix.conf #只需修改这里即可 Alias /zabbix /usr/share/zabbix php_value date.timezone Asia/Shanghai# systemctl start httpd.service # ss -tnl | grep "10051\|80"LISTEN 0 128 *:10051 *:* LISTEN 0 128 :::80 :::* LISTEN 0 128 :::10051 :::*
然后访问http://serverIP/zabbix第一次它会自动跳到http://serverIP/zabbix/setup.php 根据提示填入相应的即可,很简单,配置完毕后会在生成zabbix.conf.php文件
# cat /etc/zabbix/web/zabbix.conf.php <?php// Zabbix GUI configuration file.global $DB;$DB[‘TYPE‘] = ‘MYSQL‘; $DB[‘SERVER‘] = ‘127.0.0.1‘; $DB[‘PORT‘] = ‘0‘; $DB[‘DATABASE‘] = ‘zabbix‘; $DB[‘USER‘] = ‘zabbix‘; $DB[‘PASSWORD‘] = ‘zabbixpass‘; // Schema name. Used for IBM DB2 and PostgreSQL.$DB[‘SCHEMA‘] = ‘‘ ;$ZBX_SERVER = ‘localhost‘; $ZBX_SERVER_PORT = ‘10051‘; $ZBX_SERVER_NAME = ‘‘; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
登入信息:
default login:username: adminpassword: zabbix
本文出自 “SunshineBoySZF” 博客,请务必保留此出处http://sunshineboyszf.blog.51cto.com/12087328/1874145
以上是关于CentOS7+zabbix 3.0+mysql5.5安装的主要内容,如果未能解决你的问题,请参考以下文章