Bug 269779

Summary: sysutils/datadog-agent: datadog agent error
Product: Ports & Packages Reporter: alexis.cimpu
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: New ---    
Severity: Affects Only Me CC: uros
Priority: --- Flags: bugzilla: maintainer-feedback? (uros)
Version: Latest   
Hardware: Any   
OS: Any   

Description alexis.cimpu 2023-02-23 13:30:36 UTC
Datadog agent fails to restart on freebsd with the error below if the agent is already stopped:

# service datadog-agent restart
Error: Error stopping the agent: Post "https://localhost:5001/agent/stop": dial tcp [::1]:5001: connect: operation timed out

Current workaround that seems to fix the problem is adding a check and a sleep in the stop or restart in rc.d of datadogagent 
Below is a snip of current datadogagent rc.d
datadog_agent_restart()
{
        datadog_agent_stop &&  sleep 3 && datadog_agent_start
        return $?
}


datadog_agent_stop() {
        rc_pid=`check_pidfile ${pidfile} ${command}`
        if [ -n "${rc_pid}" ]; then
                ${command} ${command_args} stop
        fi
        return $?
}