
최근에 다음 내용에 몇 가지 경고가 있음을 확인했습니다 nagios.log
.
[1366060611] Warning: The check of service 'pt-deadlock-logger' on host 'xx' looks like it was orphaned (results never came back). I'm scheduling an immediate check of the service...
중요한 문제는 그 이후에는 Nagios가 더 이상 검사를 실행하지 않는다는 것입니다. 해결 방법으로 다음 경고가 표시될 때마다 Nagios를 다시 시작하도록 이벤트 핸들러를 설정해야 합니다.
localhost.cfg
define service{
use logfile-service
host_name localhost
service_description nagios_orphaned
check_command check_nagios_orphaned
event_handler restart_nagios
contact_groups admin
}
commands.cfg
define command {
command_name check_nagios_orphaned
command_line sudo $USER2$/check_logfiles --tag=orphaned --logfile=/usr/local/nagios/var/nagios.log --warningpattern="looks like it was orphaned"
}
define command {
command_name restart_nagios
command_line $USER1$/eventhandlers/restart_nagios.sh $SERVICESTATE$
}
restart_nagios.sh
#!/bin/bash
case "$1" in
OK)
;;
WARNING)
/usr/bin/screen -S nagios -d -m sudo /etc/init.d/nagios restart
;;
UNKNOWN)
;;
CRITICAL)
;;
esac
exit 0
Nagios를 최신 버전으로 업데이트하려고 했습니다.
# nagios -V
Nagios Core 3.5.0
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 03-15-2013
License: GPL
하지만 여전히 이 경고가 표시됩니다.
구글링의 첫 번째 결과는 다음과 같습니다.http://support.nagios.com/wiki/index.php/Nagios_XI:FAQs#Check_Services_Being_Orphaned
하지만 실행 중인 (부모) 프로세스는 하나만 있다고 확신합니다.
# ps -ef | grep '/usr/local/nagios/bin/nagio[s]'
nagios 8956 15155 0 18:08 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 8957 15155 0 18:08 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 15155 1 5 14:09 ? 00:13:47 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
Resource temporarily unavailable
게다가 로그 파일에는 오류가 보이지 않으므로 ulimit
제한 가능성도 배제할 수 있습니다.
내장된 Perl 인터프리터가 이미 비활성화되었습니다.
enable_embedded_perl=0
use_embedded_perl_implicitly=0
다른 원인이 있나요?
추신: 저는 Xen HVM에서 Nagios를 실행하고 있습니다.
# virt-what
xen
xen-hvm
업데이트 화요일 4월 16일 22:07:09 ICT 2013
소스 코드 디렉토리에서 이 경고를 검색해 보면 다음과 같습니다.
# grep -lr 'looks like it was orphaned' nagios-3.5.0
/nagios-3.5.0/base/checks.o
/nagios-3.5.0/base/nagios
/nagios-3.5.0/base/checks.c
그리고 이것은 check_for_orphaned_services
기능입니다:
/* check for services that never returned from a check... */
void check_for_orphaned_services(void) {
service *temp_service = NULL;
time_t current_time = 0L;
time_t expected_time = 0L;
log_debug_info(DEBUGL_FUNCTIONS, 0, "check_for_orphaned_services()\n");
/* get the current time */
time(¤t_time);
/* check all services... */
for(temp_service = service_list; temp_service != NULL; temp_service = temp_service->next) {
/* skip services that are not currently executing */
if(temp_service->is_executing == FALSE)
continue;
/* determine the time at which the check results should have come in (allow 10 minutes slack time) */
expected_time = (time_t)(temp_service->next_check + temp_service->latency + service_check_timeout + check_reaper_interval + 600);
/* this service was supposed to have executed a while ago, but for some reason the results haven't come back in... */
if(expected_time < current_time) {
/* log a warning */
logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: The check of service '%s' on host '%s' looks like it was orphaned (results never came back). I'm scheduling an immediate check of the service...\n", temp_service->description, temp_service->host_name);
log_debug_info(DEBUGL_CHECKS, 1, "Service '%s' on host '%s' was orphaned, so we're scheduling an immediate check...\n", temp_service->description, temp_service->host_name);
/* decrement the number of running service checks */
if(currently_running_service_checks > 0)
currently_running_service_checks--;
/* disable the executing flag */
temp_service->is_executing = FALSE;
/* schedule an immediate check of the service */
schedule_service_check(temp_service, current_time, CHECK_OPTION_ORPHAN_CHECK);
}
}
return;
}
업데이트 시간: 4월 18일 목요일 22:32:19 ICT 2013
확인을 위해 소스 코드를 편집하여 로그 파일에 expected_time
및 값을 추가했습니다. current_time
내가 얻는 것은 다음과 같습니다.
[1366294608] expected_time: 'Thu Apr 18 21:16:36 2013
', current_time: 'Thu Apr 18 21:16:48 2013
' - Warning: The check of service 'Check_MK' on host 'xx' looks like it was orphaned (results never came back). I'm scheduling an immediate check of the service...
로그 파일을 다시 읽으면 중요한 메시지가 표시됩니다.
[1366218303] Warning: A system time change of 0d 0h 0m 1s (backwards in time) has been detected. Compensating...
Xen이 범인인 것 같습니다.