{
Log->set_log_facility(Conf->get_loglevel(),Conf->get_syslog(),Conf->get_external_warning_log(),Conf->get_external_warning_level(),Conf->get_external_log_only_once());
Log->print_init_log_facility();
+
+ Log->set_log_passwords(Conf->get_log_passwords());
}
string hostname = service->get_hostname();
time_t current_time = time(NULL);
- // Try to get the last update time of the service if there is one.
- // And check for burnt IP, too.
- std::map<time_t,std::string> last_updates = service->get_last_updates(); /*lint !e1793 */
- time_t lastupdated = 0;
-
- int last_updates_size = last_updates.size();
- int max_equal_updates_in_succession = service->get_max_equal_updates_in_succession();
-
- Log->print_last_updates(ip_host,max_equal_updates_in_succession,last_updates,service->get_hostname());
-
- // Only check for burnt IP address if there are at least max_equal_updates_in_succession entries in the last_updates map.
- if ( (max_equal_updates_in_succession != 0) && (last_updates_size >= max_equal_updates_in_succession) )
- {
- bool ip_burnt = true;
- int i = 0;
- // Reverse iterate "last_updates" list so the latest update
- // will be the first entry (map key is the unix timestamp)
- for ( std::map<time_t,std::string>::reverse_iterator r_iter = last_updates.rbegin();
- (r_iter != last_updates.rend()) && (i < max_equal_updates_in_succession); r_iter++ )
- {
- if ( i == 0 )
- lastupdated = r_iter->first;
-
- if ( ip_host != r_iter->second )
- {
- ip_burnt = false;
- break;
- }
-
- i++;
- }
-
- if ( ip_burnt )
- {
- // IP Address is burnt. Too many updates in succession with the same IP.
- Log->print_ip_burnt(ip_host,service->get_hostname());
- continue;
- }
- }
+ // Get the last update time of the service.
+ time_t lastupdated = service->get_last_update_time();
Log->print_check_service_update(hostname, current_time, lastupdated);
Log->print_cached_dns_entry(hostname, ip_dns_recheck, ip_last_update, ip_host);
// Test if the DNS-Record could not be found.
- if ( ip_dns_recheck.empty() )
+ // If DNS-Record was not found but service was not activated, the hostname could be deactivated, offline or not existent. In this case try a ordinary update.
+ if ( ip_dns_recheck.empty() && service->get_activated() )
{
Log->print_dns_lookup_failed(changed_to_online, hostname);
continue;
if ( ip_last_update != ip_host )
{
// Update
- Log->print_update_service(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated);
+ if ( !ip_dns_recheck.empty() )
+ {
+ Log->print_update_service(hostname, ip_dns_recheck, ip_last_update, ip_host, lastupdated);
+ }
+ else
+ {
+ // Service gets updated the first time and no DNS-Record was found. This is either a initial update or the hostname is really not available.
+ Log->print_update_service(hostname, "<NO IP SET>", ip_last_update, ip_host, lastupdated);
+ }
+
service->update(ip_host, current_time, changed_to_online);
}
else