Add a 10 second wait to force alarm on. If the monitor doesn't notice it is likely not running, leaving an mmap behind

pull/3122/head
Isaac Connor 2021-01-31 11:44:58 -05:00
parent 14c06cd2d4
commit 4bcefe0562
1 changed files with 8 additions and 2 deletions

View File

@ -586,11 +586,17 @@ int main(int argc, char *argv[]) {
);
}
monitor->ForceAlarmOn(config.forced_alarm_score, "Forced Web");
while ( ((state = monitor->GetState()) != Monitor::ALARM) && !zm_terminate ) {
int wait = 10*1000*1000; // 10 seconds
while ( ((state = monitor->GetState()) != Monitor::ALARM) and !zm_terminate and wait) {
// Wait for monitor to notice.
usleep(1000);
wait -= 1000;
}
if ( (state = monitor->GetState()) != Monitor::ALARM and !wait ) {
Error("Monitor failed to respond to forced alarm.");
} else {
printf("Alarmed event id: %" PRIu64 "\n", monitor->GetLastEventId());
}
printf("Alarmed event id: %" PRIu64 "\n", monitor->GetLastEventId());
}
} // end if ZMU_ALARM