原创文章,转载请注明出处,谢谢。
分类: LINUX
2014-02-27 15:00:15
简介:
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
被监控端:主机通过安装agent方式采集数据,网络设备通过SNMP方式采集数据
Server端:通过收集SNMP和agent发送的数据,写入MySQL数据库,再通过php+apache在web前端展示。
它可以运行在Linux, Unix,Windows等平台上。ZabbixServer需要运行在LAMP环境。
特点:
- 支持多语言(包括中文)
- 免费开源
- 自动发现服务器与网络设备
- 分布式监视以及WEB集中管理功能
- 可以无agent监视
- 用户安全认证和柔软的授权方式
- 通过WEB界面设置或查看监视结果
- email等通知功能
Zabbix主要功能:
- CPU负荷
- 内存使用
- 磁盘使用
- 网络状况
- 端口监视
- 日志监视
一、安装LAMP
1、Apache安装
[root@zx tools]# tar xvf httpd-2.2.22.tar.bz2
[root@zx tools]# cd httpd-2.2.22
[root@zx tools]# "./configure" \
"--prefix=/opt/apps/apache2" \
"--with-mpm=worker" \
"--with-included-apr" \
"--enable-so" \
"--enable-speling" \
"--enable-headers" \
"--enable-proxy" \
"--enable-usertrack" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--disable-userdir" \
"$@"
[root@zx tools]# make
[root@zx tools]# mak install
[root@zx bin]# cpapachectl /etc/init.d/apache
[root@zx bin]# vi /etc/init.d/apache
添加
......
# chkconfig: 35 85 15
# description: Apache is a World Wide Web Server
......
[root@zx bin]# chkconfig --add apache
[root@zx bin]# chkconfig apache on
[root@zx bin]# service apache start
[root@zx bin]#
2、Mysql安装
[root@zx tools]# useradd -M -s /sbin/nologinmysql
[root@zx tools]# mkdir -p /opt/apps/mysql/data/mysql
[root@zx tools]# tar zxvf mysql-5.1.51.tar.gz
[root@zx tools]# cd mysql-5.1.51
[root@zx mysql-5.1.51]# ./configure \
--prefix=/opt/apps/mysql \
--with-charset=utf8
[root@zx mysql-5.1.51]# make
[root@zx mysql-5.1.51]# make install
[root@zx mysql-5.1.51]# cd /opt/apps/mysql/
[root@zxmysql]# chown -R mysql:mysql *
[root@zxmysql]# /opt/apps/mysql/bin/mysql_install_db \
--user=mysql
[root@zxmysql]# chown -R mysql /opt/apps/mysql/var/
[root@zxmysql]# cp share/mysql/my-medium.cnf /etc/my.cnf
[root@zxmysql]# cp \
/opt/apps/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[root@zxmysql]# chmod 755 /etc/init.d/mysqld
[root@zxmysql]# echo \
"PATH=$PATH:/opt/apps/mysql/bin/" >>/etc/profile
[root@zxmysql]# source /etc/profile
[root@zxmysql]# chkconfig --level 24 mysqld off
[root@zxmysql]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@zxmysql]# echo "/opt/apps/mysql/lib/mysql/" >>
/etc/ld.so.conf
[root@zxmysql]# ldconfig
[root@zx ~]# service mysqld start
Starting MySQL. [ OK ]
……
#创建zabbix账号:
mysql> use mysql;
Database changed
mysql> grant all on zabbix.* to zabbix@localhost identified by '1q2w3e';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
3、PHP安装
[root@zxetc]# yum -y install php-gdphp-xml php-mbstringphp-ldapphp-pear php-xmlrpcphp-bcmath --安装php扩展
[root@zx tools]# tar zxvf php-5.4.5.tar.gz
[root@zx tools]# cd php-5.4.5
[root@zx php-5.4.5]# ./configure
--prefix=/opt/apps/php5 \
--enable-mbstring \
--with-apxs2=/opt/apps/apache2/bin/apxs \
--with-mysql=/opt/apps/mysql \
--with-config-file-path=/opt/apps/php5/etc \
--with-gd=/opt/apps/gd2 \
--with-jpeg-dir \
--with-freetype-dir \
--enable-gd-native-ttf
[root@zx php-5.4.5]# make
[root@zx php-5.4.5]# make install
[root@zx php-5.4.5]# cp php.ini-dist /opt/apps/php5/etc/php.ini
二、整合和测试
1、Apache 和PHP整合
# vi httpd.conf
LoadModule php5_module modules/libphp5.so 确认这行的存在,如果没有就重新编译php
AddType application/x-httpd-php .php 添加这行记录
DirectoryIndexindex.php index.html 在这行添加关于php格式的首页
2、PHP测试
[root@zxhtdocs]# touch a.php
[root@zxhtdocs]# vi a.php
…
phpinfo();
?>
…
--打开测试
3、Mysql测试
[root@zxhtdocs]# touch adb.php
[root@zxhtdocs]# vi adb.php
…
$link=mysql_connect("localhost","root","1q2w3e");
if(!$link) echo "失败!";
else echo "成功!";
mysql_close();
?>
--打开测试
三、安装和配置Zabbix
1、安装Zabbix Server
[root@zx ~]# groupaddzabbix
[root@zx ~]# useradd -g zabbix -s /sbin/nologinzabbix
[root@zx tools]# tar zxvf zabbix-2.2.1.tar.gz
[root@zx tools]# cd zabbix-2.2.1
[root@zx zabbix-2.2.1]# ./configure --prefix=/opt/apps/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
./configure --prefix=/opt/apps/zabbix --enable-server --enable-agent --with-mysql=/opt/apps/mysql/bin/mysql_config --with-net-snmp --with-libcurl
[root@zx zabbix-2.2.1]# make
[root@zx zabbix-2.2.1]# make install
常用参数说明
--enable-server #安装zabbix server
--enable-proxy #安装zabbix proxy
--enable-agent #安装zabbix agent(如果不监控本机也可以不装)
--with-mysql #使用mysql做数据库
--with-net-snmp #支持snmp协议
--with-libcurl #支持curl,用于web服务监控
2、导入数据库
[root@zx zabbix-2.2.1]# mysql -uroot -p1q2w3e zabbix< database/mysql/schema.sql
[root@zx zabbix-2.2.1]# mysql -uroot -p1q2w3e zabbix< database/mysql/images.sql
[root@zx zabbix-2.2.1]# mysql -uroot -p1q2w3e zabbix< database/mysql/data.sql
[root@zx zabbix-2.2.1]#
4、定义服务端口
[root@zx zabbix-2.2.1]# vi /etc/services
... ...
zabbix-agent 10050/tcp #zabbixagent
zabbix-agen 10050/udp #zabbix agent
zabbix-trapper 10051/tcp #zabbix trapper
zabbix-trapper 10051/udp #zabbix trapper
5、修改配置文件
[root@zx zabbix-2.2.1]# cpmisc/init.d/fedora/core/zabbix_server /etc/init.d/
[root@zx zabbix-2.2.1]# cpmisc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@zx zabbix-2.2.1]# cp -R frontends/php/ /opt/apps/iapps/htdocs/zabbix
[root@zx zabbix-2.2.1]# vi /opt/apps/zabbix/etc/zabbix_server.conf
sed -i 's/^DBUser=.*$/DBUser=root/g' /opt/apps/zabbix/etc/zabbix_server.conf
sed -i 's/^.*DBPassword=.*$/DBPassword=1q2w3e/g' /opt/apps/zabbix/etc/zabbix_server.conf
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
[root@zxetc]# grep -v '^#' zabbix_server.conf |grep -v '^$'
LogFile=/opt/apps/zabbix/logs/zabbix_server.log
DBName=zabbix
DBUser=root
DBPassword=1q2w3e
DBSocket=/tmp/mysql.sock
ListenIP=127.0.0.1
... ...
LogFile=/opt/apps/zabbix/logs/zabbix_server.log
DBName=zabbix
DBUser=root
DBPassword=1q2w3e
DBSocket=/tmp/mysql.sock
ListenIP=127.0.0.1
... ...
[root@zx zabbix-2.2.1]# vi /opt/apps/zabbix/etc/zabbix_agent.conf
ServerActive=10.9.11.111
Server=10.9.11.111
6、加入系统服务
[root@zxzabbix]# /etc/init.d/zabbix_server start
[root@zxzabbix]# /etc/init.d/zabbix_agentd start
[root@zxzabbix]# chkconfig --add zabbix_server
[root@zxzabbix]# chkconfigzabbix_server on
[root@zxzabbix]# chkconfig --add zabbix_agentd
[root@zxzabbix]# chkconfigzabbix_agentd on
备注说明:(个人zabbix安装目录为/opt/apps/zabbix,和默认的不一样。需要修改,不然会报错)
[root@zxinit.d]# vi zabbix_server
#BASEDIR=/usr/local
BASEDIR=/opt/apps/zabbix
[root@zxinit.d]# vi zabbix_agentd
#BASEDIR=/usr/local
BASEDIR=/opt/apps/zabbix/
Starting zabbix_server: /etc/init.d/functions: line 500: /opt/apps/sbin/sbin/zabbix_server: No such file or directory
Starting zabbix_agentd: /etc/init.d/functions: line 500: /opt/apps/sbin/sbin/zabbix_agentd: No such file or directory
[root@zxetc]# netstat -ntlp|grepzabbix
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 29828/zabbix_agentd
tcp 0 0 127.0.0.1:10051 0.0.0.0:* LISTEN 29758/zabbix_server
[root@zxetc]# vi
php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
[root@zxetc]# /opt/apps/apache2/bin/apachectl -k restart
提示zabbix.conf.php配置文件创建失败,我们需要点击Downloadconfiguretionfile下载这个配置文件,然后上传到/opt/apps/iapps/htdocs/zabbix/conf/目录,然后重试就行了。
username:admin
Password:zabbix
Error:
checking whether build environment is sane... configure:error: newly created file is older than distributed files!
Check your system clock
[root@zx zabbix-2.2.1]# date -s "2013/12/26 17:38:00"
configure error curl library not found zabbix
[root@zx zabbix-2.2.1]# yum -y install curl-devel
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
[root@zx zabbix-2.2.1]# yum -y install net-snmp*
cannot send list of active checks to [127.0.0.1]: host [Zabbix server] not monitored
加载PHP下gettext模块:
[root@zxhtdocs]# cd /opt/apps/tools/php-5.4.5/ext/gettext/
[root@zxgettext]# /opt/apps/php5/bin/phpize
[root@zxgettext]# ./configure --with-php-config=/opt/apps/php5/bin/php-config
[root@zxgettext]# make
[root@zxgettext]# make install
...
install ... ...
...
[root@zx sockets]# ls modules/
gettext.so
[root@zxgettext]# vi /opt/apps/php5/lib/php.ini
extensioni = "/opt/apps/php5/lib/php/extensions/no-debug-zts-20100525/gettext.so"
sockets模块:
[root@zx sockets]# /opt/apps/php5/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@zx sockets]# ./configure --with-php-config=/opt/apps/php5/bin/php-config
[root@zx sockets]# make
[root@zx sockets]# make install
...
install ... ...
...
[root@zx sockets]# ls modules/
sockets.so
gd模块:
[root@zxgd]# cd /opt/apps/tools/php-5.4.5/ext/gd/
[root@zxgd]# /opt/apps/php5/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@zxgd]# ./configure --with-php-config=/opt/apps/php5/bin/php-config
[root@zxgd]# make
[root@zxgd]# make install
mysqli模块:
[root@zxmysqli]# cd /opt/apps/tools/php-5.4.5/ext/mysqli
[root@zxmysqli]# /opt/apps/php5/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@zxmysqli]# ./configure --with-php-config=/opt/apps/php5/bin/php-config--with-mysqli=/opt/apps/mysql/bin/mysql_config
[root@zxmysqli]# make
[root@zxmysqli]# make install
1.1安装apache扩展
# yum -y install httpd-manual mod_sslmod_perlmod_auth_mysql
1.2安装php扩展
# yum -y install php-gdphp-xml php-mbstringphp-ldapphp-pear php-xmlrpcphp-bcmath
1.3安装mysql扩展
# yum -y install mysql-connector-odbcmysql-devellibdbi-dbd-mysql
DBName=zabbixzabbix 所属数据库名称
DBUser=zabbixzabbix 所属数据库用户
DBPassword=xxxxxxxx 数据库密码
StartPollers=30 轮询的初始值(0-1000)
StartIPMIPollers=4 IPMI轮询的初始值(0-1000)
StartPollersUnreachable=30 轮询不可达的主机数(包括IPMI 0-1000)
StartTrappers=8 捕获的初始值(0-1000)
StartPingers=4 ping 的初始值(0-1000)
StartDiscoverers=0 自动发现的初始值(0-250)
CacheSize=384M 缓存大小
CacheUpdateFrequency=300 缓存更新的频率
StartDBSyncers=8 数据库同步时间
TrendCacheSize=128M 总趋势缓存大小
AlertScriptsPath=/usr/bin 脚本的存放位置
LogSlowQueries=1000 日志慢查询设定
zabbix如何使用:
安装部署好的zabbix已经可以正常使用基础监控功能了,例如cpu,内存,硬盘占用率这些。如何监控到应用层,还需要自定义监控项
要理解自定义监控项必须先理解三个概念:
模板(
简介:
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
被监控端:主机通过安装agent方式采集数据,网络设备通过SNMP方式采集数据
Server端:通过收集SNMP和agent发送的数据,写入MySQL数据库,再通过php+apache在web前端展示。
它可以运行在Linux, Unix,Windows等平台上。ZabbixServer需要运行在LAMP环境。
特点:
- 支持多语言(包括中文)
- 免费开源
- 自动发现服务器与网络设备
- 分布式监视以及WEB集中管理功能
- 可以无agent监视
- 用户安全认证和柔软的授权方式
- 通过WEB界面设置或查看监视结果
- email等通知功能
Zabbix主要功能:
- CPU负荷
- 内存使用
- 磁盘使用
- 网络状况
- 端口监视
- 日志监视
一、安装LAMP
1、Apache安装
[root@zx tools]# tar xvf httpd-2.2.22.tar.bz2
[root@zx tools]# cd httpd-2.2.22
[root@zx tools]# "./configure" \
"--prefix=/opt/apps/apache2" \
"--with-mpm=worker" \
"--with-included-apr" \
"--enable-so" \
"--enable-speling" \
"--enable-headers" \
"--enable-proxy" \
"--enable-usertrack" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--disable-userdir" \
"$@"
[root@zx tools]# make
[root@zx tools]# mak install
[root@zx bin]# cpapachectl /etc/init.d/apache
[root@zx bin]# vi /etc/init.d/apache
添加
......
# chkconfig: 35 85 15
# description: Apache is a World Wide Web Server
......
[root@zx bin]# chkconfig --add apache
[root@zx bin]# chkconfig apache on
[root@zx bin]# service apache start
[root@zx bin]#
2、Mysql安装
[root@zx tools]# useradd -M -s /sbin/nologinmysql
[root@zx tools]# mkdir -p /opt/apps/mysql/data/mysql
[root@zx tools]# tar zxvf mysql-5.1.51.tar.gz
[root@zx tools]# cd mysql-5.1.51
[root@zx mysql-5.1.51]# ./configure \
--prefix=/opt/apps/mysql \
--with-charset=utf8
[root@zx mysql-5.1.51]# make
[root@zx mysql-5.1.51]# make install
[root@zx mysql-5.1.51]# cd /opt/apps/mysql/
[root@zxmysql]# chown -R mysql:mysql *
[root@zxmysql]# /opt/apps/mysql/bin/mysql_install_db \
--user=mysql
[root@zxmysql]# chown -R mysql /opt/apps/mysql/var/
[root@zxmysql]# cp share/mysql/my-medium.cnf /etc/my.cnf
[root@zxmysql]# cp \
/opt/apps/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[root@zxmysql]# chmod 755 /etc/init.d/mysqld
[root@zxmysql]# echo \
"PATH=$PATH:/opt/apps/mysql/bin/" >>/etc/profile
[root@zxmysql]# source /etc/profile
[root@zxmysql]# chkconfig --level 24 mysqld off
[root@zxmysql]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@zxmysql]# echo "/opt/apps/mysql/lib/mysql/" >>
/etc/ld.so.conf
[root@zxmysql]# ldconfig
[root@zx ~]# service mysqld start
Starting MySQL. [ OK ]
……
#创建zabbix账号:
mysql> use mysql;
Database changed
mysql> grant all on zabbix.* to zabbix@localhost identified by '1q2w3e';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
3、PHP安装
[root@zxetc]# yum -y install php-gdphp-xml php-mbstringphp-ldapphp-pear php-xmlrpcphp-bcmath --安装php扩展
[root@zx tools]# tar zxvf php-5.4.5.tar.gz
[root@zx tools]# cd php-5.4.5
[root@zx php-5.4.5]# ./configure
--prefix=/opt/apps/php5 \
--enable-mbstring \
--with-apxs2=/opt/apps/apache2/bin/apxs \
--with-mysql=/opt/apps/mysql \
--with-config-file-path=/opt/apps/php5/etc \
--with-gd=/opt/apps/gd2 \
--with-jpeg-dir \
--with-freetype-dir \
--enable-gd-native-ttf
[root@zx php-5.4.5]# make
[root@zx php-5.4.5]# make install
[root@zx php-5.4.5]# cp php.ini-dist /opt/apps/php5/etc/php.ini
二、整合和测试
1、Apache 和PHP整合
# vi httpd.conf
LoadModule php5_module modules/libphp5.so 确认这行的存在,如果没有就重新编译php
AddType application/x-httpd-php .php 添加这行记录
DirectoryIndexindex.php index.html 在这行添加关于php格式的首页
2、PHP测试
[root@zxhtdocs]# touch a.php
[root@zxhtdocs]# vi a.php
…
phpinfo();
?>
…
--打开测试
3、Mysql测试
[root@zxhtdocs]# touch adb.php
[root@zxhtdocs]# vi adb.php
…
$link=mysql_connect("localhost","root","1q2w3e");
if(!$link) echo "失败!";
else echo "成功!";
mysql_close();
?>
--打开测试
三、安装和配置Zabbix
1、安装Zabbix Server
[root@zx ~]# groupaddzabbix
[root@zx ~]# useradd -g zabbix -s /sbin/nologinzabbix
[root@zx tools]# tar zxvf zabbix-2.2.1.tar.gz
[root@zx tools]# cd zabbix-2.2.1
[root@zx zabbix-2.2.1]# ./configure --prefix=/opt/apps/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
./configure --prefix=/opt/apps/zabbix --enable-server --enable-agent --with-mysql=/opt/apps/mysql/bin/mysql_config --with-net-snmp --with-libcurl
[root@zx zabbix-2.2.1]# make
[root@zx zabbix-2.2.1]# make install
常用参数说明
--enable-server #安装zabbix server
--enable-proxy #安装zabbix proxy
--enable-agent #安装zabbix agent(如果不监控本机也可以不装)
--with-mysql #使用mysql做数据库
--with-net-snmp #支持snmp协议
--with-libcurl #支持curl,用于web服务监控
2、导入数据库
[root@zx zabbix-2.2.1]# mysql -uroot -p1q2w3e zabbix< database/mysql/schema.sql
[root@zx zabbix-2.2.1]# mysql -uroot -p1q2w3e zabbix< database/mysql/images.sql
[root@zx zabbix-2.2.1]# mysql -uroot -p1q2w3e zabbix< database/mysql/data.sql
[root@zx zabbix-2.2.1]#
4、定义服务端口
[root@zx zabbix-2.2.1]# vi /etc/services
... ...
zabbix-agent 10050/tcp #zabbixagent
zabbix-agen 10050/udp #zabbix agent
zabbix-trapper 10051/tcp #zabbix trapper
zabbix-trapper 10051/udp #zabbix trapper
5、修改配置文件
[root@zx zabbix-2.2.1]# cpmisc/init.d/fedora/core/zabbix_server /etc/init.d/
[root@zx zabbix-2.2.1]# cpmisc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@zx zabbix-2.2.1]# cp -R frontends/php/ /opt/apps/iapps/htdocs/zabbix
[root@zx zabbix-2.2.1]# vi /opt/apps/zabbix/etc/zabbix_server.conf
sed -i 's/^DBUser=.*$/DBUser=root/g' /opt/apps/zabbix/etc/zabbix_server.conf
sed -i 's/^.*DBPassword=.*$/DBPassword=1q2w3e/g' /opt/apps/zabbix/etc/zabbix_server.conf
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
[root@zxetc]# grep -v '^#' zabbix_server.conf |grep -v '^$'
LogFile=/opt/apps/zabbix/logs/zabbix_server.log
DBName=zabbix
DBUser=root
DBPassword=1q2w3e
DBSocket=/tmp/mysql.sock
ListenIP=127.0.0.1
... ...
LogFile=/opt/apps/zabbix/logs/zabbix_server.log
DBName=zabbix
DBUser=root
DBPassword=1q2w3e
DBSocket=/tmp/mysql.sock
ListenIP=127.0.0.1
... ...
[root@zx zabbix-2.2.1]# vi /opt/apps/zabbix/etc/zabbix_agent.conf
ServerActive=10.9.11.111
Server=10.9.11.111
6、加入系统服务
[root@zxzabbix]# /etc/init.d/zabbix_server start
[root@zxzabbix]# /etc/init.d/zabbix_agentd start
[root@zxzabbix]# chkconfig --add zabbix_server
[root@zxzabbix]# chkconfigzabbix_server on
[root@zxzabbix]# chkconfig --add zabbix_agentd
[root@zxzabbix]# chkconfigzabbix_agentd on
备注说明:(个人zabbix安装目录为/opt/apps/zabbix,和默认的不一样。需要修改,不然会报错)
[root@zxinit.d]# vi zabbix_server
#BASEDIR=/usr/local
BASEDIR=/opt/apps/zabbix
[root@zxinit.d]# vi zabbix_agentd
#BASEDIR=/usr/local
BASEDIR=/opt/apps/zabbix/
Starting zabbix_server: /etc/init.d/functions: line 500: /opt/apps/sbin/sbin/zabbix_server: No such file or directory
Starting zabbix_agentd: /etc/init.d/functions: line 500: /opt/apps/sbin/sbin/zabbix_agentd: No such file or directory
[root@zxetc]# netstat -ntlp|grepzabbix
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 29828/zabbix_agentd
tcp 0 0 127.0.0.1:10051 0.0.0.0:* LISTEN 29758/zabbix_server
Fail失败之处是PHP没有满足Zabbix要求。
[root@zxetc]# vi php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
[root@zxetc]# /opt/apps/apache2/bin/apachectl -k restart
提示zabbix.conf.php配置文件创建失败,我们需要点击Downloadconfiguretionfile下载这个配置文件,然后上传到/opt/apps/iapps/htdocs/zabbix/conf/目录,然后重试就行了。
username:admin
Password:zabbix
Error:
checking whether build environment is sane... configure:error: newly created file is older than distributed files!
Check your system clock
[root@zx zabbix-2.2.1]# date -s "2013/12/26 17:38:00"
configure error curl library not found zabbix
[root@zx zabbix-2.2.1]# yum -y install curl-devel
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
[root@zx zabbix-2.2.1]# yum -y install net-snmp*
cannot send list of active checks to [127.0.0.1]: host [Zabbix server] not monitored
加载PHP下gettext模块:
[root@zxhtdocs]# cd /opt/apps/tools/php-5.4.5/ext/gettext/
[root@zxgettext]# /opt/apps/php5/bin/phpize
[root@zxgettext]# ./configure --with-php-config=/opt/apps/php5/bin/php-config
[root@zxgettext]# make
[root@zxgettext]# make install
...
install ... ...
...
[root@zx sockets]# ls modules/
gettext.so
[root@zxgettext]# vi /opt/apps/php5/lib/php.ini
extensioni = "/opt/apps/php5/lib/php/extensions/no-debug-zts-20100525/gettext.so"
sockets模块:
[root@zx sockets]# /opt/apps/php5/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@zx sockets]# ./configure --with-php-config=/opt/apps/php5/bin/php-config
[root@zx sockets]# make
[root@zx sockets]# make install
...
install ... ...
...
[root@zx sockets]# ls modules/
sockets.so
gd模块:
[root@zxgd]# cd /opt/apps/tools/php-5.4.5/ext/gd/
[root@zxgd]# /opt/apps/php5/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@zxgd]# ./configure --with-php-config=/opt/apps/php5/bin/php-config
[root@zxgd]# make
[root@zxgd]# make install
mysqli模块:
[root@zxmysqli]# cd /opt/apps/tools/php-5.4.5/ext/mysqli
[root@zxmysqli]# /opt/apps/php5/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@zxmysqli]# ./configure --with-php-config=/opt/apps/php5/bin/php-config--with-mysqli=/opt/apps/mysql/bin/mysql_config
[root@zxmysqli]# make
[root@zxmysqli]# make install
1.1安装apache扩展
# yum -y install httpd-manual mod_sslmod_perlmod_auth_mysql
1.2安装php扩展
# yum -y install php-gdphp-xml php-mbstringphp-ldapphp-pear php-xmlrpcphp-bcmath
1.3安装mysql扩展
# yum -y install mysql-connector-odbcmysql-devellibdbi-dbd-mysql
DBName=zabbixzabbix 所属数据库名称
DBUser=zabbixzabbix 所属数据库用户
DBPassword=xxxxxxxx 数据库密码
StartPollers=30 轮询的初始值(0-1000)
StartIPMIPollers=4 IPMI轮询的初始值(0-1000)
StartPollersUnreachable=30 轮询不可达的主机数(包括IPMI 0-1000)
StartTrappers=8 捕获的初始值(0-1000)
StartPingers=4 ping 的初始值(0-1000)
StartDiscoverers=0 自动发现的初始值(0-250)
CacheSize=384M 缓存大小
CacheUpdateFrequency=300 缓存更新的频率
StartDBSyncers=8 数据库同步时间
TrendCacheSize=128M 总趋势缓存大小
AlertScriptsPath=/usr/bin 脚本的存放位置
LogSlowQueries=1000 日志慢查询设定