ææã®"munin"ãã³ã£ãããããããç»é¢è¡¨ç¤ºãéããªã£ã¦ãã¦ãã²ãããªãã¨ããæ¹åãããã¨ã«ãªã£ã話ã
åææ¡ä»¶ã¨ãã¦ããã®muninãåãã¦ãããµã¼ãã¯æ°ç¾å°ã®ãã¼ã(ãµã¼ã)ã管çãã¦ããç¶æ ã§ãmuninã®ãã¼ã¸ã§ã³ã¯2.0ç³»ã§ããã
æ¬å½ã¯ãå¾å¦ã®ããã«ãä½ã£ã¦ããã人ã«ç´ãã¦ãããã¹ãã¨æãã¤ã¤ããã¾ãæ é·ãªãã¨ãè¨ã£ã¦ãããªãæãã ã£ãã®ã§ãä¸äººãã¥ã¼ãã³ã¬ã½ã³ãæ¢è¡ãã»ã»ã»è¦æããã£ãã®ã§ãã°ãæ®ãã¦ããã¾ãã(é
ããªã£ã¦ããããªãã)
æåã®ç¶æ (before)
ã¾ããmuninã®ããããã¼ã¸ã§ãããéãã¦ã¿ãã¨ããã
ãã»ã£ã19.61ç§ããã£ã¦ããã¾ãããããã¯ãªããªãã®ã¹ãã¬ã¹ã§ãã
ç¹ã«HTMLé¨åã®åºåã«19.4ç§ããã£ã¦ãããããããªãã¨ãããã°ãªãã¾ãã
次ã«4å°åã®ãµã¼ãã®åãªã½ã¼ã¹ã®è² è·ç¶æ³ã確èªã§ãããã¼ã¸ã表示ãã¦ã¿ãã¨
ãºã©ãºã©ã¨åºã¦ããã¾ããåã°ã©ãç»åã®pngãã¡ã¤ã«ã1ã¤è¿ãã®ã«700ããªç§ç¨ããã£ã¦ãã¾ããããµããµãã
çµå±ã1ãã¼ã¸åå
¨é¨èªã¿è¾¼ã¿çµããã¾ã§ã«ãã¼ã¿ã«ã§29.75ç§ããã£ã¦ãã¾ããã
ãã¦ããªãã¨ããã¦ã¿ã¾ãããã
1. HTMLãã¼ã¸ãéçã«çæ
ã¾ããmuninã®è¨å®ãã¡ã¤ã«ã§ãã"/etc/munin/munin.conf"ãè¦ã¦ã¿ãã¨ã
html_strategy cgi
ãå
¥ã£ã¦ãã¦HTMLãã¡ã¤ã«ãåçã«çæãããããã«ãªã£ã¦ãã¾ããã
ãããããææã§ã®çµç·¯çã«ããã¼ã¸ã§ã³1.4æ代ã¯ãæ°ç¾å°ã®ãã¼ãã管çãã¦ããã¨ãå種ã®éçãã¡ã¤ã«ã®çæã«ãã·ã³ãªã½ã¼ã¹ãã¨ããããã¦éãã£ããããå
¨é¨åçã«ãã¦ã¿ãããããªããã¨æããã¾ãã
ãããããããã¼ã¸å
¨ä½ããè¦ãã¨ãæ§æãããã¡ã¤ã«ã¯ç»åãã»ã¨ãã©ã ã¨æãã®ã§ãHTMLã ããéçã«äºåçæããããã«ãã¦ããã¾ãã
ã©ãã調ã¹ã¦ã¿ãã¨ãmunin2.0ç³»ã¯HTMLã®çæã¯éçãããã©ã«ãã¿ãããªã®ã§ãä¸è¨ãã³ã¡ã³ãã¢ã¦ããããã
html_strategy cron
æ示çã«ãâãªæãã§æå®ãã¾ãã
ãã¨ã¯ãçæããHTMLãåºåããå ´æã¨ãã¦ã
htmldir /var/www/html/munin/docs/
ãããªæãã§è¨å®ãã¦ããã¾ãã
次ã«ããã¼ã¸é ä¿¡ã¯Apacheãä»ãã¦è¡ããã¦ããã®ã§ãapacheã®confã§ã
RewriteCond %{REQUEST_URI} !^/static RewriteCond %{REQUEST_URI} .html$ [or] RewriteCond %{REQUEST_URI} =/ RewriteRule ^/(.*) /var/www/html/munin/cgi/munin-cgi-html/$1 [L]
âã®ãããªè¨è¼ããã£ãã®ã§ãå ¨ã¦ã³ã¡ã³ãã¢ã¦ãããä¸ã§ã
DocumentRoot /var/www/html/munin/docs
ãããªæãã§ãå ã»ã©è¨å®ããHTMLã®åºåå ´æãè¦ããããã«ãã¦ããã¾ãã(VirtualHostã§muninå°ç¨ã«ãããã¦ããã®ã§ãDocumentRootã§ãããã«æå®ãã¡ããã¾ããã)
ã»ã»ã»ãã¦ãããã§ã©ããªã£ããã¨ããã¨ã
ããããã¼ã¸ã®HTMLãã¼ã¸ã49msecã§è¿ãããã«ãªãã¾ãããéçãã¼ã¸ã§ããããã»ã»ã»ã
ã°ã©ãã®ãã¼ã¸ãHTMLã¯é«éã§è¿ãããã«ãªã£ã¦ãã¾ãã
ã°ã©ãã®ãã¼ã¸å
¨ä½ã§ã¯15.97ç§ã§ããå°ããã·ã«ãªãã¾ããã
2. CGIå¦çãã¦ããé¨åãFastCGIã«å¤ãã
ããã¯å®ç³ã§ã¯ããã¾ãããåã°ã©ãç»åã®åççæã¯CGIã§å¦çããã¦ããã®ã§ãããã«FastCGIãçªã£è¾¼ã¿ã¾ããã
Apacheã¸ã®FastCGIã¢ã¸ã¥ã¼ã«ã®å°å
¥ã¯ãã°ã°ãã¨ããæ¹ãããããåºã¦ããã®ã§ããã¡ããåèã«ãã¦ãã ããã
ãããã¦ãmuninå´ã®è¨å®ã®ä»æ¹ã¯ãmuninã®å ¬å¼ããã¥ã¡ã³ãã®ãCgiHowto2 – Muninãã«è¼ã£ã¦ããã®ã§ããã¡ããåèã«è¨å®ãã¦ã¿ã¦ãã ããã
ã¡ãªã¿ã«ã"cgitmpdir"ã¯tmpfsä¸ã«ç½®ãã¦ã¿ã¾ããã
ã»ã»ã»ä¸å¿ãç°¡åã«èª¬æãã¦ããã¨ãmunin.confã¯
cgitmpdir /data_tmp/munin graph_strategy cgi cgiurl_graph /cgi/munin-cgi-graph
ãããªæãã§å
¥ã£ã¦ãããã確èªã¨ã
Apacheå´ã®è¨å®ã¯ã
LoadModule fcgid_module modules/mod_fcgid.so
fcgiã®ã¢ã¸ã¥ã¼ã«ã®ãã¼ãã¨ã(ã¢ã¸ã¥ã¼ã«ã®ä½ãæ¹ã¯ã°ã°ã£ã¦ãã ãããã)
RewriteEngine On RewriteRule ^/cgi/munin-cgi-graph/(.*) /$1 RewriteCond %{REQUEST_URI} !^/static RewriteCond %{REQUEST_URI} .png$ RewriteRule ^/(.*) /var/www/html/munin/cgi/munin-cgi-graph/$1 [L] <Directory /var/www/html/munin/cgi> Options +ExecCGI SetHandler fcgid-script </Directory>
ãããªæãã§å ¥ã£ã¦ããã°OKãã¨ã(ããã¾ãããæ¸ãã®ãé¢åããããªã£ã¦ãã¦ã»ã»ã»)
ãã¦ããã®æç¹ã§ãã°ã©ãã®ãã¼ã¸ããã1度表示ãã¦ã¿ãã¨ããã
åã°ã©ãç»åã®pngãã¡ã¤ã«ã70ããªç§ãããã§è¿ãããã«ãªã£ãã®ã確èªã§ãã¾ããç´ ã®CGIã¨æ¯è¼ãã¦1/10ãããã®ã¬ã¹ãã³ã¹ã¿ã¤ã ã
ã°ã©ãã®ãã¼ã¸ã¯ãã¼ã¿ã«ã§ã2.26ç§ã§è¿ããããã«ãªãã¾ããã
3. éçãã¡ã¤ã«ãå§ç¸®ãã¦é ä¿¡
ãã¦ããã®è¾ºããã¯ãã¾ãçã«ãªã£ã¦ãã¾ãããè¿ãéçãªãã¡ã¤ã«ãã¢ãã«ãã£ã¦ã¯æ°åãæ°ç¾KBãããmuninã®ãµã¼ãã®ãã¯ã¼ã«ä½è£ããã£ãã®ã§å§ç¸®ãã¦é
ä¿¡ãã¦ã¿ã¾ãã
ã³ã¬ãããæ¹ã¯ãã°ã°ãã¨ããããåºã¦ãã¾ãããä¸å¿æ¸ãã¦ããã¨ãApacheã§
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript
ãããªæãã§muninã§æ±ã£ã¦ããããªéçãã¡ã¤ã«ã®ç¨®é¡ã®ãã®ã ãè¨è¼ã
ã¨ãã£ãæãã§ãã
ãã¦ãããããã¼ã¸ã表示ãã¦ã¿ãã¨ããã
é ä¿¡ãµã¤ãºãå°ãããªã£ã¦ã217msecã¨è¥å¹²æ©ããªã£ã¦ãã¾ãããã¤ã³ã¿ã¼ãã«ãªé«ééä¿¡ç°å¢ã¨ãããã¨ããã£ã¦ããã¯ãä½æã¯ã§ããªãã§ããã
ã°ã©ãã®ãã¼ã¸ãéçãªãã¡ã¤ã«ã®ãµã¤ãºãå°ãããªãããã
ãã¼ã¿ã«ã¯2.21ç§ã¨ãªãã¾ããã
4. keepaliveãæå¹ã«ãã
ããããèããã¨ãã°ã©ãã®ãã¼ã¸ã¯å¤§éã®ç»åãã¼ããããã®ã¨ãmuninã«ã¢ã¯ã»ã¹ããã¦ã¼ã¶ã¯ããããããããã§ã¯ãªãã®ã§ãApacheã®keepaliveãæå¹ã«ãã¦ããã¾ãã
KeepAlive On KeepAliveTimeout 3
ãããªæãã(KeepAliveTimeoutã¯ç°å¢ã«ãããã¦é©åã«è¨å®ãã¦ãã ããã)
ããã§ããããã¼ã¸ã¯ã¨ããã¨ããã
196msecã¨ããã¾ãè¥å¹²éããªãã¾ããã
ã°ã©ãã®ãã¼ã¸ã«é¢ãã¦ãã1.96ç§ã¨è¥å¹²ã®å¹æã¯ããã¿ããã§ããã
ãã£ãã®è¨å®ãããã§ãããããªãç©ããã°ãªãã¨ããã£ã¦ãã¨ã§ã»ã»ã»ã
ãã¦ãããã¾ã§ã®è¨å®ã§ã
- ããããã¼ã¸ã¯ã19.61ç§ â 196ããªç§
- ã°ã©ãã®ãã¼ã¸(ãµã¼ã4å°)ã¯ã29.75ç§ â 1.96ç§
ã¾ã§æ¹åã§ãã¾ãããããããããªããã¾ã¨ãã«ä½¿ãããã§ãããã
ãã¾ã. ãã©ã¦ã¶ãã£ãã·ã¥ãæ´»ç¨ããã®ä»
muninã®ãã¼ã¸ã§å¿ ãèªã¾ããç³»ã®ãã¡ã¤ã«ã¯ãæ¯åãªã¯ã¨ã¹ããã«ãã£ã¦ãç¡é§ãªã®ã§ã
<Directory /var/www/html/munin/static> ExpiresActive On ExpiresDefault "access plus 1 days" </Directory>
ãããªæãã§ãã£ãã·ã¥ã使ããããã«ãã¦ããã¨ããã¨æãã¾ãã
ãã¨ã¯ãmuninã稼åããã¦ãããµã¼ãã®ãã·ã³ãªã½ã¼ã¹(主ã«CPU)ã確èªããªããã
- FastCGIã®èµ·åããã»ã¹æ°ã®èª¿æ´
- muninã®munin_cgi_graph_jobsã®èª¿æ´
- muninã®max_processesã®èª¿æ´
- (ãã£ã¹ã¯I/Oãããã¯ã«ãªã£ã¦ããã°)SSDãtmpfsã®å©ç¨æ¤è¨
ãããããã§ãã¯ãã¦ããã°ããã®ã§ã¯ãªãã§ããããã
ã»ã»ã»ã¡ãªã¿ã«ãå®ã¯3ã¶æãããåã«ãã£ããã¨ãæ¸ãèµ·ãããã®ã§ãä½ãæ¼ãã¨ãããããããã¾ããããã®å ´åã¯ãã容赦ãã ããã
ããã§ã¯ï¼ =͟͟͞͞(๑•̀=͟͟͞͞(๑•̀д•́=͟͟͞͞(๑•̀д•́๑)=͟͟͞͞(๑•̀д•́
åè
- ä½è : John Allspaw,ä½è¤ç´ç,æ¨ä¸å²ä¹
- åºç社/ã¡ã¼ã«ã¼: ãªã©ã¤ãªã¼ã¸ã£ãã³
- çºå£²æ¥: 2009/03/19
- ã¡ãã£ã¢: ãã¼ãã¼ããã¯
- è³¼å ¥: 9人 ã¯ãªãã¯: 61å
- ãã®ååãå«ãããã° (21件) ãè¦ã