From 7e2bac035680a64fb18a856457451e947bcedb06 Mon Sep 17 00:00:00 2001 From: Andrew Jennings Date: Fri, 17 Feb 2012 14:10:50 -0500 Subject: [PATCH] Move gunicorn plugins to directory. Add example plugin configuration to gunicorn plugins. Add magic markers to plugins. --- .../gunicorn_memory_status | 36 ++++++++++++------- plugins/{other => gunicorn}/gunicorn_status | 30 +++++++++++----- 2 files changed, 45 insertions(+), 21 deletions(-) rename plugins/{other => gunicorn}/gunicorn_memory_status (75%) rename plugins/{other => gunicorn}/gunicorn_status (81%) diff --git a/plugins/other/gunicorn_memory_status b/plugins/gunicorn/gunicorn_memory_status similarity index 75% rename from plugins/other/gunicorn_memory_status rename to plugins/gunicorn/gunicorn_memory_status index be596e68..d6595cd1 100755 --- a/plugins/other/gunicorn_memory_status +++ b/plugins/gunicorn/gunicorn_memory_status @@ -1,14 +1,26 @@ #!/usr/bin/env python -# -# gunicorn_status - A munin plugin for Linux to monitor the memory -# usage of gunicorn processes -# -# Copyright (C) 2012 Azavea, Inc. -# Author: Andrew Jennings -# -# Like Munin, this plugin is licensed under the GNU GPL v2 license -# http://www.opensource.org/licenses/GPL-2.0 -# +""" + gunicorn_status - A munin plugin for Linux to monitor the memory + usage of gunicorn processes + + Copyright (C) 2012 Azavea, Inc. + Author: Andrew Jennings + + Like Munin, this plugin is licensed under the GNU GPL v2 license + 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 from subprocess import check_output @@ -20,7 +32,7 @@ except: GUNICORN_PID_PATH = "/var/run/gunicorn.pid" -class GunicornStatus(): +class GunicornMemoryStatus(): master_pid = '' """ 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 elif len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == 'fetch'): try: - status = GunicornStatus() + status = GunicornMemoryStatus() status.print_total_memory() except: sys.exit("Couldn't retrieve gunicorn memory usage information") diff --git a/plugins/other/gunicorn_status b/plugins/gunicorn/gunicorn_status similarity index 81% rename from plugins/other/gunicorn_status rename to plugins/gunicorn/gunicorn_status index ff4f3c2c..04721e94 100755 --- a/plugins/other/gunicorn_status +++ b/plugins/gunicorn/gunicorn_status @@ -1,13 +1,25 @@ #!/usr/bin/env python -# -# gunicorn_status - A munin plugin for Linux to monitor gunicorn processes -# -# Copyright (C) 2012 Azavea, Inc. -# Author: Andrew Jennings -# -# Like Munin, this plugin is licensed under the GNU GPL v2 license -# http://www.opensource.org/licenses/GPL-2.0 -# +""" + gunicorn_status - A munin plugin for Linux to monitor gunicorn processes + + Copyright (C) 2012 Azavea, Inc. + Author: Andrew Jennings + + Like Munin, this plugin is licensed under the GNU GPL v2 license + 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 from subprocess import check_output