Is heartbeat url configuable? where acs is sending heart beat request?

cancel
Showing results for 
Search instead for 
Did you mean: 
venur
Established Member

Is heartbeat url configuable? where acs is sending heart beat request?

Jump to solution

As the title, i am seeing an error in our error logs. Seems like it is related to heartbeat, but where acs is sending these heart beat? As per the log the server is not something that we use. 

Is this configurable?

java.net.UnknownHostException: hbrx.alfresco.com: Name or service not known

 

2020-11-23 19:22:12,645  ERROR [heartbeat.datasender.HBDataSenderServiceImpl] [QuartzScheduler_Worker-1] [HB] Target is unavailable: https://hbrx.alfresco.com
java.net.UnknownHostException: hbrx.alfresco.com: Name or service not known
	at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
	at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515)
	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848)
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1364)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1298)
	at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
	at org.alfresco.heartbeat.datasender.HBDataSenderServiceImpl.isTargetAvailable(HBDataSenderServiceImpl.java:90)
	at org.alfresco.heartbeat.datasender.HBDataSenderServiceImpl.process(HBDataSenderServiceImpl.java:152)
	at org.alfresco.heartbeat.datasender.HBDataSenderServiceImpl.process(HBDataSenderServiceImpl.java:143)
	at org.alfresco.heartbeat.datasender.internal.schedule.HBDataSenderJob.execute(HBDataSenderJob.java:40)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)

Looking on this class (looked alfresco-heartbeat-data-sender jar) seems url is configurable but not finding where ? comment on the class says it is sent to AWS somewhere but question is why? Can we disable it?

package org.alfresco.heartbeat.datasender;

import java.util.List;
import java.util.function.Consumer;

import org.alfresco.heartbeat.datasender.internal.HBDataCacheQueue;
import org.alfresco.heartbeat.datasender.internal.HBDataConsumer;
import org.alfresco.heartbeat.datasender.internal.schedule.HBSendDataScheduler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

/**
 * Heartbeat Data Sender service implementation - collected data is sent to an ingestion endpoint (AWS).
 * 
 * @author Ancuta Morarasu
 *
 */
public class HBDataSenderServiceImpl implements HBDataSenderService
{
    private static Log logger = LogFactory.getLog(HBDataSenderServiceImpl.class);
    
    private static final String INGEST_ENDPOINT = "/ingest";
    private static final String HEALTH_ENDPOINT = "/health";
    
    private String heartBeatUrl;
    private int batchSize;
    private HBDataCacheQueue<HBData> dataCache;
    private boolean sendingEnabled;
    
    private HBSendDataScheduler scheduler;

    protected HBDataSenderServiceImpl()
    {
        this.dataCache = new HBDataCacheQueue<>();
    }

    protected HBSendDataScheduler getScheduler()
    {
        return scheduler;
    }

    protected void setScheduler(HBSendDataScheduler scheduler)
    {
        this.scheduler = scheduler;
    }

    protected void setCacheMaxEntries(long maxEntries)
    {
        dataCache.setMaxEntries(maxEntries);
    }
    
    protected void setBatchSize(int size)
    {
        this.batchSize = size;
    }

    protected void setHeartBeatUrl(String heartBeatUrl)
    {
        this.heartBeatUrl = heartBeatUrl;
    }
    protected String getHeartBeatIngestionUrl()
    {
        return heartBeatUrl + INGEST_ENDPOINT;
    }

    protected boolean isTargetAvailable()
    {
        boolean available = true;
 
        try (CloseableHttpClient client = HttpClients.createDefault())
        {
            HttpGet httpGet = new HttpGet(heartBeatUrl + HEALTH_ENDPOINT);
            CloseableHttpResponse response = client.execute(httpGet);
            available = response.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
            if (logger.isDebugEnabled())
            {
                logger.debug("[HB] Target available: " + response.getStatusLine().getReasonPhrase() + " - " + response.getStatusLine().getStatusCode());
            }
        }
        catch (Exception e)
        {
            logger.error("[HB] Target is unavailable: " + heartBeatUrl, e);
            available = false;
        }
        return available;
    }
    
    protected int getCacheCount()
    {
        return dataCache.size();
    }

    @Override
    public synchronized void enable(boolean heartbeatState)
    {
        this.sendingEnabled = heartbeatState;
        if (sendingEnabled)
          {
              // Schedule the sending job
              scheduler.scheduleJob();
          }
          else
          {
              // Stop the sending job
              scheduler.stopJob();
          }
    }

    @Override
    public void sendData(HBData data)
    {
        dataCache.add(data);
    }

    @Override
    public void sendData(List<HBData> dataBatch)
    {
        dataCache.addAll(dataBatch);
    }

    public void process()
    {
        process(new HBDataConsumer<HBData>(getHeartBeatIngestionUrl()));
    }
    public void process(Consumer<List<HBData>> consumer)
    {
        // Check the availability of the target, if the heartbeat server is down, there is no need to start sending data.
        if (isTargetAvailable())
        {
            try
            {
                dataCache.process(batchSize, consumer);
            }
            catch(Exception ex)
            {
                // Don't propagate any processing error.  
                logger.error("[HB] Cache processing error: " + ex.getMessage());
            }
        }
    }

}

Please help

 

1 Solution

Accepted Solutions
EddieMay
Alfresco Employee

Re: Is heartbeat url configuable? where acs is sending heart beat request?

Jump to solution

Hi @venur 

The heartbeat sends anonymous info to Alfresco about product usage. If you are using Community Edition you can disable it: 

heartbeat.enabled=false

HTH

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

View solution in original post

4 Replies
kaynezhang
Advanced

Re: Is heartbeat url configuable? where acs is sending heart beat request?

Jump to solution

try to add heartbeat.enabled=true to alfresco-global.properties

EddieMay
Alfresco Employee

Re: Is heartbeat url configuable? where acs is sending heart beat request?

Jump to solution

Hi @venur 

The heartbeat sends anonymous info to Alfresco about product usage. If you are using Community Edition you can disable it: 

heartbeat.enabled=false

HTH

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
venur
Established Member

Re: Is heartbeat url configuable? where acs is sending heart beat request?

Jump to solution

Thnx @EddieMay it is working, after adding properties to false i am not getting the log.

EddieMay
Alfresco Employee

Re: Is heartbeat url configuable? where acs is sending heart beat request?

Jump to solution

Hi @venur 

Glad its working & thanks for reporting back - really helpful to other users.

All the best,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!