Zabbix代理proxy架构搭建
众所周知,Zabbix是一个基于Web界面的提供分布式系统监视以及网络监视功能的企业级开源解决方案。Zabbix能监视各种网络尝试,保证服务器系统的安全运营;并提供灵活的通知机制以让系统工程师快速定位/解决存在的问题。当我们的监控的服务器增多或者需要监控异地IDC服务器的时候,单台服务器的Server-Client 架构可能就不能满足我们的需求了,此时就需要考虑使用分布式...
众所周知,Zabbix是一个基于Web界面的提供分布式系统监视以及网络监视功能的企业级开源解决方案。Zabbix能监视各种网络尝试,保证服务器系统的安全运营;并提供灵活的通知机制以让系统工程师快速定位/解决存在的问题。当我们的监控的服务器增多或者需要监控异地IDC服务器的时候,单台服务器的Server-Client 架构可能就不能满足我们的需求了,此时就需要考虑使用分布式的Server-Proxy-Client/Server-Node-Client架构了,现在就Server-Proxy-Client 架构给大家演示下。
拓扑
实验拓扑如下:
Zabbix server
1.ZabbixServer 系统版本和内核版本
cat/etc/redhat-release
CentOS release 5.9 (Final)
uname-rmos
Linux 2.6.18-348.16.1.el5 x86_64 GNU/Linux
2.安装Zabbix依赖软件包
yuminstall -y make gcc gcc-c++ httpd php php-mysql mysql mysql-server php-gdphp-common php-xml net-snmp net-snmp-devel net-snmp-utils curl-develmysql-devel gnutls openldap-devel OpenIPMI OpenIPMI-devel ncurses-develunixODBC unixODBC-devel mysql-connector-odbc *libX* alsa-lib jpackage-utils php-bcmath php-mbstringjava
3.安装额外依赖软件包(需要独立下载安装,系统默认仓库没有)
rpm-ivh libssh2-1.2.4-1.el5.x86_64.rpm
rpm -ivhlibssh2-devel-1.2.4-1.el5.x86_64.rpm
rpm -ivh fping-2.4b2-7.el5.art.x86_64.rpm
rpm -ivh iksemel-1.4-2_2.el5.x86_64.rpm
rpm -ivhiksemel-devel-1.4-2_2.el5.x86_64.rpm
rpm -ivhlibiksemel3-1.4-2_2.el5.x86_64.rpm
4.添加Zabbix运行账户,解压tar包
useradd-r zabbix
tar-zxvf zabbix-2.0.8.tar.gz
5.Mysql启动和配置
servicemysqld start
mysqladmin-u root password redhat
mysql-u root –p
>createdatabse zabbix character set utf8;
>grantall privileges on zabbix.* to zabbix@localhost identified by ‘redhat’;
>flushprivileges;
mysql-u zabbix -p zabbix </root/zabbix-2.0.8/database/mysql/schema.sql
mysql-u zabbix -p zabbix </root/zabbix-2.0.8/database/mysql/p_w_picpaths.sql
mysql-u zabbix -p zabbix </root/zabbix-2.0.8/database/mysql/data.sql
6.Zabbix编译安转
./configure--prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy -- with-mysql--with-net-snmp --with-libcurl --with-ldap --with-ssh2 --with-jabber--with-openipmi --with-unixodbc
make install
7.添加服务端口及描述,将下面内容加入services文件里
grepzabbix /etc/services
zabbix-agent10050/tcp# Zabbix Agent
zabbix-agent10050/udp# Zabbix Agent
zabbix-trapper10051/tcp# Zabbix Trapper
zabbix-trapper10051/udp# Zabbix Trapper
8.创建日志和PID存放目录,设定权限
mkdir /var/log/zabbix
mkdir/var/run/zabbix
chown -R zabbix.zabbix /usr/local/zabbix/etc/
chown -R zabbix.zabbix /var/run/zabbix/
chown -R zabbix.zabbix /var/log/zabbix/
9.配置zabbix_server.conf文件如下
catzabbix_server.conf |grep -v ^#|grep -v ^$
LogFile=/var/log/zabbix/zabbix_server.log
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword=redhat
10.配置zabbix_agentd.conf文件如下
catzabbix_agentd.conf |grep -v ^#|grep -v ^$
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=ws128.example.com
11.设定Zabbix server前端文件
cpzabbix-2.0.8/frontends/php/ /var/www/html/zabbix -rf
chown-R zabbix.zabbix /var/www/html/zabbix/
12.PHP.INI文件设置
vim/etc/php.ini
max_execution_time = 300
date.timezone =Asia/Shanghai
post_max_size = 32M
max_input_time = 300
13.重启服务,设定开机启动
servicehttpd restart ; chkconfig httpd on
servicemysqld restart ; chkconfig mysqld on
14.Zabbix服务脚本配置
cpzabbix-2.0.8/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
cpzabbix-2.0.8/misc/init.d/fedora/core/zabbix_server /etc/init.d/
chownzabbix.zabbix /etc/init.d/zabbix_*
vim/etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
PIDFILE=/var/run/zabbix/$BINARY_NAME.pid
vim/etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix
PIDFILE=/var/run/zabbix/$BINARY_NAME.pid
15.启动Zabbix服务脚本,设定开机启动
servicezabbix_server restart ;chkconfig zabbix_server on
servicezabbix_agentd restart ;chkconfig zabbix_agentd on
16.前端安装配置,使用浏览器访问
firefox http://localhost/zabbix &
17.运行环境检查
18.数据库连接检查
20.安装信息汇总
21.点击Download configuration file 下载该文件,拷贝到/var/www/html/zabbix/conf/下,点击Retry重试,点击Finish
Zabbix proxy
1.ZabbixServer 系统版本和内核版本
cat/etc/redhat-release
CentOS release 5.9 (Final)
uname-rmos
Linux 2.6.18-348.16.1.el5 x86_64 GNU/Linux
2.安装Zabbix依赖软件包
yum-y install net-snmp net-snmp-devel net-snmp-utils curl-devel mysql-servermysql-devel gnutls openldap-devel OpenIPMI ncurses-devel unixODBC unixODBC-develmysql-connector-odbc *libX* gcc gcc-c++make alsa-lib jpackage-utils php-bcmath php-mbstring OpenIPMI OpenIPMI-develjava
3.安装额外依赖软件包(需要独立下载安装,系统默认仓库没有)
rpm-ivh libssh2-1.2.4-1.el5.x86_64.rpm
rpm -ivhlibssh2-devel-1.2.4-1.el5.x86_64.rpm
rpm -ivhfping-2.4b2-7.el5.art.x86_64.rpm
rpm -ivhiksemel-1.4-2_2.el5.x86_64.rpm
rpm -ivh iksemel-devel-1.4-2_2.el5.x86_64.rpm
rpm -ivhlibiksemel3-1.4-2_2.el5.x86_64.rpm
4.添加Zabbix运行账户,解压tar包
useradd-r zabbix
tar -zxvf zabbix-2.0.8.tar.gz
5.Mysql启动和配置
servicemysqld start
mysqladmin-u root password redhat
mysql-u root –p
>createdatabse zabbix character set utf8;
>grantall privileges on zabbix.* to zabbix@localhost identified by ‘redhat’;
>flushprivileges;
mysql-u zabbix -p zabbix </root/zabbix-2.0.8/database/mysql/schema.sql
mysql-u zabbix -p zabbix </root/zabbix-2.0.8/database/mysql/p_w_picpaths.sql
mysql-u zabbix -p zabbix </root/zabbix-2.0.8/database/mysql/data.sql
6.Zabbix编译安转
./configure--prefix=/usr/local/zabbix_proxy --enable-agent --enable-proxy --with-mysql--with-net-snmp --with-libcurl --with-ldap --with-ssh2 --with-jabber--with-openipmi --with-unixodbc
makeinstall
7.创建日志和PID存放目录,设定权限
mkdir /var/run/zabbix
mkdir /var/log/zabbix
chown -R /var/run/zabbix/
chown -R zabbix.zabbix /var/run/zabbix/
chown -R zabbix.zabbix /var/log/zabbix/
chown -R zabbix.zabbix/usr/local/zabbix_proxy/etc/
8.配置zabbix_server.conf文件如下
cat/usr/local/zabbix_proxy/etc/zabbix_proxy.conf |grep -v ^#|grep -v ^$
Server=192.168.150.128
Hostname=ws129.example.com
LogFile=/var/log/zabbix/zabbix_proxy.log
PidFile=/var/run/zabbix/zabbix_proxy.pid
DBName=zabbix
DBUser=zabbix
DBPassword=redhat
9.配置zabbix_agentd.conf文件如下
cat/usr/local/zabbix_proxy/etc/zabbix_agentd.conf |grep -v ^#|grep -v ^$
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=127.0.0.1,192.168.150.128
ServerActive=192.168.150.128
Hostname=ws129.example.com
Zabbix client
这里就以一台Zabbixagent为例,其他Client设置都雷同。
1.ZabbixServer 系统版本和内核版本
cat/etc/redhat-release
CentOS release 5.9 (Final)
uname-rmos
Linux 2.6.18-348.16.1.el5 x86_64 GNU/Linux
2.添加Zabbix运行账户,解压tar包
useradd-r zabbix
tar-zxvf zabbix_agents_2.0.8.linux2_6.amd64.tar.gz
3.创建日志和PID存放目录,设定权限
mkdir/usr/local/zabbix_agent
mkdir/var/log/zabbix
mkdir/var/run/zabbix
chown-R zabbix.zabbix /var/run/zabbix/
chown-R zabbix.zabbix /var/log/zabbix/
chown-R zabbix.zabbix /usr/local/zabbix_agent/conf/
4.配置zabbix_agentd.conf文件如下
cat/usr/local/zabbix_agent/conf/zabbix_agentd.conf |grep -v ^#|grep -v ^$
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=192.168.150.129
ServerActive=192.168.150.129
Hostname=ws130.example.com
Zabbix Server前台设置
1.登录Zabbix Server前台,在AdministrationàDM选项设置代理服务器,如图
1.在ConfigurationàHost设置新加入的主机,如图
转载于:https://blog.51cto.com/coolsky/1304979
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)