修改hosts

如果你没有注册域名,需要给服务器和你的笔记本系统都配置hosts。

Linux位置/etc/hosts,Windows位置C:\Windows\System32\drivers\etc\hosts

配置内容,例如:

192.168.100.2 zabbix.bigops.com (换成你服务器IP和你自己的域名)

切记2个域名都要设置!切记!切记!切记!

切记服务器和你的笔记本都要设置!切记!切记!切记!

安装软件

wget -O /etc/yum.repos.d/zabbix.repo https://raw.githubusercontent.com/yunweibang/yum.repos.d/master/zabbix.repo

yum install -y php php-mysql php-gd php-fpm php-mbstring mcrypt php-mcrypt php-bcmath php-xml php-xmlrpc php-ldap php-pecl-mysql net-snmp net-snmp-devel net-snmp-libs net-snmp-utils fping mysql-devel gcc iksemel libiksemel libevent-devel libcurl-devel libxml2-devel libssh2-devel OpenIPMI-devel unixODBC unixODBC-devel glibc-static libcurl-devel git openssl-devel pcre-devel zlib zlib-devel zabbix-server-mysql zabbix-web-mysql zabbix-agent nginx systemd-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel

设置PHP

ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so

sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf

sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf

sed -i 's/;listen.owner = nobody/listen.owner = nginx/g' /etc/php-fpm.d/www.conf

sed -i 's/;listen.group = nobody/listen.group = nginx/g' /etc/php-fpm.d/www.conf

sed -i 's/;rlimit_files = 1024/rlimit_files = 51200/g' /etc/php-fpm.d/www.conf

sed -i 's#^listen =.*#listen = /var/run/php-fpm.socket#g' /etc/php-fpm.d/www.conf

sed -i 's@^pm.start_servers.*@pm.start_servers = 10@' /etc/php-fpm.d/www.conf

sed -i 's@^pm.min_spare_servers.*@pm.min_spare_servers = 10@' /etc/php-fpm.d/www.conf

sed -i 's@^pm.max_spare_servers.*@pm.max_spare_servers = 30@' /etc/php-fpm.d/www.conf

sed -i 's@^pm.max_children.*@pm.max_children = 30@' /etc/php-fpm.d/www.conf
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/g' /etc/php.ini

sed -i 's/^post_max_size.*/post_max_size = 16M/g' /etc/php.ini

sed -i 's/^max_execution_time.*/max_execution_time = 300/g' /etc/php.ini

sed -i 's/^max_input_time.*/max_input_time = 300/g' /etc/php.ini

sed -i 's/^;date.timezone.*/date.timezone = PRC/g' /etc/php.ini

sed -i 's/^memory_limit.*/memory_limit = 512M/g' /etc/php.ini

chmod -R 777 /var/lib/php

重启PHP

centos 6

chkconfig --level 345 php-fpm on

/etc/init.d/php-fpm restart

centos 7

systemctl enable php-fpm.service

systemctl restart php-fpm.service

systemctl status php-fpm.service

设置Nginx

wget -O /etc/nginx/conf.d/zabbix.conf https://raw.githubusercontent.com/yunweibang/bigops-install/master/nginx/conf.d/zabbix.conf

vi /etc/nginx/conf.d/zabbix.conf

修改域名和zabbix目录为你自己的

重启Nginx

centos 6

chkconfig --level 345 nginx on

/etc/init.d/nginx restart

centos7

systemctl enable nginx.service

systemctl restart nginx.service

systemctl status nginx.service

下载定制版zabbix

下载地址:https://github.com/yunweibang/bigops-zabbix

tar zxvf bigops-zabbix-x.x.x.tar.gz

cd bigops-zabbix-x.x.x

groupadd -g 491 zabbix

useradd -u 491-g zabbix -c 'Zabbix monitoring' zabbix

chown root:zabbix /usr/sbin/fping

chmod 4710 /usr/sbin/fping

编译zabbix server

./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --with-net-snmp --with-libcurl --with-mysql --with-libxml2 --with-unixodbc --with-openipmi --enable-agent --with-ssh2 --enable-proxy --enable-java

