码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix2.2 服务端安装

时间:2017-01-31 20:08:48      阅读:382      评论:0      收藏:0      [点我收藏+]

标签:zabbix

操作系统为centos6.5 64位,采用yum方式安装,操作系统能正常出公网后,建议先更新操作系统

yum -y update

如果yum 安装时错误 Errno 14 Couldn‘t resolve host需要修改DNS服务器,可以修改一下 /etc/resolv.conf

添加一个nameserver 8.8.8.8完成


 安装epel扩展源技术分享

  [root@localhost ~]#yum install -y epel-release

安装rpm包的lamp环境

  [root@localhost ~]#yum install -y httpd mysql mysql-libs php php-mysql mysql-server php-bcmath php-gd php-mbstring

 安装zabbix的版本可以通过yum search zabbix查看yum源带的是什么版本,确认后选择你需要的版本即可

   [root@localhost ~]# yum search zabbix

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

epel/metalink                                                      | 5.3 kB     00:00     

 * base: centos.ustc.edu.cn

 * epel: ftp.cuhk.edu.hk

 * extras: mirrors.yun-idc.com

 * updates: mirrors.sina.cn

base                                                               | 3.7 kB     00:00     

extras                                                             | 3.4 kB     00:00     

updates                                                            | 3.4 kB     00:00     

================================== N/S Matched: zabbix ===================================

pcp-export-zabbix-agent.x86_64 : Module for exporting from PCP into a Zabbix agent daemon

python-pyzabbix.noarch : PyZabbix is a Python module for working with the Zabbix API

uwsgi-stats-pusher-zabbix.x86_64 : uWSGI - Zabbix Stats Pusher for uWSGI

zabbix-agent.x86_64 : Zabbix Agent

zabbix-proxy.x86_64 : Zabbix Proxy

zabbix-proxy-mysql.x86_64 : Zabbix proxy compiled to use MySQL

zabbix-proxy-pgsql.x86_64 : Zabbix proxy compiled to use PostgreSQL

zabbix-proxy-sqlite3.x86_64 : Zabbix proxy compiled to use SQLite

zabbix-server.x86_64 : Zabbix server common files

zabbix-server-mysql.x86_64 : Zabbix server compiled to use MySQL

zabbix-server-pgsql.x86_64 : Zabbix server compiled to use PostgresSQL

zabbix-server-sqlite3.x86_64 : Zabbix server compiled to use SQLite

zabbix-web.noarch : Zabbix Web Frontend

zabbix-web-mysql.noarch : Zabbix web frontend for MySQL

zabbix-web-pgsql.noarch : Zabbix web frontend for PostgreSQL

zabbix-web-sqlite3.noarch : Zabbix web frontend for SQLite

zabbix20-agent.x86_64 : Zabbix agent

zabbix20-proxy.noarch : Zabbix proxy common files

zabbix20-proxy-mysql.x86_64 : Zabbix proxy compiled to use MySQL

zabbix20-proxy-pgsql.x86_64 : Zabbix proxy compiled to use PostgreSQL

zabbix20-proxy-sqlite3.x86_64 : Zabbix proxy compiled to use SQLite

zabbix20-server.noarch : Zabbix server common files

zabbix20-server-mysql.x86_64 : Zabbix server compiled to use MySQL

zabbix20-server-pgsql.x86_64 : Zabbix server compiled to use PostgresSQL

zabbix20-web.noarch : Zabbix Web Frontend

zabbix20-web-mysql.noarch : Zabbix web frontend for MySQL

zabbix20-web-pgsql.noarch : Zabbix web frontend for PostgreSQL

zabbix22-agent.x86_64 : Zabbix Agent

zabbix22-dbfiles-mysql.noarch : Zabbix database schemas, images, data and patches

zabbix22-dbfiles-pgsql.noarch : Zabbix database schemas, images, data and patches

zabbix22-dbfiles-sqlite3.noarch : Zabbix database schemas and patches

zabbix22-proxy.noarch : Zabbix Proxy

zabbix22-proxy-mysql.x86_64 : Zabbix proxy compiled to use MySQL

zabbix22-proxy-pgsql.x86_64 : Zabbix proxy compiled to use PostgreSQL

zabbix22-proxy-sqlite3.x86_64 : Zabbix proxy compiled to use SQLite

zabbix22-server.noarch : Zabbix server common files

zabbix22-server-mysql.x86_64 : Zabbix server compiled to use MySQL

zabbix22-server-pgsql.x86_64 : Zabbix server compiled to use PostgreSQL

zabbix22-web.noarch : Zabbix Web Frontend

zabbix22-web-mysql.noarch : Zabbix web frontend for MySQL

zabbix22-web-pgsql.noarch : Zabbix web frontend for PostgreSQL

zabbix.x86_64 : Open-source monitoring solution for your IT infrastructure

zabbix20.x86_64 : Open-source monitoring solution for your IT infrastructure

zabbix22.x86_64 : Open-source monitoring solution for your IT infrastructure

从yum源可以看到配置了zabbix2.0和zabbix2.2

安装zabbix服务端(可以选择安装zabbix2.0或者zabbix2.2)

安装zabbix2.0

 [root@localhost ~]#yum install -y zabbix20 zabbix20-agent zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel

安装zabbix2.2
 [root@localhost ~]#yum install -y zabbix22 zabbix22-agent zabbix22-server zabbix22-server-mysql zabbix22-web zabbix22-web-mysql net-snmp-devel


       启动服务

 [root@localhost ~]# /etc/init.d/zabbix-server start
Starting Zabbix server:                                    [确定]
 [root@localhost ~]# /etc/init.d/zabbix-agent start
