为什么80%的码农都做不了架构师?>>>
1.准备
下载zabbix的服务端和客户端文件,
下载地址: http://www.zabbix.com/download.php
服务端IP:192.168.2.140
客户端IP:192.168.2.138
2.服务端操作:
groupadd zabbix
useradd zabbix -g zabbixtar -zxvf zabbix-2.0.5.tar.gz
cd zabbix-2.0.5source /home/postgres/.bash_profile
./configure --prefix=/usr/local/zabbix --enable-server --with-postgresql --with-net-snmp --with-libcurl
期间遇到了几个软件包找不到的问题 checking for pg_config... no
configure: error: PostgreSQL library not foundchecking for curl-config... no
configure: error: Curl library not foundchecking for net-snmp-config... no
configure: error: Invalid NET-SNMP directory - unable to find net-snmp-config
因为已经在服务端装好了postgres数据库,所以第一个问题是在root下引用了postgres的环境变量解决的,即source $PGHOME/.bash_profile 其余两个用yum搞定。 yum install curl-devel
yum install net-snmp-devel
完了以后就是下面这样,

然后安装
make && make install
3.配置数据库
[postgres@localhost ~]$psql
Password:
psql (9.1.3)
Type "help" for help.
postgres=# create database zabbix;
CREATE DATABASE
postgres=# create user zabbix with password '123456';
CREATE ROLE
postgres=# grant all on database zabbix to zabbix;
GRANT
postgres=# \q
[postgres@localhost ~]$--导入zabbix的数据
[postgres@localhost ~]$ cd /home/kenyon/zabbix-2.0.5/database/postgresql/
[postgres@localhost postgresql]$ psql -U zabbix -d zabbix -f schema.sql
[postgres@localhost postgresql]$ psql -U zabbix -d zabbix -f images.sql
[postgres@localhost postgresql]$ psql -U zabbix -d zabbix -f data.sql
配置zabbix与Postgres的连接 vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=zabbix[root@localhost ~]# mkdir -p /var/www/html/zabbix
[root@localhost ~]# cp -r /home/kenyon/zabbix-2.0.5/frontends/php/* /var/www/html/zabbix/
4.启动服务器端的软件 启动apache
/etc/init.d/httpd restart
--apache的下载地址:http://apache.org/dist/httpd/
启动zabbix
/usr/local/zabbix/sbin/zabbix-server start
[postgres@localhost tmp]$ pwd
/tmp
[postgres@localhost tmp]$ ll zabbix_server.*
-rw-rw-r--. 1 zabbix zabbix 2517 Feb 26 22:19 zabbix_server.log
-rw-rw-r--. 1 zabbix zabbix 4 Feb 26 22:19 zabbix_server.pid
浏览网页,看是否正常 http://192.168.2.140/zabbix 可能会有一些选项异常,我遇到了几个,通过yum的方式和修改/etc/php.ini的方式解决,如果界面没出来,出来的是一些目录文件,则很有可能是php没有安装yum install php即可,改完重启一下apache。
yum install php-pgsql
yum install php-bcmath
yum install php-mbstring
yum install php-xml
yum install php-gd

配置DB

如果出现
|
登陆窗口,注意首字母是大写,忘记用户密码可以通过修改DB数据来获取,默认是Admin/zabbix:
psql -U zabbix -d zabbix
zabbix=# select userid,name,surname,passwd from users;
userid | name | surname | passwd
--------+---------+---------------+----------------------------------
1 | Zabbix | Administrator | 5fce1b3e34b520afeffb37ce08c7cd66
2 | Default | User | d41d8cd98f00b204e9800998ecf8427e
(2 rows)
zabbix=# update users set passwd = md5('123456') where userid = 1;
UPDATE 1

最终见下图,说明服务端准备好了,只等客户端传数据过来。

5.安装配置客户端
把客户端文件(本次下载的是zabbix_agents_2.0.4.linux2_6_23.amd64.tar.gz,下载地址同服务端)拷贝到/home/kenyon/
tar -zxvf zabbix_agents_2.0.4.linux2_6_23.amd64.tar.gz
[root@localhost kenyon]# ls -l
total 284
drwxr-xr-x. 5 root root 4096 Feb 26 17:39 zabbix_agents
-rw-r--r--. 1 root root 286523 Feb 25 23:22 zabbix_agents_2.0.4.linux2_6_23.amd64.tar.gz[root@localhost kenyon]# cd zabbix_agents/conf/
[root@localhost conf]# vi zabbix_agentd.conf
Server=192.168.2.140
ServerActive=192.168.2.138
Hostname=192.168.2.138
如有错误或图片出不来,再看服务端和客户端的/tmp/zabbix_server.log信息 正常情况下:

参考:http://metaler.dyndns.org/wordpress/?p=481