Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[systemd] apply sysconfig settings on launch too. #3489

Merged
merged 3 commits into from
Aug 24, 2017

Conversation

truthbk
Copy link
Member

@truthbk truthbk commented Aug 23, 2017

What does this PR do?

Honor sysconfig settings when launching with systemd service.

Motivation

Not working in the mentioned scenario: #3301

@truthbk truthbk changed the title [systemd] apply sysconfig settings too. [systemd] apply sysconfig settings on launch too. Aug 23, 2017
@truthbk truthbk added this to the 5.17 milestone Aug 23, 2017
@truthbk truthbk force-pushed the jaime/sysconfigfix branch from 238f842 to 12e0f09 Compare August 23, 2017 17:08
@olivielpeau olivielpeau self-requested a review August 23, 2017 17:45
@@ -5,4 +5,9 @@

PATH=/opt/datadog-agent/embedded/bin:/opt/datadog-agent/bin:$PATH

if [ "$DATADOG_ENABLED" = "no" ]; then
echo "Disabled via $AGENTSYSCONFIG. Exiting."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$AGENTSYSCONFIG doesn't exist here, I'll update the PR

@olivielpeau
Copy link
Member

olivielpeau commented Aug 23, 2017

@truthbk This seems to work well but the way systemd logs what our script echoes is a bit weird when DATADOG_ENABLED is set to no:

This is what systemd logs once service datadog-agent start is called on an ubuntu 16.04 VM. The agent does not actually start (as expected) but the logs might be misleading:

$ journalctl -u datadog-agent
Aug 23 18:46:29 ubuntu-xenial systemd[1]: Starting "Datadog Agent"...
Aug 23 18:46:29 ubuntu-xenial supervisorctl[28008]: ERROR: unix:///opt/datadog-agent/run/datadog-supervisor.sock no such file (already shut down?)
Aug 23 18:46:29 ubuntu-xenial systemd[1]: Started "Datadog Agent".

whereas /var/log/syslog does contain what we echo from start_agent.sh:

Aug 23 18:46:29 ubuntu-xenial systemd[1]: Starting "Datadog Agent"...
Aug 23 18:46:29 ubuntu-xenial start_agent.sh[28007]: Disabled via DATADOG_ENABLED env var. Exiting.
Aug 23 18:46:29 ubuntu-xenial supervisorctl[28008]: ERROR: unix:///opt/datadog-agent/run/datadog-supervisor.sock no such file (already shut down?)
Aug 23 18:46:29 ubuntu-xenial systemd[1]: Started "Datadog Agent".

I think this is related to the forking type of our service, which might make systemd only log what the forked processes echo to stdout.

Not sure this is a blocker, I'm concerned this may make things harder to understand and debug by users. Let me know what you think though, and feel free to merge if you think this is OK.

@truthbk
Copy link
Member Author

truthbk commented Aug 24, 2017

The error: ERROR: unix:///opt/datadog-agent/run/datadog-supervisor.sock no such file (already shut down?) we see is due to ExecStop getting called. I think that since the script is exiting cleanly, the service is considered to have been up. Then systemd detects the process is gone, and calls ExecStop.

@olivielpeau
Copy link
Member

Going to go ahead and merge this, we can fix the slightly misleading log entry later.

@olivielpeau olivielpeau merged commit 8828728 into master Aug 24, 2017
@olivielpeau olivielpeau deleted the jaime/sysconfigfix branch August 24, 2017 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants