ãã®è¨äºã¯ãMackerel ã¢ããã³ãã«ã¬ã³ãã¼ï¼å ¨é¨CREï¼ã®25æ¥ç®ã®è¨äºã§ããæçµæ¥ã§ãï¼ã¡ãªã¼ã¯ãªã¹ãã¹ï¼
æçµæ¥ãã¤ã¾ãããã§æå¾ãä»å¹´ã®ã¢ããã³ãã«ã¬ã³ãã¼ã¯çµãããã¨ãããã¨ã§ä»åã¯ããµã¼ãã¼ãMackerelã®ç£è¦å¯¾è±¡ããå¤ãã¦"çµãã"ã«ãã"éå½¹"æä½ã®ãªãã§ãããèªåéå½¹æ©è½ãã«ã¯ãã¼ãºã¢ãããã¦ã¿ããã¨æãã¾ãã...... "çµãã" 㨠"éå½¹" ãæãã¦ã¿ããã§ãã......ã¤ãã¤ãã......ã
Mackerelã«ããã "éå½¹" ã¨ã¯
ããã«ã¤ãã¦ã¯ããã§ã«å ¬å¼ã«ããã«ããã¼ã¸ãåå¨ãã¦ãã¦ããã²ä¸åº¦èªãã§ã¿ã¦ããã ãããã¨æãã®ã§ããã
ããã¯ãä¸è¦ãªãµã¼ãã¼ãæå®ãã¦æåã§éå½¹ãããå ´åã«ã¤ãã¦ã®è¨è¿°ã§ããä»åã®ãã®ã¨ã³ããªã®ãã¼ãã¯ããã§ã¯ãªããä¾ãã°ãªã¼ãã¹ã±ã¼ã«ç°å¢ä¸ã«ãããµã¼ãã¼ã®ç£è¦ã«ã¤ãã¦ã¯ããã®éå½¹æä½ãèªåã§ãããªã£ã¦ã»ãããããªãã§ããããã®ãããªæ©è½ã Mackerel ã«ã¯åãã£ã¦ããããããæãã¦ãèªåéå½¹ãã¨å¼ãã§ããã®ããããããããã¼ãã§ãã
ããã§ã¯ã以ä¸ã®åãã¿ã¼ã³ã«ããã¦ã©ã®ããã«ãã¦èªåéå½¹ã¨ããä»çµã¿ãå®ç¾ããã¦ããããç´è§£ãã¦ã¿ããã¨æãã¾ãã
- Linuxç³»ãµã¼ãã¼ã«ãããèªåéå½¹
- systemd ã®å ´å
- init ã¹ã¯ãªããã®å ´å
- Windowsç³»ãµã¼ãã¼ã«ãããèªåéå½¹
- AWSã¤ã³ãã°ã¬ã¼ã·ã§ã³ã«ãããèªåéå½¹
Linuxç³»ãµã¼ãã¼ã«ãããèªåéå½¹
systemd ã®å ´å
主ã«ãCentOS 7 ã RHEL 7ãAmazon Linux 2 以éã®å ´åã¯ãã¡ããã¨æããã¾ããsystemd ã«ããèµ·åããããµã¼ãã¹ã¯ãserviceãã¡ã¤ã«ã«ããå®ç¾©ããããã㯠mackerel-agent ã«ããã¦ãåæ§ã§ãã
ã¨ã¼ã¸ã§ã³ãã®ã¤ã³ã¹ãã¼ã«ã«ããã»ããã¢ããããã service ãã¡ã¤ã«ã¯ãmackerel-agent ã® GitHub ãªãã¸ããªã§ã確èªãããã¨ãã§ãã¾ãã
mackerel-agent/mackerel-agent.service at master · mackerelio/mackerel-agent · GitHub
注ç®ãã¹ãã¯ä»¥ä¸ã®è¡ï¼
ExecStopPost=/bin/sh -c '[ "$AUTO_RETIREMENT" == "" ] || [ "$AUTO_RETIREMENT" == "0" ] && true || /usr/bin/mackerel-agent retire -force --root $ROOT $OTHER_OPTS'
ExecStopPost
ã¯ããã®ãµã¼ãã¹ãåæ¢ããããã¨ã«å®è¡ãã¦ã»ããã³ãã³ããæå®ããããã®ãã®ã§ãã/usr/bin/mackerel-agent retire -force
ããªãã»ã©ãªãã»ã©ãretire ãµãã³ãã³ãã«ã¤ãã¦ã¯ã以ä¸ã®ãã«ããã¼ã¸ã«ãè¨è¼ããã¦ãã¾ãã
è¬ã解ãã¾ããããç°¡åï¼
initã¹ã¯ãªããã®å ´å
ãã¡ãã®å ´åãä¸è¨ã¨åæ§ãmackerel-agent ã® init ã¹ã¯ãªããã®å 容ã GitHub ã§ç¢ºèªãããã¨ãã§ãã¾ãã
mackerel-agent/mackerel-agent.initd at master · mackerelio/mackerel-agent · GitHub
èªåéå½¹ã«é¢ãããããªã®ã¯ã以ä¸ã®ãããªãããã§ããããã
case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 retval=$? [ "$AUTO_RETIREMENT" != "" ] && [ "$AUTO_RETIREMENT" != "0" ] && retire exit $retval ;;
retire() { echo -n $"Retiring the Host:" $BIN retire -force ${APIBASE:+--apibase=$APIBASE} ${APIKEY:+--apikey=$APIKEY} --root=$ROOT $OTHER_OPTS >>$LOGFILE 2>&1 retval=$? if [ $retval -ne 0 ]; then failure echo return $retval fi success echo }
èãæ¹ã¯åºæ¬çã« systemd ã®ã¨ãã¨åãã§ããï¼initã¹ã¯ãªããã® stop
ã«ä¾ããªããããªåæ¢ã®ããæ¹ããããã¨ãèªåéå½¹ããããªããã¨ãããã¨ã«ãªãã¾ãã
Windowsç³»ãµã¼ãã¼ã«ãããèªåéå½¹
å®ã¯ãã¡ãã¯ãæ¯è¼çæè¿ãµãã¼ããããæ©è½ã§ãã
ãã®å¯¾å¿ã®ããã® Pull Request ã¯ãã¡ããå®å¿ã®mattnããããï¼ãããã¨ããããã¾ãï¼ï¼
å
¨è¬çã«ãWindowsãµã¼ãã¹ã¨ãã¦ãã¤ããªãèµ·åããããã«å¿
è¦ãªããã±ã¼ã¸ã»svcï¼ golang.org/x/sys/windows/svc
ï¼ã使ã£ã¦å®è£
ããã¦ãã¾ããã¸ã¼ãç¥ããªãã£ããã
ä¸è¨ Pull Request ã File Changed ã§è¦ã¦é ãã¨ããããããã§ãããåºæ¬çãªèãæ¹ã¯ Windows ã§ãã£ã¦ããã£ãããèªåéå½¹è¨å®ãæå¹ãªç¶æ
ã§ãµã¼ãã¹ãã·ã£ãããã¦ã³ãããããéå½¹å¦çã§ãã retire
ãå®è¡ãããããã«ãªã£ã¦ãã¾ãã
AWSã¤ã³ãã°ã¬ã¼ã·ã§ã³ã«ãããèªåéå½¹
ãã¡ãããæ¯è¼çæè¿ãµãã¼ããããæ©è½ã§ããä»ã®æEC2ã®ã¿ã®ãµãã¼ãã§ãã
ãã¡ãâã®ãèªåéå½¹ãæå¹ã«ãããããªã³ã«ãããã¨ã§ãã¤ã³ãã°ã¬ã¼ã·ã§ã³é£æºãã¹ãã«å¯¾ããèªåéå½¹ãæå¹ã«ãªãã¾ãã
ãã®æ©è½ã¯ããã¾ã§ã®ä»çµã¿ã¨ã¯å ¨ããã¨ãªãã¢ããã¼ãã«ãªãã¾ãããªããªãã°ãAWSã¤ã³ãã°ã¬ã¼ã·ã§ã³ãªã®ã§ãã¨ã¼ã¸ã§ã³ãã®ã¤ã³ã¹ãã¼ã«ãåæã¨ãããã¨ãã§ããªãããã§ãã
AWSã¤ã³ãã°ã¬ã¼ã·ã§ã³ã®ã³ã¼ãã¯å
¬éããã¦ããªãã®ã§ããããã®æ©è½ã®ä»æ§ã¨ãã¦ã¯ãAWSã¤ã³ãã°ã¬ã¼ã·ã§ã³ã«ããã¡ããªãã¯åå¾æã«ãEC2 ã¤ã³ã¹ã¿ã³ã¹ã® status ã terminated
ã§ããã°ããã«å¯¾å¿ãã Mackerel ãã¹ããéå½¹ããããã¨ãããã®ã«ãªãã¾ãã
ããã¾ã§æ¸ãã¦ããã¨ãããmackerel-agent ã«ããèªåéå½¹ã¯ãã¨ã¼ã¸ã§ã³ãã®ããã»ã¹ã®æ»ã«æ¹ã«ãã£ã¦ã¯éå½¹å¦çãèµ°ããªãå ´åãããã¾ããããããå ´åã«ã¯ã課é対象ã¨ã¯ãªããªãã¾ã§ãã´ããã¹ããæ®ã£ã¦ãã¾ãã®ã§ãå°å³ã«åä»ãªåé¡ã§ãããAWSã¤ã³ãã°ã¬ã¼ã·ã§ã³èªåéå½¹æ©è½ã¯ãããã«å¯¾ããã»ã¼ããã£ã¼ãããçãªæ©è½ã«ããªãã¾ãã
ã¾ã¨ã
Mackerel ã®èªåéå½¹ã®ä»çµã¿ããã¿ã¼ã³ãã¨ã«ãç´¹ä»ãã¾ããããè¬ãªä¾¿å©æ©è½ãã¨ãã¦æ´»ç¨ããã¦ãããã¨ãå¤ãæ°ããããã§ãããç´è§£ãã¦ã¿ãã¨æå¤ã¨ã·ã³ãã«ã§ãããã¨ããããã¾ããã
ã¨ããããã¨ã§ã12æã«å ¥ã£ã¦ããã¨ãããã®ãåããCREã® id:missasan ã¨èµ°ãç¶ãã¦ããMackerel ã¢ããã³ãã«ã¬ã³ãã¼ï¼å ¨é¨CREï¼ããããã«ã¦ç¡äºçµäºã¨ãªãã¾ããæ¯æ¥æ´æ°ã楽ãã¿ã«ãã¦ããã ããã¿ãªãã¾ï¼ããã®ããª......ï¼ï¼ãæ¬å½ã«ãããã¨ããããã¾ããã
2019å¹´ã Mackerel ãã©ãããããããé¡ããããã¾ããã¡ãªã¼ã¯ãªã¹ãã¹ï¼è¯ããå¹´ãï¼ï¼