Monitoring Gunicorn

This article will help you get the Gunicorn plugin for sd-agent configured and returning metrics

Installing the gunicorn plugin package

Install the gunicorn plugin on Debian/Ubuntu:

sudo apt-get install sd-agent-gunicorn

Install the gunicorn plugin on RHEL/CentOS:

sudo yum install sd-agent-gunicorn

Read more about agent plugins.

Configuring the agent to monitor Gunicorn

1. Configure your python environment

The gunicorn plugin requires the python environment in which gunicorn runs to have the `setproctitle` module installed. This can be installed with pip using pip install setproctitle

2. Configure /etc/sd-agent/conf.d/gunicorn.yaml

Configure the gunicorn.yaml file with the name of the gunicorn process. For example, the following gunicorn server would require the example below gunicorn --name my_web_app my_web_app_config.ini

init_config:

instances:
- proc_name: my_web_app

3. Restart the agent

sudo /etc/init.d/sd-agent restart

or

sudo systemctl restart sd-agent

Verifying the configuration
Execute info to verify the configuration with the following:

sudo /etc/init.d/sd-agent info 

or

/usr/share/python/sd-agent/agent.py info

If the agent has been configured correctly you'll see an output such as:

gunicorn
-----
  - instance #0 [OK]
  - Collected * metrics

You can also view the metrics returned with the following command:

sudo -u sd-agent /usr/share/python/sd-agent/agent.py check gunicorn

Configuring graphs

Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the gunicorn metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.

Screen_Shot_2018-01-18_at_11.46.12.png

Monitored metrics

Metric Values
gunicorn.log.critical

The rate of logged critical statements.
occurrence / second
Type: float
gunicorn.log.error

The rate of logged errors.
occurrence / second
Type: float
gunicorn.log.exception

The rate of logged exceptions.
occurrence / second
Type: float
gunicorn.log.warning

The rate of logged warnings.
occurrence / second
Type: float
gunicorn.request.duration.95percentile

The 95th percentile of request duration time.
millisecond / None
Type: float
gunicorn.request.duration.avg

The average request duration time.
millisecond / None
Type: float
gunicorn.request.duration.count

The rate of requests received.
request / second
Type: float
gunicorn.request.duration.max

The maximum request duration time.
millisecond / None
Type: float
gunicorn.request.duration.median

The median request duration time.
millisecond / None
Type: float
gunicorn.request.status.100

The rate of requests that generate responses with a 100 status code.
request / second
Type: float
gunicorn.request.status.101

The rate of requests that generate responses with a 101 status code.
request / second
Type: float
gunicorn.request.status.102

The rate of requests that generate responses with a 102 status code.
request / second
Type: float
gunicorn.request.status.200

The rate of requests that generate responses with a 200 status code.
request / second
Type: float
gunicorn.request.status.201

The rate of requests that generate responses with a 201 status code.
request / second
Type: float
gunicorn.request.status.202

The rate of requests that generate responses with a 202 status code.
request / second
Type: float
gunicorn.request.status.203

The rate of requests that generate responses with a 203 status code.
request / second
Type: float
gunicorn.request.status.204

The rate of requests that generate responses with a 204 status code.
request / second
Type: float
gunicorn.request.status.205

The rate of requests that generate responses with a 205 status code.
request / second
Type: float
gunicorn.request.status.206

The rate of requests that generate responses with a 206 status code.
request / second
Type: float
gunicorn.request.status.207

The rate of requests that generate responses with a 207 status code.
request / second
Type: float
gunicorn.request.status.208

The rate of requests that generate responses with a 208 status code.
request / second
Type: float
gunicorn.request.status.226

The rate of requests that generate responses with a 226 status code.
request / second
Type: float
gunicorn.request.status.300

The rate of requests that generate responses with a 300 status code.
request / second
Type: float
gunicorn.request.status.301

The rate of requests that generate responses with a 301 status code.
request / second
Type: float
gunicorn.request.status.302

The rate of requests that generate responses with a 302 status code.
request / second
Type: float
gunicorn.request.status.303

The rate of requests that generate responses with a 303 status code.
request / second
Type: float
gunicorn.request.status.304

The rate of requests that generate responses with a 304 status code.
request / second
Type: float
gunicorn.request.status.305

The rate of requests that generate responses with a 305 status code.
request / second
Type: float
gunicorn.request.status.307

The rate of requests that generate responses with a 307 status code.
request / second
Type: float
gunicorn.request.status.308

