一、zabbix服务端安装
步骤1 下载zabbix安装包
cd /tmp
wget http://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.7/zabbix-2.4.7.tar.gz
步骤2 创建zabbix组和用户
groupadd zabbix
useradd –g zabbix –s /sbin/nologin zabbix
步骤3 配置zabbix数据库
mysql –u root –proot
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;
\q
步骤4 安装zabbix
cd /tmp
tar –zxvf zabbix-2.4.7.tar.gz
cd zabbix-2.4.7
./configure –prefix=/usr/local/zabbix –enable-server –enable-proxy –enable-agent –with-mysql –with-net-snmp –with-libcurl
make
make install
步骤5 部署zabbix
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
cd /usr/local/zabbix
ln –s /usr/local/zabbix/etc/ /etc/zabbix
ln –s /usr/local/zabbix/bin/* /usr/bin/
ln –s /usr/local/zabbix/sbin/* /usr/sbin/
cp /tmp/zabbix-2.4.7/misc/init.d/fedora/core/* /etc/init.d/
chmod 755 /etc/init.d/zabbix_*
vim /etc/init.d/zabbix_server #打开server启动文件,修改如下值
BASEDIR=/usr/local/zabbix
vim /etc/init.d/zabbix_agentd #打开agentd启动文件,修改如下值
BASEDIR=/usr/local/zabbix
vim /etc/zabbix/zabbix_server.conf #打开server配置文件,修改如下值
LogFile=/var/log/zabbix/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBPort=3306
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
执行如下命令,配置zabbix_agentd
sed -i -e 's|LogFile=/tmp|LogFile=/var/log/zabbix|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|Server=127.0.0.1|Server=192.168.0.19|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|ServerActive=127.0.0.1|ServerActive=192.168.0.19:10051|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|# Include=/usr/local/etc/zabbix_agentd.conf.d/|Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|# UnsafeUserParameters=0|UnsafeUserParameters=1|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_agentd
mkdir –P /data/nginx/zabbix #创建zabbix网页目录
cp –rf /tmp/zabbix-2.4.7/frontends/php/* /data/nginx/zabbix/
vim /etc/nginx/vhosts/zabbix.conf #创建nginx配置文件
server { listen 80; server_name 192.168.0.19; index index.php; root /data/nginx/zabbix; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
chmod 777 –R /data/nginx/zabbix
cd /tmp/zabbix-2.4.7/database/mysql
执行以下命令,初始化zabbix数据库,注意初始化先后顺序。
mysql -u root -proot zabbix < schema.sql
mysql -u root -proot zabbix < images.sql
mysql -u root -proot zabbix < data.sql
chkconfig zabbix_server on
chkconfig zabbix_agentd on
service zabbix_server start
service zabbix_agentd start
service php-fpm restart
service nginx restart
二、zabbix客户端安装
步骤1 下载zabbix安装包
cd /tmp
wget http://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.7/zabbix-2.4.7.tar.gz
步骤2 创建zabbix组和用户
groupadd zabbix
useradd –g zabbix –s /sbin/nologin zabbix
步骤3 编译安装zabbix
tar –zxvf zabbix-2.4.7.tar.gz
cd zabbix-2.4.7
./configure –prefix=/usr/local/zabbix –enable-agent
make
make install
步骤4 执行如下命令,配置zabbix_agentd
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
cp /usr/local/src/zabbix-2.4.7/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
ln -s /usr/local/zabbix/etc /etc/zabbix
ln -s /usr/local/zabbix/sbin/* /usr/sbin/
ln -s /usr/local/zabbix/bin/* /usr/bin/
sed -i -e 's|LogFile=/tmp|LogFile=/var/log/zabbix|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|Server=127.0.0.1|Server=192.168.0.19|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|ServerActive=127.0.0.1|ServerActive=192.168.0.19:10051|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|# Include=/usr/local/etc/zabbix_agentd.conf.d/|Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|# UnsafeUserParameters=0|UnsafeUserParameters=1|' /etc/zabbix/zabbix_agentd.conf
sed -i -e 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_agentd
chkconfig zabbix_agentd on
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于