监控 zabbix安装篇

备注:本次安装使用的是Ubuntu  OS  
  1. 首先安装Apache、php、mysql,构建LAMP环境
    ?
    1
    2
    3
    4
    5
    6
    7
    sudo apt-get install apache2
     
    安装完成末尾,有如下信息:
     
    * Starting web server apache2
    AH00558: apache2: Could not reliably determine the server 's fully qualified domain name, using 127.0.1.1. Set the ' ServerName' directive globally to suppress this message
      *
    根据网上查找的结论:没有配置httpd.conf.                                                                                                                  检查apahe2.conf文件发现(sudo vim /etc/apache2/apache2.conf) 根本没有httpad.conf的配置项,/etc/apache2/下也没有httpd.conf的文件,所以只好如下这样做:
    ?
    1
    2
    3
    4
    5
    1、在 /etc/apache2/ 下新建httpd.conf文件,内容为:ServerName 127.0.0.1
    2、修改 /etc/apache2/apache2 .conf文件在
        IncludeOptional mods-enabled/*.conf后边增加如下:
         # Include all the user configurations:
         Include /etc/apache2/httpd .conf
  2. sudo /etc/init.d/apache2 restart

  3. sudo apt-get install php5

  4. sudo apt-get install libapache2-mod-php5

  5. sudo apt-get install mysql-server(openstack已安装就不要安装了。设置密码和重复密码:root)

  6. sudo apt-get install libapache2-mod-auth-mysql

  7. sudo apt-get install php5-mysql

  8. sudo /etc/init.d/apache2 restart

  9. sudo ls /etc/apache2/mods-enabled  看到php5.conf 和 php5.load说明OK

  10. 这里还需要配置下/etc/php5/apache2/php.ini

    ?
    1
    2
    3
    4
    5
    6
    7
    ; date .timezone ===>去掉注释在=后添加 Asia /Shanghai
     
    max_input_time =600
     
    max_execution_time= 600
     
    post_max_size =32M
  11. ?
    1
    sudo /etc/init .d /apache2 restart
  12. ZABBIX安装
  13. sudo apt-get install zabbix-server-mysql 
    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    安装过程很安静,没有出现网上说的会输入2-3次数据库的密码,
    sudo /etc/init .d /zabbix-server start
    会出现:
      * zabbix_server is disabled in /etc/default/zabbix-server .
    查看相关文件: sudo vim /etc/default/zabbix-server
     
    #如下一段
    # This is by default set to "no" because a MySQL database needs to be prepared
    # and configured before you can start the Zabbix server for the first time.
    #
    # Instructions on how to set up the database can be found in
    # /usr/share/doc/zabbix-server-mysql/README.Debian
    START=no
     
    被设成no了,当然启动不了,改成 yes
  14. 这还没完呢,因为数据库什么的没有设置

    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    查看相关文件: cat /usr/share/doc/zabbix-server-mysql/README .Debian可以看到相关信息:
    -> apt-get install mysql-server
     
    Create a new database ( let 's call it "zabbix" ):
     
    -> mysql -p -e "create database zabbix character set utf8"
     
    Create a MySQL user that has access rights to the database
    (please use another password than 'SECRETPASSWORD' ):
     
    -> mysql -p -e "grant all on zabbix.* to 'zabbix'@'localhost' identified by 'SECRETPASSWORD'"
     
    Create the database schema:
     
    -> zcat /usr/share/zabbix-server-mysql/ {schema,images,data}.sql.gz \
        | mysql -uzabbix -pSECRETPASSWORD zabbix
     
     
     
    我们照着做就好(不过我加上了用户名,因为我当前登录账户不是root,如果是的话就不用加上):
    mysql -uroot -p -e "create database zabbix character set utf8"
    mysql -uroot -p -e "grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix'"
    zcat /usr/share/zabbix-server-mysql/ {schema,images,data}.sql.gz | mysql -uzabbix -pzabbix zabbix(等待一小会)
  15. sudo /etc/init.d/zabbix-server start (成功!)

  16.  接着安装zabbix网站

    ?
    1
    2
    3
    4
    5
    6
    <strong> sudo apt-get install zabbix-frontend-php
    又是安静静的装完了,没有让输入什么root之类,于是,手动拷贝到apache目录下:
    sudo cp -r /usr/share/zabbix /var/www/html/zabbix
    重启zabbix
    sudo /etc/init .d /zabbix-server stop
    sudo /etc/init .d /zabbix-server start< /strong >
  17. 现在访问,终于可以出现设置界面了:  http://服务器地址或域名/zabbix 

  18.  第三步:Port  3306,password,user 都是root

  19. 不过安装到最后一步又出问题了,还算好,提供了下载,下载后ftp到服务器

  20. 下载之后把文件放到/etc/zabbix/目录下,刷新页面,如果出现:configration file error:permission deny .那说明还得给该文件权限:我就暴力点:

    ?
    1
    sudo chmod 755 zabbix.conf.php



    ,刷新OK。
  21. OK,终于可以了。登录用户名密码admin/zabbix

  22.  最后,安装zabbix客户端

    ?
    1
    2
    3
    4
    5
    <strong> sudo apt-get install zabbix-agent 
     
     
    安装客户端后,若不是服务器本机,都需要修改zabbix配置文件 /etc/zabbix/zabbix_agent .conf和 /etc/zabbix/zabbix_sagentd .conf的一行
    server=zabbix服务端地址或域名< /strong >
  23. 可能遇到的问题

    ?
    1
    2
    3
    解决方法:
    1.在页面上设置“组态->主机”将主机设置为监控客户端的机器 hostname
    2. /etc/zabbix/zabbix_agent .conf 中的 hostname 与1中设置的一致。
  24. 中文汉化问题:如果选择中文之后出现乱码或者页面出现  zabbix : imagettftext():Could not find/open font [map.php: 这样的东东,都是字体的问题,下载truetype的字体(微软雅黑),然后替换 /var/www/html/zabbix/fonts目录下的DejaVuSans.ttf,把你新下载的字体也写成DejaVuSans.ttf这个名字。最后,发现zabbix 的翻译真是蛋疼啊,下载一个修改过的汉化文件,替换/var/www/html/zabbix/locale/zh_CN/LC_MESSAGES下边的po和mo,下载地址:http://www.zabbix.net.cn/download/file.php?id=70&sid=a70c6d6cea3e789903181e0e12f28bfd 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值