ãã®è¨äºã¯ Mackerel ãã©ã°ã¤ã³ã¢ããã³ãã«ã¬ã³ãã¼(å ¨é¨CREï¼ ã®2æ¥ç®ã§ãã
ããã§ã¯2æ¥ç®ã¯ mackerel-plugin-apache2
ã§ãã
ããã§ã¯Apacheã®ç´°ãã説æã¯å²æãã¾ãã
mackerel-plugin-apache2ã¯WebServerã¨ãã¦åºã使ããã¦ããApache2å°ç¨ã®pluginã§ãã
ãã¡ã㯠README.md ã«ãæ¸ãã¦ããéãã server-status
ãå¯è¦åãã¦ããããã©ã°ã¤ã³ã§ç°¡åã«å°å
¥ãããã¨ãã§ãã¾ãã
ã¤ã³ã¹ãã¼ã«ã¨è¨å®æé
æ¬ãã©ã°ã¤ã³ã¯ãã©ã°ã¤ã³éã¨ãã¦æä¾ãã¦ããããã±ã¼ã¸ã® mackerel-agent-plugins
ã«å«ã¾ãã¦ãã¾ãã
ã¤ã³ã¹ãã¼ã«å
㯠/usr/bin/mackerel-plugin-apache2
ã§ãã
mackerel-plugin-apache2ã®ã¤ã³ã¹ãã¼ã«ã¯ããã ãã§ã¯ãªããApache Serverå´ã«ã追å ã®è¨å®ãå¿ è¦ã§ãã httpd.confãé©å®è¨å®ãã¦ä¸è¨ã®å 容ã追è¨ãã¦ãã ããã
Listen 1080 ExtendedStatus On <VirtualHost 127.0.0.1:1080> <Location /server-status> SetHandler server-status </Location> </VirtualHost>
ããã«ãã http://127.0.0.1:1080/server-status/
ã«ã¢ã¯ã»ã¹ããã¨Apache2ã®æ
å ±ãè¦ããããã«ãªãã¾ãã
å®éã«ã¯ããã°ã©ã ã§æ´å½¢ããããããã« http://127.0.0.1:1080/server-status?auto
ã«ã¢ã¯ã»ã¹ãã¦ãããä¸è¨ã®ãããªåºåã«ãªãã¾ãã
Apache Server Statusã®ãµã³ãã«
mackerel-plugin-apache2ã¯ãã®æ å ±ããã¼ã¹ãã¦ã°ã©ãã«ãã¦ãããã®ã§ãã 次ã«Mackerelã®ãã©ã°ã¤ã³ã¯ã³ãã³ãã§ãã®ã§å®è¡ããäºãã§ãã¾ãã
â»/usr/bin ã¯PATHãéã£ã¦ããã®ã§çç¥åºæ¥ã¾ã
-- /usr/bin ã¯PATHãéã£ã¦ããã®ã§çç¥åºæ¥ã¾ã # mackerel-plugin-apache2 -p 1080 apache2.workers.busy_workers 1.000000 1511852690 apache2.workers.idle_workers 9.000000 1511852690 apache2.bytes.bytes_sent 20.000000 1511852690 apache2.cpu.cpu_load 0.564763 1511852690 apache2.req.requests 20.000000 1511852690 apache2.scoreboard.score-_ 9.000000 1511852690 apache2.scoreboard.score-W 1.000000 1511852690 apache2.scoreboard.score- 246.000000 1511852690
è¨å®ãã¡ã¤ã«ã§ããmackerel-agent.confã¯æ¨æºã§ã¯ /etc/mackerel-agent/mackerel-agent.conf
ã«ã¤ã³ã¹ãã¼ã«ããã¾ãã
ãã¡ãã«ä¸è¨ã®ã¨ãã追è¨ãã¾ãããã
[plugin.metrics.apache2] command = "mackerel-plugin-apache2 -p 1080"
以ä¸ãè¡ã£ãä¸ã§mackerel-agentãåèµ·åãã¦ãã ããã
è¦ããã¡ããªãã¯
server-statusã§è¦ããæ å ±ã«ã¤ãã¦ã¯Apacheã®å ¬å¼ããã¥ã¡ã³ãã«çºã¾ã£ã¦ãã¾ãã
mod_status - Apache HTTP サーバ バージョン 2.4
ã§ããããå°ãå ·ä½çã«è¦ã¦ããã¾ãããã
åã°ã©ãå®ç¾©ãã¨ã«èª¬æãã¾ãã
ã¾ã表ã«åºã¦ããdiffã¨ã¯ãã©ã°ã¤ã³ä¸ã§å·®åå¤è¨ç®ããããã©ããã§ãã
â¯
ã¨ãªã£ã¦ããé
ç®ã¯ãã©ã°ã¤ã³ã§ååã®å®è¡æã®å¤ã¨å·®åå¤è¨ç®ãã¦åºåãã¦ãã¾ãã
Apache Workers
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
Busy Workers | apache2.workers.busy_workers | ã¼ | ãªã¯ã¨ã¹ãå¦çä¸ã®ãµã¼ãããã»ã¹ï¼ã¹ã¬ããï¼æ° |
Idle Workers | apache2.workers.idle_workers | ã¼ | ãªã¯ã¨ã¹ãå¾ ã¡ç¶æ ã®ãµã¼ãããã»ã¹ï¼ã¹ã¬ããï¼æ° |
åè¿°ã®ã³ãã³ãã§ã¯ä¸è¨ã®é¨åã§ãã
apache2.workers.busy_workers 1.000000 1511852690 apache2.workers.idle_workers 9.000000 1511852690
ç¾ç¶ã®Apacheã®ããã»ã¹ã¾ãã¯ã¹ã¬ããã®ç¶æ ããããã¾ãã
StartServers 60 MinSpareServers 60 MaxSpareServers 60 MaxClients 60
ä¸è¨ã®ããã«Apacheã«è¨å®ããã¦ããå ´åã常㫠busy_workers+idle_workers=60
ã¨ãªãã¾ãã
ä¾ãã°busy_workersãå¤ãå ´åã¯Apacheãå¿ããã¨è¨ãã¾ãã100%ã«ãªãã¨ãªã¯ã¨ã¹ããæãã¦ããªãç¶æ
ã§ãã
ãã®å ´åã¯WebServerã®å°æ°ãå¢ããã¦ãã¼ããã©ã³ã·ã³ã°ãããã¢ããªã±ã¼ã·ã§ã³ããã¥ã¼ãã³ã°ãå¿
è¦ã§ãã
busy_workersãMaxClientsã«éããåã«æ°ã¥ãå¿
è¦ãããã¾ãã®ã§busy_workersãMaxClientsã®7å²ç¨åº¦ã§Warningã®ã¢ã©ã¼ããè¨å®ããã®ãè¯ãã§ãããã
éã«Webãµã¼ãã¹ã¨ãã¦ã¯ã¢ã¯ã»ã¹ããã¦ãªãéãããã¨ãåé¡ã§ãã
ãã®å ´åã¯idle_workersãç£è¦ãã¦å ´åã«ãã£ã¦ã¯WebServerã®å°æ°ãæ¸ãããªã©ã®ãã¥ã¼ãã³ã°ãè¡ãã¾ãããã
Apache Bytes
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
Bytes Sent | apache2.bytes.bytes_sent | ⯠| 1åéãããã®åè¨éä¿¡é |
åè¿°ã®ã³ãã³ãã§ã¯ä¸è¨ã®é¨åã§ãã
apache2.bytes.bytes_sent 20.000000 1511852690
å ã«ãªãserver-statusã¯åè¨éä¿¡éã§ãããã©ã°ã¤ã³ã§åºåãããå¤ã¯ååã®å®è¡ãããå¤ã¨ã®å·®åã¨ãªã£ã¦ãã¾ãã ä¾ãã°ã¢ã¯ã»ã¹ãå°ãªããç»åãã¡ã¤ã«ã大éã«ãããããªWebãã¼ã¸ãããã«ããã¯ã«ãªã£ã¦ãããªã©ããããã¾ãã ãã®å ´åã¯æ´ã«CDNã«ç§»è¡ãã¦ã©ãããããã©ãã£ãã¯ãæ¸ã£ãããªã©ããããã¾ãã
Apache CPU Load
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
CPU Load | apache2.cpu.cpu_load | ã¼ | CPU使ç¨çï¼UNIXçï¼ |
åè¿°ã®ã³ãã³ãã§ã¯ä¸è¨ã®é¨åã§ãã
apache2.cpu.cpu_load 0.564763 1511852690
ãã¡ãã¯ã·ã¹ãã ã¡ããªãã¯ã¹ã®load average5ãcpuã¨ã¯éãApacheã®ã¿ã®å¤ã«ãªãã¾ãã ãã®ãã該å½ã®ãã¹ãã®CPUã®é«é¨°ãApacheèµ·å ãªã®ããããã¨ãä»ã®ã¢ããªã±ã¼ã·ã§ã³èµ·å ãªã®ãåãåããããã¨ãåºæ¥ã¾ãã ä¾ãã°WebServerããããå¦çãå ¼ä»»ãã¦ããå ´åãªã©ä½µãã¦è¦ãã¨ä¾¿å©ã§ãã
Apache Requests
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
Requests | apache2.req.requests | ⯠| 1åéãããã®åè¨ã¢ã¯ã»ã¹åæ° |
åè¿°ã®ã³ãã³ãã§ã¯ä¸è¨ã®é¨åã§ãã
apache2.req.requests 20.000000 1511852690
å ã«ãªãserver-statusã¯åè¨ã¢ã¯ã»ã¹åæ°ã§ãããã©ã°ã¤ã³ã§åºåãããå¤ã¯ååã®å®è¡ãããå¤ã¨ã®å·®åã¨ãªã£ã¦ãã¾ãã ãã®åã®ã¨ãããApacheã«å¯¾ããã¢ã¯ã»ã¹æ°ã§ãã å¤ãæããã°æããã»ã©ãã¹ããæå¹æ´»ç¨ãã¦ããã¨ããã¾ãã ä»ã®å¤ã§ã¢ã©ã¼ããæ¥ãæã«æ³å®ã©ããã®ã¢ã¯ã»ã¹æ°ãæãã¦ãããã®ç¢ºèªãããã¨ã大åã§ãã
Apache Scoreboard
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
Waiting for connection | score-_ | ã¼ | ãªã¯ã¨ã¹ãå¾ ã¡ |
Starting up | score-S | ã¼ | èµ·åå¦çä¸ |
Reading request | score-R | ã¼ | ã¯ã©ã¤ã¢ã³ãããã®ãªã¯ã¨ã¹ããåä¿¡ä¸ |
Sending reply | score-W | ã¼ | ãªã¯ã¨ã¹ãã®å¦çå®è¡ãããã³ã¯ã©ã¤ã¢ã³ãã¸ã¬ã¹ãã³ã¹éä¿¡ä¸ |
Keepalive | score-K | ã¼ | ã¢ã¤ãã«æ¥ç¶ç¶æ ã§ãªã¯ã¨ã¹ãåä¿¡å¾ ã¡ |
DNS lookup | score-D | ã¼ | ã«ãã¯ã¢ããä¸ |
Closing connection | score-C | ã¼ | æ¥ç¶çµäº |
Logging | score-L | ã¼ | ãã°åºåå¦çä¸ |
Gracefully finishing | score-G | ã¼ | gracefulãªã¹ã¿ã¼ãã«ãããå¦ççµäºå¾ ã¡ |
Idle cleanup | score-I | ã¼ | ã¹ã¬ããåæ¢ä¸ |
Open slot | score- | ã¼ | èµ·åãã¦ãªãç¶æ |
åè¿°ã®ã³ãã³ãã§ã¯ä¸è¨ã®é¨åã§ãã
apache2.scoreboard.score-_ 9.000000 1511852690 apache2.scoreboard.score-W 1.000000 1511852690 apache2.scoreboard.score- 246.000000 1511852690
åè¿°ã®å¼ç¨å ã«ãæ¸ãã¦ããã¾ããã¹ã³ã¢ãã¼ãã¯ç¨¼åä¸ã®ããã»ã¹ã®åã ã®ç¶æ ã§ãã ä¸è¨ã®ããã»ã¹æ°ãã«ã¦ã³ãããåè¨å¤ãMackerelã«æ稿ããã¦ãã¾ãã ãã®ãããã¢ã¯ã»ã¹æ°ãå°ãªããããã»ã¹ã«ä½è£ãããã°Open slotãå¢ãã¾ãããã¢ã¯ã»ã¹ãå¢ããã°éã«ä»ã®ããã»ã¹ç¶æ ãå¢ãã¾ãã ãã®ããApacheã®ç¶æ ãç¥ãããã¨ãã¯ã¹ã³ã¢ãã¼ããæ´»ç¨ãããã¨ãéè¦ã§ããMackerelã¯ã¨ã¦ãããããããã¹ã³ã¢ãã¼ããå¯è¦åãã¦ããã¦ãã¾ãã®ã§æ¯éãæ´»ç¨ãã ããã
2æ¥ç®ã¯WebServerã§2大巨é ã®Apache2ã®ãã©ã°ã¤ã³ã«ã¤ãã¦ã®èª¬æã§ããã ææ¥ã¯çãããå¾ ã¡ãããWebãµã¼ãã®2大巨é ã®ããä¸ã¤ãnginxã§ãã å¼ãç¶ããMackerel ãã©ã°ã¤ã³ã¢ããã³ãã«ã¬ã³ãã¼ãã楽ãã¿ã«ï¼