发布Zabbix程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了发布Zabbix程序相关的知识,希望对你有一定的参考价值。

运行环境:

操作系统:CentOS release 6.8 (Final)

数据库:mysql 5.5.52

Web应用服务器:Apache/2.2.15(Unix):

开源监控程序:Zabbix 3.2.6

任务:安装zabbix。

操作步骤:

[[email protected]]# tar xf zabbix-3.2.6.tar.gz 

[[email protected]]# cd zabbix-3.2.6

[[email protected]]# cd database/

[email protected]]# cd mysql/

[[email protected]]# ll

总用量 3068

-rw-r--r-- 1 10001000 1036662 5   522:51 data.sql

-rw-r--r-- 1 10001000 1978341 5   522:50 images.sql

-rw-r--r-- 1 10001000  122134 5   5 22:51schema.sql

[[email protected]]# mysql -uroot -p

Enter password:

mysql> createdatabase zabbix character set utf8;

mysql> insertinto mysql.user(Host,User,Password)values(‘localhost‘,‘zabbix‘,password(‘******‘));

mysql> flushprivileges;

mysql> grantall on zabbix.* to ‘zabbix‘@‘127.0.0.1‘ identified by  ‘***‘ with grant option;     

mysql> usezabbix;

mysql> source/var/www/html/zabbix-3.2.6/database/mysql/schema.sql;

mysql> source/var/www/html/zabbix-3.2.6/database/mysql/images.sql;

mysql> source/var/www/html/zabbix-3.2.6/database/mysql/data.sql;

mysql> exit

[[email protected]]# ln -s libmysqlclient.so.16.0.0libmysqlclient.so

[[email protected]]# ln -s libmysqlclient_r.so.16.0.0libmysqlclient_r.so

[[email protected]]# useradd zabbix

useradd:用户“zabbix”已存在

[[email protected]]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

[[email protected]]# /sbin/ldconfig

[email protected]]# ./configure \

--prefix=/usr/local/zabbix\

 --enable-server  \

--enable-agent  \

--with-net-snmp \

--with-libcurl  \

--enable-proxy  \

--with-mysql=/usr/bin/mysql_config

[[email protected] zabbix-3.2.6]#make

[[email protected] zabbix-3.2.6]#make install

[[email protected] zabbix-3.2.6]#vi /usr/local/zabbix/etc/zabbix_server.conf  #配置文件

DBHost=localhost

DBName=zabbix

DBUser=zabbix
DBPassword=***

DBPort=3306

DBSocket=/var/lib/mysql/mysql.sock

[[email protected] etc]# vi zabbix_agentd.conf

Server=127.0.0.1    #建议改成实际IP

ServerActive=127.0.0.1   #建议改成实际IP

Hostname=Zabbix server

User=zabbix

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/

UnsafeUserParameters=1

[[email protected] zabbix-3.2.6]#

cp /var/www/html/zabbix-3.2.6/misc/init.d/fedora/core/zabbix_server  /etc/rc.d/init.d/zabbix_server

[[email protected] zabbix-3.2.6]#

cp /var/www/html/zabbix-3.2.6/misc/init.d/fedora/core/zabbix_agentd/etc/rc.d/init.d/zabbix_agentd

[[email protected] zabbix-3.2.6]#chmod +x /etc/rc.d/init.d/zabbix_server

[[email protected] zabbix-3.2.6]#chmod +x /etc/rc.d/init.d/zabbix_agentd

[[email protected] zabbix-3.2.6]#chkconfig zabbix_server on

[[email protected] zabbix-3.2.6]#chkconfig zabbix_agentd on

[[email protected] zabbix-3.2.6]#vi  /etc/rc.d/init.d/zabbix_server

BASEDIR=/usr/local/zabbix/     

[[email protected] zabbix]# vi /etc/rc.d/init.d/zabbix_agentd

BASEDIR=/usr/local/zabbix/

[[email protected] zabbix]# cp -r /var/www/html/zabbix-3.2.6/frontends/php/var/www/html/zabbix

[[email protected] zabbix]# chown apache.apache -R/var/www/html/zabbix

[[email protected] zabbix]# service  zabbix_server restart

[[email protected] zabbix]# service zabbix_agentd start

[[email protected] zabbix]# vi/var/www/html/zabbix/include/locales.inc.php

‘zh_CN‘ => [‘name‘ => _(‘Chinese (zh_CN)‘),     ‘display‘ => true],       #启用中文版

以上都是安装之前的配置:

现在开始安装:http://IP+setup.php

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享该图是配置中文版

发布过程出现以下问题:

问题1zabbix监控报错zabbixserver is not running: the information displayed may not be current

[[email protected] tmp]# cat zabbix_server.log   #查日志

26996:20170619:203827.925 [Z3001]connection to database ‘zabbix‘ failed: [2002] Can‘t connect to local MySQLserver through socket ‘/tmp/mysql.sock‘ (2)

26996:20170619:203827.926 database is down:reconnecting in 10 seconds

解决问题1: 

[[email protected] etc]# pwd

/usr/local/zabbix/etc

[[email protected] etc]# vi zabbix_server.conf

#DBSocket=/tmp/mysql.sock  #默认目录

DBSocket=/var/lib/mysql/mysql.sock  #指定实际的mysql.sock目录

[[email protected] init.d]# vi   zabbix_server.conf

BASEDIR=/usr/local/  默认安装目录在zabbix   或者指定:BASEDIR=/usr/local/zabbix/

[[email protected] init.d]# vi   zabbix_agentd.conf

BASEDIR=/usr/local/   默认安装目录在zabbix    或者指定:BASEDIR=/usr/local/zabbix/


问题2:

[[email protected] tmp]# cat zabbix_agentd.log

23521:20170620:091435.666 using configuration file:/usr/local/zabbix/etc/zabbix_agentd.conf

 23521:20170620:091435.667 agent #0 started[main process]

 23523:20170620:091435.668 agent #1 started[collector]

 23525:20170620:091435.668agent #3 started [listener #2]

 23527:20170620:091435.669 agent #5 started[active checks #1]

 23524:20170620:091435.669 agent #2 started[listener #1]

 23526:20170620:091435.669 agent #4 started[listener #3]

 23527:20170620:100835.983 active checkconfiguration update from [127.0.0.1:10051] started to fail (cannot connect to[[127.0.0.1]:10051]: [111] Connection refused)

解决问题2:

[[email protected] etc]# vi zabbix_agentd.conf

Server=117.40.*.*   #把127.0.0.1改成实际IP

ServerActive=117.40.*.*   #把127.0.0.1改成实际IP

    到这里安装完毕。

技术分享

 

 

 


以上是关于发布Zabbix程序的主要内容,如果未能解决你的问题,请参考以下文章

Zabbix实战-1.zabbix server程序部署

zabbix运维篇

Zabbix之二----Zabbix监控Tomcat服务

Zabbix学习笔记(三十三)

zabbix与tomcat

Zabbix