Zabbix Server 3.0.7 Centos6.5编译安装

前言

服务器上线对于云服务商来说已经做得非常的完成,各种主机的监控数据。直观的反应服务器的运行状态、负载等,如AWS、Aliyun等。有时候需要对具体的程序进行监控如JVM MySQL Redis等,尝试了Zabbix 、Negios这两个监控解决方案,在此记录下编译安装过程。

环境

-系统:centos6.5
-软件:Zabbix 3.0.7 源码

前提

  • selinux状态关闭
vi /etc/selinux/config
SELINUX=disabled
#重启服务器
  • 下载zabbix 3.0.7 安装包
cd /tmp
wget http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.7/zabbix-3.0.7.tar.gz
tar -zxvf zabbix-3.0.7.tar.gz
#配置my.cnf
[mysqld]
innodb_file_per_table=1
  • 编译环境
yum -y install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel
  • 安装PHP5.6 及Httpd
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

yum -y install httpd php56w php56w-gd php56w-mysqlnd php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

#配置php.ini
vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1

#配置httpd.conf
vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
DirectoryIndex index.html index.html.var index.php

Zabbix Installation

  • 创建zabbix 用户组和用户
groupadd zabbix
useradd -g zabbix zabbix
  • 编译及安装
    将zabbix 安装到/usr/local/zabbix下
cd /tmp/zabbix-3.0.7/

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --enable-java --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix

make install
  • 修改配置文件zabbix_server.conf
vim /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
  • 安装前端Web
#创建前端Web文件
mkdir /var/www/html/zabbix

cd /tmp/zabbix-3.0.7/frontends/php/
cp -a . /var/www/html/zabbix/

#设置apache的执行和所有者
chown -R apache:apache /var/www/html/zabbix

#赋予可执行权限
chmod +x /var/www/html/zabbix/conf/
  • 添加Zabbix服务器和Zabbix代理启动脚本
cp /tmp/zabbix-3.0.7/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp /tmp/zabbix-3.0.7/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd

#修改 /etc/init.d/zabbix_server /etc/init.d/zabbix_agentd的BASEDIR=/usr/local/为BASEDIR=/usr/local/zabbix
  • 导入数据库
    登录数据库,创建zabbix用户并导入模板db
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+

use zabbix;

source /tmp/zabbix-3.0.7/database/mysql/schema.sql;
source /tmp/zabbix-3.0.7/database/mysql/data.sql;
source /tmp/zabbix-3.0.7/database/mysql/images.sql;

show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
| auditlog_details           |
| autoreg_host               |
| conditions                 |
| config                     |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| groups                     |
| history                    |
| history_log                |
| history_str                |
| history_text               |
| history_uint               |
| host_discovery             |
| host_inventory             |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| httpstep                   |
| httpstepitem               |
| httptest                   |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| item_application_prototype |
| item_condition             |
| item_discovery             |
| items                      |
| items_applications         |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| mappings                   |
| media                      |
| media_type                 |
| opcommand                  |
| opcommand_grp              |
| opcommand_hst              |
| opconditions               |
| operations                 |
| opgroup                    |
| opinventory                |
| opmessage                  |
| opmessage_grp              |
| opmessage_usr              |
| optemplate                 |
| profiles                   |
| proxy_autoreg_host         |
| proxy_dhistory             |
| proxy_history              |
| regexps                    |
| rights                     |
| screen_user                |
| screen_usrgrp              |
| screens                    |
| screens_items              |
| scripts                    |
| service_alarms             |
| services                   |
| services_links             |
| services_times             |
| sessions                   |
| slides                     |
| slideshow_user             |
| slideshow_usrgrp           |
| slideshows                 |
| sysmap_element_url         |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| timeperiods                |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
+----------------------------+
113 rows in set (0.00 sec)

exit
  • 启动及开机自启动
#启动
/etc/init.d/httpd start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

# 开机自启动
chkconfig httpd on
chkconfig --add /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_agentd
chkconfig zabbix_server on
chkconfig zabbix_agentd on

安装完成后,登陆:
用户名:Admin
密码:zabbix

至此,Zabbix Server和本地agent已经安装完成。登录后进行简单的配置,就可以清楚的看到本台机器的相关监控信息。

参考:http://www.cnblogs.com/zzzhfo/p/5820321.html
http://www.linuxidc.com/Linux/2016-07/132897.htm
http://blog.chinaunix.net/uid-25266990-id-3380929.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mingjie1212

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值