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 zabbix@'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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章