引自:http://www.iyunv.com/thread-62087-1-1.html
*、我的安装环境
windows10+VMware Workstation Pro12+CentOS6.5+Zabbix(该版本待定) CentOS:/home-5G,/boot-200M,swap-2G,/-13G(共20G的手动分区方案) vmware-tools环境安装详见:http://lbovinl.iteye.com/admin/blogs/2169424 桥接网络详见:http://lbovinl.iteye.com/admin/blogs/2335592 PS:要监控Tomcat需要其他配置详情待定:??
*、安装历程(root ,root,root)
yum -y install wget vim tree gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp net-snmp-devel curl-devel
*、启动httpd、mysql并设置成开机自动启动
service httpd start service mysqld start chkconfig httpd on chkconfig mysqld on
*、在iptables中放行80,10050,10051端口
iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT
*、查看防火墙结果
iptables -L -n
*、保存iptables规则
service iptables save
*、zabbix的运行需要特定的php参数支持,修改如下
sed -i "s@;date.timezone [email protected] = Asia/Shanghai@g" /etc/php.ini sed -i "s@max_execution_time = 30@max_execution_time = 300@g" /etc/php.ini sed -i "s@post_max_size = 8M@post_max_size = 32M@g" /etc/php.ini sed -i "s@max_input_time = 60@max_input_time = 300@g" /etc/php.ini sed -i "s@memory_limit = 128M@memory_limit = 128M@g" /etc/php.ini sed -i "s@;mbstring.func_overload = [email protected]_overload = 2@g" /etc/php.ini
*、修改httpd的FQDN错误,重启httpd服务
echo "ServerName localhost:80" >>/etc/httpd/conf/httpd.conf /etc/init.d/httpd restart
*、创建zabbix_server目录(以下操作目录均为该目录)
cd /home mkdir zabbix_server cd zabbix_server
*、下载zabbix-2.4.5.tar.gz
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz
*、添加zabbix用户和组
groupadd -g 201 zabbix useradd -g zabbix -u 201 -s /sbin/nologin zabbix
*、安装zabbix_server
tar xf zabbix-2.4.5.tar.gz cd zabbix-2.4.5 ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl make && make install
*、创建zabbix数据库及其表的导入
mysql -e "create database zabbix default charset utf8;" mysql -e "grant all on zabbix.* to zabbix@localhost identified by 'zabbix';" mysql -uzabbix -pzabbix zabbix<./database/mysql/schema.sql mysql -uzabbix -pzabbix zabbix<./database/mysql/images.sql mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql
*、配置软连接和启动文件信息
mkdir /var/log/zabbix chown zabbix.zabbix /var/log/zabbix ln -s /usr/local/zabbix/etc/ /etc/zabbix ln -s /usr/local/zabbix/bin/* /usr/bin/ ln -s /usr/local/zabbix/sbin/* /usr/sbin/ cp /home/zabbix_server/zabbix-2.4.5/misc/init.d/fedora/core/zabbix_* /etc/init.d chmod 755 /etc/init.d/zabbix_*
*、修改/etc/init.d目录下的zabbix_server和zabbix_agentd启动文件
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
*、修改/etc/zabbix/zabbix_server.conf
sed -i "s@DBUser=root@DBUser=zabbix@g" /etc/zabbix/zabbix_server.conf sed -i "s@#DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf sed -i "s@# DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf
*、修改/etc/zabbix/zabbix_agentd.conf,这里的IP地址写的是zabbix_server的IP地址,即192.168.**.**
sed -i "s@Server=127.0.0.1@Server=127.0.0.1,192.168.**.**@g" /etc/zabbix/zabbix_agentd.conf sed -i "s@ServerActive=127.0.0.1@ServerActive=$IP:10051@g" /etc/zabbix/zabbix_agentd.conf sed -i "s@tmp/zabbix_agentd.log@var/log/zabbix/zabbix_agentd.log@g" /etc/zabbix/zabbix_agentd.conf sed -i "s@^# UnsafeUserParameters=0@UnsafeUserParameters=1\n@g" /etc/zabbix/zabbix_agentd.conf
*、复制zabbix站点的文件到/var/www/html目录下
cp -r /home/zabbix_server/zabbix-2.4.5/frontends/php/ /var/www/html/zabbix/ chown -R apache.apache /var/www/html/zabbix/
*、配置zabbix_server和agentd开机自启动
chkconfig zabbix_server on chkconfig zabbix_agentd on
*、关闭selinux
vim /etc/sysconfig/network 改为selinux=disabled即可(永久生效,但不重启不会生效)
*、不重启实现关闭selinux从而避免zabbix server is not running的问题
setenforce 0
*、启动zabbix服务端和客户端
service zabbix_server start service zabbix_agentd start
*、通过web站点配置zabbix
配置页面:http://192.168.**.**/zabbix/setup.php
一路下一步,数据库zabbix时端口是3306,账号密码是:zabbix,zabbix,下一个页面host改为服务端IP,下一步其他默认
登陆页面:http://192.168.**.**/zabbix/index.php
用户名密码是:admin,zabbix
-----------------------------------------------如果有问题,请看这里----------------------------------------------------------
*、You need to be root to perform this command.
这说明你当前用户权限不足,su登陆root即可。
*、Error resolving pool.ntp.rog: Name or service not known
在同步时间时出现的问题,尚未解决,求解啊。
*、mysql我在安装时出现过无法登陆的问题于是乎
- yum remove mysql mysql-server mysql-libs compat-mysql51
- rm -rf /var/lib/mysql
- rm /etc/my.cnf
- 查看是否还有mysql软件:
- rpm -qa|grep mysql
- 有的话继续删除-over
- 引自:http://blog.163.com/yang_jianli/blog/static/1619900062012915115253789/
缺少组件,执行以下即可
- yum -y install wget vim tree gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp net-snmp-devel curl-devel
打开/etc/php.ini,将该项=2注释掉即可,重启httpd服务即可
*、Get value from agent failed: ZBX_TCP_READ() failed: [104] Connection reset by peer
注意注意:客户端中的配置文件的Ip是服务端的信息,移植到别的机器时一定要注意同步,而且可能需要重启电脑(之前这些操作我都做了可是还是报这个异常,但是第二天我启动服务器之后,无意中发现竟然可以监控了,哈哈)