点击登录
  • 欢迎访问无限星辰技术博客,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏无限星辰吧
  • 无限星辰的淘宝店铺已经开张了哦,传送门:http://

安装zabbix-server

LINUX服务器 crx349 1477次浏览 0个评论 扫描二维码

cd /usr/local
在该网站下载需要的zabbix 版本http://www.zabbix.com/download
上传到/usr/local 目录下

yum install net-snmp-devel -y
tar zxvf zabbix-3.4.1.tar.gz
cd zabbix-3.4.1
./configure --prefix=/usr/local/zabbix-3.4.1/ --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2
make && make install

添加zabbix 运行用户组

groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix

注:zabbix-server 共需要导入3个源码包中的sql文件,而搭建proxy 则只需要导入一个sql

#创建zabbix 数据库

mysql -uroot -pxxxx

mysql> create database zabbix default charset utf8;
Query OK, 1 row affected (0.00 sec)

mysql> quit
# mysql -uroot -pxxxx zabbix < /usr/local/zabbix-3.4.1/database/mysql/schema.sql
# mysql -uroot -pxxx zabbix < /usr/local/zabbix-3.4.1/database/mysql/images.sql
# mysql -uroot -pxxx zabbix < /usr/local/zabbix-3.4.1/database/mysql/data.sql

#配置zabbix 服务器

vi /usr/local/zabbix-3.4.1/etc/zabbix_server.conf
------------------------------------------------------------------------
DBName=zabbix
DBUser=root
DBPassword=XXXXX
DBPort=3306
------------------------------------------------------------------------
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf
ldconfig
/usr/local/zabbix-3.4.1/sbin/zabbix_server
/usr/local/zabbix-3.4.1/sbin/zabbix_agentd
#自启动
cd /root/zabbix-3.4.1/misc/init.d/fedora/core
cp * /etc/init.d/
chmod +x /etc/init.d/zabbix_server 
chmod +x /etc/init.d/zabbix_agentd
vi /etc/init.d/zabbix_server
#将BASEDIR=/usr/local/替换为BASEDIR=/usr/local/zabbix-3.4.1/(以之前编译的位置为准)
#修改客户器端启动文件:
#vi /etc/init.d/zabbix_agentd
#将BASEDIR=/usr/local/替换为BASEDIR=/usr/local/zabbix-3.4.1/(以之前编译的位置为准)
chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig --level 35  zabbix_server on
chkconfig --level 35  zabbix_agentd  on

#配置zabbix web
mkdir -p /home/data/zabbix/zabbix
cp -rp /usr/local/zabbix-3.4.1/frontends/php/* /home/data/zabbix/zabbix

vim /etc/nginx/conf.d/zabbix.conf
------------------------------------------------------------------------
server {
        listen 80;
        server_name zabbix.prd.xjh.com;
        access_log /var/log/nginx/zabbix.prd.xjh.com.access.log main;

        index index.php index.html index.html;
        root /home/data/zabbix;


        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ .*\.(php)?$ {
                expires -1s;
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include fastcgi_params;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass 127.0.0.1:9000;

        }
}
------------------------------------------------------------------------
cp /home/data/zabbix/zabbix/conf/zabbix.conf.php.example /home/data/zabbix/zabbix/conf/zabbix.conf.php
vim /home/data/zabbix/zabbix/conf/zabbix.conf.php
------------------------------------------------------------------------
< ?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE']                             = 'MYSQL';
$DB['SERVER']                   = 'localhost';
$DB['PORT']                             = '0';
$DB['DATABASE']                 = 'zabbix';
$DB['USER']                             = 'root';
$DB['PASSWORD']                 = 'xxxxx';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA']                   = '';

$ZBX_SERVER                             = 'localhost';
$ZBX_SERVER_PORT                = '10051';
$ZBX_SERVER_NAME                = 'zabbix-server';

$IMAGE_FORMAT_DEFAULT   = IMAGE_FORMAT_PNG;

------------------------------------------------------------------------

#绑定hosts之后,打开浏览器访问


无限星辰 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明安装zabbix-server
喜欢 (0)
[]
分享 (0)

您必须 登录 才能发表评论!