posts - 6, comments - 0, trackbacks - 0, articles - 0

          linux 服務器監控腳本

          Posted on 2010-12-14 16:10 rainingcn 閱讀(268) 評論(0)  編輯  收藏
          有時需要在服務器上每隔一段時間運行一段命令,以監控服務器性能。可以用crontab來做。
          但是秒級的需要自己寫shell腳本。
          比如監控apache:
          #!/bin/sh
          echo 
          "==========1.httpd==2.total connection==3.wait connection====4.jboss connection"
          rp
          =1
          while rp=1
          do
          echo 
          "================="
          date 
          -d today +"%T"
          #show apache thread count
          ps -ef|grep httpd|wc -l
          #show total clients
          netstat 
          -ant|grep 10.108.10.2|wc -l
          #show time_wait or ESTABLISHED clients
          netstat 
          -ant|grep ffff|wc -l
          #show jboss connection
          netstat 
          -ant|grep 10.108.7.7|wc -l
          sleep 
          1
          done

          運行腳本前莫忘 chmod +x filename

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 梁山县| 天祝| 邹平县| 油尖旺区| 手机| 昌邑市| 花莲县| 绍兴市| 全州县| 达孜县| 漳浦县| 望江县| 来安县| 柳林县| 巴彦淖尔市| 长沙县| 息烽县| 恩施市| 安阳市| 徐州市| 定兴县| 长武县| 遂溪县| 鸡西市| 申扎县| 上栗县| 弥渡县| 葫芦岛市| 临夏县| 延津县| 巴青县| 阿城市| 金堂县| 疏附县| 通化县| 和龙市| 凭祥市| 申扎县| 小金县| 安塞县| 独山县|