zoukankan      html  css  js  c++  java
  • Zabbix使用总结

    1. CentOS 7上启动zabbix-server失败,/var/log/messages中的报错信息如下:

    Feb 22 12:56:43 mysql-server1 systemd: Starting Zabbix Server with MySQL DB...
    Feb 22 12:56:43 mysql-server1 kernel: zabbix_server[1599]: segfault at 18 ip 00007fce09ca6bd0 sp 00007fffa39b7808 error 4 in libpthread-2.17.so[7fce09c9d000+16000]
    Feb 22 12:56:43 mysql-server1 systemd: zabbix-server-mysql.service: control process exited, code=killed status=11
    Feb 22 12:56:43 mysql-server1 systemd: Failed to start Zabbix Server with MySQL DB.
    Feb 22 12:56:43 mysql-server1 systemd: Unit zabbix-server-mysql.service entered failed state.

    解决方法:

    # rpm -Uvh --force ftp://bo.mirror.garr.it/1/slc/centos/7.0.1406/updates/x86_64/Packages/gnutls-3.1.18-10.el7_0.x86_64.rpm

    Retrieving ftp://bo.mirror.garr.it/1/slc/centos/7.0.1406/updates/x86_64/Packages/gnutls-3.1.18-10.el7_0.x86_64.rpm
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:gnutls-3.1.18-10.el7_0           ################################# [ 50%]
    Cleaning up / removing...
       2:gnutls-3.3.8-12.el7              ################################# [100%]

    该RPM包的下载地址为:

    http://rpm.pbone.net/index.php3/stat/4/idpl/27966545/dir/centos_7/com/gnutls-3.1.18-10.el7_0.x86_64.rpm.html

    2. CentOS 7的Zabbix官方源和epel源

        # rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/7/x86_64/zabbix-2.2.11-1.el7.x86_64.rpm

        # rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

        前者是Zabbix的官方源,后者是epel,前者只是安装zabbix这个软件,后者是安装epel的yum源,该epel源包含了zabbix的相关软件包,两者只用其一即可,如果两个都装了,在后续安装的过程中会报冲突。

    Transaction check error:
      file /var/log/zabbix from install of zabbix22-agent-2.2.11-1.el7.x86_64 conflicts with file from package zabbix-2.2.11-1.el7.x86_64

     epel中包含的zabbix的软件包如下所示:

    zabbix20.x86_64                                             2.0.16-1.el7                               epel              
    zabbix20-agent.x86_64                                       2.0.16-1.el7                               epel              
    zabbix20-proxy.noarch                                       2.0.16-1.el7                               epel              
    zabbix20-proxy-mysql.x86_64                                 2.0.16-1.el7                               epel              
    zabbix20-proxy-pgsql.x86_64                                 2.0.16-1.el7                               epel              
    zabbix20-proxy-sqlite3.x86_64                               2.0.16-1.el7                               epel              
    zabbix20-server.noarch                                      2.0.16-1.el7                               epel              
    zabbix20-server-mysql.x86_64                                2.0.16-1.el7                               epel              
    zabbix20-server-pgsql.x86_64                                2.0.16-1.el7                               epel              
    zabbix20-web.noarch                                         2.0.16-1.el7                               epel              
    zabbix20-web-mysql.noarch                                   2.0.16-1.el7                               epel              
    zabbix20-web-pgsql.noarch                                   2.0.16-1.el7                               epel              
    zabbix22.x86_64                                             2.2.11-1.el7                               epel              
    zabbix22-agent.x86_64                                       2.2.11-1.el7                               epel              
    zabbix22-dbfiles-mysql.noarch                               2.2.11-1.el7                               epel              
    zabbix22-dbfiles-pgsql.noarch                               2.2.11-1.el7                               epel              
    zabbix22-dbfiles-sqlite3.noarch                             2.2.11-1.el7                               epel              
    zabbix22-proxy.noarch                                       2.2.11-1.el7                               epel              
    zabbix22-proxy-mysql.x86_64                                 2.2.11-1.el7                               epel              
    zabbix22-proxy-pgsql.x86_64                                 2.2.11-1.el7                               epel              
    zabbix22-proxy-sqlite3.x86_64                               2.2.11-1.el7                               epel              
    zabbix22-server.noarch                                      2.2.11-1.el7                               epel              
    zabbix22-server-mysql.x86_64                                2.2.11-1.el7                               epel              
    zabbix22-server-pgsql.x86_64                                2.2.11-1.el7                               epel              
    zabbix22-web.noarch                                         2.2.11-1.el7                               epel              
    zabbix22-web-mysql.noarch                                   2.2.11-1.el7                               epel              
    zabbix22-web-pgsql.noarch                                   2.2.11-1.el7                               epel    

    3. 利用zabbix_get验证Agent的配置是否正确

    # zabbix_get -s 192.168.244.144 -p 10050 -k system.uanme
    ZBX_NOTSUPPORTED

       ZBX_NOTSUPPORTED代表监控项有问题

    # zabbix_get -s 192.168.244.144 -p 10050 -k agent.ping
    1

    4.  59635:20160223:161315.258 no active checks on server [192.168.244.146:10051]: host [192.168.244.146] not found

         原因:/etc/zabbix_agentd.conf中的Hostname与zabbix web页面Monitoring->Configuration->Hosts 页面的Name不匹配

    5. 在执行system.run时报“ZBX_NOTSUPPORTED”错误

    [root@localhost ~]# zabbix_get -s 192.168.244.10 -k system.run['df -h']
    ZBX_NOTSUPPORTED

       原因:客户端中配置文件中EnableRemoteCommands默认为0,没有开启。

       开启后,

    [root@localhost ~]# zabbix_get -s 192.168.244.10 -k system.run['df -h']
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda3        18G  8.7G  8.0G  53% /
    tmpfs           238M     0  238M   0% /dev/shm
    /dev/sda1       190M   27M  154M  15% /boot

    6. 被动模式和主动模式的区别

        被动模式:

        1> Server打开一个TCP连接

        2> Server发送一个key为agent.ping

        3> Agent接受到这个请求,然后响应数据<HEADER><DATALEN>1

        4> Server对接收到的数据进行处理

        5> TCP连接关闭

        主动模式:

        1> Agent向Server建立一个TCP的连接

        2> Agent请求需要检测的数据列表

        3> Server响应Agent,发送一个Items列表(item key,delay)

        4> Agent响应请求

        5> TCP连接关闭

        6> Agent开始周期性地收集数据。

        7> Agent向Server建议一个TCP连接

        8> Agent发送在采集周期内,需要采集的数据给Server。

        9> Server处理Agent发送的数据。

       10> TCP连接关闭

    7. 如何禁用Zabbix的重新安装

       禁用前:

      

       如何禁用:

       # vim /usr/share/zabbix/include/menu.inc.php

    /**,
                            array(
                                    'url' => 'setup.php',
                                    'label' => _('Installation')
                            )**/

      禁用后:

     

      如果数据库不变的话,重装数据库基本上没影响,还是展示之前的数据。

    8. 如何设置zabbix前端页面的刷新时间

        右上角Profile->User->Refresh (in seconds)

    9. Zabbix Agent的配置参数

    Server:被动模式,允许哪台服务器连接Agent

    ServerActive:主动模式,向哪台服务器传送数据。

    10. zabbix_sender

    Zabbix的Trapping模式,将采集到的数据通过定时任务等主动发送给zabbix_server。

    11. Administration->General->Housekeeper

    采用表分区后,需要关闭Housekeeper的功能,因为Housekeeper对数据的清理主要是通过DELECT语句来进行的,在数据量比较大的情况下,DELETE操作执行效率比较低。 

    12. Zabbix登录用户的账号和密码保存在zabbix.users表中

          其中passwd字段是用的md5算法加密

    mysql> select * from zabbix.users where alias='Admin'G
    *************************** 1. row ***************************
            userid: 1
             alias: Admin
              name: Zabbix
           surname: Administrator
            passwd: 5fce1b3e34b520afeffb37ce08c7cd66
               url: 
         autologin: 1
        autologout: 0
              lang: en_GB
           refresh: 30
              type: 3
             theme: default
    attempt_failed: 0
        attempt_ip: 192.168.244.1
     attempt_clock: 1488507893
     rows_per_page: 50
    1 row in set (0.00 sec)
    
    mysql> select md5('123456');
    +----------------------------------+
    | md5('123456')                    |
    +----------------------------------+
    | e10adc3949ba59abbe56e057f20f883e |
    +----------------------------------+
    1 row in set (0.01 sec)

    13. Zabbix完整的监控配置流程

    Host groups(主机组)-> Hosts(主机)-> Applications(监控项组)-> Items(监控项)-> Triggers(触发器)->Event(事件)->Actions(处理动作)-> User Groups(用户组)-> Users(用户)-> Medias(告警方式)-> Audit(日志审计)

    14. Graphs

    个人感觉Graphs其实完全不用配置,直接查看Monitoring->Latest data->具体item的Graph

    15. Screen

    Screen将多种信息放到一起展示,便于集中展示某个Host的多个信息,或是将多个Hosts的同一种信息放到一起显示。

    这些信息可以为Graphs,Maps,Server info等,几乎涵盖Zabbix所有的监控信息。
     
    16. Slide shows在多个Screen之间以幻灯片的方式来展示。
     
    17. 日志的工作方式必须为主动模式,用zabbig_get提示不支持。
     
    18. Zabbix告警的配置步骤
    1. 设置Trigger
    2. 配置用户
    3. 配置告警介质
    4. 设置Action
    其中,action包含两部分:第一是发送信息,即将告警信息发送给用户;第二部分是执行命令,即将事件用命令进行处理,达到对事件故障自动尝试恢复的效果。
     
    19. 如何查看已经触发的Action
    Administration-> Audit -> Actions(Action_log)
     
    20. 解决zabbix Item Not supported的问题
    Administration -> General -> Other -> Refresh unsupported items (in sec)
     
    21.
    /*
     * The cache (zbx_vc_cache_t) is organized as a hashset of item records (zbx_vc_item_t).
     *
     * Each record holds item data (itemid, value_type), statistics (hits, last access time,...)
     * and the historical data (timestamp,value pairs in ascending order).
     *
     * The historical data are stored from largest request (+timeshift) range to the
     * current time. The data is automatically fetched from DB whenever a request
     * exceeds cached value range.
     *
     * If an item is already being cached the new values are automatically added to the cache
     * after being written into database.
     *
     * When cache runs out of memory to store new items it enters in low memory mode.
     * In low memory mode cache continues to function as before with few restrictions:
     *   1) items that weren't accessed during the last day are removed from cache.
     *   2) items with worst hits/values ratio might be removed from cache to free the space.
     *   3) no new items are added to the cache.
     *
     * The low memory mode can't be turned off - it will persist until server is rebooted.
     * In low memory mode a warning message is written into log every 5 minutes.
     */
     

       

       

  • 相关阅读:
    html5 canvas雨点打到窗玻璃动画
    html5跟随鼠标炫酷网站引导页动画特效
    如何实现复选框的全选和取消全选效果
    CSS3透明属性opacity
    jQuery实现方式不一样的跳转到底部
    ul li设置横排,并除去li前的圆点
    jQuery美女幻灯相册轮播源代码
    微软modern.IE网站,多版本IE免费测试工具集
    css中position与z-index
    C#一个方法返回多个值
  • 原文地址:https://www.cnblogs.com/ivictor/p/5206735.html
Copyright © 2011-2022 走看看