配色: 字号:
zabbix搭建文档
2015-06-25 | 阅:  转:  |  分享 
  
zabbix安装http://www.ttlsa.com/monitor/zabbix/page/5/创建zabbix用户;属于nologi
n组[root@zhangyuzabbix-2.4.2]#useraddzabbix[root@zhangyuzabbix
-2.4.2]#useradd-s/sbin/nologinzabbix[root@zhangyu~]#mysql-
uroot-p123456mysql>createdatabasezabbixcharactersetutf8co
llateutf8_bin;创建中文格式的zabbix数据库QueryOK,1rowaffected(0.29sec
)mysql>grantallprivilegeson.to''zabbix''@''localhost''ident
ifiedby''123456'';创建zabbix用户;给他所有权限QueryOK,0rowsaffected(0.2
3sec)mysql>grantallprivilegeson.to''zabbix''@''%''identifi
edby''123456'';QueryOK,0rowsaffected(0.15sec)mysql>select
user,host,passwordfrommysql.user;查看用户+--------+-----------+----
---------------------------------------+|user|host|pa
ssword|+--------+-----------+--
-----------------------------------------+|root|localhost|
6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9||root|zhangyu|
||root|127.0.0.1
|||root|::1
||||localhos
t||||zhangyu
|||zabbix|%
|6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9|+--------+------
-----+-------------------------------------------+7rowsinset(
0.00sec)mysql>flushprivileges;刷新权限QueryOK,0rowsaffected(0
.04sec)>exit[root@zhangyuzabbix]#tarzxfzabbix-2.4.2.tar.gz[
root@zhangyuzabbix]#cdzabbix-2.4.2将下面三个库导入的zabbix库[root@zhangy
uzabbix-2.4.2]#mysql-uroot-p123456zabbixhema.sql[root@zhangyuzabbix-2.4.2]#mysql-uroot-p123456zabbix
root-p123456zabbixx-2.4.2]#yuminstallunixODBC-develnet-snmp-develOpenIPMI-deve
lcurl-devellibxml2-develphp-gettext-yyuminstallunixODBC-dev
elnet-snmpnet-snmp-utilsnet-snmp-develOpenIPMI-develcurl-dev
ellibxml2-develphp-gettextphp-develphp-gdphp-bcmathphp-mbst
ringphp-xmlphp-mysql-y[root@zhangyuzabbix-2.4.2]#./configure
--enable-server--enable-agent--with-mysql--with-net-snmp--wi
th-libcurl--with-libxml2--with-openipmi--with-unixodbc--prefi
x=/usr/local/zabbix[root@zhangyuzabbix-2.4.2]#makeinstall客户端[r
oot@ciqing-0zabbix-2.4.2]#./configure--enable-agent--prefix=/
usr/local/zabbixmake&&makeinstall添加zabbix服务对应的端口{cat>>/etc/se
rvices<zabbix_agent10050/udp#zabbixagentzabbix-serv
er10051/tcp#zabbixserverzabbix-server10051
/udp#zabbixserverEOF}服务器zabbix_agentzabbix_age
ntdzabbix_server安装在/usr/local/zabbix/sbin下客户端zabbix_getzabbix
_sender安装在/usr/local/zabbix/bin下服务端客户端要做下面的操作{[root@zhangyu~]#/
usr/local/zabbix/sbin/zabbix_server启动zabbix出现错误/usr/local/zabbix/
sbin/zabbix_server:errorwhileloadingsharedlibraries:libicon
v.so.2:cannotopensharedobjectfile:Nosuchfileordirectory
[root@zhangyu~]#vim/etc/ld.so.conf解决方法在这个文件下面加入/usr/local/lib/
includeld.so.conf.d/.conf/usr/local/lib/[root@zhangyu~]#ldcon
fig运行(ld.so.conf和ldconfig是维护系统动态链接库的)}客户端{[root@ciqing-0etc]#/u
sr/local/zabbix/sbin/zabbix_agentd[root@ciqing-0etc]#netstat-l
antp|grep10050tcp000.0.0.0:100500
.0.0.0:LISTEN10438/zabbix_agentd}将zabbi
x启动文件复制到/etc/init.d下[root@zhangyuzabbix-2.4.2]#cd/home/zabbix/
zabbix-2.4.2/misc/init.d/tru64[root@zhangyutru64]#pwd/home/zabb
ix/zabbix-2.4.2/misc/init.d/tru64[root@zhangyutru64]#cpzabbix_
/etc/init.d[root@zhangyutru64]#chmod+x/etc/init.d/zabbix_下
面两句不要{[root@zhangyuinit.d]#cd/usr/local/sbin/[root@zhangyusbi
n]#cp/etc/init.d/zabbix_./}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~[root@ciqing-0init.d]#pwd/etc/init.d[ro
ot@ciqing-0init.d]#vimzabbix_server在文件头部#!/bin/bash下面分别添加两行#!/
bin/sh#chkconfig:359595#description:zabbixAgentserver添加服务[ro
ot@zabbixzabbix-2.0.6]#chkconfig--addzabbix_server[root@zabbi
xzabbix-2.0.6]#chkconfig--addzabbix_agentd设置服务器开机自动启动[root@za
bbix~]#chkconfigzabbix_serveron[root@zabbix~]#chkconfigzab
bix_agentdon修改zabbix_agentd、zabbix_server程序目录的位置{[root@ciqing-0
sbin]#vim/etc/init.d/zabbix_serverDAEMON=/usr/local/zabbix/sbin
/zabbix_server[root@ciqing-0sbin]#vim/etc/init.d/zabbix_agentd
DAEMON=/usr/local/zabbix/sbin/zabbix_agentd}在zabbix_server.conf中
的数据库配置三个东西[root@ciqing-0etc]#pwd/usr/local/zabbix/etc[root@ciqi
ng-0etc]#vimzabbix_server.confDBName=zabbixDBUser=zabbixDBPass
word=123456[root@zhangyuphp]#/usr/local/zabbix/sbin/zabbix_serv
er启动zabbix服务器[root@zhangyuphp]#/usr/local/zabbix/sbin/zabbix_ag
entd启动zabbix客户端[root@ciqing-0init.d]#servicezabbix_serverrest
art启动zabbix服务器Zabbixserverterminated.Usage:/usr/local/sbin/zab
bix_serverstart|stop|restartZabbixserverstarted.[root@ciqing-0
init.d]#servicezabbix_agentdrestart启动zabbix客户端Usage:/usr/loc
al/sbin/zabbix_agentdstart|stop|restartZabbixagentstarted.[roo
t@zabbix~]#ps-ef|grepzabbixzabbix18031008:21?
00:00:00/usr/local/sbin/zabbix_agentdzabbix18051803
008:21?00:00:00/usr/local/sbin/zabbix_agentdzabbix
18061803008:21?00:00:00/usr/local/sbin/zabbix_age
ntdzabbix18071803008:21?00:00:00/usr/local/sbi
n/zabbix_agentdzabbix18081803008:21?00:00:00/u
sr/local/sbin/zabbix_agentdzabbix18141008:21?
00:00:00/usr/local/sbin/zabbix_serverroot20432006008
:23pts/000:00:00grepzabbix[root@zabbix~]#netstat-lantp
|grep10050tcp000.0.0.0:100500.0.0.
0:LISTEN1803/zabbix_agentd[root@zabbix
~]#netstat-lantp|grep10051tcp000.0.0.0:10051
0.0.0.0:LISTEN2308/zabbix_
server@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@[root@zhangyuetc]#vim/etc/serviceszabbix_agent10050/tc
p#zabbixagentzabbix_agent10050/udp
#zabbixagentzabbix-server10051/tcp
#zabbixserverzabbix-server10051/udp
#zabbixserver安装zabbixweb界面(server)cp-R/home/
zabbix/zabbix-2.4.2/frontends/php/usr/local/zabbix/配置php.inimax_
execution_time=300max_input_time=300memory_limit=128Mpost_m
ax_size=16Mupload_max_filesize=2Msession.auto_start=0date.t
imezone=Etc/GMT-8北京时间extension="gettext.so"/usr/local/php/sbi
n/php-fpm-t检查配置文件killallphp-fpm停止php-fpm/usr/local/php/sbin/php
-fpm启动php-fpm安装gettext方法一、重新编译php,加上--with-gettext二、动态安装现在说下第二个动态
安装1、下载同版本的php原包,解压后进入ext目录,目录下便是模块2、进入gettext目录下执行:/usr/local/php
/bin/phpize./configure--with-php-config=/usr/local/php/bin/php-c
onfig(以上两个命令的路径根据自己系统情况而定)makemakeinstall3、在php.ini里添加上gettext.s
oextension="gettext.so"重启php即可[root@zhangyugettext]#pwd/home/
lnmp/php-5.3.8/ext/gettext[root@zhangyugettext]#/usr/local/php/
bin/phpize[root@zhangyugettext]#./configure--with-php-config=/
usr/local/php/bin/php-config[root@zhangyugettext]#make[root@zha
ngyugettext]#makeinstallInstallingsharedextensions:/usr
/local/php/lib/php/extensions/no-debug-non-zts-20090626/vim/usr/
local/php/etc/php.iniextension="gettext.so"/usr/local/php/sbin/
php-fpm-tkillallphp-fpm/usr/local/php/sbin/php-fpm[root@zhangyu
include]#pwd/usr/local/zabbix/php/include[root@zhangyuinclude]
#vimlocales.inc.phpfunctiongetLocales(){returnarray(''en_G
B''=>array(''name''=>_(''English(en_GB)''),''display''=>t
rue),''en_US''=>array(''name''=>_(''English(en_US)''),''di
splay''=>true),''bg_BG''=>array(''name''=>_(''Bulgarian(bg_BG)''
),''display''=>true),''zh_CN''=>array(''name''=>_(''Chinese
(zh_CN)''),''display''=>true),//原本这里为false,请改为true.....
......代码省略掉........);}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~·访问zabbix[root@zhangyuconf]#chmod-R777
/usr/local/zabbix/phphttp://192.168.221.100/index.php登陆zabbix默认账号
:Admin,密码:zabbix,这是一个超级管理员。登陆之后在右下角可以看到“connectedasAdmin“(中文版:连
接为Admin)。访问zabbix[root@zhangyuconf]#chmod-R777/usr/local/zab
bix/phphttp://192.168.221.100/setup.phpzabbix中文设置Profile->Lang
uage->Chinese(zh_CN)->Save[root@zhangyufonts]#pwd/usr/loca
l/zabbix/php/fonts[root@zhangyufonts]#lsDejaVuSans.ttfsimkai.
ttf[root@zhangyufonts]#cpDejaVuSans.ttfDejaVuSans.ttf_bak[roo
t@zhangyufonts]#mvsimkai.ttfDejaVuSans.ttfmv:是否覆盖"DejaVuSans.
ttf"?yes@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@客户端[root@ciqing-0zabbix-2.4.2]#./configure--enable-agent--p
refix=/usr/local/zabbixmake&&makeinstall客户端要做下面的操作{[root@zhangyu~]#/usr/local/zabbix/sbin/zabbix_server启动zabbix出现错误/usr/local/zabbix/sbin/zabbix_server:errorwhileloadingsharedlibraries:libiconv.so.2:cannotopensharedobjectfile:Nosuchfileordirectory[root@zhangyu~]#vim/etc/ld.so.conf解决方法在这个文件下面加入/usr/local/lib/includeld.so.conf.d/.conf/usr/local/lib/[root@zhangyu~]#ldconfig运行(ld.so.conf和ldconfig是维护系统动态链接库的)}客户端{[root@ciqing-0etc]#/usr/local/zabbix/sbin/zabbix_agentd[root@ciqing-0etc]#netstat-lantp|grep10050tcp000.0.0.0:100500.0.0.0:LISTEN10438/zabbix_agentd}
献花(0)
+1
(本文系终极妖神首藏)