make && make install

编译zabbix agent

./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-agent

make && make install

安装zabbix web

mkdir /opt/bigops/zabbix

cp -rf frontends/php/* /opt/bigops/zabbix/

chmod -R 755 /opt/bigops/zabbix

chmod -R 777 /opt/bigops/zabbix/conf

设置目录权限

mkdir -p /etc/zabbix/alertscripts /etc/zabbix/externalscripts

chmod -R 777 /etc/zabbix/alertscripts /etc/zabbix/externalscripts

mkdir /var/run/zabbix/ /var/log/zabbix/

chmod 777 /var/run/zabbix/ /var/log/zabbix/

创建zabbix数据库

mysql> create database zabbix;

Query OK, 1 row affected (0.01 sec)

导入zabbix表

cd database/mysql/

mysql -uroot -p -h127.0.0.1 zabbix <schema.sql

mysql -uroot -p -h127.0.0.1 zabbix <images.sql

mysql -uroot -p -h127.0.0.1 zabbix <data.sql

配置zabbix server和zabbix agent

vi /etc/zabbix/zabbix_server.conf

略,参考zabbix官方文档

vi /etc/zabbix/zabbix_agent.conf

略,参考zabbix官方文档

启动zabbix server

centos 6

wget -O /etc/rc.d/init.d/zabbix-server https://raw.githubusercontent.com/yunweibang/bigops-zabbix/master/zabbix-server

chmod +x /etc/rc.d/init.d/zabbix_server

chkconfig --add zabbix_server

chkconfig zabbix_server on

service zabbix-server restart

centos 7

wget -O /usr/lib/systemd/system/zabbix-server.service https://raw.githubusercontent.com/yunweibang/bigops-zabbix/master/zabbix-server.service

systemctl daemon-reload

systemctl enable zabbix-server.service

systemctl restart zabbix-server.service

systemctl status zabbix-server.service

启动zabbix agent

centos 6

wget -O /etc/rc.d/init.d/zabbix-agent https://raw.githubusercontent.com/yunweibang/bigops-zabbix/master/zabbix-agent

chmod +x /etc/rc.d/init.d/zabbix_agent

chkconfig --add zabbix_agent

chkconfig zabbix_agent on

service zabbix-agent restart

centos 7

wget -O /usr/lib/systemd/system/zabbix-agent.service https://raw.githubusercontent.com/yunweibang/bigops-zabbix/master/zabbix-agent.service

systemctl daemon-reload

systemctl enable zabbix-agent.service

systemctl restart zabbix-agent.service

systemctl status zabbix-agent.service

浏览器访问域名,开始安装

zabbix默认账号和密码

用户:admin

密码:zabbix

修改Zabbix的Admin用户的alias为全小写admin

use zabbix;

update users set alias='admin1' where userid='1';

update users set alias='admin' where userid='1';

直接由Admin改为admin会报错,所以先修改为admin1,再修改为admin

设置域名和salt

点击:监控--设置--Zabbix API,然后根据图片提示设置

编辑zabbix文件

vi /opt/bigops/zabbix/conf/sso.conf.php

总后台接入系统

添加zabbix系统

重启bigweb

/opt/bigops/bin/bigweb.sh restart

测试效果

1、zabbix和sso同步登入和登出

2、内嵌bigops系统的zabbix菜单,点击下图菜单查看

BigOps主机和Zabbix主机进行绑定

手动绑定的前提是bigops的主机的IP和Zabbix系统主机接口里的IP相同。

如果bigops主机和zabbix主机IP一样,bigserver每隔一段时间会自动绑定。

bigserver还会同步一些数据给zabbix,对应关系如下表:

bigops系统 zabbix系统
主机可见名 主机可见名
用户account 用户Alias
服务树 主机组(服务树其实也是一种分组)
角色及权限 用户组(zabbix用户组相当于角色概念)

手动绑定,bigops会智能筛选出相同的IP的主机

开启bigserver自动绑定

最后进入视图,查看服务器详情

常见问题:

因为没有修改Admin用户为admin

results matching ""

    No results matching ""