安装编译环境
yum -y install *gcc*
安装LAMP
yum install -y httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-bcmath php-gd php-odbc php-xml php-pear
安装zabbix其他需求
yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI
启动服务
service httpd restart
service mysqld start
安装zabbix
useradd -s /sbin/nologin zabbix
tar -zxf zabbix-2.2.2.tar.gz
cd zabbix-2.2.2
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
make install
修改zabbix配置
cd /usr/local/etc/
vim zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
添加启动脚本和web
cd /root/zabbix-2.0.7
cp misc/init.d/tru64/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_server
mkdir /var/www/html/zabbix
cp -r frontends/php/* /var/www/html/zabbix/
配置数据库
mysql>create database zabbix;
mysql>grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql>flush privileges;
导入zabbix数据
mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql
启动服务
service zabbix_server start
配置安装,按要配置即可,有错误改/etc/php.ini文件即可
http://119.161.216.70/zabbix
vim /etc/php.ini
date.timezone = Asia/Shanghai
改好以后重启下http在刷新继续下一步
最后下载zabbix.conf.php 按要求上传即可
用户名admin 密码zabbix 现在可以登录了
二、zabbix的agent端安装
解压安装
useradd -s /sbin/nologin zabbix
tar -zxvf zabbix-2.2.2.tar.gz
cd zabbix-2.2.2
./configure --prefix=/usr/ --sysconfdir=/etc/zabbix --enable-agent
make install
建立启动脚本
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
更改默认路径
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd
配置agentd.conf
vim zabbix_agentd.conf
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=192.168.1.127 //添加server端ip
ServerActive=192.168.1.127:10051 //添加server端ip+端口号
Hostname=Zabbix server
UnsafeUserParameters=1
service zabbix_agentd start
之后我们可以再server端用命令检测下是否监控
#zabbix_get -s 192.168.1.126 -p10050 -k"net.if.in[eth0,bytes]"
190415522
有输出就ok了