淘先锋技术网

首页 1 2 3 4 5 6 7
  • zabbix4.0编译安装

    yum install -y libevent-devel wget tar gcc gcc-c++ make net-snmp-devel libxml2-devel libcurl-devel   #安装依赖包
    useradd -s /sbin/nologin zabbix   #创建zabbix用户
    cd /usr/local/src/
    wget 'https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz'   #下载zabbix源码包
    tar -zxvf zabbix-4.0.3.tar.gz   #解压
    cd zabbix-4.0.3
    ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2#环境配置
    make  && make install   #编译安装
    vim /etc/profile   #编辑环境变量配置文件,在末行加入以下语句
    	export PATH=$PATH:/usr/local/zabbix/sbin/:/usr/local/zabbix/bin/
    source /etc/profile          #重新加载环境变量配置文件
    zabbix_server --version  #查看版本
    mysql -h 127.0.0.1 -uroot -pzabbix   #登录mysql数据库
    	create database zabbix character set utf8 collate utf8_bin;#创建zabbix数据库
    	grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';#设置zabbix数据库只允许zabbix用户通过127.0.0.1访问,并导入数据到zabbix数据库
    	flush privileges;
    	set names utf8;
    	use zabbix;
    	source /usr/local/src/zabbix-4.0.7/database/mysql/schema.sql;
    	source /usr/local/src/zabbix-4.0.7/database/mysql/data.sql;
    	source /usr/local/src/zabbix-4.0.7/database/mysql/images.sql;
    vim /usr/local/zabbix/etc/zabbix_server.conf  #修改zabbix配置文件
    	LogFile=/usr/local/zabbix/zabbix_server.log
    	DBHost=127.0.0.1
    	DBName=zabbix
    	DBUser=zabbix
    	DBPassword=zabbixpwd
    	DBPort=3306
    	Timeout=30
    	DBSocket=/tmp/mysql.sock
    	AlertScriptsPath=/usr/local/zabbix/alertscripts
    	ExternalScripts=/usr/local/zabbix/externalscripts
    	LogSlowQueries=3000
    chown zabbix:zabbix -R /usr/local/zabbix/  #授权zabbix用户权限
    zabbix_server    #启动zabbix
    
    • zabbix Web的安装
      mkdir /usr/local/nginx/html/zabbix
      cp -a /usr/local/src/zabbix-4.0.7/frontends/php/* /usr/local/nginx/html/zabbix
      访问zabbix web,在游览器打开http://192.168.1.84/zabbix
      zabbix web需要php做配置优化
    	post_max_size = 32M
    	max_execution_time = 350
    	max_input_time = 350
    	date.timezone = Asia/Shanghai
    	always_populate_raw_post_data = -1
    	systemctl restart php-fpm