Starting Zabbix agent:                                     [确定]
 [root@localhost ~]# /etc/init.d/httpd start
正在启动 httpd:httpd: Could not reliably determine the server‘s fully qualified domain name, using 0.0.0.133 for ServerName
                                                           [确定]

 修改mysql配置文件

 [root@localhost ~]# vim /etc/my.cnf

增加如下内容

[mysql]
default-character-set=utf8
[mysqld]
character_set_server=utf8

 启动mysql

 [root@localhost ~]# /etc/init.d/mysqld start
Please report any problems with the /usr/bin/mysqlbug script!
                                                           [确定]
正在启动 mysqld:                                          [确定]

      创建数据库,导入数据

 [root@localhost ~]# mysql -uroot -e "create database zabbix"
 [root@localhost ~]# mysql -uroot --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/schema.sql
 [root@localhost ~]# mysql -uroot --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/images.sql
 [root@localhost ~]# mysql -uroot --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/data.sql
 [root@localhost ~]# mysql -uroot -e "grant all on *.* to ‘zabbix‘@‘localhost‘ identified by ‘zabbix‘;"

       编辑zabbix-server配置文件,配置DBUser,DBPassword,然后重启zabbix-server。

 [root@localhost ~]## vim /etc/zabbix/zabbix_server.conf
DBUser=zabbix
DBPassword=zabbix
 [root@localhost ~]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server:                               [失败]
Starting Zabbix server:                                    [确定]
 [root@localhost ~]# netstat -lnp|grep zabbix
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      1691/zabbix_agentd
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      2078/zabbix_server
tcp        0      0 :::10050                    :::*                        LISTEN      1691/zabbix_agentd
tcp        0      0 :::10051                    :::*                        LISTEN      2078/zabbix_server

 网页安装zabbix

       浏览器访问 http://ip/zabbix,默认会有“It is not safe to rely on the system‘s timezone settings”这样的警告信息,根据其中提示,需要 vim /etc/php.ini 设置 date.timezone="Asia/Shanghai",重启apache后刷新就没有了,点next。

技术分享

技术分享


         它会提示一些参数不合适:

技术分享


        编辑配置文件 /etc/php.ini,修改对应的项目,然后点击retry。

 [root@localhost ~]# vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
 [root@localhost ~]# service httpd restart
停止 httpd:                                               [确定]
正在启动 httpd:httpd: Could not reliably determine the server‘s fully qualified domain name, using 0.0.0.133 for ServerName
                                                           [确定]


技术分享


        然后接着输入mysql的信息,首先测试一下,不通过则需要调试,通过则下一步。

技术分享

        前两项保持默认,其中zabbix-server的port可以用netstat -lnp|grep zabbix查看,Name是可以自定义的,可以写zabbix所在服务器的主机名(这个名字会在web界面上显示,建议写的比较有意义一些) ,下面就是一路next到finish。

技术分享

技术分享

技术分享


        下面即进入登录界面,默认管理员账号为 admin,密码为 zabbix。

技术分享

技术分享


登陆后如果提示zabbix server is running 值为no的话,需要将server服务器的selinux、iptables关掉,具体操作方式如下:

关闭SELinux的方法:

修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。

如果不想重启系统,使用命令setenforce 0

注:

setenforce 1 设置SELinux 成为enforcing模式

setenforce 0 设置SELinux 成为permissive模式 

在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux

关闭iptables的方法:

service iptables stop

chkconfig iptables off



配置zabbix相关服务开机自动重启:

安装完成后服务器重启,进程均没有自动启动,需要配置开机自动重启。

 chkconfig --add zabbix_server

chkconfig --add zabbix-agent

chkconfig --add httpd

chkconfig --add mysqld

chkconfig --level 345 zabbix-server on

chkconfig --level 345 zabbix-agent on

chkconfig --level 345 mysqld on

 chkconfig --level 345 httpd on

启动后zabbix服务端的日志放在/var/log/zabbixsrv/zabbix_server.log中,如果启动过程中有任何问题可以查看这个日志

启动后如果还提示zabbix server is running,查看zabbix的日志有out of memory的错误提示,需要修改/etc/zabbix_server.conf,修改为如下所示的配置。主要是修改CacheSize的值,根据机器性能修改为100M即可。

LogFile=/var/log/zabbixsrv/zabbix_server.log

LogFileSize=0

PidFile=/var/run/zabbixsrv/zabbix_server.pid

DBName=zabbix

DBUser=zabbix

 DBPassword=zabbix

DBSocket=/var/lib/mysql/mysql.sock

 StartVMwareCollectors=5

 VMwareFrequency=60

VMwareCacheSize=2000M

CacheSize=100M

AlertScriptsPath=/var/lib/zabbixsrv/alertscripts

ExternalScripts=/var/lib/zabbixsrv/externalscripts

TmpDir=/var/lib/zabbixsrv/t


如何汉化

zabbix2.2.11发现不能汉化,本人觉得还是不汉化好,想要汉化修改一下,如下:

1、 服务端/usr/share/zabbix/include/locales.inc.php文件

2、修改 locales.inc.php内容为:‘zh_CN‘ => array(‘name‘ => _(‘Chinese (zh_CN)‘),        ‘display‘ => true),

       默认是false,所以不显示Chinese(zh_CN)。保存退出。

3、在web端,按下图设置即可配置为中文模式

技术分享





本文出自 “andy_youl” 博客,请务必保留此出处http://236859.blog.51cto.com/226859/1894467

zabbix2.2 服务端安装

标签:zabbix

原文地址:http://236859.blog.51cto.com/226859/1894467

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!