亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: nagios eventhandler的問(wèn)題 [打印本頁(yè)]

作者: soap2003    時(shí)間: 2009-04-22 09:39
標(biāo)題: nagios eventhandler的問(wèn)題
本帖最后由 soap2003 于 2011-04-23 09:04 編輯

我想通過(guò)nagios先監(jiān)控本機(jī)的ssh進(jìn)程,當(dāng)發(fā)現(xiàn)進(jìn)程宕機(jī)的時(shí)候,則自動(dòng)重啟。

<<services.cfg>>

define service{
        host_name                               localhost
        service_description             local_procs_sshd
        check_command                   check_local_procs_sshd
        max_check_attempts                      3
        normal_check_interval           5
        retry_check_interval            5
        check_period                    24x7
        event_handler                   restart_sshd
        event_handler_enabled           1
        process_perf_data                       1
        notification_interval           5
        notification_period             24x7
        notification_options            w,u,c
        contact_groups                  admin
}

<<misccommands.cfg>>

define command{
        command_name                  restart_sshd
        command_line                    $USER1$/restart_sshd $SERVICESTATE$ $SERVICESTA
TETYPE$ $SERVICEATTEMPT$
}

<<restart_ssh>>

#!/bin/sh
#
# Event handler script for restarting the cypress server on the local machine
#
#


# What state is the search service in?
/usr/bin/printf "We enter" >> /usr/lib/nagios/plugins/sshd.log
yourdate=`date   +%Y%m%d%H%M%S`
case "$1" in
OK)
         
    # The service just came back up, so don't do anything...
    /usr/bin/printf "check OK $yourdate \n" >> /usr/lib/nagios/plugins/sshd.log
    ;;   
CRITICAL)
    # Aha!  The cypress service appears to have a problem - perhaps we should restart the server...
    /usr/bin/printf " The cypress service appears to have a problem $yourdate \n " >> /usr/lib/nagios/plugins/sshd.log
    service sshd restart
    ;;
esac
exit 0

配置基本這些,nagios。cfg中已經(jīng)
enable_event_handlers=1
當(dāng)監(jiān)控到服務(wù)停止的時(shí)候,就是不會(huì)調(diào)用哪個(gè)shell(restart_ssh),哪位高人幫忙分析一下,還有關(guān)于這些方面的調(diào)試應(yīng)該按照什么邏輯思路來(lái)查找問(wèn)題,原理方面還不是很懂,多謝

以下是eventlog
22-04-2009 10:25:17] SERVICE EVENT HANDLER: localhost;local_procs_sshd;CRITICAL;HARD;3;restart_sshd
[22-04-2009 10:25:05] SERVICE NOTIFICATION: nagiosadmin;localhost;local_procs_sshd;CRITICAL;notify-by-sms-serviceROCS CRITICAL: 0 processes with args /usr/sbin/sshd
[22-04-2009 10:25:05] SERVICE ALERT: localhost;local_procs_sshd;CRITICAL;HARD;3ROCS CRITICAL: 0 processes with args '/usr/sbin/sshd'
[22-04-2009 10:20:05] SERVICE EVENT HANDLER: localhost;local_procs_sshd;CRITICAL;SOFT;2;restart_sshd
[22-04-2009 10:20:05] SERVICE ALERT: localhost;local_procs_sshd;CRITICAL;SOFT;2ROCS CRITICAL: 0 processes with args '/usr/sbin/sshd'
[22-04-2009 10:20:01] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;local_procs_sshd;1240366795
[22-04-2009 10:19:05] SERVICE EVENT HANDLER: localhost;local_procs_sshd;CRITICAL;SOFT;1;restart_sshd
[22-04-2009 10:19:05] SERVICE ALERT: localhost;local_procs_sshd;CRITICAL;SOFT;1ROCS CRITICAL: 0 processes with args '/usr/sbin/sshd'
[22-04-2009 10:19:03] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;localhost;local_procs_sshd;1240366736


[ 本帖最后由 soap2003 于 2009-4-22 10:27 編輯 ]
作者: soap2003    時(shí)間: 2009-04-24 09:50
標(biāo)題: 加油
看來(lái)無(wú)人問(wèn)津,難道沒(méi)有相關(guān)的同行?
作者: heizi21    時(shí)間: 2009-05-04 22:15
基本和你相同吧,能檢測(cè)到宕機(jī),但是腳本不運(yùn)行,不起作用,不知道是不是權(quán)限問(wèn)題,試試 sudo,成功后請(qǐng)回復(fù)。




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2