diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index 5f6694e95..a6857d816 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -36,7 +36,7 @@ void CheckerComponent::Start(void) DynamicObject::OnUnregistered.connect(bind(&CheckerComponent::ObjectRemovedHandler, this, _1)); m_CheckTimer = boost::make_shared(); - m_CheckTimer->SetInterval(1); + m_CheckTimer->SetInterval(0.1); m_CheckTimer->OnTimerExpired.connect(boost::bind(&CheckerComponent::CheckTimerHandler, this)); m_CheckTimer->Start(); @@ -129,6 +129,8 @@ void CheckerComponent::CheckTimerHandler(void) msgbuf << "CheckTimerHandler: created " << tasks << " task(s)"; Logger::Write(LogInformation, "checker", msgbuf.str()); } + + RescheduleCheckTimer(); } void CheckerComponent::CheckCompletedHandler(const Service::Ptr& service) @@ -182,6 +184,8 @@ void CheckerComponent::NextCheckChangedHandler(const Service::Ptr& service) idx.erase(it); idx.insert(service); + + RescheduleCheckTimer(); } void CheckerComponent::ObjectRemovedHandler(const DynamicObject::Ptr& object) @@ -195,3 +199,17 @@ void CheckerComponent::ObjectRemovedHandler(const DynamicObject::Ptr& object) m_IdleServices.erase(service); m_PendingServices.erase(service); } + +void CheckerComponent::RescheduleCheckTimer(void) +{ + if (m_IdleServices.empty()) + return; + + typedef nth_index::type CheckTimeView; + CheckTimeView& idx = boost::get<1>(m_IdleServices); + + CheckTimeView::iterator it = idx.begin(); + Service::Ptr service = *it; + + m_CheckTimer->Reschedule(service->GetNextCheck()); +} diff --git a/components/checker/checkercomponent.h b/components/checker/checkercomponent.h index 66cb9a2f2..a6f652779 100644 --- a/components/checker/checkercomponent.h +++ b/components/checker/checkercomponent.h @@ -76,6 +76,8 @@ private: void CheckerChangedHandler(const Service::Ptr& service); void NextCheckChangedHandler(const Service::Ptr& service); void ObjectRemovedHandler(const DynamicObject::Ptr& object); + + void RescheduleCheckTimer(void); }; } diff --git a/docs/icinga2-config.txt b/docs/icinga2-config.txt index bc9614e5b..61c280b75 100644 --- a/docs/icinga2-config.txt +++ b/docs/icinga2-config.txt @@ -56,7 +56,7 @@ Example: 2.5m ------------------------------------------------------------------------------- -Supported suffixes include s (seconds), m (minutes) and h (hours). +Supported suffixes include ms (milliseconds), s (seconds), m (minutes) and h (hours). String Literals ^^^^^^^^^^^^^^^ diff --git a/lib/base/timer.cpp b/lib/base/timer.cpp index 23a171d6b..0922323bd 100644 --- a/lib/base/timer.cpp +++ b/lib/base/timer.cpp @@ -62,7 +62,10 @@ double Timer::ProcessTimers(void) * timer call took - we need to fetch the current time */ now = Utility::GetTime(); - timer->Reschedule(now + timer->GetInterval()); + double next = now + timer->GetInterval(); + + if (timer->m_Next < now || next < timer->m_Next) + timer->Reschedule(next); } assert(timer->m_Next > now); diff --git a/lib/config/config_lexer.cc b/lib/config/config_lexer.cc index 8b8bb86d2..1b0a84e66 100644 --- a/lib/config/config_lexer.cc +++ b/lib/config/config_lexer.cc @@ -370,8 +370,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 39 -#define YY_END_OF_BUFFER 40 +#define YY_NUM_RULES 40 +#define YY_END_OF_BUFFER 41 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -379,25 +379,25 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[160] = +static yyconst flex_int16_t yy_accept[161] = { 0, - 0, 0, 0, 0, 40, 38, 37, 37, 38, 38, - 38, 20, 38, 38, 38, 26, 38, 27, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 34, - 35, 37, 0, 21, 0, 0, 0, 0, 0, 20, - 30, 28, 26, 29, 32, 0, 31, 0, 23, 24, - 25, 0, 22, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 34, 33, 0, 0, - 0, 0, 0, 36, 26, 20, 6, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, - 0, 0, 0, 0, 20, 20, 20, 20, 20, 16, + 0, 0, 0, 0, 41, 39, 38, 38, 39, 39, + 39, 20, 39, 39, 39, 27, 39, 28, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 35, + 36, 38, 0, 21, 0, 0, 0, 0, 0, 20, + 31, 29, 27, 30, 33, 0, 32, 0, 24, 25, + 26, 0, 22, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 35, 34, 0, 0, + 0, 0, 0, 37, 27, 23, 20, 6, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 0, 0, 0, 0, 0, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 18, 1, 0, 0, 0, - 0, 0, 20, 20, 19, 20, 11, 20, 20, 20, - 20, 20, 0, 0, 0, 0, 0, 20, 20, 20, - 3, 12, 20, 5, 4, 0, 0, 0, 0, 0, - 20, 20, 20, 17, 13, 14, 0, 8, 0, 10, - 20, 15, 0, 0, 20, 9, 7, 2, 0 + 16, 20, 20, 20, 20, 20, 18, 1, 0, 0, + 0, 0, 0, 20, 20, 19, 20, 11, 20, 20, + 20, 20, 20, 0, 0, 0, 0, 0, 20, 20, + 20, 3, 12, 20, 5, 4, 0, 0, 0, 0, + 0, 20, 20, 20, 17, 13, 14, 0, 8, 0, + 10, 20, 15, 0, 0, 20, 9, 7, 2, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -440,134 +440,136 @@ static yyconst flex_int32_t yy_meta[40] = 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst flex_int16_t yy_base[166] = +static yyconst flex_int16_t yy_base[167] = { 0, - 0, 0, 273, 272, 278, 281, 38, 40, 273, 18, - 27, 261, 260, 35, 41, 39, 258, 281, 258, 39, + 0, 0, 274, 273, 279, 282, 38, 40, 274, 18, + 27, 262, 261, 35, 41, 39, 259, 282, 259, 39, 40, 42, 47, 44, 48, 52, 55, 61, 57, 0, - 261, 76, 267, 281, 240, 243, 232, 245, 248, 250, - 281, 281, 70, 281, 281, 0, 281, 252, 281, 281, - 281, 247, 281, 68, 69, 72, 73, 75, 74, 78, - 71, 87, 94, 89, 95, 96, 0, 281, 242, 242, - 224, 226, 230, 0, 101, 99, 242, 101, 103, 100, - 102, 112, 110, 109, 118, 119, 124, 126, 127, 228, - 221, 220, 216, 226, 128, 129, 130, 131, 136, 236, + 262, 76, 268, 282, 241, 244, 233, 246, 249, 251, + 282, 282, 70, 282, 282, 0, 282, 253, 282, 229, + 282, 247, 282, 68, 69, 72, 73, 75, 74, 78, + 71, 87, 94, 89, 95, 96, 0, 282, 242, 242, + 224, 226, 230, 0, 101, 282, 99, 242, 101, 103, + 100, 102, 112, 110, 109, 118, 119, 124, 126, 127, + 228, 221, 220, 216, 226, 128, 129, 130, 131, 136, - 138, 141, 142, 148, 143, 235, 234, 211, 229, 220, - 219, 223, 152, 144, 228, 154, 227, 156, 157, 159, - 161, 163, 220, 206, 220, 202, 215, 164, 166, 167, - 200, 199, 170, 198, 197, 189, 170, 170, 184, 169, - 168, 171, 173, 187, 281, 281, 165, 281, 169, 184, - 176, 182, 172, 85, 177, 281, 281, 38, 281, 216, - 220, 222, 226, 230, 234 + 236, 138, 141, 142, 148, 143, 235, 234, 211, 229, + 220, 219, 223, 152, 144, 228, 154, 227, 156, 157, + 159, 161, 163, 220, 206, 220, 202, 215, 164, 166, + 167, 200, 199, 170, 198, 197, 189, 170, 170, 184, + 169, 168, 171, 173, 187, 282, 282, 165, 282, 169, + 184, 176, 182, 172, 85, 177, 282, 282, 38, 282, + 216, 220, 222, 226, 230, 234 } ; -static yyconst flex_int16_t yy_def[166] = +static yyconst flex_int16_t yy_def[167] = { 0, - 159, 1, 160, 160, 159, 159, 159, 159, 161, 159, - 159, 162, 159, 159, 159, 159, 163, 159, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 164, - 159, 159, 161, 159, 159, 159, 159, 159, 159, 162, - 159, 159, 159, 159, 159, 165, 159, 159, 159, 159, - 159, 163, 159, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 164, 159, 159, 159, - 159, 159, 159, 165, 159, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 159, - 159, 159, 159, 159, 162, 162, 162, 162, 162, 162, + 160, 1, 161, 161, 160, 160, 160, 160, 162, 160, + 160, 163, 160, 160, 160, 160, 164, 160, 163, 163, + 163, 163, 163, 163, 163, 163, 163, 163, 163, 165, + 160, 160, 162, 160, 160, 160, 160, 160, 160, 163, + 160, 160, 160, 160, 160, 166, 160, 160, 160, 160, + 160, 164, 160, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 165, 160, 160, 160, + 160, 160, 160, 166, 160, 160, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, + 160, 160, 160, 160, 160, 163, 163, 163, 163, 163, - 162, 162, 162, 162, 162, 162, 162, 159, 159, 159, - 159, 159, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 159, 159, 159, 159, 159, 162, 162, 162, - 162, 162, 162, 162, 162, 159, 159, 159, 159, 159, - 162, 162, 162, 162, 159, 159, 159, 159, 159, 162, - 162, 162, 159, 159, 162, 159, 159, 162, 0, 159, - 159, 159, 159, 159, 159 + 163, 163, 163, 163, 163, 163, 163, 163, 160, 160, + 160, 160, 160, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 160, 160, 160, 160, 160, 163, 163, + 163, 163, 163, 163, 163, 163, 160, 160, 160, 160, + 160, 163, 163, 163, 163, 160, 160, 160, 160, 160, + 163, 163, 163, 160, 160, 163, 160, 160, 163, 0, + 160, 160, 160, 160, 160, 160 } ; -static yyconst flex_int16_t yy_nxt[321] = +static yyconst flex_int16_t yy_nxt[322] = { 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 6, 15, 16, 6, 17, 18, 6, 19, 20, 19, 19, 21, 19, 22, 19, 19, 23, 19, 24, 19, 25, 26, 27, 19, 19, 28, 29, 19, 19, 19, 32, 32, 32, 32, 35, 37, 36, 43, 45, 48, 44, - 43, 46, 159, 159, 159, 47, 159, 54, 159, 57, - 38, 159, 159, 49, 39, 56, 159, 50, 55, 159, - 61, 159, 62, 51, 59, 159, 58, 32, 32, 48, - 63, 43, 159, 159, 60, 159, 159, 159, 159, 159, - 65, 78, 159, 81, 49, 66, 64, 84, 50, 80, + 43, 46, 160, 160, 160, 47, 160, 54, 160, 57, + 38, 160, 160, 49, 39, 56, 160, 50, 55, 160, + 61, 160, 62, 51, 59, 160, 58, 32, 32, 48, + 63, 43, 160, 160, 60, 160, 160, 160, 160, 160, + 65, 79, 160, 82, 49, 66, 64, 85, 50, 81, - 79, 159, 76, 159, 51, 82, 83, 77, 159, 159, - 159, 86, 75, 159, 159, 159, 159, 159, 157, 99, - 85, 98, 87, 159, 159, 49, 159, 89, 101, 50, - 102, 88, 159, 159, 95, 51, 96, 97, 159, 100, - 159, 159, 159, 159, 159, 159, 104, 106, 107, 105, - 159, 115, 159, 103, 114, 159, 159, 159, 159, 118, - 119, 113, 159, 117, 116, 121, 159, 120, 159, 128, - 159, 159, 122, 159, 129, 159, 133, 159, 159, 130, - 159, 159, 159, 141, 159, 159, 135, 159, 151, 131, - 159, 159, 132, 156, 134, 142, 159, 144, 159, 154, + 80, 160, 77, 160, 51, 83, 84, 78, 160, 160, + 160, 87, 75, 160, 160, 160, 160, 160, 158, 100, + 86, 99, 88, 160, 160, 49, 160, 90, 102, 50, + 103, 89, 160, 160, 96, 51, 97, 98, 160, 101, + 160, 160, 160, 160, 160, 160, 105, 107, 108, 106, + 160, 116, 160, 104, 115, 160, 160, 160, 160, 119, + 120, 114, 160, 118, 117, 122, 160, 121, 160, 129, + 160, 160, 123, 160, 130, 160, 134, 160, 160, 131, + 160, 160, 160, 142, 160, 160, 136, 160, 152, 132, + 160, 160, 133, 157, 135, 143, 160, 145, 160, 155, - 153, 159, 143, 150, 149, 148, 147, 152, 146, 155, - 145, 159, 159, 159, 159, 158, 30, 30, 30, 30, + 154, 160, 144, 151, 150, 149, 148, 153, 147, 156, + 146, 160, 160, 160, 160, 159, 30, 30, 30, 30, 33, 33, 33, 33, 40, 40, 52, 52, 52, 52, - 67, 67, 140, 67, 74, 139, 74, 74, 138, 137, - 136, 159, 159, 127, 126, 125, 124, 123, 159, 159, - 159, 112, 111, 110, 109, 108, 159, 94, 93, 92, - 91, 90, 53, 75, 159, 73, 72, 71, 70, 69, - 34, 68, 159, 53, 42, 41, 34, 159, 31, 31, - 5, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 67, 67, 141, 67, 74, 140, 74, 74, 139, 138, + 137, 160, 160, 128, 127, 126, 125, 124, 160, 160, + 160, 113, 112, 111, 110, 109, 160, 95, 94, 93, + 92, 91, 53, 76, 75, 160, 73, 72, 71, 70, + 69, 34, 68, 160, 53, 42, 41, 34, 160, 31, + 31, 5, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159 + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160 } ; -static yyconst flex_int16_t yy_chk[321] = +static yyconst flex_int16_t yy_chk[322] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 7, 8, 8, 10, 11, 10, 14, 15, 16, 14, - 16, 15, 158, 20, 21, 15, 22, 20, 24, 22, + 16, 15, 159, 20, 21, 15, 22, 20, 24, 22, 11, 23, 25, 16, 11, 21, 26, 16, 20, 27, 26, 29, 27, 16, 24, 28, 23, 32, 32, 43, 28, 43, 54, 55, 25, 61, 56, 57, 59, 58, 29, 56, 60, 59, 43, 29, 28, 61, 43, 58, 57, 62, 54, 64, 43, 60, 60, 55, 63, 65, - 66, 63, 75, 76, 80, 78, 81, 79, 154, 81, - 62, 80, 64, 84, 83, 75, 82, 66, 83, 75, - 84, 65, 85, 86, 76, 75, 78, 79, 87, 82, - 88, 89, 95, 96, 97, 98, 86, 88, 89, 87, - 99, 97, 101, 85, 96, 102, 103, 105, 114, 101, - 102, 95, 104, 99, 98, 104, 113, 103, 116, 113, - 118, 119, 105, 120, 114, 121, 120, 122, 128, 116, - 129, 130, 141, 128, 133, 142, 122, 143, 142, 118, - 151, 155, 119, 153, 121, 129, 152, 133, 150, 149, + 66, 63, 75, 77, 81, 79, 82, 80, 155, 82, + 62, 81, 64, 85, 84, 75, 83, 66, 84, 75, + 85, 65, 86, 87, 77, 75, 79, 80, 88, 83, + 89, 90, 96, 97, 98, 99, 87, 89, 90, 88, + 100, 98, 102, 86, 97, 103, 104, 106, 115, 102, + 103, 96, 105, 100, 99, 105, 114, 104, 117, 114, + 119, 120, 106, 121, 115, 122, 121, 123, 129, 117, + 130, 131, 142, 129, 134, 143, 123, 144, 143, 119, + 152, 156, 120, 154, 122, 130, 153, 134, 151, 150, - 147, 144, 130, 141, 140, 139, 138, 143, 137, 151, - 136, 135, 134, 132, 131, 155, 160, 160, 160, 160, - 161, 161, 161, 161, 162, 162, 163, 163, 163, 163, - 164, 164, 127, 164, 165, 126, 165, 165, 125, 124, - 123, 117, 115, 112, 111, 110, 109, 108, 107, 106, - 100, 94, 93, 92, 91, 90, 77, 73, 72, 71, - 70, 69, 52, 48, 40, 39, 38, 37, 36, 35, - 33, 31, 19, 17, 13, 12, 9, 5, 4, 3, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 148, 145, 131, 142, 141, 140, 139, 144, 138, 152, + 137, 136, 135, 133, 132, 156, 161, 161, 161, 161, + 162, 162, 162, 162, 163, 163, 164, 164, 164, 164, + 165, 165, 128, 165, 166, 127, 166, 166, 126, 125, + 124, 118, 116, 113, 112, 111, 110, 109, 108, 107, + 101, 95, 94, 93, 92, 91, 78, 73, 72, 71, + 70, 69, 52, 50, 48, 40, 39, 38, 37, 36, + 35, 33, 31, 19, 17, 13, 12, 9, 5, 4, + 3, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159 + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[40] = +static yyconst flex_int32_t yy_rule_can_match_eol[41] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, - }; + 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, + 0, }; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -619,7 +621,7 @@ do { \ } while (0) #define YY_NO_UNISTD_H 1 -#line 623 "config_lexer.cc" +#line 625 "config_lexer.cc" #define INITIAL 0 #define IN_C_COMMENT 1 @@ -868,7 +870,7 @@ YY_DECL #line 49 "config_lexer.ll" -#line 872 "config_lexer.cc" +#line 874 "config_lexer.cc" yylval = yylval_param; @@ -925,13 +927,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 160 ) + if ( yy_current_state >= 161 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 159 ); + while ( yy_current_state != 160 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1078,17 +1080,17 @@ YY_RULE_SETUP case 23: YY_RULE_SETUP #line 72 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; } +{ yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; } YY_BREAK case 24: YY_RULE_SETUP #line 73 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; } +{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; } YY_BREAK case 25: YY_RULE_SETUP #line 74 "config_lexer.ll" -{ yylval->num = strtod(yytext, NULL); return T_NUMBER; } +{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; } YY_BREAK case 26: YY_RULE_SETUP @@ -1098,75 +1100,80 @@ YY_RULE_SETUP case 27: YY_RULE_SETUP #line 76 "config_lexer.ll" -{ yylval->op = OperatorSet; return T_EQUAL; } +{ yylval->num = strtod(yytext, NULL); return T_NUMBER; } YY_BREAK case 28: YY_RULE_SETUP #line 77 "config_lexer.ll" -{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; } +{ yylval->op = OperatorSet; return T_EQUAL; } YY_BREAK case 29: YY_RULE_SETUP #line 78 "config_lexer.ll" -{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; } +{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; } YY_BREAK case 30: YY_RULE_SETUP #line 79 "config_lexer.ll" -{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; } +{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; } YY_BREAK case 31: YY_RULE_SETUP #line 80 "config_lexer.ll" +{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 81 "config_lexer.ll" { yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; } YY_BREAK -case 32: +case 33: YY_RULE_SETUP -#line 83 "config_lexer.ll" +#line 84 "config_lexer.ll" BEGIN(IN_C_COMMENT); YY_BREAK -case 33: -YY_RULE_SETUP -#line 87 "config_lexer.ll" -BEGIN(INITIAL); - YY_BREAK case 34: -/* rule 34 can match eol */ YY_RULE_SETUP #line 88 "config_lexer.ll" -/* ignore comment */ +BEGIN(INITIAL); YY_BREAK case 35: +/* rule 35 can match eol */ YY_RULE_SETUP #line 89 "config_lexer.ll" +/* ignore comment */ + YY_BREAK +case 36: +YY_RULE_SETUP +#line 90 "config_lexer.ll" /* ignore star */ YY_BREAK -case 36: -YY_RULE_SETUP -#line 92 "config_lexer.ll" -/* ignore C++-style comments */ - YY_BREAK case 37: -/* rule 37 can match eol */ YY_RULE_SETUP #line 93 "config_lexer.ll" -/* ignore whitespace */ +/* ignore C++-style comments */ YY_BREAK case 38: +/* rule 38 can match eol */ YY_RULE_SETUP -#line 95 "config_lexer.ll" -return yytext[0]; +#line 94 "config_lexer.ll" +/* ignore whitespace */ YY_BREAK case 39: YY_RULE_SETUP #line 96 "config_lexer.ll" +return yytext[0]; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 97 "config_lexer.ll" ECHO; YY_BREAK -#line 1170 "config_lexer.cc" +#line 1177 "config_lexer.cc" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(IN_C_COMMENT): yyterminate(); @@ -1462,7 +1469,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 160 ) + if ( yy_current_state >= 161 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1491,11 +1498,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 160 ) + if ( yy_current_state >= 161 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 159); + yy_is_jam = (yy_current_state == 160); return yy_is_jam ? 0 : yy_current_state; } @@ -2354,7 +2361,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 96 "config_lexer.ll" +#line 97 "config_lexer.ll" diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 00b5fc7d5..6a72178fd 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -69,6 +69,7 @@ false { yylval->num = 0; return T_NUMBER; } [a-zA-Z_\*][:a-zA-Z0-9\-_\*]* { yylval->text = strdup(yytext); return T_IDENTIFIER; } \"[^\"]*\" { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING; } \<[^\>]*\> { yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; } +-?[0-9]+(\.[0-9]+)?ms { yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; } -?[0-9]+(\.[0-9]+)?h { yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; } -?[0-9]+(\.[0-9]+)?m { yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; } -?[0-9]+(\.[0-9]+)?s { yylval->num = strtod(yytext, NULL); return T_NUMBER; } diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 6b0888ff8..822077d16 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -45,7 +45,6 @@ REGISTER_TYPE(Service, serviceAttributes); const int Service::DefaultMaxCheckAttempts = 3; const int Service::DefaultCheckInterval = 5 * 60; -const int Service::MinCheckInterval = 5; const int Service::CheckIntervalDivisor = 5; boost::signal Service::OnCheckResultReceived; @@ -136,20 +135,17 @@ long Service::GetMaxCheckAttempts(void) const return value; } -long Service::GetCheckInterval(void) const +double Service::GetCheckInterval(void) const { Value value = Get("check_interval"); if (value.IsEmpty()) return DefaultCheckInterval; - if (value < MinCheckInterval) - value = MinCheckInterval; - return value; } -long Service::GetRetryInterval(void) const +double Service::GetRetryInterval(void) const { Value value = Get("retry_interval"); diff --git a/lib/icinga/service.h b/lib/icinga/service.h index d579b577b..d6c0309c2 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -69,7 +69,6 @@ public: static const int DefaultMaxCheckAttempts; static const int DefaultCheckInterval; - static const int MinCheckInterval; static const int CheckIntervalDivisor; String GetAlias(void) const; @@ -79,8 +78,8 @@ public: Dictionary::Ptr GetComments(void) const; String GetCheckCommand(void) const; long GetMaxCheckAttempts(void) const; - long GetCheckInterval(void) const; - long GetRetryInterval(void) const; + double GetCheckInterval(void) const; + double GetRetryInterval(void) const; Dictionary::Ptr GetHostDependencies(void) const; Dictionary::Ptr GetServiceDependencies(void) const; Dictionary::Ptr GetGroups(void) const;