Chinaunix首页 | 论坛 | 博客
  • 博客访问: 52349
  • 博文数量: 19
  • 博客积分: 870
  • 博客等级: 准尉
  • 技术积分: 230
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-22 16:51
文章分类

全部博文(19)

文章存档

2013年(1)

2011年(1)

2009年(17)

我的朋友

分类: 系统运维

2009-03-31 22:44:49

Following are instructions on installing ZABBIX on Ubuntu. Beware that the packages in the Ubuntu repository are quite probably an old version. You can check this with

apt-cache showpkg zabbix-server-mysql

They currently apply to ZABBIX v1.4.2 and Ubuntu 7.04 but may apply to other versions. These instructions have been compiled from various sources so a big thanks to the sources.

Install pre-requisites: Apache MySQL-Server PHP5 Net-Snmp libraries Curl libraries

sudo apt-get install build-essential mysql-server libmysqlclient15-dev php5 php5-gd php5-mysql snmp libsnmp9-dev snmpd libcurl3-dev

If you aren’t going to be using Web Monitoring, you can exclude libcurl3-dev from above.

NOTE: For Jabber support make sure to include libiksemel1 and libiksemel1-dev packages and then add –with-jabber=/usr/ to your configure command (STEP #4 below). The script wants the /include dir for the .h file and /lib for .c files and it needs to look in the root of the directory for them. For Ubuntu /usr is the place. Therefore, if you make sure that it knows to look in “/usr/” Jabber support should build fine. This is tested on Ubuntu Dapper 6.06 with Zabbix 1.4.2 but should work for more recent versions of Ubuntu as well.

1 - Make the zabbix user and group:

sudo adduser zabbix
enter in new password
confirm

use the remaining defaults.

Add zabbix to the admin group:

sudo adduser zabbix admin

2 - Download and Untar the sources:

su - zabbix
wget 
tar zxvpf zabbix-1.4.2.tar.gz

You might want to confirm that this is actually the latest version. You might also want to find a mirror closer to you by going to .

3 - Create a zabbix database and populate it:

sudo mysql -e"create database zabbix;"
sudo mysql -e"grant all privileges on zabbix.* to zabbix@localhost identified by 'enter-password-here';"

安装是遇到禁止进入mysql的问题,使用webwin在图形界面的mysql管理里增加了zabbix用户设置密码,因此这两步完全略过

The following steps will require the password you assigned to the new zabbix database user account in the step above.

mysql -uzabbix -p zabbix < /home/zabbix/zabbix-1.4.2/create/schema/mysql.sql
mysql -uzabbix -p zabbix < /home/zabbix/zabbix-1.4.2/create/data/data.sql
mysql -uzabbix -p zabbix < /home/zabbix/zabbix-1.4.2/create/data/images_mysql.sql

使用刚才在sql里建立的zabbix的密码

4 - Configure, compile and install the server:

cd zabbix-1.4.2/
./configure --prefix=/usr --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent && make
sudo make install

If you aren’t going to be using Web Monitoring, you can exclude –with-libcurl from above.

If you wish to add Jabber support add –with-jabber=/usr/ and make sure you have libiksemel1 and libiksemel1-dev packages as noted above before STEP #1

5 - Prepare the rest of the system:

sudo vim /etc/services

Add at the end:

zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

Save and exit.

sudo mkdir /etc/zabbix
sudo chown -R zabbix.zabbix /etc/zabbix/
sudo cp misc/conf/zabbix_* /etc/zabbix/

Edit /etc/zabbix/zabbix_agentd.conf:

sudo vim /etc/zabbix/zabbix_agentd.conf

Make sure that the Server parameter points to the server address, for the agent that runs on the server it is like this:

Server=127.0.0.1

Save and exit.

Edit /etc/zabbix/zabbix_server.conf:

sudo vim /etc/zabbix/zabbix_server.conf

For small sites this default file will do, however if you are into tweaking your config for your 10+ hosts site, this is the place.

Change this:

# Database user
DBUser=zabbix
# Database password
# Comment this line if no password used
DBPassword=Secret

这步没做,我不需要改这个

Save and exit.

Copy the init.d scripts to the right spot:

sudo cp misc/init.d/debian/zabbix-server /etc/init.d
sudo cp misc/init.d/debian/zabbix-agent /etc/init.d

You may need to edit these script files as the compiled versions of the zabbix files is placed under /usr/sbin (/usr/bin in older versions).

sudo vim /etc/init.d/zabbix-server

Look for the following line:

DAEMON=/home/zabbix/bin/${NAME}

and replace it with:

DAEMON=/usr/sbin/${NAME} (old versions use /usr/bin/${NAME})

Save and exit.

sudo vim /etc/init.d/zabbix-agent

Look for the following line:

DAEMON=/home/zabbix/bin/${NAME}

and replace it with:

DAEMON=/usr/sbin/${NAME}  (old versions use /usr/bin/${NAME})

Save and exit.

Now set the correct permissions and set ZABBIX to start when the machine boots:

sudo chmod 755 /etc/init.d/zabbix-server
sudo update-rc.d zabbix-server defaults
sudo chmod 755 /etc/init.d/zabbix-agent
sudo update-rc.d zabbix-agent defaults

Start the server :

sudo /etc/init.d/zabbix-server start

Start the agent:

sudo /etc/init.d/zabbix-agent start

Now check to make sure that they are running:

ps -aux | grep zabbix

You should see multiple instances of zabbix_server and zabbix_client running if everything has gone ok.

6 - Configure web interface

mkdir /home/zabbix/public_html
sudo cp -R frontends/php/* /home/zabbix/public_html/

Edit /etc/apache2/sites-enabled/000-default:

sudo vim /etc/apache2/sites-enabled/000-default

Work into file:

Alias /zabbix /home/zabbix/public_html/

  AllowOverride FileInfo AuthConfig Limit Indexes
  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  
    Order allow,deny
    Allow from all
  
  
    Order deny,allow
    Deny from all
  

把这个加在原来文档的最后就可以了,我的文件夹一开始写错名字了,把public写成pulic结果实验的时候显示404错误,很囧。。。

Save and exit.

Make php.ini adjustments:

sudo vim /etc/php5/apache2/php.ini

Change the following values:

max_execution_time = 300 ; Maximum execution time of each script, in seconds
date.timezone = Asia/Shanghai
原文档里,date.timezone = Asia/Shanghai前面还有个分号呢,记得去掉,要不命令是无法生效的

(use this url to find your correct timezone format: )

Restart Apache:

sudo /etc/init.d/apache2 restart

Now point your browser to:

 or ip>/zabbix/
最后打开网页,输入我的地址却打不开网页,而是提示是否下载php文件
有次可知php没有被解析,上网查了下,可以试试以下命令
sudo /etc/init.d/apache2 restart
sudo a2enmod php5
第一条让apache重启,之后激活php5,我的php安装比较早,一直没用,一开始装完了就没激活……
执行这个命令之后刷新网页,zabbix页面终于出来了
---------------------------------------------------------------------------
打开网页后是安装界面,按照步骤到第四步:4. Configure DB connection
host使用localhost
user用最初建立好的zabbix用户,密码也是,点击显示ok就可以了
第五步,要求你下载zabbix.conf.php文件,并且复制到/home/zabbix/public_html/conf/下
点retry之后显示
Configuration file:Ok
就可以了
最后完成所有安装,就可以看到Zabbix的用户界面了
Log in with username: Admin No Password 
装好了,界面很干净,也是中文的,现在研究一下报警之类的配置吼吼~~~
http://palm0507.blog.sohu.com/73469620.html
阅读(620) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~