网络监控软件Zabbix详细安装过程

运维 系统运维
Zabbix作为一款网络监控软件,在监控方面绝不含糊,谁用谁知道,让我们来看看它的具体安装步骤!

zabbix由2部分构成,zabbix server与可选组件zabbix agent。让我们看看它的安装过程!

  1.创建ZABBIX的系统账号

  为了安全起见建议创建使用zabbix用户运行ZABBIX.

  useradd zabbix

  2.解压:

  tar xvzf zabbix-1.1beta12.tar.gz

  3.创建 ZABBIX 数据库

 

  1.   mysql -u test -p  
  2.  
  3.   >create database zabbix;  
  4.  
  5.   >quit;  
  6.  
  7.   /* 1.1.6 cd create/mysql  
  8.  
  9.   cat schema.sql |mysql -u root -p zabbix  
  10.  
  11.   cd ../data  
  12.  
  13.   cat data.sql |mysql -u root -p zabbix */ 
  14.  
  15.   1.4.1  
  16.  
  17.   cd create/schema  
  18.  
  19.   cat schema.sql |mysql -u root -p zabbix  
  20.  
  21.   cd ../data  
  22.  
  23.   cat data.sql |mysql -u root -p zabbix  
  24.  
  25.   cat images_mysql.sql |mysql -u root -p zabbix  
  26.  

 

  4.编译:

  服务器端+客户端的编译:

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

  客户端只需执行:

  ./configure --prefix=/usr/local/zabbix --enable-agent

  make

  make install

  cd /usr/local/zabbix/bin

  for i in * ; do ln -s /usr/local/zabbix/bin/$i /usr/bin/$i ; done

