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

Add in support for /etc/default/datadog-agent and set nicelevel from it #3086

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

directionless
Copy link

What does this PR do?

This adds support for /etc/default/datadog-agent into the debian and centos init scripts.
It then uses the NICELEVEL if set.

In debian, start-stop-daemon has a --nicelevel argument.

In centos, daemon does not, but seems to honor the NICELEVEL environmental variable

Motivation

In my environment, we run sshd at a high priority to aid in access during host issues. This higher priority is inherited by apt, and by the init script. Thus accidentally causing datadog-agent to run at high priority

We're finding that when datadog-agent runs at a high priority, gohai ends up causing some CPU locks. I referenced this in #3085 This is workaround.

Additional Notes

I don't know how to add this to the systemd configs. Though they won't have the same inheritance issue I'm running into.

For debian systems, start-stop-daemon has a `--nicelevel` argument.

For centos, daemon does not, but seems to honor the NICELEVEL environmental variable
@davexunit
Copy link

This patch would be extremely useful to me. Any chance of it getting merged soon?

Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

Thanks @directionless for your PR! And sorry for not responding earlier.

Overall I think this change makes sense. Pinging @truthbk to see what he thinks about it though :)

I'll put this on the Triage milestone until we have a final decision on whether we want to support this in the long term.

Systemd unit files support the EnvironmentFile= and Nice= options, that said I think the convention on systemd is to let users copy the default unit file in /lib/systemd/system/datadog-agent.service to /etc/systemd/system/datadog-agent and make modifications on the latter. Does that make sense to you?

Thanks again!

@@ -42,6 +42,7 @@ DD_OPT_PROC_REGEX="dogstatsd|jmxfetch|go-metro"
# Source function library.
. /etc/rc.d/init.d/functions

[ -r /etc/default/datadog-agent ] && . /etc/default/datadog-agent
Copy link
Member

Choose a reason for hiding this comment

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

on centos I think the convention is to source /etc/sysconfig/datadog-agent instead of /etc/default/datadog-agent

Copy link
Author

Choose a reason for hiding this comment

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

Okay! I don't know the centos conventions. I'll push an update

@directionless
Copy link
Author

systemd does have more options. But it's easy for end users to adjust the service files.

One idiom I've seen is to set EnvironmentFile to that config file. Eg: https://github.com/facebook/osquery/blob/master/tools/deployment/osqueryd.service I'm not sure if that makes sense here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants