1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Merge pull request #36 from andrewjennings/gunicorn

Changes requested by steveschnepp.
This commit is contained in:
Steve Schnepp 2012-02-17 12:26:34 -08:00
commit 3c5cdab8eb
2 changed files with 45 additions and 21 deletions

View file

@ -1,14 +1,26 @@
#!/usr/bin/env python #!/usr/bin/env python
# """
# gunicorn_status - A munin plugin for Linux to monitor the memory gunicorn_status - A munin plugin for Linux to monitor the memory
# usage of gunicorn processes usage of gunicorn processes
#
# Copyright (C) 2012 Azavea, Inc. Copyright (C) 2012 Azavea, Inc.
# Author: Andrew Jennings Author: Andrew Jennings
#
# Like Munin, this plugin is licensed under the GNU GPL v2 license Like Munin, this plugin is licensed under the GNU GPL v2 license
# http://www.opensource.org/licenses/GPL-2.0 http://www.opensource.org/licenses/GPL-2.0
#
If you've put your gunicorn pid somewhere other than the
default /var/run/gunicorn.pid, you can add a section like
this to your munin-node's plugin configuration:
[gunicorn_memory_status]
env.gunicorn_pid_path [path to your gunicorn pid]
This plugin supports the following munin configuration parameters:
#%# family=auto contrib
#%# capabilities=autoconf
"""
import sys, os import sys, os
from subprocess import check_output from subprocess import check_output
@ -20,7 +32,7 @@ except:
GUNICORN_PID_PATH = "/var/run/gunicorn.pid" GUNICORN_PID_PATH = "/var/run/gunicorn.pid"
class GunicornStatus(): class GunicornMemoryStatus():
master_pid = '' master_pid = ''
""" """
The Gunicorn master process pid, as a string The Gunicorn master process pid, as a string
@ -80,7 +92,7 @@ if __name__ == "__main__":
# Some docs say it'll be called with fetch, some say no arg at all # Some docs say it'll be called with fetch, some say no arg at all
elif len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == 'fetch'): elif len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == 'fetch'):
try: try:
status = GunicornStatus() status = GunicornMemoryStatus()
status.print_total_memory() status.print_total_memory()
except: except:
sys.exit("Couldn't retrieve gunicorn memory usage information") sys.exit("Couldn't retrieve gunicorn memory usage information")

View file

@ -1,13 +1,25 @@
#!/usr/bin/env python #!/usr/bin/env python
# """
# gunicorn_status - A munin plugin for Linux to monitor gunicorn processes gunicorn_status - A munin plugin for Linux to monitor gunicorn processes
#
# Copyright (C) 2012 Azavea, Inc. Copyright (C) 2012 Azavea, Inc.
# Author: Andrew Jennings Author: Andrew Jennings
#
# Like Munin, this plugin is licensed under the GNU GPL v2 license Like Munin, this plugin is licensed under the GNU GPL v2 license
# http://www.opensource.org/licenses/GPL-2.0 http://www.opensource.org/licenses/GPL-2.0
#
If you've put your gunicorn pid somewhere other than the
default /var/run/gunicorn.pid, you can add a section like
this to your munin-node's plugin configuration:
[gunicorn_status]
env.gunicorn_pid_path [path to your gunicorn pid]
This plugin supports the following munin configuration parameters:
#%# family=auto contrib
#%# capabilities=autoconf
"""
import sys, os import sys, os
from subprocess import check_output from subprocess import check_output