zabbix

Posted by

1.部署nginx

2.部署php-fpm

3.部署数据库

[root@Test-UAT conf.d]# cat zabbix.conf 
server {
    listen 80;
    server_name zabbix.wangwenjie520.com;
    root /code/zabbix;

    location / {
      index index.php index.html;
    }


  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

[root@Test-UAT conf.d]# cat /code/zabbix/test.php
<?php   phpinfo();?>

下载安装包,部署

[root@zabbix-master src]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.2.tar.gz
[root@zabbix-master src]# tar xf zabbix-5.0.2.tar.gz -C /application/
[root@zabbix-master src]# cd /application/zabbix-5.0.2/

创建zabbix用户

[root@zabbix-master zabbix-5.0.2]# groupadd zabbix
[root@zabbix-master zabbix-5.0.2]# useradd -M -g zabbix -s /sbin/nologin zabbix

编译安装zabbix

[root@zabbix-master zabbix-5.0.2][root@zabbix-master zabbix-5.0.2][root@zabbix-master zabbix-5.0.2]# yum install -y net-snmp net-snmp-devel curl curl-devel mysql-devel libevent-devel pcre-devel
[root@zabbix-master zabbix-5.0.2][root@zabbix-master zabbix-5.0.2]# yum install mysql-devel libxml2-devel curl-devel unixODBC-devel net-snmp-devel OpenIPMI-devel openldap openldap-devel libevent-devel curl curl-devel net-snmp net-snmp-devel


[root@zabbix-master zabbix-5.0.2]# ./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
[root@zabbix-master zabbix-5.0.2]# make && make install

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


[root@wwj ~]# mysql -uzabbix -pzabbix
mysql> use zabbix
mysql> source /application/zabbix-5.0.2/database/mysql/schema.sql
mysql> source /application/zabbix-5.0.2/database/mysql/images.sql
mysql> source /application/zabbix-5.0.2/database/mysql/data.sql
[root@wwj zabbix-4.0.23]# cp -a /application/zabbix-4.0.23/frontends/php/* /code/zabbix/
[root@wwj zabbix-4.0.23]# chown -R zabbix:zabbix /opt/zabbix/
[root@wwj zabbix-4.0.23]# chown -R zabbix:zabbix /code/zabbix/
[root@wwj zabbix-4.0.23]# chmod -R 755 /code/zabbix/


[root@wwj zabbix-4.0.23]# cp /application/zabbix-4.0.23/misc/init.d/fedora/core/zabbix_* /etc/init.d/
[root@zabbix-master etc]# grep  ^[a-Z]  /opt/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Timeout=4
LogSlowQueries=3000