ä»ã«ä¼¼ããã¼ã«ãããã°æãã¦æ¬²ããã§ã
ロードアベレージを監視して任意のコマンドを実行するコマンド - blog.nomadscafe.jp
ãã¾ã¾ã§ä½¿ã£ããã¨ã¯ãªãã£ãã®ã§ãããmonit ã§ã§ããã¯ããã¨æã£ã¦å®é¨ãä¸è¬çã«ã¯ãè² è·ãä¸ãã£ããããã»ã¹ãå¿çããªããªã£ããåèµ·åãã®ãããªç¨éã«ä½¿ããã¼ã«ã§ãã
# /etc/monit/monitrc check system localhost start program = "/path/to/command" if loadavg (1min) > 2 then start
[追è¨] exec ã使ãã»ããããã¨ã®ãææãã³ã¡ã³ãã§ããã ãã¾ããã
check system localhost if loadavg (1min) > 2 then exec "/path/to/command"
ããã§ãã¼ãã¢ãã¬ã¼ã¸ã®1åå¹³åã2ãè¶ ããå ´åã« /path/to/command ãå®è¡ããã¾ãã
ãã°ã¯ãããªæãã§åºã¾ããã
[JST Jul 26 15:48:00] error : 'localhost' loadavg(1min) of 2.4 matches resource limit [loadavg(1min)>2] [JST Jul 26 15:48:00] info : 'localhost' start: /path/to/command
ããªã¬ã«ãããã®ã¯ãã¼ãã¢ãã¬ã¼ã¸ä»¥å¤ã«ããCPUãã¡ã¢ãªããã£ã¹ã¯ã®ä½¿ç¨çããã¡ã¤ã«ã®ãµã¤ãºãã¿ã¤ã ã¹ã¿ã³ããå±æ§ãTCPã®ãã¼ãã«åå¿ãããããªã©ããããããªãã®ã使ãã¾ãã
çµã¿è¾¼ã¿ã® Web UI ããã£ã¦ãç¶æ ããã©ã¦ã¶ã§è¦ããç£è¦ãæ¢ããããã§ããã¨ã http://mmonit.com/monit/screenshots/
ãªããªã便å©ããã§ããã