隨筆 - 0, 文章 - 264, 評(píng)論 - 170, 引用 - 0
          數(shù)據(jù)加載中……

          監(jiān)控系統(tǒng)服務(wù)和端口,異常時(shí)實(shí)現(xiàn)自動(dòng)重啟

          詳見:http://www.51testing.com/html/86/n-214186.html

          示例,監(jiān)聽ssh服務(wù),如果停止則自動(dòng)重啟服務(wù),步驟如下:
          1、vi /etc/monit.d/sshd.monit。
          2、撰寫內(nèi)容,如下:
          check process sshd with pidfile /var/run/sshd.pid
              start program = "/etc/init.d/sshd start"
              stop program = "/etc/init.d/sshd stop"
              if failed port 22 protocol ssh then restart
              if 5 restarts within 5 cycles then timeout
          3、如果要設(shè)置monit的相關(guān)參數(shù),比如多長(zhǎng)時(shí)間檢測(cè)一次,請(qǐng)修改/etc/monit.conf,示例文件如下:
          set daemon 300

          set logfile /var/log/monit.log
          set idfile /var/monit/id
          set statefile /var/monit/state

          set httpd port 2812 and use address 127.0.0.1
              allow 127.0.0.1
              allow surfront:surfront

          check system 127.0.0.1

          include /etc/monit.d/*.monit
          4、重啟monit服務(wù),/etc/init.d/monit restart。
          5、完畢,monit的相關(guān)日志位于/var/log/monit.log。

          posted on 2013-03-01 17:08 小一敗涂地 閱讀(3020) 評(píng)論(0)  編輯  收藏 所屬分類: linux相關(guān)性能調(diào)優(yōu)相關(guān)surfront問題清單

          主站蜘蛛池模板: 肇源县| 扶余县| 石门县| 榆树市| 冀州市| 永修县| 岐山县| 昌图县| 江安县| 钟山县| 那坡县| 桃江县| 南安市| 台安县| 宁强县| 韶关市| 常宁市| 沭阳县| 游戏| 铜川市| 庆阳市| 南澳县| 浮山县| 岚皋县| 商城县| 赞皇县| 凌云县| 秦皇岛市| 浮山县| 会同县| 潞西市| 泊头市| 怀宁县| 民权县| 辰溪县| 巴东县| 五华县| 南靖县| 新沂市| 集贤县| 霍林郭勒市|