mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Added instance name for gunicorn_memory_status plugin if linked as gunicorn_memory_status_INSTANCE or gunicorn_INSTANCE_memory_status
This commit is contained in:
parent
c301832032
commit
7d58abe5c5
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys, os
|
import sys, os, re
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
|
|
||||||
# set path to your gunicorn pid
|
# set path to your gunicorn pid
|
||||||
@ -44,11 +44,9 @@ class GunicornMemoryStatus():
|
|||||||
except:
|
except:
|
||||||
raise Exception("Couldn't read gunicorn pid information")
|
raise Exception("Couldn't read gunicorn pid information")
|
||||||
|
|
||||||
|
|
||||||
def print_total_memory(self):
|
def print_total_memory(self):
|
||||||
print ('total_memory.value %d' % self._get_total_memory())
|
print ('total_memory.value %d' % self._get_total_memory())
|
||||||
|
|
||||||
|
|
||||||
def _get_master_pid(self):
|
def _get_master_pid(self):
|
||||||
master_pid_file = open(GUNICORN_PID_PATH)
|
master_pid_file = open(GUNICORN_PID_PATH)
|
||||||
self.master_pid = master_pid_file.read().rstrip()
|
self.master_pid = master_pid_file.read().rstrip()
|
||||||
@ -74,7 +72,18 @@ class GunicornMemoryStatus():
|
|||||||
return worker_memory_usage
|
return worker_memory_usage
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
print "graph_title Gunicorn - Memory Usage"
|
instance = None
|
||||||
|
name = os.path.basename(sys.argv[0])
|
||||||
|
if name != "gunicorn_memory_status":
|
||||||
|
for r in ("^gunicorn_(.*?)_memory_status$", "^gunicorn_memory_status_(.*?)$"):
|
||||||
|
m = re.match(r, name, re.IGNORECASE)
|
||||||
|
if m:
|
||||||
|
instance = m.group(1)
|
||||||
|
break
|
||||||
|
graph_title = "graph_title Gunicorn - Memory Usage"
|
||||||
|
if instance:
|
||||||
|
graph_title = "%s - %s" % (graph_title, instance)
|
||||||
|
print graph_title
|
||||||
print "graph_args --base 1024 -l 0"
|
print "graph_args --base 1024 -l 0"
|
||||||
print "graph_vlabel Megabytes"
|
print "graph_vlabel Megabytes"
|
||||||
print "graph_category gunicorn"
|
print "graph_category gunicorn"
|
||||||
|
Loading…
Reference in New Issue
Block a user