一. 需求分析及参考网页
利用ZABBIX 提供的网页浏览方式,远程监控各个服务。同时,利用设定ZABBIX对各服务器的ITEM 来生成GRAPHICS对 服务器动态的与形象的监视
http://13angel.javaeye.com/blog/604425
http://hi.baidu.com/duking/blog/item/68821655453e09ceb745ae82.html
http://hi.baidu.com/evo2004/blog/category/Zabbix
三、安装配置及错误分析
yum install http-devel
yum install libxml2-devel
yum install openssl-devel
yum install curl-devel
yum install libjpeg-devel
yum install gd-devel
yum install net-snmp-devel
1. 安装apache
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most
修改httpd.conf 添加
AddType application/x-httpd-php .php .phtml .php4 .inc
DirectoryIndex index.php
3安装PHP
'./configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-mysql=/usr/local/mysql/' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-freetype-dir' '--with-libxml-dir' '--with-curl' '--with-snmp' '--with-openssl' '--with-iconv' '--enable-sockets' '--enable-mbstring' '--enable-pdo' '--with-pdo-mysql=/usr/local/mysql/' '--enable-bcmath' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--enable-fpm'
cp php.ini-dist /usr/local/php5/lib/php/php.ini
修改php.ini
max_execution_time = 300
date.timezone = Asia/Shanghai
否则会出现如下
2. 安装mysql5.1
1>./configure --prefix=/usr/local/mysql –charset --with-extra-charsets=all
Cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
启动授权表:/usr/local/mysql/bin/mysql_install_db
Chown –R mysql.mysql /usr/local/mysql
Chmod –R 777 /usr/local/mysql/var
/usr/local/mysql/bin/mysql
设置密码/usr/local/mysql/mysqladmin –u root password password
测试 /usr/loca/mysql/mysql –u root –p
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY ‘zabbix’ WITH GRANT OPTION;
2>安装fping
./configure && make && make install
3>安装net-snmp
./configure --prefix=/usr/local/net-snmp- -disable-debugging --enable-developer --enable-mfd-rewrites
cp EXAMPLE.conf /usr/server/snmpd/share/snmp/snmpd.conf
4>安装 zabbix
./configure --enable-server --enable-proxy --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
配置参数说明
;
--enable-server 安装 Zabbix Server
--enable-proxy 安装 Zabbix Proxy
--enable-agent 安装 Zabbix Agent
--with-mysql 使用 mysql 做数据库服务器
--with-net-snmp 支持 SNMP
--with-libcurl 支持 curl,用于 web 监控
出现Curl library not found 安装 curl-devel
重新编译为
5>复制配置文件:
mkdir /etc/zabbix cp misc/conf/*.conf /etc/zabbix/6>生成启动脚本
cp misc/init.d/redhat/zabbix_* /usr/local/zabbix/bin/
编辑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
启动之前把net-snmpd和mysql的库路径加入ldconfig,否则会报错:
启动出错如图所示
7>配置web界面:
复制网页文件到web路径:
cp php.ini-dist /usr/local/lib/php.ini
编辑php.ini文件:
max_execution_time = 300 ==> 修改为600 #大约255行。
max_input_time = 120 ==>修改为600 #大约256行。
memory_limit = 128M ==>修改为256M #大约258行。
post_max_size = 8M ==> 修改为32M #大约439行。
upload_max_filesize = 10M ==>修改为16M #大约555行。
;date.timezone = ==>去掉注释在
启php-fpm,apache的话就重启httpd。
在最后测试时出现如下的问题
Call to undefined function mysql_connect()
php没有编译到支持mysql pdo功能
可是即使我重新编译,仍然不行,发现在编译ZABBIX时,没有先将其导入数据
当登录时出现timezone ,可是无论设置都不生效
cp /usr/local/php5/lib/php/php.ini /usr/local/php5/lib 就好了
登录时的默认用户密码为admin/zabbix
第二次安装笔记
安装mysql
groupadd mysql
useradd -g mysql mysql
tar -zxvf mysql-5.1.44.tar.gz
cd mysql-5.1.44
./configure --prefix=/usr/local/mysql
make
make install
mkdir /usr/local/mysql/etc
cp /usr/local/src/mysql-5.1.44/support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf
chown –R root /usr/local/mysql
chown –R mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --user=mysql
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf --user=mysql &
测试:
/usr/local/mysql/bin/mysql -u root –p
mysql> show databases;
安装PHP
tar -zxvf php-5.2.13.tar.gz
cd php-5.2.13
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-gd --enable-bcmath --enable-mbstring --with-xml --with-png-dir=/usr --enable-sockets --with-apxs2=/usr/local/httpd/bin/apxs --enable-maintainer-zts
make
make install
安装apache
./configure --prefix=/usr/local/httpd --datadir=/usr/local/httpd/var/ --with-mpm=worker
LoadModule php5_module modules/libphp5.so
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php5
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php-source .php5s
DirectoryIndex index.php DirectoryIndex index.php5
</IfModule>
cat mysql.sql | /usr/local/mysql/bin/mysql -u root -p Zabbix
cat data.sql |/usr/local/mysql/bin/mysql -u root -p Zabbix
cat images_mysql.sql |/usr/local/mysql/bin/mysql -u root -p Zabbix
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
echo /usr/local/mysql/lib/mysql/ >>/etc/ld.so.conf
ldconfig
/usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf
/usr/local/httpd/bin/httpd -f /usr/local/httpd/etc/httpd.conf
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf &
转载于:https://blog.51cto.com/pablopan/352952