Centos6.x已有LNMP环境下编译安装Zabbix2.2

 

#安装依赖库
yum -y install mysql-devel libcurl-devel net-snmp-devel Percona-Server-devel-55
#因为我的mysql使用的是percona55 所以这里需要装 Percona-Server-devel-55

#给zabbix在mysql中创建库和用户
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';


#创建zabbix运行的独立用户
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin

#下载编译安装zabbix
wget -O zabbix.tar.gz -c "http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.4/zabbix-2.2.4.tar.gz/download"

tar zxvf zabbix.tar.gz
cd zabbix-2.2.4/

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \
--with-mysql --with-net-snmp --with-libcurl
make install

##编译错误解决
#checking for mysql_config... /usr/bin/mysql_config
#checking for main in -lmysqlclient... no
#configure: error: Not found mysqlclient library
ln -s /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib64/mysql/libmysqlclient.so
ln -s /usr/lib64/mysql/libmysqlclient_r.so.16.0.0 /usr/lib64/mysql/libmysqlclient_r.so
ln -s /usr/lib64/libmysqlclient.so.16.0.0 /usr/lib64/libmysqlclient.so
ln -s /usr/lib64/libmysqlclient_r.so.16.0.0 /usr/lib64/libmysqlclient_r.so

#导入zabbix的数据库
mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/data.sql

#修改配置文件
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
cp -R frontends/php /data/wwwroot/zabbix  #复制web文件到网站目录,替换成你自己的
sed -i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd

#增加服务端口<br>
cat >>/etc/services <<EOF
zabbix-agent 10050/tcp #Zabbix Agent
zabbix-agent 10050/udp #Zabbix Agent
zabbix-trapper 10051/tcp #Zabbix Trapper
zabbix-trapper 10051/udp #Zabbix Trapper
EOF

#启动服务
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
chkconfig zabbix_server on   #开机启动启动服务
#chkconfig zabbix_agentd on  #被控端
#echo "/etc/init.d/zabbix_server start" >> /etc/rc.local
#echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local

问题处理

zabbix_server  不能监听端口tcp  10051 ?

打开日志 cat /tmp/zabbix_server.log

1635:20140706:015834.413 [Z3001] connection to database ‘zabbix’ failed: [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
1635:20140706:015834.413 Database is down. Reconnecting in 10 seconds.

看来是mysql sock错误了。 找到 #DBSocket=/tmp/mysql.sock 去掉前面的#注释即可。

zabbix2.2.4 web中 语言没有中文可选?

1、服务器端找到 zabbix/include/ locales.inc.php 文件

2、修改 locales.inc.php内容为:’zh_CN’ => array(‘name’ => _(‘Chinese (zh_CN)’),        ‘display’ => true),

       默认是false,所以不显示Chinese(zh_CN)。保存退出。

打赏

3 评论

  1. ini_set(): Use of mbstring.internal_encoding is deprecated [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() → init_mbstrings() → ini_set() in /usr/local/nginx/html/zabbix/include/locales.inc.php:25]安装之后登录提示这个是因为什么啊?zabbix_server.log上提示10532:20150421:022715.757 cannot send list of active checks to [127.0.0.1]: host [Zabbix server] not monitored10523:20150421:022759.507 enabling Zabbix agent checks on host “Zabbix server”: host became available10541:20150421:022843.523 item [Zabbix server:zabbix[process,ipmi poller,avg,busy]] became not supported: No “ipmi poller” processes started10541:20150421:022843.523 item [Zabbix server:zabbix[process,java poller,avg,busy]] became not supported: No “java poller” processes started10544:20150421:022848.531 item [Zabbix server:zabbix[process,node watcher,avg,busy]] became not supported: No “node watcher” processes started10544:20150421:022848.532 item [Zabbix server:zabbix[process,snmp trapper,avg,busy]] became not supported: No “snmp trapper” processes started10543:20150421:022853.533 item [Zabbix server:zabbix[process,vmware collector,avg,busy]] became not supported: No “vmware collector” processes started10541:20150421:022858.538 item [Zabbix server:zabbix[vmware,buffer,pfree]] became not supported: No “vmware collector” processes started至于zabbix_agentd.log上说没有检测啥的10591:20150421:022715.757 no active checks on server [127.0.0.1:10051]: host [Zabbix server] not monitored求大哥给分析分析,QQ505983701,新浪13693066544

      1. PHP是5.6的(应该是)那个启动成功了,我现在就是网页管理的时候会出现下面第一行和第二行的红色字体

发表评论

电子邮件地址不会被公开。 必填项已用*标注