码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix监控搭建以及客户端配置

时间:2015-10-28 15:45:52      阅读:471      评论:0      收藏:0      [点我收藏+]

标签:服务器   客户端   mysql   监控   

1、安装LANMP环境

yum -yinstall gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysqlhttpd-manual mod_ssl mode_perl mod_auth_mysql php-gd php-xml php-mbstringphp-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devellibdbi-dbd-mysql net-snmp-devel curl-devel unix0DBC-devel OpenIPMI-develjava-devel


2、测试PHP

cd /var/www/html/

vim index.php

<?php

        phpinfo();

?>

chkconfig httpd on

service http restart

在网页输入服务器的IP地址,测试PHP是否正常:

http://8.8.8.109/

技术分享


3、安装Zabbix-Server

tar zxvf zabbix-2.2.10.tar.gz 

cd zabbix-2.2.10

 ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java

checking for main in -lodbc... yes

checking whether unixodbc is usable... no

configure: error: cannot use unixODBC library


yum  install unixODBC-devel

 ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java

checking for SSH2 support... no

configure: error: SSH2 library not found


 yum install -y libssh2-devel

 ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java

checking for LDAP support... no

configure: error: Invalid LDAP directory - unable to find ldap.h


yum install openldap

yum install openldap-devel

 ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java

make && make install


4、配置MySQL,导入zabbix数据库

useradd zabbix

cd zabbix-2.2.10


chkconfig mysqld on

service mysqld restart


修改root密码,创建名为zabbix的数据库及用户名和密码都是zabbix的用户


mysqladmin -uroot password ‘mysql_pass‘

mysql -uroot -p

create database zabbix characer set utf8;

grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;

flush privileges;


导入数据库

mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql 

mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql 

mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql 

mkdir /var/log/zabbix

chown zabbix.zabbix /var/log/zabbix/


5、复制启动脚本

cp misc/init.d/fedora/core/zabbix_* /etc/init.d/

chmod 755 /etc/init.d/zabbix_*

sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_server 

sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd 


6、服务器端配置,将数据库、用户名、密码修改为刚才新建的


vim /etc/zabbix/zabbix_server.conf


DBName=zabbix

DBUser=zabbix

DBPassword=zabbix


7、复制网页文件值apache目录

cp -r ./frontends/php/ /var/www/html/zabbix

chown -R apache.apache /var/www/html/zabbix


chkconfig zabbix_server on

service zabbix_server restart


8、通过WEB配置Zabbix-Server

http://8.8.8.109/zabbix

技术分享

技术分享

修改/etc/php.ini后,重启httpd服务

service httpd restart


技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

9、开启中文支持及更正中文乱码问题

开启中文支持:

vim /var/www/html/zabbix/include/locales.inc.php

zh_CN‘ => array(‘name‘ => _(‘Chinese (zh_CN)‘),        ‘display‘ => true),

将false改为true

更正中文乱码问题:

Windows中找到所需的字体文件传到/var/www/html/zabbix/fonts目录下,修改zabbixweb/var/www/html/zabbix/include/defines.inc.php将原来的字体替换掉.

#define(‘ZBX_GRAPH_FONT_NAME‘,          ‘DejaVuSans‘); // font file name

define(‘ZBX_GRAPH_FONT_NAME‘,           ‘simkai‘); // font file name

#define(‘ZBX_FONT_NAME‘, ‘DejaVuSans‘);

define(‘ZBX_FONT_NAME‘, ‘simkai‘);


10、Linux客户端安装

yum -y install gcc gcc-c++

useradd zabbix

tar zxvf zabbix-2.2.10.tar.gz 

cd zabbix-2.2.10

./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-agent

make && make install

mkdir /var/log/zabbix

chown zabbix.zabbix /var/log/zabbix/

cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/

chown 755 /etc/init.d/zabbix_agentd 

sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd 

sed -i "s/Server\=127.0.0.1/Server\=127.0.0.1,8.8.8.109/g" /etc/zabbix/zabbix_agentd.conf

sed -i "s/ServerActive\=127.0.0.1/ServerActive\=8.8.8.109/g" /etc/zabbix/zabbix_agentd.conf

sed -i "s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g" /etc/zabbix/zabbix_agentd.conf

sed -i "#UnsafeUserParameters=0#aUnsafeUserParameters=1\n" /etc/zabbix/zabbix_agentd.conf

sed -i "s/Hostname\=Zabbix server/Hostname\=CentOS6.5/g" /etc/zabbix/zabbix_agentd.conf


chkconfig iptables off

service iptables off


chkconfig zabbix_agentd on

service zabbix_agentd restart


测试客服端是否安装成功

[root@Zabbix_Server ~]# zabbix_get -s 8.8.8.103 -k system.uname

Linux Zabbxi_Client 2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686


11、Windows 7客户端安装

将zabbix_agents_2.2.9.win.zip解压到C:\Program Files目录,修改C:\Program Files\zabbix_agentd.win里的三项内容如下

Server=8.8.8.109

ServerActive=8.8.8.109

Hostname=Windows7


注册、启动、停止服务

C:\Program Files\zabbix_agents_2.2.9.win\bin\win32>zabbix_agentd.exe --install -c "C:\Program Files\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf"

zabbix_agentd.exe [9444]: service [Zabbix Agent] installed successfully

zabbix_agentd.exe [9444]: event source [Zabbix Agent] installed successfully


C:\Program Files\zabbix_agents_2.2.9.win\bin\win32>zabbix_agentd.exe --install -s -c "C:\Program Files\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf"

zabbix_agentd.exe [8900]: service [Zabbix Agent] started successfully


C:\Program Files\zabbix_agents_2.2.9.win\bin\win32>zabbix_agentd.exe --install -x -c "C:\Program Files\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf"

zabbix_agentd.exe [10048]: service [Zabbix Agent] stopped successfully


测试客服端是否安装成功

[root@Zabbix_Server ~]# zabbix_get -s 8.8.8.100 -k system.uname

Windows PC 6.1.7601 Microsoft Windows 7 Ultimate Edition Service Pack 1 x86


本文出自 “小伙” 博客,请务必保留此出处http://systemyw.blog.51cto.com/7424832/1707220

zabbix监控搭建以及客户端配置

标签:服务器   客户端   mysql   监控   

原文地址:http://systemyw.blog.51cto.com/7424832/1707220

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!