接入说明

zabbix是由zabbix web、zabbix server、zabbix agent三部分组成,要接入bigops的sso只需要修改zabbix web即可,zabbix server和zabbix agent不需要做任何修改。

现在已支持的zabbix web版本包括:

确认当前Zabbix域名没有第二层目录

http://zabbix.bigops.com ,正确

http://zabbix.bigops.com/zabbix ,错误

修改/etc/hosts

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

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

配置内容,例如:

192.168.100.2 zabbix.bigops.com (替换为你服务器IP和域名)

安装zabbix

安装相关软件

wget -O /etc/yum.repos.d/zabbix.repo http://www.bigops.com/yum.repos.d/zabbix.repo

yum -y install 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

方法一:YUM安装

安装zabbix server

yum -y install zabbix-server-mysql zabbix-web-mysql

创建数据库

mysql> create database zabbix character set utf8 collate utf8_bin;

导入表

zcat /usr/share/doc/zabbix-server-mysql-4.4.8/create.sql.gz | mysql -h IP -u 用户 -p  数据库

方法二:源代码安装

编译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 --enable-agent
make && make install

创建数据库

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)

导入表

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

编辑文件/etc/zabbix/zabbix_server.conf

DBHost=xxx.xxx.xxx.xxx
DBName=zabbix
DBUser=root
DBPassword=xxxxxx
DBPort=3306
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
Timeout=15
AlertScriptsPath=/etc/zabbix/alertscripts
ExternalScripts=/etc/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1

编辑文件/etc/zabbix/zabbix_agent.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=xxx.xxx.xxx.xxx  //改成zabbix server IP
ServerActive=xxx.xxx.xxx.xxx  //改成zabbix server IP
Hostname=IP  //改成当前服务器IP
Include=/etc/zabbix/zabbix_agentd.d/*.conf

设置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
systemctl enable php-fpm.service
systemctl restart php-fpm.service
systemctl status php-fpm.service

设置Nginx

wget -O /etc/nginx/conf.d/zabbix.conf http://www.bigops.com/bigops-install/nginx/conf.d/zabbix.conf
vi /etc/nginx/conf.d/zabbix.conf
systemctl enable nginx.service
systemctl restart nginx.service
systemctl status nginx.service

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

安装定制版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
mkdir -p /etc/zabbix/alertscripts /etc/zabbix/externalscripts
chmod -R 777 /etc/zabbix/alertscripts /etc/zabbix/externalscripts
mkdir /var/run/zabbix/ /var/log/zabbix/ /run/zabbix/ /var/log/snmptrap/ /usr/lib/zabbix
chmod 777 /etc/zabbix /var/run/zabbix/ /var/log/zabbix/ /run/zabbix/ /var/log/snmptrap/ /usr/lib/zabbix

安装zabbix web,/opt/web/zabbix改为你的目录

mkdir /opt/web/zabbix
cp -rf frontends/php/* /opt/web/zabbix/
chmod -R 755 /opt/web/zabbix
chmod -R 777 /opt/web/zabbix/conf

启动zabbix server

wget -O /usr/lib/systemd/system/zabbix-server.service http://www.bigops.com/bigops-install/zabbix-server.service
systemctl daemon-reload
systemctl enable zabbix-server.service
systemctl restart zabbix-server.service
systemctl status zabbix-server.service

启动zabbix agent

wget -O /usr/lib/systemd/system/zabbix-agent.service http://www.bigops.com/bigops-install/zabbix-agent.service
systemctl daemon-reload
systemctl enable zabbix-agent.service
systemctl restart zabbix-agent.service
systemctl status zabbix-agent.service

总后台接入系统

点击添加接入系统,注意域名替换为你自己的

系统名填写:

zabbix

ServiceId填写:

^http://zabbix.bigops.com.*

注销URL填写:

http://zabbix.bigops.com/sso.php?logout=1

必须点保存

设置域名和密码salt

点击:Z助手--设置--Zabbix API,然后根据图片提示设置

编辑zabbix文件

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

重启BigOps系统

docker stop bigops
docker rm bigops
/opt/bigops/restart.sh

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

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

BigOps主机和Zabbix主机进行绑定

自动绑定

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

手动绑定

测试效果

1、用户同时登录和登出zabbix和sso系统

2、通过bigops的视图功能可以看到zabbix监控图,点击zabbix/视图/服务树视图。

常见问题:

因为没有修改Admin用户为admin,修改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

results matching ""

    No results matching ""