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

          linux 服務器監控腳本

          Posted on 2010-12-14 16:10 rainingcn 閱讀(268) 評論(0)  編輯  收藏
          有時需要在服務器上每隔一段時間運行一段命令,以監控服務器性能??梢杂胏rontab來做。
          但是秒級的需要自己寫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

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


          網站導航:
           
          主站蜘蛛池模板: 密云县| 宝兴县| 京山县| 永安市| 白水县| 肃南| 民权县| 泗阳县| 临桂县| 正蓝旗| 云浮市| 肇庆市| 达州市| 大宁县| 宜丰县| 卢氏县| 秦安县| 榆社县| 博爱县| 新邵县| 封开县| 苍溪县| 罗平县| 乐昌市| 金门县| 罗田县| 偏关县| 璧山县| 大石桥市| 沿河| 韩城市| 庆云县| 环江| 循化| 剑河县| 桦南县| 巧家县| 历史| 瑞金市| 石屏县| 于田县|