#p#

 

  5.配置:

  (1).vi /etc/services

  该文件是zabbix建议操作,可忽略:

  加入:

 

  1.   zabbix_agent 10050/tcp  
  2.  
  3.   zabbix_trap 10051/tcp  
  4.  

 

  (2) WEB interface

  回到zabbix的编译目录,

 

  1.   vi frontends/php/include/db.inc.php  
  2.  

 

  更改数据库相关内容:

 

  1.   $DB_TYPE ="MYSQL";  
  2.  
  3.   $DB_SERVER ="localhost";  
  4.  
  5.   $DB_DATABASE ="zabbix";  
  6.  
  7.   $DB_USER ="root";  
  8.  
  9.   $DB_PWD ="";  
  10.  
  11.   cp -rf frontends/php /usr/local/www/html/zabbix -R  
  12.  
  13.   chown zabbix /usr/local/www/html/zabbix/ -R  
  14.  

 

  (3) 生成配置文件:

 

  1.   mkdir /etc/zabbix  
  2.  
  3.   cp misc/conf/* /etc/zabbix/  
  4.  

 

  配置相关内容(以下内容请根据大家具体服务器的IP/MYSQL的账号情况做相应修改):

  zabbix_agent.conf

  grep -v '^#' zabbix_agent.conf |grep -v '^$'

  Server=10.5.21.46

  Timeout=3

  UserParameter=mysql.ping,/usr/local/mysql/bin/mysqladmin -uroot -p ping|grep alive|wc -l

  UserParameter=mysql.uptime,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f2 -d":"|cut -f1 -d"T"

  UserParameter=mysql.threads,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f3 -d":"|cut -f1 -d"Q"

  UserParameter=mysql.questions,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f4 -d":"|cut -f1 -d"S"

  UserParameter=mysql.slowqueries,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f5 -d":"|cut -f1 -d"O"

  UserParameter=mysql.qps,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f9 -d":"

  UserParameter=mysql.version,/usr/local/mysql/bin/mysql -V

  zabbix_agentd.conf

  grep -v '^#' zabbix_agentd.conf |grep -v '^$'

  Server=10.5.21.46

  Hostname=localhost

  ListenPort=10050

  ListenIP=10.5.21.46

  StartAgents=5

  RefreshActiveChecks=120

  DisableActive=1

  DebugLevel=3

  PidFile=/var/tmp/zabbix_agentd.pid

  LogFile=/var/log/zabbix_agentd.log

  Timeout=3

  UserParameter=mysql.ping,/usr/local/mysql/bin/mysqladmin -uroot -p ping|grep alive|wc -l

  UserParameter=mysql.uptime,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f2 -d":"|cut -f1 -d"T"

  UserParameter=mysql.threads,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f3 -d":"|cut -f1 -d"Q"

  UserParameter=mysql.questions,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f4 -d":"|cut -f1 -d"S"

  UserParameter=mysql.slowqueries,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f5 -d":"|cut -f1 -d"O"

  UserParameter=mysql.qps,/usr/local/mysql/bin/mysqladmin -uroot -p status|cut -f9 -d":"

  UserParameter=mysql.version,/usr/local/mysql/bin/mysql -V

  zabbix_server.conf

  grep -v '^#' zabbix_server.conf |grep -v '^$'

  Server=1

  StartPollers=6

  StartTrappers=5

  ListenPort=10051

  HousekeepingFrequency=1

  SenderFrequency=30

  DebugLevel=3

  Timeout=5

  UnreachablePeriod=45

  UnavailableDelay=15

  UnavailableDelay=60

  PidFile=/var/tmp/zabbix_server.pid

  LogFile=/var/log/zabbix_server.log

  AlertScriptsPath=/home/zabbix/bin/

  PingerFrequency=30

  DBHost=localhost

  DBName=zabbix

  DBUser=root

  DBPassword=

  DBSocket=/usr/local/mysql/data/mysql.sock

  zabbix_trapper.conf

  grep -v '^#' zabbix_trapper.conf |grep -v '^$'

  DebugLevel=2

  Timeout=3

  LogFile=/var/log/zabbix_trapper.log

  DBHost=localhost

  DBName=zabbix

  DBUser=root

  DBPassword=

  DBSocket=/usr/local/mysql/data/mysql.sock

  (4). 生成启动脚本

 

  1.   cp misc/init.d/redhat/zabbix_* /usr/local/zabbix/bin/  
  2.  

 

  编辑zabbix_agentd_ctl 和 zabbix_suckerd_ctl

  BASEDIR=/usr/local/zabbix 为指定的zabbix安装目录.

  zabbix_suckerd_ctl文件中的

  ZABBIX_SUCKERD=$BASEDIR/bin/zabbix_suckerd可能因为版本关系应该改为

  ZABBIX_SUCKERD=$BASEDIR/bin/zabbix_server

#p#

  6.启动服务:

  服务器端

 

  1.   /usr/local/zabbix/bin/zabbix_suckerd_ctl start  
  2.  

 

  客户端

 

  1.   /usr/local/zabbix/bin/zabbix_agentd_ctl start  
  2.  

 

  7.--mysql

  tar zxvf mysql-5.0.37.tar.gz

  cd mysql-5.0.37

  more INSTALL-SOURCE

  groupadd mysql

  useradd -g mysql mysql

  passwd mysql

  ./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charsets=gb2312,latin1,utf8 --enable-largefile --with-big-tables --localstatedir=/usr/local/mysql/data --without-debug --with-max-indexes=64 --without-ndbcluster

  make

  make install

  cp support-files/my-medium.cnf /etc/my.cnf

  cp /root/mysql-5.0.37/support-files/mysql.server /usr/local/mysql/mysql

  chmod +x /usr/local/mysql/mysql

  cd /usr/local/mysql

  bin/mysql_install_db --user=mysql

  chown -R root .

  chown -R mysql .

  chgrp -R mysql .

  chown mysql.mysql -R data

  bin/mysqld_safe --user=mysql &

  ./bin/mysqladmin -u root password ***** (密码)

  /usr/local/mysql/mysql restart

  /usr/local/mysql/bin/mysql -uroot -p **** (密码) 登入mysql控制台看看是不是正常了

  --apache

  emerge gd

  emerge jpeg

  emerge zlib

  emerge libpng

  emerge freetype

  tar zxvf httpd-2.2.4.tar.gz

  cd httpd-2.2.4

  ./configure --prefix=/usr/local/httpd --enable-so --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr -with-zlib-dir=/usr --with-freetype-dir=/usr

  make

  make install

  /usr/local/httpd/bin/apachectl start 如果没起来,看看日志:more /usr/local/httpd/logs/error_log,可能是这台机器80端口被别的程序(如resin)占用了,修改一下配置文件:

  vi /usr/local/httpd/conf/httpd.conf

  Listen 192.168.1.212:88

  修改一下#ServerName www.example.com:88 为ServerName www.test.com:80

  /usr/local/httpd/bin/apachectl restart 试试,应该就能访问了: http://192.168.1.212/ 能出来 It works! 的页面了

  cd..

  --php

  emerge dev-libs/libxml

  emerge dev-libs/libxml2 //如果没装libxml,则编译会出现configure: error: xml2-config not found.

  tar zxvf php-5.2.1.tar.gz

  cd php-5.2.1

  ./configure --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql-dir=/usr/local/mysql --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr -with-zlib-dir=/usr --with-freetype-dir=/usr

  make

  make install

  cp php.ini-dist /usr/local/lib/php.ini

  vi /usr/local/httpd/conf/httpd.conf 手动添加:

  AddType application/x-httpd-php .php

  AddType application/x-httpd-php-source .phps

  #这两行是让apache知道php的文件类型

  DirectoryIndex index.html 改成DirectoryIndex index.html index.php ,让apache默认的首页也支持index.php

  echo '/usr/local/mysql/lib/mysql'>>/etc/ld.so.conf

  ldconfig

#p#

  8.打开浏览器:

  http://10.5.21.46/zabbix

  用户名admin,初始密码为空.

通过上面的具体介绍,我们清楚的知道了网络监控软件Zabbix详细安装过程!希望对你们有帮助!

【编辑推荐】

  1. 分布式系统监控zabbix 特点与功能
  2. zabbix agentd的安装手册
  3. zabbix 简单介绍
  4. 备份cacti为windows制定计划任务
责任编辑:赵鹏 来源: 网络转载
相关推荐

2010-09-10 13:15:39

NetBEUI网络协议安装

2011-03-30 10:07:05

Zabbix监控

2011-03-28 12:42:26

nagios

2011-04-01 15:50:55

ZABBIX监控

2011-03-29 11:28:03

Linux安装zabbix

2011-09-06 10:24:11

2010-05-31 10:00:14

Nagios安装

2011-04-22 17:08:43

电脑安装故障

2009-03-24 09:14:20

Windows Emb

2010-05-04 16:20:11

resin负载均衡

2010-01-14 16:00:46

CentOS php安

2010-02-26 10:11:04

Fedora Core

2012-07-30 10:26:59

2009-08-07 08:30:20

Windows Emb

2010-01-07 15:36:53

Ubuntu orac

2009-07-16 14:49:50

Windows Emb

2010-06-09 18:57:53

Opensuse安装

2009-10-12 13:54:56

RHEL kernel

2009-12-17 18:50:27

2009-11-26 10:46:38

VS2003制作安装
点赞
收藏

51CTO技术栈公众号