Giter Site home page Giter Site logo

check_gunicorn's Introduction

This is a plugin that works between ElasticSearch and Nagios. This plugin takes status report from ElasticSearch and puts it into Nagios. This plugin is specifically for Gunicorn working with statsd. Statsd takes data from Gunicorn and posts it into ElasticSearch. Then this plugin takes required data from the elasticsearch and transforms it for nagios. It tells Nagios states of workers working in Gunicorn, request rate that Gunicorn is facing, request ruration that Gunicorn is taking.

The file gets installed at '/usr/local/bin'

Inputs types to Plugin:

Case Type(-t) Input

Average Workers "Avgworkers"

Maximum Workers "Maxworkers"

Minimum Workers "Minworkers"

Average Request Rate "Avgrequestrate"

Maximum Request Rate "Maxrequestrate"

Minimum Request Rate "Minrequestrate"

Average Request Duration "Avgrequestduration"

Maximum Request Duration "Maxrequestduration"

Minimum Request Duration "Minrequestduration"

Set Time Range (-st): For now, Time Range is between (-st):currentsystemtime; where user can set -st to any number of minutes user wants to keep track of. By default -st is set to 5 minutes.

Warning Range (-w): Warning Range can be set by user in terms of range. Syntax is 'a:b', a is lower bound of range, b is upper bound of range.

Critical Range (-c): Critical Range can be set by user in terms of range. Syntax is 'a:b', a is lower bound of range, b is upper bound of range.

Commands "

Workers

define command { command_name check_gunicorn_maxworkers command_line /usr/local/bin/check_gunicorn.py -st $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$ } define command { command_name check_gunicorn_minworkers command_line /usr/local/bin/check_gunicorn.py -st $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$ }

RequestRate

define command { command_name check_gunicorn_requestrate command_line /usr/local/bin/check_gunicorn.py -st $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$ } define command { command_name check_gunicorn_requestratemax command_line /usr/local/bin/check_gunicorn.py -st $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$ }

RequestDuration

define command { command_name check_gunicorn_requestduration command_line /usr/local/bin/check_gunicorn.py -st $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$ } define command { command_name check_gunicorn_requestdurationmax command_line /usr/local/bin/check_gunicorn.py -st $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$ } " You might have differet path for check_gunicorn.py according to your pip configurations

Services "

Gunicorn Maximum Workers Check

define service{ use local-service ; Name of service template to use host_name localhost service_description Gunicorn Max Workers check_command check_gunicorn_maxworkers!50!Maxworkers!:15!:25 }

Gunicorn Minimum Workers Check

define service{ use local-service ; Name of service template to use host_name localhost service_description Gunicorn Min Workers check_command check_gunicorn_minworkers!50!Minworkers!10:!7: }

Gunicorn Request Rate Average Check

define service{ use local-service ; Name of service template to use host_name localhost service_description Gunicorn Request Rate check_command check_gunicorn_requestrate!50!Avgrequestrate!5:15!4:25 }

Gunicorn Request Rate Maximum Check

define service{ use local-service ; Name of service template to use host_name localhost service_description Gunicorn Request Rate Max check_command check_gunicorn_requestratemax!50!Maxrequestrate!:15!:25 }

Gunicorn Request Duration Check

define service{ use local-service ; Name of service template to use host_name localhost service_description Gunicorn Request Duration check_command check_gunicorn_requestduration!50!Avgrequestduration!5:15!3:25 }

Gunicorn Request Duration Maximum Check

define service{ use local-service ; Name of service template to use host_name localhost service_description Gunicorn Request Duration Max check_command check_gunicorn_requestdurationmax!50!Maxrequestduration!:15!:25 }

"

NOTE: by default, application will show result of Maximum Workers in last 5 minutes.

check_gunicorn's People

Contributors

sadaqatullah avatar

Watchers

 avatar

check_gunicorn's Issues

UNKNOWN: ConnectionError

Hi,

I am using to gunicorn plugin in order to monitor gunicorn from nagios server, I am getting below error while entering command on gunicorn server:
Command:
/usr/local/bin/check_gunicorn.py --casetype Avgworkers -w 1:3 -c 6:7 -st 50
Output:

UNKNOWN: ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f5d6df37690>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f5d6df37690>: Failed to establish a new connection: [Errno 111] Connection refused)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nagiosplugin/runtime.py", line 43, in wrapper
    return func(*args, **kwds)
  File "/usr/local/bin/check_gunicorn.py", line 191, in main
    case_types.get(args.casetype, run_check.error_handler )(args.casetype, args.warning, args.critical)
  File "/usr/local/bin/check_gunicorn.py", line 121, in avg_worker
    self.run_check(contextname, self.data_fetch.get_gunicorn_workers()['avg'], warning, critical)
  File "/usr/local/bin/check_gunicorn.py", line 57, in get_gunicorn_workers
    "size": 2500000
  File "/usr/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 655, in search
    doc_type, '_search'), params=params, body=body)
  File "/usr/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
    status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
  File "/usr/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 180, in perform_request
    raise ConnectionError('N/A', str(e), e)
ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f5d6df37690>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f5d6df37690>: Failed to establish a new connection: [Errno 111] Connection refused)

python 2.7 on centos 6.9. Kindly help me in order to get rid off this issue.

Regards,
rlinux57

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.