ãŸããã
ç§ãã¡ã®äž»ãªãããžã§ã¯ãã¯ããœãŒã·ã£ã«ãããã¯ãŒã¯ãšã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ã§ã®åºåã€ã³ãã¬ãã·ã§ã³ã®æé©åã§ãã åãããŒè¡šç€ºã¯ãç°ãªããµãŒããŒãå Žåã«ãã£ãŠã¯ç°ãªãããŒã¿ã»ã³ã¿ãŒã«ããååã«å€æ°ã®ãµãŒãã¹ã®çžäºäœçšã®çµæã§ãã åœç¶ããµãŒããŒãšãµãŒãã¹éã®éä¿¡ãç£èŠããã¿ã¹ã¯ããããŸãã ãã®ã¿ã¹ã¯ã®åœ¢åŒãé©åãªãœãªã¥ãŒã·ã§ã³ãé©åã§ãªããœãªã¥ãŒã·ã§ã³ã«ã€ããŠ-ããã«èª¬æããŸãããããã¯ãŒã¯æ§é ïŒããã³ããšã³ããããã¯ãšã³ãããµãŒãã¹
ä»ã®å€ãã®Webã¢ããªã±ãŒã·ã§ã³ãšåæ§ã«ãç§ãã¡ã®ã¢ããªã±ãŒã·ã§ã³ã¯ããã³ããšã³ãïŒFEïŒãããã¯ãšã³ãïŒBEïŒãããã³ãµãŒãã¹ã§æ§æãããŠããŸãã ããã³ããšã³ãã¯ã¯ã©ã€ã¢ã³ãããã®æ¥ç¶ãåãå ¥ããããã¯ãšã³ãã«è»¢éããŸããããã¯ãšã³ãã¯ãµãŒãã¹ãåŒã³åºããŠã¯ã©ã€ã¢ã³ãã«å¿çããŸãã ç§ãã¡ã®å ŽåãFE-ã»ãšãã©ã®å Žå-nginxãBE-Tomcatã ãã®ã¢ãŒããã¯ãã£ã¯ããªãæšæºçãªãã®ã§ãããããã³ããšã³ããããã¯ãšã³ããããã³ãµãŒãã¹éã§ãªã¯ãšã¹ããã«ãŒãã£ã³ã°ããæ¹æ³ã決å®ããå¿ èŠãããå Žåãéæšæºã®éå§ç¹ã§ãã
ãã®å Žåãã«ãŒãã£ã³ã°ã¯CMDBæ§æããŒã¿ããŒã¹ã«ãã£ãŠå¶åŸ¡ãããŸãã ãã®ããŒã¿ããŒã¹ã«ã¯ããããã¯ãŒã¯ã®ç©çããã€ã¹ïŒããŒã¿ã»ã³ã¿ãŒãç©çãµãŒããŒãªã©ïŒãšã¢ããªã±ãŒã·ã§ã³ã®è«çããã€ã¹ïŒãµãŒãã¹ãšã€ã³ã¿ãŒãã§ã€ã¹ãé 眮ãããŠããã³ã³ãããŒãç©çãµãŒããŒãFEããã³BEãã¯ã©ã¹ã¿ãŒã«åå²ãããã©ãã£ãã¯ãåŠçã§ãããµãŒããŒïŒã®äž¡æ¹ãåæ ãããŸãã©ããããã§ãªãããªã©ïŒ
CMDBæ å ±ã¯2ã€ã®æ¹æ³ã§äœ¿çšã§ããŸãã æåã®-æ¡ä»¶ä»ãããªãã©ã€ã³ãã¯ãæ°åããšã«ãã¹ã¯ãªãããCMDBããå¿ èŠãªæ å ±ãéžæããããšãã°ãnginxã«å¿ èŠãªã¢ããã¹ããªãŒã ã®ãã®ãå«ãææ°ã®æ§æãæ§ç¯ãããšããäºå®ããæããŸãã CMDBã«ã¢ã¯ã»ã¹ãã2çªç®ã®æ¹æ³ã®ä»çµã¿ã«ã€ããŠã¯ã次ã®ã»ã¯ã·ã§ã³ã§èª¬æããŸãã
CMDBãççž®åãååã«ãããµãŒãã¹ã®æ€çŽ¢
CMDBã䜿çšãã2çªç®ã®æ¹æ³ã¯ãå®æçã§ã¯ãªãå³æã«CMDBã®å€æŽãåæ ããããããªã³ã©ã€ã³ãšããŠä»»æã«æå®ã§ããŸãïŒCMDBã®äžã®çæãã£ãã·ã¥ãèæ ®ïŒããã®æ¹æ³ã¯ãäž»ã«ããã¯ãšã³ããå¿ èŠãªãµãŒãã¹ãèŠã€ããŠãããèªäœã¯ãDNSã®äœ¿çšã«åºã¥ããŠããŸãã 説æã®åçãããããã©ã®ããã«è¡ãããããç解ããæãç°¡åãªæ¹æ³ïŒ
- host58ã«ããbe5ããã¯ãšã³ãã¯ããŒã¿ããŒã¹ã«æ¥ç¶ããå¿ èŠããããŸããããŒã¿ããŒã¹ãµãŒãã¹åã¯db1ïŒçãDNSåïŒã§ã
- åådb1.be5.host58.example.comã¯ãresolv.confã®ããŒã¿ãããåådb1ããäœæãããŸãã ãªãŸã«ããŒã¯PowerDNSèŠæ±ãéä¿¡ããŸã
- db1.be5.host58ãšããååã®pDNSãã©ã°ã€ã³ã¯ãhost58ã«ããbe5ã³ã³ãããŒãdb1ãµãŒãã¹ãæ¢ããŠãããšçµè«ä»ããŸã
- CMDBããŒã¿ã¯ãhost58ã«æãè¿ãdb1ãµãŒãã¹ãæäŸããå®è¡äžã®ã³ã³ãããŒã®IPããªã¹ãããããã«äœ¿çšãããŸã
- be5ã®ãµãŒãã¹ã¯ãåä¿¡ãããªã¹ãããä»»æã®ã¢ãã¬ã¹ãéžæããdb1ãµãŒãã¹ã«ã¢ã¯ã»ã¹ããŸã
äžéçµæã®èŠçŽïŒããã³ããšã³ããããã¯ãšã³ãããµãŒãã¹ã¯ãCMDBã®åäžã®æ å ±æºã䜿çšããŠãäºããèŠã€ããŸãã ã¢ãã¬ã¹ãååŸããã«ã¯ãæ§æã®æ§ç¯ãšDNSã¯ãšãªã®2ã€ã®æ¹æ³ããããŸãã
ç©ççãªãããã¯ãŒã¯æ§é ãéä¿¡ã®åé¡
ãã¹ãã£ã³ã°ãããã€ããŒãããµãŒããŒãã¬ã³ã¿ã«ããŸãã ç°ãªãããŒã¿ã»ã³ã¿ãŒã®æ§é ã¯åãã§ããããã³ããšã³ããããã¯ãšã³ãããŸãã¯ãµãŒãã¹ãåããã³ã³ãããå®è¡ãããŠããç©çãã¹ãã®ã»ããã§ãã äœããã®çç±ã§å¿ èŠãªãµãŒãã¹ãå¥ã®ããŒã¿ã»ã³ã¿ãŒã§ã®ã¿å©çšå¯èœãªå Žåãä»»æã®ã³ã³ããŒãã³ãããã®ãªã¯ãšã¹ãã¯ãä»ã®ãã¹ããããã«ã¯å¥ã®ããŒã¿ã»ã³ã¿ãŒã«éä¿¡ã§ããŸãã åèšã§ã6ã€ã®ããŒã¿ã»ã³ã¿ãŒã«é 眮ãããŠãããåããŒã¿ã»ã³ã¿ãŒã«ã¯çŽ100ãŸãã¯2ã€ã®ãµãŒããŒããããåãµãŒããŒã«ã¯æ倧4ã€ãŸãã¯5ã€ã®ã³ã³ãããŒããããŸãã åèšã§ãçŽ1,000ã®ãã¹ããšçŽ5,000ã®ã³ã³ãããŒãååŸããŸãã
ãããã¯ãŒã¯æ§é å šäœãæå ã«ãªãããããªã³ã¯ãã¹ã€ããããã£ãã«è² è·ãªã©ãç£èŠã§ããŸããã åãçç±ã§ïŒãããã¯ãŒã¯ã¯æå ã«ãããŸããïŒããµãŒããŒéã®éä¿¡ã«ipsecã䜿çšããŸãã IPsecã¯ã2ã€ã®ãã¹ãéïŒãŸãã¯ã³ã³ãããŒéã®ã¿ïŒã®éä¿¡ã倱ããããšãã圢ã§é©ãã瀺ãããšããããŸãã åæ§ã®é©ãããããã€ããŒã®ã€ã³ãã©ã¹ãã©ã¯ãã£ã«ãã£ãŠæ瀺ãããŸãã ãããã«ãããç§ãã¡ãç¥ãããšãã§ããã®ã¯ããã¹ããŸãã¯ã³ã³ããã®ã»ããã®äžéšã§1ã€ã®ãã¹ãïŒãŸãã¯ãã®ã³ã³ããïŒãå©çšã§ããªããšããäºå®ã ãã§ãã ããã«ãå©çšã§ããªããšããäºå®ã¯ãã¢ããªã±ãŒã·ã§ã³ã¬ãã«ã§åžžã«çŸããããã§ã¯ãããŸããããµãŒãã¹ãè€è£œãããå©çšå¯èœãªãµãŒããŒããèŠæ±ãæºããããšãã§ããŸãã ãŸããäžå€®ãµãŒããŒããã®pingã䜿çšããŠãã®ãããªåé¡ãç£èŠããããšã¯ã§ããŸãã-圌ã¯åã«ãããã«æ°ä»ããªãã§ãããã
ãµãŒããŒã®æ°ãæ°åã«å¶éãããŠãããšããæ°ã«ããŸããã§ãããåãã¹ãããä»ã®ãã¹ãŠã®äººã«éä¿¡ãããpingãšæ倱ã®è¿œè·¡ã«ãã£ãŠæ¥ç¶ã確èªããŸããã ãã¹ãã®æ°ã1000ã«è¿ã¥ããšããã®ç°¡åãªæ¹æ³ã¯æ©èœããªããªããŸãã
- pingæéãé·ãããããŸãã¯ïŒ
- ç£èŠã®ããã®ãããã¯ãŒã¯æ¶è²»ãé¡èã«ãªããŸãïŒ1å°ã®ãµãŒããŒãã1ç§ã«1000å°ã®ãµãŒããŒã«éä¿¡ãããæšæºã®pingã¯ãã¡ã¬ãããã®åž¯åå¹ ãå¿ èŠãšããŸãã
- ã誰ã誰ãèŠããããŸãã¯èŠãªããåŠçããã³åæã®ããã®ãã¹ãäžã®CPUæ¶è²»ã倧ãããªã
- ã³ã³ããéã®æ¥ç¶æ§ã¯ç£èŠãããŸãã-ipsecã®åé¡ãã«ãŒãèšå®ã¯èŠããããã³ã³ããã¬ãã«ã§ã®åé¡ã«ã€ãªãããŸã
ããããã¹ãŠã®åé¡ã1åã®ãããã§è§£æ±ºããã«ã¯ãããã¹ãŠãã§ã¯ãªããçžäºã«ã¢ã¯ã»ã¹ããã³ã³ããŒãã³ãéã®é¢ä¿ã®ã¿ãç£èŠããå¿ èŠããããŸãã ãããã£ãŠãããã§çºçããæåã®ã¿ã¹ã¯ã¯ãç¹å®ã®ã³ã³ããŒãã³ããã¢ã¯ã»ã¹ããŠããã³ã³ããŒãã³ããèŠã€ããæ¹æ³ã§ãã éçºè ã ããããã確å®ã«ç¥ã£ãŠããŸãããåžžã«ææ°ã®æ å ±ãæäŸã§ããããã§ã¯ãªããããããã«ã€ããŠå°ããããäœããã®ã¬ãžã¹ããªãä¿æããããã«é Œãã ãããããšã¯ã»ãšãã©æå³ããããŸãããå®éãããã¯æ©èœããŸããã
ããã§ã¯ããµãŒãã¹ããäºããèŠã€ããæ¹æ³ã®ç¥èã®å©ãã«ãªããŸãïŒè§£æ±ºã䜿çšããªãããCMDBãžã®çŽæ¥åŒã³åºããä»ããŠããŒãããŒãèšç®ããã³ã³ããŒãã³ãã¯ããã®èšç®ã®çµæãæ§æã ãã§ãªãäžéšã®ãããªãã¯ã«ãä¿åããããã«æ±ããŸãåæããã圢åŒã®å Žæã ãŸãã解決ãéããŠCMDBã䜿çšãããµãŒãã¹ã®å ŽåãPowerDNSãã°ã解æããPowerDNSãèŠæ±ã«å¿çããããšã確èªããŸãã ãããã£ãŠããããã®ã³ã³ããŒãã³ããŸãã¯ãããã®ã³ã³ããŒãã³ãã§äœ¿çšã§ããIPã®å®å šãªãªã¹ããåéã§ããŸãã
ç£èŠããã¹ã
éä¿¡ãç£èŠããã¿ã¹ã¯ã®ããã«ãã³ã³ããéã®é¢é£ããæ¥ç¶ã®å®å šãªãªã¹ãã1ãæã«ãŸãšããŠããŸãããã®1ãæãããµãŒããŒãã®åœ¹å²ãæãããŸãã ãã¹ãŠã®æ å ±ã¯ãèŸæžã®åœ¢åŒã§ãµãŒããŒã«è¡šç€ºãããŸãã
ã³ã³ãã | ãªã³ã¯ãªã¹ã |
---|---|
be5.host58 | 192.168.5.1 192.168.5.2 10.1.2.3 10.2.3.4 |
be8.host1000 | 10.0.0.1 10.0.100.5 |
ãµãŒããŒã¯ãRESTã€ã³ã¿ãŒãã§ãŒã¹ãä»ããŠãã®æ å ±ãå©çšå¯èœã«ããŸãã
ç£èŠã®åŸåã¯åã³ã³ããã«ãããŸã-ãã®éšåãããšãŒãžã§ã³ãããšåŒã³ãŸãã ãšãŒãžã§ã³ãã¯ãããã眮ãããŠããã³ã³ãããç¥ãããçŸåšã®ç¶æ ã®åå以å€ã¯äœãä¿åããŸããã 2åããšã«ããšãŒãžã§ã³ãã¯ãµãŒããŒã«æ¥ç¶ã®ãªã¹ããåãåããããµãŒããŒã¯äžèšã®è¡šã®è¡ã§å¿çããŸãã éåžžãIPã¢ãã¬ã¹ã®ãªã¹ãã¯10ãè¶ ããŸããã ãšãŒãžã§ã³ãã¯ãããã®ã¢ãã¬ã¹ã«pingãéä¿¡ããŸãã åé¡ã®ãªã¹ãïŒããå ŽåïŒãå«ãçµæã¯ãPOSTãä»ããŠãµãŒããŒã«å ±åãããŸãã ãµãŒããŒããšãŒãžã§ã³ãã«å¯ŸããŠå®è¡ãããã¹ãŠã®æäœã¯éåžžã«åçŽã§ãããããå€æ°ã®ãšãŒãžã§ã³ããç°¡åã«åŠçã§ããŸãããã®ããã«ã¯ãGETãPOSTãªã¯ãšã¹ããåãå ¥ããŠèŸæžãæ€çŽ¢ããããèŸæžã«ããŒã¿ã1ç§ãããæ°ååè¿œå ããã ãã§ãã
ããã«ããšãŒãžã§ã³ãã¯æ°åããšã«èµ·åãããããã³ã³ããŒãã³ãã®ä»ã®çŸåšã®ããã©ãŒãã³ã¹ã€ã³ãžã±ãŒã¿ãŒãåéããŠãµãŒããŒã«è»¢éããããšã¯çã«ããªã£ãŠããŸãã muninã䜿çšããŠå€ãã®ããšãç£èŠããŸãããmuninã¯ããŒã¿ã®è¡šç€ºã«ããªã倧ããªé 延ãäžããŸãããããã§ã¯ããªã¢ã«ã¿ã€ã ãã¢ãŒãã§äœããååŸã§ããŸãã ãã®ããããšãŒãžã§ã³ãã¯ãã³ã³ããŒãã³ãå ã®LAãnginxãžã®èŠæ±ã®å²åïŒååšããå ŽåïŒãããã³ã³ãŒãããšã®nginxãšã©ãŒã®æ°ãªã©ã®ã€ã³ãžã±ãŒã¿ãåæã«åéããŸãã
çµæã®ç£èŠããã¬ãŒã³ããŒã·ã§ã³ãåæ
åè¿°ã®ããã«ããšãŒãžã§ã³ãã¯æ¥ç¶ãã¹ãã®çµæããµãŒããŒã«éä¿¡ããŸãïŒä»ã®ããŒã¿ãšãšãã«ããã®ãªã¹ãã¯ãšãŒãžã§ã³ãã«ãã£ãŠç°ãªãå ŽåããããŸãïŒã ããã«ç§ãã¡ãæã£ãŠããããã€ãã®æ å ±ããããŸãïŒ
ãåå | åæãã | DC | åœ¹å² | ããŒã | nginxErrRate | æ¥ç¶æ§ | nginxAccessRate |
be1.host123 | 0 | TX | ãªã | 0.21 | 15.55 | 31.38 | |
be1.host122 | 0 | TX | ãªã | 0.11 | | 18.28 | 34.61 | |
fo1.host161 | 2 | VA | fo | 0.02 | 0.11 | 10.1.1.4,10.1.2.4 | 14.1 |
fo1.host160 | 0 | VA | fo | 0.0 | 0.00 | 0.0 | |
fo1.host162 | 2 | VA | fo | 0.01 | 0.18 | 10.2.1.4,10.2.4.3 | 17.56 |
ãã®ããŒãã«ã®æ å ±ã®äžéšã¯ãšãŒãžã§ã³ãã«ãã£ãŠéä¿¡ããïŒåæãããŒããnginx ...ïŒãäžéšïŒDCãããŒã«ïŒã¯CMDBããèªã¿èŸŒãŸããŸãã ãã®ããŒãã«ã®ããŒã¿ã¯éåžžã«çåœã§ããããã®äžã®è¡æ°ã¯æ°åã®ãªãŒããŒã§ããããããïŒmemoryïŒãã¿ã€ãã®sqliteããŒã¿ããŒã¹ã®äžéšãšããŠèšèšããããšã¯çã«ããªã£ãŠããŸãã
ãã®åºåå šäœãèšçœ®ãããäž»ãªçç±ã¯ãã³ãã¥ãã±ãŒã·ã§ã³ã®åé¡ãç£èŠããããšã§ãã ãããã£ãŠãããããåæãšæ¥ç¶ã®åïŒå£ããæ¥ç¶ã®æ°ãšå¯Ÿå¿ããã³ã³ãããŒã®ãªã¹ãïŒã«ã®ã¿é¢å¿ããããŸãããäžè¬ã«ãåçŽãªSQLã¯ãšãªã䜿çšããŠãã®ãããªããŒãã«ããããŸããŸãªèå³æ·±ãäºå®ãååŸã§ããŸãã ãSELECT BY FROMããŒã¿ORDER BYåæDESCã-æåã«è§£æ±ºããå¿ èŠãããéä¿¡ã®åé¡ããããµãŒããŒã®ãªã¹ããæäŸããŸãã 空ã§ãªãå Žåããã®ã¯ãšãªã®çµæã¯ãåé¡ã®ãããµãŒããŒã®ãªã¹ããæ·»ä»ãããã¢ã©ãŒããšããŠNagiosã«éä¿¡ãããŸãã åé¡ã«é¢ããæ å ±ãåãåã£ãåœçŽã®ãšã³ãžãã¢ã¯ãããã«å¯Ÿçãè¬ããŸããåé¡ã®ãããµãŒããŒãããã©ãã£ãã¯ãåé€ãããã¹ãã£ã³ã°ãããã€ããŒã®ã·ã¹ãã ã§ãã±ãããäœæããŸãã
ã·ã¹ãã ã®ãšã©ãŒã®å šäœçãªã¬ãã«ãå¢å€§ãå§ããç¶æ³ãæã ãããŸãã ããã¯ãéçšäžã®åé¡ãšå€éšã®çç±ã®äž¡æ¹ã«é¢é£ããããŸããŸãªçç±ã§çºçããå¯èœæ§ããããŸãã æœè±¡çãªäŸ-ããŒã¿ã»ã³ã¿ãŒéã®ãªã¯ãšã¹ããæéå¶éã«é©åããªããªã£ããããããŒã¿ã»ã³ã¿ãŒéã®ã«ãŒãã£ã³ã°ãå€æŽãããnginxã§504ãšã©ãŒãå¢å ããŸããã ã¯ãšãªãSELECT SUMïŒnginxAccessRateïŒãSUMïŒnginxErrorRateïŒãdataCenter FROM data GROUP by dataCenter ORDER BY SUMïŒnginxAccessRateïŒãã¯ãããŒã¿ã»ã³ã¿ãŒå¥ã«å解ããããšã©ãŒã®äžè¬çãªç¶æ³ã瀺ããŠããŸãã ãã®å šäœåã¯ã504ãšã©ãŒãªã©ã§ã®ã¿æ©èœããã¯ãšãªã䜿çšããŠè©³çŽ°ã«è¡šç€ºã§ããŸãã
å¥ã®äŸ-ãµãŒããŒã®è² è·ãšããã«çºçãããšã©ãŒã®æ°ãšã®éã«çžé¢é¢ä¿ããããã©ããã調ã¹ãããšããŸãã ã¯ãšãª "SELECT loadãnginxErrorRate FROM data WHERE role =" be1 "ORDER by nginxErrorRate DESC"ã¯ããã®ãããªäŸåé¢ä¿ããããããŸãã¯åæçã«æ€åºããæ©äŒãæäŸããŸãã
ãã®ãããªäŸã®ãªã¹ãã¯ç¶ç¶ã§ããŸãã ããã§éèŠãªã®ã¯ãMuninã®ãã£ãŒããšã¯ç°ãªãããã®æ å ±ã¯ãã¹ãŠé¢é£æ§ãé«ãããšã§ããããŒã¿ã®è¡šç€ºã®é 延ã¯çŽ2åã§ãããããŒã¿åæã®æ¹æ³ã¯æ¯èŒã«ãªããªãã»ã©å€§ãããå®è¡ã容æã§ãã
ããã¯ãstatsd +ã°ã©ãã¡ã€ãã®ã¿ã€ãã®ãã³ãã«ã眮ãæãããœãªã¥ãŒã·ã§ã³ã§ã¯ãããŸãããå±¥æŽããªãããã ãã«ãã·ã¹ãã ã®åäœã®ããŸããŸãªã»ã¯ã·ã§ã³ããã°ããååŸããæ©èœã¯ããµãŒãã¹éã®æ¥ç¶ãåæããããã®ããŒãã¹ã«ãããŸããã
ãããã«
çŸåšèª¬æãããŠããã·ã¹ãã ã¯ãçŽ1000ã®ã³ã³ããã®éä¿¡ãç£èŠããŠããŸãã ãããŸã§ã«ããã©ãŒãã³ã¹ã®åé¡ã¯çºèŠãããŠããŸããã äžæ¹ãæ床ã¯ãéä¿¡ã®çæçãªæ倱ããã£ãã«ã®æ··éããŸãã¯æéã®å¢å ã«å¯ŸããŠé«ãããããšãå€æããŸããã ããã«ãããNagiosã¢ã©ãŒãã®æ床ã®èª¿æŽã«èŠåŽããŠããŸãã