国庆前期,想做个小小的总结!
1、Zabbix Active(主动)与Passive(被动)检查的区别:
被动检查,这是最简单的一种方式:zabbix server或者proxy请求被检测数据(比如 cpu load),agent response 这些数据的检查结果;
server: <item key>\n
agent:<HEADER><DATALEN><DATA>
ps:检查中可以没有hostname设置
主动检查:
第一步是agent会向server请求需要检查哪些item lists(如果失败会等待60s),
<HEADER><DATALEN>{ "request":"active checks", "host":"<hostname>" }
ps:包含hostname;
server的response:
{ "response":"success", "data":[ { "key":"log[\/home\/zabbix\/logs\/zabbix_agentd.log]", "delay":"30", "lastlogsize":"0" }, { "key":"agent.version", "delay":"600" } ] }
key和delay这几个参数是必须存在的,如果items的type为“log”类型,那lastlogsize必须存在;server返回失败的话, 不做重传机制(已经在agent做啦)
agent再次返回的结果是:
<HEADER><DATALEN>{ "request":"agent data", "data":[ { "host":"<hostname>", "key":"log[\/home\/zabbix\/logs\/zabbix_agentd.log]", "value":" 13039:20090907:184546.759 zabbix_agentd started. ZABBIX 1.6.6 (revision {7836}).", "lastlogsize":80, "clock":1252926015 }, { "host":"<hostname>", "key":"agent.version", "value":"1.6.6", "clock":1252926015 } ], "clock":1252926016 }
server再次回复:
<HEADER><DATALEN>{ "response":"success", "info":"Processed 2 Failed 0 Total 2 Seconds spent 0.002070" }
2、zabbix里面的宏
宏适用的场合:
item keys 或者描述 (这个多用于模板,然后针对个别机器做更改)
比如:
net.tcp.service[ssh,{$SSH_PORT}]
触发器或者对比表达式:
{ca_001:system.cpu.load[,avg1].last(0)}>{$MAX_CPULOAD}
宏使用的查找范围: host-->template