0

I have datadog-agent installed on my Debian 8 server. It is already configured and works well to report metrics about postgres, nginx, system, etc.

I want to monitor my gunicorn daemons (i have 2 Django websites on this server). As far as I understand, datadog-agent already integrates a statsd server, so I don't have to install one:

# ps ax | grep datadog
18816 ?        Ss     0:00 /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/bin/supervisord -c /etc/dd-agent/supervisor.conf
18822 ?        Sl     0:01 /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/dogstatsd.py --use-local-forwarder
18824 ?        S      0:01 /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/ddagent.py
18825 ?        S      0:01 /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/agent.py foreground --use-local-forwarder

I think "dogstatsd.py" is the statsd server, but maybe I am wrong ?

Then, I modified my gunicorn startup script to integrates --name option to set a name to my process and --statsd-host to indicates where to send metrics.

# ps ax | grep gunicorn
18588 ?        Ss     0:00 /var/projects/my_project/venv/bin/python3 /var/projects/my_project/venv/bin/gunicorn --name my_project --statsd-host=localhost:8125 --workers 2 --bind unix:/var/tmp/my_project.sock core.wsgi:application
18630 ?        S      0:00 /var/projects/my_project/venv/bin/python3 /var/projects/my_project/venv/bin/gunicorn --name my_project --statsd-host=localhost:8125 --workers 2 --bind unix:/var/tmp/my_project.sock core.wsgi:application
18632 ?        S      0:00 /var/projects/my_project/venv/bin/python3 /var/projects/my_project/venv/bin/gunicorn --name my_project --statsd-host=localhost:8125 --workers 2 --bind unix:/var/tmp/my_project.sock core.wsgi:application

Now I created gunicorn.yaml from example in /etc/dd-agent/conf.d/ as follow

# NB: This check requires the python environment on which gunicorn runs to
# have the `setproctitle` module installed (https://pypi.python.org/pypi/setproctitle/)

init_config:

instances:
  # The name of the gunicorn process. For the following gunicorn server ...
  #
  #    gunicorn --name my_web_app my_web_app_config.ini
  #
  #  ... we'd use the name `my_web_app`.
  #
  - proc_name: my_project

After restarting agent, I wait a few seconds and I check its status:

# sudo service datadog-agent info
# [...]
  Checks
  ======

    gunicorn
    --------
      - instance #0 [ERROR]: 'Found no master process with name: gunicorn: master [my_project]'
      - Collected 0 metrics, 0 events & 1 service check
      - Dependencies:
          - psutil: 4.4.1

I can't find where I fail to configure this. Can somebody help me ?

0

After connecting to Datadog IRC, somebody explained that the gunicorn process should have a pretty printed name. The solution was to install setproctitle using pip in the same venv than gunicorn.

Obviously, the answer was in the question, at the top of "gunicorn.yaml" file:

NB: This check requires the python environment on which gunicorn runs to have the setproctitle module installed (https://pypi.python.org/pypi/setproctitle/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.