• Linux:Day48(上) zabbix使用进阶


    Zabbix常用术语:

      Item Key

      Escalation

      Template

      Web Scennario

    Zabbix服务器进程:

      housekeeper,alter,discoverer,poller,pinger,db_config_syncer,timer,escaltor

    Item key:

      命名要求:只要使用字母、数字、下划线、点号、连接符

      接受参数:system.cpu.load[<cpu>,<mode>],net.if.inbound[if,<mode>]

        注意:每个key背后都应该有一个命令或脚本来负责实现数据收集;此命令或脚本可调用传递给key的参数,调用方式为$1,$2,...

      在Zabbix中定义item时调用某key,还需额外定义数据采集频率、历史数据的保存时长等;

    Trigger:

      触发器表达式:{<Server>:<key>.<function>(<parameter>)}<operator><constant>

      <function>:评估采集到的数据是否在合理范围内时所使用的函数;其评估过程可以根据采集到的数据、当前时间或其它因素;

        avg,count,change,date,dayofweek,dayofmonth,delta,diff,iregexp,regexp,last,max,min,nodata,now,prev,str,strlen,sum

          regexp:检查最后一次采集的数据是否能够被指定的模式所匹配:1表示匹配,0表示不匹配;

          now:返回Unix元年至此刻经历的秒数;

          prev:倒数第二个采样值;

          str:从最后一次的采样中查找此处指定的子串;

          strlen:

      触发器间有依赖关系;

    Action:

      message

      condition

        event:

          trigger

          discovery:

            Service Up,Service Down,Host up,Host Down,Service Discovered,Service Lost,Host Discovered,Host Lost

          auto_registration

          lld

      operation

        send message

          Media

            Email,SMS,Jabber,Script,EZ Texting

          User

        remote command

          (1) 给zabbix定义sudo规则:

            zabbix ALL=(ALL) ALL

          (2) 不支持active模式的agent;

          (3) 不支持代理模式;

          (4) 命令长度不得超过255个字符;

          (5) 可以使用宏;

          (6) zabbix-server仅执行命令,而不关心命令是否执行成功;

          前提:zabbix-agent要配置为支持执行远程命令;

            # EnableRemoteCommands=0

          注意:(1) 如果用到以其它用户身份执行命令的话,那么命令本身要以sudo方式运行;

                sudo /etc/rc.d/init.d/httpd restart

             (2) 在各agent上的sudoers文件,要注释如下行:

                Defaults          requiretty

        Script:Alert Script

          放置于特定目录中:AlertScriptsPath=/var/lib/zabbixsrv/alertscripts

            zabbix_server.conf配置文件中的参数;

          脚本中可使用$1,$2,$3来调用action中的邮件的收件人,Default Subject,Default Message;

          注意:新放入此目录中的脚本,只有重启zabbix-server方能被使用;

    宏:

      两类:

        内建:{MACRO_NAME}

        自定义:{$MACRO_NAME}

      可以三个级别使用:

        Global,Template,Host

        优先级:Host --> Template --> Global

          在某级别找到后将直接使用;

    模板:一系列配置的集合,此些配置可通过“链接”的方式应用于指定的主机;

      application,item,trigger,graph,screen,discovery,web

    维护时间:

      Cconfiguration --> Maintance

    User Parameters:

      zabbix内置了许多item key;

      实现用户自定义item key,实现特有数据指标监控;

      语法:

        UserParameter=<key>,<command>

      用户自定义key是在agent端设置的,可以在/etc/zabbix_agentd.conf.d/目录下写个配置文件,也可以在直接在zabbix_agentd.conf配置文件的Option: UserParameter中定义。

  • 相关阅读:
    SQL面试积累
    The server does not support version 3.0 of the J2EE Web module specification
    AspectJ报错:error at ::0 can't find referenced pointcut XXX
    maven教程
    sqlMapConfig.xml配置文件详解
    解决eclipse+MAVEN提示One or more constraints have not been satisfied.的问题
    maven常见问题
    Dmaven.multiModuleProjectDirectory system propery is not set.
    maven最齐全配置pom.xml
    serialVersionUID的作用
  • 原文地址:https://www.cnblogs.com/sq5288/p/11531545.html
Copyright © 2020-2023  润新知