IT貓撲網(wǎng):您身邊最放心的安全下載站! 最新更新|軟件分類|軟件專題|手機版|論壇轉(zhuǎn)貼|軟件發(fā)布

您當(dāng)前所在位置: 首頁操作系統(tǒng)LINUX → linux系統(tǒng)監(jiān)控利器--monit

linux系統(tǒng)監(jiān)控利器--monit

時間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(1)

  Monit 是用于對系統(tǒng)中的進程、文件、目錄、以及設(shè)備等進行監(jiān)視和管理的工具。當(dāng)你所指定的server宕機或者沒有反應(yīng),monit會將該進程殺死并重啟該server。并通過郵件進行通知。Monit 包含一個內(nèi)嵌的 HTTP(S) Web 界面,你可以使用瀏覽器方便地查看 Monit 所監(jiān)視的服務(wù)器。

  Monit的官方網(wǎng)站: http://www.mmonit.com

  下面將介紹monit在CentOS5.3上的安裝和配置:

  download:http://mmonit.com/monit/dist/monit-5.1.1.tar.gz

  shell >? tar xzvf monit-5.1.1.tar.gz

  shell> cd monit-5.*

  shell>./configure

  shell>make

  shell> make install

  shell> rm /etc/monitrc

  shell> cp monitrc /etc/

  在inittab文件中添加下面這句話,使init守護monit進程?。?/p>

  shell> vi /etc/inittab

  mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc

  現(xiàn)在安裝完成了,是不是超簡單??!

  接下來就是配置了!!

  Monitrc文件########################################################

  set daemon? 120? #設(shè)置monit檢查的間隔時間,單位是秒?。?/p>

  set logfile syslog facility log_daemon? #用syslog來記錄log

  set logfile /var/logs/monit.log #設(shè)置日志路徑

  set idfile /var/.monit.id #設(shè)置PID文件的位置

  set mailserver? 192.168.0.21,?? # primary mailserver? 郵件服務(wù)器的IP

  set mail-format { from: monit@test.com }? #設(shè)置你的郵件從哪個賬號發(fā)出

  set alert phoneNumber@139.com?? #發(fā)到我的139郵箱,用139郵箱是因為139有一個郵件到達通知功能

  set httpd port 2812 and????? #設(shè)置monit監(jiān)聽的端口號

  use address 192.168.0.21?? # 設(shè)置monit服務(wù)器的IP,可以讓你方便的http訪問

  allow admin:pass????? #設(shè)置用戶名和密碼

  ################################# Services? ##############################

  監(jiān)控服務(wù)器的磁盤使用情況

  check device system with path /dev/mapper/VolGroup00-LogVol00

  if space usage > 85% for 5 times within 15 cycles then alert

  if space usage > 95% then stop

  if inode usage > 85% then alert

  if inode usage > 95% then stop

  ######################################################

  #sshd?? 監(jiān)控sshd進程

  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 host 127.0.0.1 port 22? then restart

  if 5 restarts within 5 cycles then timeout

  #######################################################

  #cron 監(jiān)控crontab進程

  check process cron with pidfile /var/run/crond.pid

  group system

  start program = "/etc/init.d/crond start"

  stop program = "/etc/init.d/crond stop"

  if 5 restarts within 5 cycles then timeout? depends on cron_rc

  #########################################################################

  #scripts?? 監(jiān)控nginx的日志切割腳本文件

  check file cut_nginx_log.sh with path /scripts/cut_nginx_log.sh

  group scripts

  if failed checksum then unmonitor

  if failed permission 755 then unmonitor

  if failed uid root then unmonitor

  if failed gid root then unmonitor

  ##########################################################################

  #systemfile??? 監(jiān)控passwd文件和group文件

  check file passwd with path /etc/passwd

  group system

  if failed checksum then unmonitor

  if failed permission 644 then unmonitor

  if failed uid root then unmonitor

  if failed gid root then unmonitor

  check file group with path /etc/group

  group system

  if failed checksum then unmonitor

  if failed permission 644 then unmonitor

  if failed uid root then unmonitor

  if failed gid root then unmonitor

  ##############################################################

  # 監(jiān)控本機的25,110端口號

  check host localhost with address 127.0.0.1

  if failed port 25? with timeout 15 seconds then exec "/usr/bin/qmailctl restart"

  if failed port 110 protocol pop with timeout 15 seconds then exec "/usr/bin/vpopmailctl restart"

  基本的配置就是這樣子,剩下的就是根據(jù)各自的實際情況進行修改?。?!,配置好從瀏覽器登錄查看下是否成功,接下來就是輕松的喝喝茶,逛逛論壇了!! 哈哈

關(guān)鍵詞標(biāo)簽:linux系統(tǒng)監(jiān)控利器

相關(guān)閱讀

文章評論
發(fā)表評論

熱門文章 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 Tomcat9.0如何安裝_Tomcat9.0環(huán)境變量配置方法 Tomcat9.0如何安裝_Tomcat9.0環(huán)境變量配置方法 多種操作系統(tǒng)NTP客戶端配置 多種操作系統(tǒng)NTP客戶端配置 Linux操作系統(tǒng)修改IP Linux操作系統(tǒng)修改IP

相關(guān)下載

    人氣排行 Linux下獲取CPUID、硬盤序列號與MAC地址 dmidecode命令查看內(nèi)存型號 linux tc實現(xiàn)ip流量限制 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 linux下解壓rar文件 lcx.exe、nc.exe、sc.exe入侵中的使用方法 Ubuntu linux 關(guān)機、重啟、注銷 命令 查看linux服務(wù)器硬盤IO讀寫負載