centos上部署zabbix

zabbix 安装:

1.获取安装包:
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.5/zabbix-2.0.5.tar.gz/download

1.安装lamp环境:
apache:
安装apache:
yum install httpd
启动apache:
service httpd start

php:
yum install php.x86_64 php-bcmath.x86_64 php-gd.x86_64

yum install php-mbstring

yum install php-xml



安装 MySQL
yum install mysql-server.x86_64 mysql.x86_64 php-mysql.x86_64 

service mysqld start


设置 MySQL root 密码

mysqladmin -uroot -p password 123456 

Enter password: 输入旧密码(如果是第一次设置,root 默认密码为空,直接回车)

设置MySQL开机自动启动


设置MySQL开机自动启动

chkconfig --add mysqld 

chkconfig --level 345 mysqld on 




2. 安装用于编译 Zabbix 的软件及库

安装 MySQL 的头文件及库文件

yum install mysql-devel.x86_64 

安装 net-snmp

yum install net-snmp.x86_64 net-snmp-devel.x86_64 net-snmp-utils.x86_64 

安装 curl

yum install curl.x86_64 curl-devel.x86_64 

安装 gcc

yum install gcc.x86_64 libgcc.i386 libgcc.x86_64 

安装 make

yum install make 




3. 编译安装 zabbix

从 zabbix 的官网上下载 源代码,上传到虚拟机,开始解压编译

解压缩

tar -zxvf zabbix-2.0.4.tar.gz

编译安装 zabbix ,注意要连同 agent 一起编译

./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl 

make install 




创建 zabbix 用户

useradd -d /home/zabbix -p zabbix zabbix 



进入 zabbix 解压缩后的目录,创建 zabbix 数据库

mysql -uroot -p123456 

create database zabbix character set utf8;

quit; 


# cd database/mysql
# cat schema.sql| mysql -u root -p123456 zabbix
# cat images.sql | mysql -u root -p123456 zabbix
# cat data.sql | mysql -u root -p123456 zabbix


zabbix-agent 10050/tcp Zabbix Agent 
zabbix-agent 10050/udp Zabbix Agent 
zabbix-trapper 10051/tcp Zabbix Trapper 
zabbix-trapper 10051/udp Zabbix Trapper





6.配置 zabbix server

出于安全的考虑,使用 zabbix 用户登录启动 zabbix server 和 zabbix agentd

/usr/local/sbin/zabbix_server 

/usr/local/sbin/zabbix_agentd 

使用浏览器登陆到 zabbix server

http:///index.php

会出现如下配置服务器界面


一路 next 进入配置检查页面,会发现 PHP max execution 和PHP Timezone 两项检查失败,


修改 /etc/php.ini ,修改以下两项

max_execution_time = 300

date.timezone = Asia/Chongqing 







配置:

邮件配置:




客户端安装:
wget http://www.zabbix.com/downloads/2.0.4/zabbix_agents_2.0.4.linux2_6.i386.tar.gz


groupadd zabbix
useradd -g zabbix


解压:
mkdir /usr/local/zabbix
cd /usr/local/zabbix
wget -c http://www.zabbix.com/downloads/2.0.4/zabbix_agents_2.0.4.linux2_6.i386.tar.gz
tar zxf zabbix_agents_2.0.4.linux2_6.i386.tar.gz


接下来,需要对angent进行一些配置
Server安装产生的配置文件位于:zabbix安装目录/etc/zabbix_agentd.conf
agent package产生的配置文件位于:zabbix目录/conf/zabbix_agentd.conf


#主要需要配置的内容为:
     Server=172.16.103.230            #指定Server端的IP地址
     Hostname=eyou60                  #本机的hostname
#其他一些配置:
     PidFile=/tmp/zabbix_agentd.pid   #pid文件设定
     LogFile=/tmp/zabbix_agentd.log   #日志文件设置
     LogFileSize=10                   #设定单个日志文件的最大大小(单位为M)
     ListenPort=10050                 #agentd监听端口
     ListenIP=172.16.100.60           #监听IP。默认是对本机的所有进行监听,按需设置
     #另外不得不说的一个配置是UserParameter,可以通过这个配置实现自定义监控项目,非常实用的一个配置项,在后面具体使用过程中再介绍它。

     #配置基本上足够了,如果有别的需求可以自行查看zabbix_agentd.conf文档中的具体说明再按需配置
复制zabbix_agentd启动脚本到/etc/init.d中并修改好路径信息

启动agentd


service zabbix_agentd start





zabbix 收不到邮件:
Archive for the ‘postfix’ Category

Connect to googlemail.com[IPv6 IP]:25: Network is unreachable Gmail
without comments



relay=none, delay=508, delays=508/0.02/0.02/0, dsn=4.4.1, status=deferred (connect to aspmx2.googlemail.com[IPv6 Address]:25: Network is unreachable)
If anyone is getting the above message or similar it’s being caused by Gmail now accepting mail over IPv6 and your server is failing to connect to their server for some reason to fix this in postfix I simply forced it to use IPv4 until I have the time to spend setting up IPv6 mail.

In postfix open:

/etc/postfix/main.cf
Set Postfix IPv4 Only
Find the line starting with “inet_protocols” and make sure it reads:

inet_protocols=ipv4
(On CentOS the default was inet_protocols=all)

Restart  or reload Postfix.

/etc/init.d/postfix reload
You might want to flush the mail queue in Postfix or just wait and mail will start to send, note you will probably have backed up email.


猜你喜欢

转载自mark-ztw.iteye.com/blog/1821056