Immutableãªã¤ã³ãã©ããªãããããã¨å§ããä»æ¥ãã®é ã§ãããã¤ã³ã¹ã¿ã³ã¹ãé »ç¹ã«å¢ãããæ¸ã£ããããã¨ãç£è¦ãµã¼ãã¹ã§ç¶ç¶çãªå¤ã追ãã®ãé£ãããªããããã¨ããåé¡ãæè¿æãã¦ãã¾ãã
ãµã¼ãã¹å ¨ä½ã§è¤æ°ã®ãã¹ãã®åè¨å¤ãåå¾ãã¦ãããã¨ã§ä½¿ç¨éã®æ¨ç§»ãè¦ãããããªå¤ãå ·ä½çã«ã¯ä»¥ä¸ã®ãããªãã®ã§ãã
- å¤åãã®ãããã¯ã¼ã¯ãã©ãã£ãã¯
- ã¯ã©ã¤ã¢ã³ãã¨æ°¸ç¶æ¥ç¶ãã daemon ã®æã£ã¦ããã³ãã¯ã·ã§ã³æ°
- ã¸ã§ãã®å¦çæ°
- è¤æ°ã®MySQL slaveãå¦çããåç §ã¯ã¨ãªæ°
ã¨ãããã¨ã§ãzabbix-agent ã¸ã® proxy ã¨ãã¦åä½ãããè¤æ° agent ããã®æ°å¤ãåè¨ãã¦è¿ããããªãã®ããã£ããæãããããªããã¨æ¸ãã¦ã¿ã¾ããã
å ¬å¼ãã¼ã¸ fujiwara.github.io/zabbix-aggregate-agent
ãªãã¸ã㪠zabbix-aggregate-agent Github
ã¢ã¼ããã¯ãã£
[zabbix-server(or zabbix-proxy)] | ^ | (1)key | (6)aggregated value | | v | [zabbix-aggregate-agent] <--- (2) list of zabbix-agents from static list or file or command output | ^ | (3)key | (4)values(*) v | [zabbix-agents(*)]
1. zabbix server(ã¾ãã¯proxy) ã aggregate-agent ã«å¤ãè¦æ±
2. aggregate-agente ã¯ãã¡ã¤ã«ãã³ãã³ãããå¤ãéç´ãã対象 agent ã解決
-
- 解決ã«ã¯ãè¨å®ãã¡ã¤ã«ã«å®ç¾©ããéçãªã¹ããè¡åºåãã®ããã¹ããã¡ã¤ã«ãæ¨æºåºåã«å¯¾è±¡ãåºåããã³ãã³ãããå©ç¨ã§ãã¾ã
3. aggragate-agentã¯è§£æ±ºããè¤æ°ã® agent ã«å¤ã並åã«è¦æ±
4. ããããã® agent ã¯èªåã®æã£ã¦ããå¤ãè¿ã
5. aggregate-agent ãå¤ãéç´ãã
6. server(proxy) ã«å¤ãè¿ã
Zabbixã«ã¯ãAggregate checksãã¨ããä»çµã¿ããããã©â¦?
ãããããå©ç¹æ¬ ç¹ãããã¾ãã
Aggregate checks
Pros.
- æ¨æºæ©è½ã§ã
Cons.
- éç´ãããã¢ã¤ãã ã«ããããã«ã¤ãã¦ãã¢ã¤ãã ã¨ã°ã©ãã¨ããªã¬ã®å®ç¾©ãè¡ãå¿
è¦ãããã¾ã
- Web UIã§ã½ã¡ã½ã¡ã½ã¡ã½ã¡â¦â¦
- éç´ããã zabbix-agent ã¯ãã¹ã¦ zabbix-server ã«ç»é²ããå¿ è¦ãããã¾ã
zabbix-agentã®èªåç»é²ã«ãã£ã¦ç»é²ãããã¨ã¯ç°¡åã§ãããä¸è¦ã«ãªã£ãæ å ±ãå¥éåé¤ããããã«å¥é Zabbix API ãå©ç¨ããå¦çãæ¸ãå¿ è¦ãããã¾ãã
zabbix-aggregate-agent
Pros.
- ã¢ã¤ãã ãã°ã©ããããªã¬ã®å®ç¾©ã¯æ¢ã« agent åãã«å®ç¾©ããããã®ããã®ã¾ã¾å©ç¨ã§ãã¾ã
- zabbix-serverããè¦ã㨠agent ãã®ãã®ã«è¦ãã
- éç´ããã zabbix-agent ã¯ãå¿
ããã zabbix-server ä¸ã«å®ç¾©ããã¦ããå¿
è¦ã¯ããã¾ãã
- ãã¨ãã°ãªã¼ãã¹ã±ã¼ã«ã§èµ·åãã¦çæéã§è½ã¡ããããªä¸æçãªã¤ã³ã¹ã¿ã³ã¹ã«ã¤ã㦠aggregate-agent ãåå¨ãèªç¥(APIãªã©ã§)ã§ããã°ãzabbix-serverã¸ã®ç»é²ã¯ä¸è¦ã§ã
Cons.
- zabbix-aggregate-agentã®deamonã1ããã»ã¹ãèµ·åããå¿ è¦ãããã¾ã
使ç¨æ¹æ³
Goã§æ¸ãã¦ããã®ã§ãå ¬å¼ãã¼ã¸ãããã¤ããªããã¦ã³ãã¼ãããã ãã§åä½å¯è½ã§ãã
$ zabbix-aggregate-agent --config /path/to/config.toml
è¨å®ãã¡ã¤ã«ä¾ã¯ä»¥ä¸ã®ãããªæãã§ãã
è¤æ°ã® aggregate-agent ã¤ã³ã¹ã¿ã³ã¹ã1ããã»ã¹ã§èµ·åå¯è½ã§ãã
zabbix-serverã«ã¯éç´ç¨ã®ãã¹ãå®ç¾©ãè¡ããListenããã¢ãã¬ã¹ã zabbix-agent ã®ã¢ãã¬ã¹ã¨ãã¦æå®ãã¾ãã
[[agent]] # Name: èå¥å(ãã°ã«åºåããã) Name = "web_servers" # Listen: aggregate-agentã Listen ãã address (default "127.0.0.1:10052") Listen = "0.0.0.0:10052" # List : éçãªã¹ãã«ãã解決 List = [ "web01:10050", "web02:10050" ] [[agent]] Name = "app_servers" Listen = "0.0.0.0:10053" # ListFile: æ¹è¡åºåãã®ããã¹ããã¡ã¤ã«ã«ãã解決 ListFile = "/path/to/agent.list" [[agent]] Name = "db_servers" Listen = "0.0.0.0:10054" # ListCommand: æ¨æºåºåã«éç´å¯¾è±¡ãæ¹è¡åºåãã§åºåããã³ãã³ããæå® ListCommand = [ "/path/to/generate_list.sh", "arg1", "args2" ] # CacheExpires : ã³ãã³ãå®è¡çµæã®ãã£ãã·ã¥ä¿ææé CacheExpires = 300
ã§å®éã©ããªã®
Aggregate checksã§ã¯ã
- ãã¹ã¦ã®ç£è¦å¯¾è±¡ã zabbix-server ã«ç»é²ãã
- éç´å¯¾è±¡ãã¨ã«ãã¹ãã°ã«ã¼ããå®ç¾©ãã
å¿ è¦ãããã®ã§ãä¸æçã«å¢ãããæ¸ã£ãããããã¹ã¦ã®ãã¹ãããã£ã¡ãzabbix-serverã§ç»é²ãåé¤ããä»çµã¿ãããã°ãã¡ãã使ãã»ããããã¨æãã¾ãã
aggregate-agentã¯ãã¡ã¤ã«ãã³ãã³ãã®å®è¡çµæã§éç´å¯¾è±¡ãå®ç¾©ã§ããããã
- zabbix以å¤ã®APIã§ãã¹ãã°ã«ã¼ãçãªãã®ã解決ã§ãã
(ã¤ã¾ãzabbix-serverã«ãã¹ãã¡ã¿ãã¼ã¿ã®ç®¡çãå ¨é¨å¯ãããã¦ããªãå ´å) ã«ã¯ä¾¿å©ã«ä½¿ãããã¨æãã¾ãã
ãã¨ã¯æ¢åã®ç£è¦å¯¾è±¡ã¢ã¤ãã ãã°ã©ããããªã¬ã®å®ç¾©ããã®ã¾ã¾æµç¨ã§ããã®ãå人çã«ã¯å¬ããã¨ããã§ãWeb UIã§ã½ã¡ã½ã¡å®ç¾©ããã¦ããå¿ è¦ãããã¾ããã
æ¸ãã¦ã¿ã¦
è¤æ°ã® agent ã«ãªã¯ã¨ã¹ããé£ã°ãã¦åããã¨ãããè¤æ°ã® aggregate-agent ã¤ã³ã¹ã¿ã³ã¹ãç«ã¦ãã¨ãã㯠Goroutine ã§ç°¡åã«ä¸¦ååã§ããã®ã§ã大å¤æ¥½ã§ãããPerlã§AnyEventã§éåæå¦çã¨ããè¤æ°ã®åããã»ã¹ãforkãã¦ããã»ã¹ééä¿¡ããã®ã¨ã¯æ¯è¼ããæ°ãèµ·ããªããããã§ãã