安装配置Zabbix开源监控
运行环境:
在鹿城等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站建设、网站建设 网站设计制作按需求定制开发,公司网站建设,企业网站建设,品牌网站设计,全网营销推广,外贸营销网站建设,鹿城网站建设费用合理。
操作系统:CentOS release 6.8 (Final)
数据库:MySQL 5.5.52
Web应用服务器:Apache/2.2.15(Unix):
开源监控程序:Zabbix 3.2.6
任务:安装zabbix。
操作步骤:
[root@sky9896html]# tar xf zabbix-3.2.6.tar.gz
[root@sky9896html]# cd zabbix-3.2.6
[root@sky9896zabbix-3.2.6]# cd database/
root@sky9896database]# cd mysql/
[root@sky9896mysql]# ll
总用量 3068
-rw-r--r-- 1 10001000 1036662 5月 522:51 data.sql
-rw-r--r-- 1 10001000 1978341 5月 522:50 p_w_picpaths.sql
-rw-r--r-- 1 10001000 122134 5月 5 22:51schema.sql
[root@sky9896mysql]# 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/p_w_picpaths.sql;
mysql> source/var/www/html/zabbix-3.2.6/database/mysql/data.sql;
mysql> exit
[root@sky9896mysql]# ln -s libmysqlclient.so.16.0.0libmysqlclient.so
[root@sky9896mysql]# ln -s libmysqlclient_r.so.16.0.0libmysqlclient_r.so
[root@sky9896mysql]# useradd zabbix
useradd:用户“zabbix”已存在
[root@sky9896mysql]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
[root@sky9896mysql]# /sbin/ldconfig
root@sky9896zabbix-3.2.6]# ./configure \
--prefix=/usr/local/zabbix\
--enable-server \
--enable-agent \
--with-net-snmp \
--with-libcurl \
--enable-proxy \
--with-mysql=/usr/bin/mysql_config
[root@sky9896 zabbix-3.2.6]#make
[root@sky9896 zabbix-3.2.6]#make install
[root@sky9896 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
[root@sky9896 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
[root@sky9896 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
[root@sky9896 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
[root@sky9896 zabbix-3.2.6]#chmod +x /etc/rc.d/init.d/zabbix_server
[root@sky9896 zabbix-3.2.6]#chmod +x /etc/rc.d/init.d/zabbix_agentd
[root@sky9896 zabbix-3.2.6]#chkconfig zabbix_server on
[root@sky9896 zabbix-3.2.6]#chkconfig zabbix_agentd on
[root@sky9896 zabbix-3.2.6]#vi /etc/rc.d/init.d/zabbix_server
BASEDIR=/usr/local/zabbix/
[root@sky9896 zabbix]# vi /etc/rc.d/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix/
[root@sky9896 zabbix]# cp -r /var/www/html/zabbix-3.2.6/frontends/php/var/www/html/zabbix
[root@sky9896 zabbix]# chown apache.apache -R/var/www/html/zabbix
[root@sky9896 zabbix]# service zabbix_server restart
[root@sky9896 zabbix]# service zabbix_agentd start
[root@sky9896 zabbix]# vi/var/www/html/zabbix/include/locales.inc.php
'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true], #启用中文版
以上都是安装之前的配置:
现在开始安装:http://IP+setup.php
该图是配置中文版
发布过程出现以下问题:
问题1:zabbix监控报错zabbixserver is not running: the information displayed may not be current
[root@sky9896 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:
[root@sky9896 etc]# pwd
/usr/local/zabbix/etc
[root@sky9896 etc]# vi zabbix_server.conf
#DBSocket=/tmp/mysql.sock #默认目录
DBSocket=/var/lib/mysql/mysql.sock #指定实际的mysql.sock目录
[root@sky9896 init.d]# vi zabbix_server.conf
BASEDIR=/usr/local/ 默认安装目录在zabbix 或者指定:BASEDIR=/usr/local/zabbix/
[root@sky9896 init.d]# vi zabbix_agentd.conf
BASEDIR=/usr/local/ 默认安装目录在zabbix 或者指定:BASEDIR=/usr/local/zabbix/
问题2:
[root@sky9896 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:
[root@sky9896 etc]# vi zabbix_agentd.conf
Server=117.40.*.* #把127.0.0.1改成实际IP
ServerActive=117.40.*.* #把127.0.0.1改成实际IP
到这里安装完毕。
网页标题:安装配置Zabbix开源监控
浏览路径:http://scjbc.cn/article/ishces.html