以zabbix2.07为例,操作系统centos6.4. 首先需要一个lamp环境。 [iyunv@localhost ~]# yum install httpd php php-devel php-gd php-bcmath php-mbstring mysql-devel mysql-server php-xml php-mysql gd net-snmp net-snmp-devel net-snmp-utils
[iyunv@localhost ~]# chkconfig httpd on [iyunv@localhost ~]# chkconfig mysqld on [iyunv@localhost ~]# chkconfig snmpd on
编译安装zabbix
[iyunv@localhost ~]# useradd zabbix [iyunv@localhost ~]# tar zxvf zabbix-2.0.7.tar.gz [iyunv@localhost ~]# cd zabbix-2.0.7 [iyunv@localhost zabbix-2.0.7]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl [iyunv@localhost zabbix-2.0.7]# make install
配置数据库
[iyunv@localhost ~]# /etc/init.d/mysqld start #启动mysql [iyunv@localhost ~]# mysqladmin -uroot password 'abc123' #配置用户密码 [iyunv@localhost ~]# mysql -uroot -pabc123 mysql> create database zabbix character set utf8; mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'abc123'; #建立一个zabbix用户 mysql> quit
导入zabbix数据库 [iyunv@localhost ~]# cd zabbix-2.0.7/database/mysql/ [iyunv@localhost mysql]# mysql -uzabbix -pabc123 zabbix < schema.sql [iyunv@localhost mysql]# mysql -uzabbix -pabc123 zabbix < images.sql [iyunv@localhost mysql]# mysql -uzabbix -pabc123 zabbix < data.sql 顺序为:schema.sql---images.sql----data.sql
配置zabbix连接数据库选项 [iyunv@localhost ~]# vim /usr/local/zabbix/etc/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456 DBSocket=/var/lib/mysql/mysql.sock #注意你的mysql.sock位置 DBPort=3306
启动zabbix_server
cp zabbix-2.0.7/misc/init.d/fedora/core/zabbix_* /etc/init.d/
/etc/init.d/zabbix_server start
vim /etc/init.d/zabbix_server BASEDIR=/usr/local/zabbix #修改为zabbix安装的路径
vim /etc/init.d/zabbix_agentd BASEDIR=/usr/local/zabbix #修改为zabbix安装的路径 [iyunv@localhost ~]# echo "/etc/init.d/zabbix_server start" >> /etc/rc.local [iyunv@localhost ~]# echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local [iyunv@localhost ~]# /etc/init.d/zabbix_server start [iyunv@localhost ~]# /etc/init.d/zabbix_agentdstart
配置zabbix web管理接口 修改httpd [iyunv@localhost ~]# vim /etc/httpd/conf/httpd.conf DirectoryIndex index.php index.html index.html.var #增加一个index.php
[iyunv@localhost ~]# /etc/init.d/httpd start [iyunv@localhost ~]# mkdir /var/www/html/zabbix [iyunv@localhost ~]# cp -a zabbix-2.0.7/frontends/php/* /var/www/html/zabbix/ [iyunv@localhost html]# chown apache:apache -R /var/www/html/zabbix/
打开http://xxx/zabbix/将会看到zabbix安装向导 点击“Next>>看到zabbix对系统一些软件要求特性,不满足条件的以红色显示“Fail” [iyunv@localhost ~]# vim /etc/php.in post_max_size = 8M max_execution_time = 30 max_input_time = 60 修改: post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = Asia/Chongqing 重启httpd服务,刷新后正常
通过web登录,默认用户:admin 密码:zabbix 如需要显示中文可通过:右上角“Profile”--"Language" 选择“chinese(zh_CN)”之后保存
客户端的安装 下载zabbix_agents_2.0.6.linux2_6.amd64.tar.gz。官网上很多。(没找到2.0.7的)
[iyunv@localhost ~]# useradd zabbix [iyunv@localhost ~]# mkdir /usr/local/zabbix/ [iyunv@localhost~]#tar zxf zabbix_agents_2.0.6.linux2_6.amd64.tar.gz -C /usr/local/zabbix/ [iyunv@localhost ~]# ln -s /usr/local/zabbix/bin/* /usr/local/bin/ [iyunv@localhost ~]# ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/ [iyunv@localhost ~]# echo "/usr/local/zabbix/sbin/zabbix_agent start" >>/etc/rc.local #开机自启动
官网上下载相应平台的agent包里没有运行agent所需的配置文件,可以从zabbix Server上拷贝一份zabbix.agentd.conf放到/usr/local/etc目录下,这个配置文件是所有平台都通用的。 修改zabbix.agentd.conf [iyunv@localhost ~]# vim /usr/local/etc/zabbix_agentd.conf 将server修改成zabbix_server的服务器IP Server=xxxx 手动启动: [iyunv@localhost ~]# zabbix_agentd start [iyunv@localhost ~]# netstat -nlp | grep zabbix_agentd tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2855/zabbix_agentd
|