The rate of requests that generate responses with a 308 status code.
request / second
Type: float
gunicorn.request.status.400

The rate of requests that generate responses with a 400 status code.
request / second
Type: float
gunicorn.request.status.401

The rate of requests that generate responses with a 401 status code.
request / second
Type: float
gunicorn.request.status.402

The rate of requests that generate responses with a 402 status code.
request / second
Type: float
gunicorn.request.status.403

The rate of requests that generate responses with a 403 status code.
request / second
Type: float
gunicorn.request.status.404

The rate of requests that generate responses with a 404 status code.
request / second
Type: float
gunicorn.request.status.405

The rate of requests that generate responses with a 405 status code.
request / second
Type: float
gunicorn.request.status.406

The rate of requests that generate responses with a 406 status code.
request / second
Type: float
gunicorn.request.status.407

The rate of requests that generate responses with a 407 status code.
request / second
Type: float
gunicorn.request.status.408

The rate of requests that generate responses with a 408 status code.
request / second
Type: float
gunicorn.request.status.409

The rate of requests that generate responses with a 409 status code.
request / second
Type: float
gunicorn.request.status.410

The rate of requests that generate responses with a 410 status code.
request / second
Type: float
gunicorn.request.status.411

The rate of requests that generate responses with a 411 status code.
request / second
Type: float
gunicorn.request.status.412

The rate of requests that generate responses with a 412 status code.
request / second
Type: float
gunicorn.request.status.413

The rate of requests that generate responses with a 413 status code.
request / second
Type: float
gunicorn.request.status.414

The rate of requests that generate responses with a 414 status code.
request / second
Type: float
gunicorn.request.status.415

The rate of requests that generate responses with a 415 status code.
request / second
Type: float
gunicorn.request.status.416

The rate of requests that generate responses with a 416 status code.
request / second
Type: float
gunicorn.request.status.417

The rate of requests that generate responses with a 417 status code.
request / second
Type: float
gunicorn.request.status.419

The rate of requests that generate responses with a 419 status code.
request / second
Type: float
gunicorn.request.status.421

The rate of requests that generate responses with a 421 status code.
request / second
Type: float
gunicorn.request.status.422

The rate of requests that generate responses with a 422 status code.
request / second
Type: float
gunicorn.request.status.423

The rate of requests that generate responses with a 423 status code.
request / second
Type: float
gunicorn.request.status.424

The rate of requests that generate responses with a 424 status code.
request / second
Type: float
gunicorn.request.status.426

The rate of requests that generate responses with a 426 status code.
request / second
Type: float
gunicorn.request.status.428

The rate of requests that generate responses with a 428 status code.
request / second
Type: float
gunicorn.request.status.429

The rate of requests that generate responses with a 429 status code.
request / second
Type: float
gunicorn.request.status.431

The rate of requests that generate responses with a 431 status code.
request / second
Type: float
gunicorn.request.status.451

The rate of requests that generate responses with a 451 status code.
request / second
Type: float
gunicorn.request.status.500

The rate of requests that generate responses with a 500 status code.
request / second
Type: float
gunicorn.request.status.501

The rate of requests that generate responses with a 501 status code.
request / second
Type: float
gunicorn.request.status.502

The rate of requests that generate responses with a 502 status code.
request / second
Type: float
gunicorn.request.status.503

The rate of requests that generate responses with a 503 status code.
request / second
Type: float
gunicorn.request.status.504

The rate of requests that generate responses with a 504 status code.
request / second
Type: float
gunicorn.request.status.505

The rate of requests that generate responses with a 505 status code.
request / second
Type: float
gunicorn.request.status.506

The rate of requests that generate responses with a 506 status code.
request / second
Type: float
gunicorn.request.status.507

The rate of requests that generate responses with a 507 status code.
request / second
Type: float
gunicorn.request.status.508

The rate of requests that generate responses with a 508 status code.
request / second
Type: float
gunicorn.request.status.510

The rate of requests that generate responses with a 510 status code.
request / second
Type: float
gunicorn.request.status.511

The rate of requests that generate responses with a 511 status code.
request / second
Type: float
gunicorn.request.status.512

The rate of requests that generate responses with a 512 status code.
request / second
Type: float
gunicorn.requests

The rate of requests received.
request / second
Type: float
gunicorn.workers

Number of workers managed by the arbiter.
worker / None
Type: float
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.