{
BOOST_ASSERT( !host_address.empty() );
- GlobalLogger.info() << "- Host up: " << host_address << endl;
+ bool has_changed = add_host_up( host_address );
- add_host_up( host_address );
+ if (has_changed)
+ GlobalLogger.notice() << "Status (" << HostsDownList.size()
+ << "/" << HostsDownLimit << " down): now up again is "
+ << host_address << endl;
+ else // less important so log only at info level
+ GlobalLogger.info() << "Status (" << HostsDownList.size()
+ << "/" << HostsDownLimit << " down): still up is "
+ << host_address << endl;
if ( !exceeded_host_down_limit() )
{
{
BOOST_ASSERT( !host_address.empty() );
- GlobalLogger.info() << "- Host down: " << host_address << endl;
-
add_host_down( host_address );
+ // report this always at notice level
+ GlobalLogger.notice() << "Status (" << HostsDownList.size()
+ << "/" << HostsDownLimit << " down): down is "
+ << host_address << endl;
+
if ( exceeded_host_down_limit() )
{
notify_link_down();
BOOST_ASSERT( HostsDownList.count( host_address ) == 1 );
} //lint !e1788
-void LinkStatus::add_host_up( const string &host_address )
+// returns true if this did change something (i.e. host had been down)
+bool LinkStatus::add_host_up( const string &host_address )
{
if ( HostsDownList.count( host_address ) > 0 )
{
size_t erased_host_count = HostsDownList.erase( host_address );
BOOST_ASSERT( erased_host_count == 1 );
+
+ return true;
}
+ else
+ return false;
+
}
void LinkStatus::add_host_down( const string &host_address )
"up"
); //lint !e534
+ GlobalLogger.notice() << "Status (" << HostsDownList.size()
+ << "/" << HostsDownLimit << " down): report link up" << endl;
bool executed = StatusNotifierCmd->execute();
if ( executed )
BOOST_ASSERT( CurrentLinkStatus == Status_Down );
BOOST_ASSERT( CurrentNotificationStatus == NotificationStatus_NotReported );
+ GlobalLogger.notice() << "Status (" << HostsDownList.size()
+ << "/" << HostsDownLimit << " down): report link down" << endl;
StatusNotifierCmd->set_token_value(
StatusNotifierCommand::StatusToken,
"down"