LAMP(YUM)+Zabbix2.4.8(源码)安装第一篇
查看系统环境1
2
3
4
5
6
7
8
9
10
#lsb_release -a
LSB Version::base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:CentOS
Description:CentOS release 6.5 (Final)
Release:6.5
Codename:Final
#uname -r
2.6.32-431.el6.x86_64
#python -V
Python 2.6.6
1、YUM安装apache、mysql、php
1
#yum -y install httpd httpd-devel mysql-server mysql mysql-devel mysql-libs php php-devel php-mysql
2、apache与php的整合
1
2
3
4
5
6
7
8
9
10
11
#vim /var/www/html/index.php
<?php
phpinfo();
?>
#vim /etc/httpd/conf/httpd.conf
LoadModulephp5_module modules/libphp5.so //默认已存在,apache解析php需要此项支持
ServerName localhost:80
DirectoryIndexindex.php index.html
AddType application/x-httpd-php.php
#/etc/init.d/httpd restart
#firefox http://172.16.30.2 &
3、创建zabbix用户及mysql授权
1
2
3
4
5
#useradd zabbix
#usermod -s /sbin/nologin zabbix
#/etc/init.d/mysqld restart
mysql> create database zabbix charset=utf8;
mysql> grant all on zabbix.* to zabbix@localhost identified by 'zabbixpassword';
4、导入zabbix数据库
1
2
3
4
5
6
#wget http://prdownloads.sourceforge.net/zabbix/zabbix-2.4.8.tar.gz?download
#tar xf zabbix-2.4.8.tar.gz
#cd zabbix-2.4.8/database/mysql
#mysql -uzabbix -pzabbixpassword zabbix < schema.sql
#mysql -uzabbix -pzabbixpassword zabbix < images.sql
#mysql -uzabbix -pzabbixpassword zabbix < data.sql
5、源码安装zabbix
1
2
3
4
5
#yum -y install curl curl-devel net-snmp net-snmp-devel per-DBI
#cd zabbix-2.4.8
#./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl
#make
#make install
6、配置zabbix为系统服务
1
2
3
4
5
#ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
#cd
#cd zabbix-2.4.8/misc/init.d/tru64
#cp * /etc/init.d/
#chmod u+x /etc/init.d/zabbix_*
7、拷贝zabbix的php代码到网站发布目录
1
2
3
#cd
#cd zabbix-2.4.8/frontends/php
#cp -arf * /var/www/html
8、网页安装zabbix,如下图需要注意的是,zabbix依赖许多图形包(图2.1)与正确的php值(图2.2),所以才会产生下面的报错
1
2
3
4
5
6
7
8
9
#yum install php-mbstring php-bcmath gd gd-devel php-gd php-xml //图2.1解决方法
#/etc/init.d/httpd restart
#vim /etc/php.ini //图2.2解决方法
post_max_size = 16
max_execution_time = 300
max_input_time= 300
date.timezone = PRC
#/etc/init.d/httpd restart
图1 图2.1图2.2
图2.3
图3
图4
图5
图6图7注:zabbix默认的登录名和密码分别是Admin和zabbix
9、监控第一台服务器(监控本机)
(1)、修改本机客户端配置文件
1
2
3
4
5
6
#vim zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log
Server=172.16.30.2
ServerActive=172.16.30.2
Hostname=172.16.30.2
#/etc/init.d/zabbix_agentd restart
(2)、web界面添加本机
History:Latest data-->Host screens-->Custom graphs-->Host screens-->Configuration of host groups然后点击Create host
图8.1图8.2注:添加模板时需要点击第一个“Add”按钮
图8.3注:需要等待一段时间图标才会变变绿,进而收集本机数据
页:
[1]