#include "host/hoststatus.h"
#include <iostream>
+#include <logfunc.hpp>
#include "boost_assert_handler.h"
using namespace std;
+using I2n::Logger::GlobalLogger;
//-----------------------------------------------------------------------------
// HostStatus
BOOST_ASSERT( 1 <= resolved_ip_count );
ResolvedIpCount = resolved_ip_count;
+
+ GlobalLogger.notice() << "Stat(" << HostAddress << "): "
+ << PingsFailedCount << " fail/" << PingsPerformedCount << " pings/"
+ << ResolvedIpCount << " IPs: #IPs set";
}
/**
*/
void HostStatus::update_ping_statistics( bool ping_success )
{
+ GlobalLogger.notice() << "Stat(" << HostAddress << "): "
+ << PingsFailedCount << " fail/" << PingsPerformedCount << " pings/"
+ << ResolvedIpCount << " IPs: add ping with success=" << ping_success;
+
BOOST_ASSERT( 1 <= ResolvedIpCount );
BOOST_ASSERT( 0 <= PingsPerformedCount );
BOOST_ASSERT( PingsFailedCount <= PingsPerformedCount );
// notify if the amount of pings that failed exceed the limit
if ( exceeded_ping_failed_limit() )
{
+ GlobalLogger.notice() << "Stat(" << HostAddress << "): "
+ << PingsFailedCount << " fail/" << PingsPerformedCount << " pings/"
+ << ResolvedIpCount << " IPs: notify down";
LinkAnalyzer->notify_host_down( HostAddress );
}
else
{
+ GlobalLogger.notice() << "Stat(" << HostAddress << "): "
+ << PingsFailedCount << " fail/" << PingsPerformedCount << " pings/"
+ << ResolvedIpCount << " IPs: notify up";
LinkAnalyzer->notify_host_up( HostAddress );
}
} //lint !e1762
{
++PingsPerformedCount;
- BOOST_ASSERT( ( 0 <= PingsPerformedCount ) && ( PingsPerformedCount <= ResolvedIpCount ) );
+ BOOST_ASSERT( ( 0 < PingsPerformedCount ) && ( PingsPerformedCount <= ResolvedIpCount ) );
}
void HostStatus::increase_ping_failed_count()
if ( PingsFailedCount > ping_fail_limit_count )
{
ExceededPingFailedLimit = true;
+
+ GlobalLogger.notice() << "Stat(" << HostAddress << "): "
+ << PingsFailedCount << " fail/" << PingsPerformedCount << " pings/"
+ << ResolvedIpCount << " IPs: exceed limit=" << ping_fail_limit_count;
}
else
{
ExceededPingFailedLimit = false;
+
+ GlobalLogger.notice() << "Stat(" << HostAddress << "): "
+ << PingsFailedCount << " fail/" << PingsPerformedCount << " pings/"
+ << ResolvedIpCount << " IPs: below limit=" << ping_fail_limit_count;
}
}