mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Avoid ulimit kicking in when running ~1k nodes
This commit is contained in:
parent
32f9909e6d
commit
fbb6614e15
1 changed files with 23 additions and 15 deletions
|
@ -22,6 +22,10 @@ VERSION = "muninnode-from-hell v0.1"
|
||||||
modules = {}
|
modules = {}
|
||||||
|
|
||||||
class MuninPlugin:
|
class MuninPlugin:
|
||||||
|
def __init__(self):
|
||||||
|
self.current_load = None
|
||||||
|
self.current_locks = None
|
||||||
|
|
||||||
def sleep_fetch(self, conf):
|
def sleep_fetch(self, conf):
|
||||||
period = None
|
period = None
|
||||||
if conf.get("mode") == "sleepy" and conf.get("sleepyness"):
|
if conf.get("mode") == "sleepy" and conf.get("sleepyness"):
|
||||||
|
@ -36,14 +40,26 @@ class MuninPlugin:
|
||||||
def sleep_config(self, conf):
|
def sleep_config(self, conf):
|
||||||
return self.sleep_fetch(conf)
|
return self.sleep_fetch(conf)
|
||||||
|
|
||||||
|
def find_load(self):
|
||||||
|
# At about a thousand node instances you get this:
|
||||||
|
#IOError: [Errno 24] Too many open files: '/proc/loadavg'
|
||||||
|
# cache it for a bit..
|
||||||
|
if (not self.current_load) or random.randint(0,100) == 1:
|
||||||
|
load = open("/proc/loadavg", "r").read()
|
||||||
|
load, rest = load.split(" ", 1)
|
||||||
|
self.current_load = float(load)
|
||||||
|
return self.current_load
|
||||||
|
|
||||||
|
def find_locks(self):
|
||||||
|
if (not self.current_locks) or random.randint(0,100) == 1:
|
||||||
|
fp = open("/proc/locks", "r")
|
||||||
|
self.current_locks = len(fp.readlines())
|
||||||
|
return self.current_locks
|
||||||
|
|
||||||
class load(MuninPlugin):
|
class load(MuninPlugin):
|
||||||
def fetch(self, conf):
|
def fetch(self, conf):
|
||||||
self.sleep_fetch(conf)
|
self.sleep_fetch(conf)
|
||||||
load = open("/proc/loadavg", "r").read()
|
return "load.value %.2f" % self.find_load()
|
||||||
load, rest = load.split(" ", 1)
|
|
||||||
load = float(load)
|
|
||||||
return "load.value %.2f" % load
|
|
||||||
|
|
||||||
def config(self, conf):
|
def config(self, conf):
|
||||||
self.sleep_config(conf)
|
self.sleep_config(conf)
|
||||||
|
@ -60,9 +76,7 @@ modules["load"] = load()
|
||||||
class locks(MuninPlugin):
|
class locks(MuninPlugin):
|
||||||
def fetch(self, conf):
|
def fetch(self, conf):
|
||||||
self.sleep_fetch(conf)
|
self.sleep_fetch(conf)
|
||||||
fp = open("/proc/locks", "r")
|
return "locks.value %i" % self.find_locks()
|
||||||
fdata = fp.readlines()
|
|
||||||
return "locks.value %i" % len(fdata)
|
|
||||||
|
|
||||||
def config(self, conf):
|
def config(self, conf):
|
||||||
self.sleep_config(conf)
|
self.sleep_config(conf)
|
||||||
|
@ -171,10 +185,7 @@ modules["graph_area"] = graph_area()
|
||||||
class utf8_graphcat(MuninPlugin):
|
class utf8_graphcat(MuninPlugin):
|
||||||
"A plugin with a graph category which has UTF-8 in it"
|
"A plugin with a graph category which has UTF-8 in it"
|
||||||
def fetch(self, conf):
|
def fetch(self, conf):
|
||||||
load = open("/proc/loadavg", "r").read()
|
return "apples.value %.2f" % self.find_load()
|
||||||
load, rest = load.split(" ", 1)
|
|
||||||
load = float(load)
|
|
||||||
return "apples.value %.2f" % load
|
|
||||||
|
|
||||||
def config(self, conf):
|
def config(self, conf):
|
||||||
return """graph_title Example UTF-8 graph
|
return """graph_title Example UTF-8 graph
|
||||||
|
@ -188,10 +199,7 @@ modules["utf8_graphcat"] = utf8_graphcat()
|
||||||
class utf8_graphname(MuninPlugin):
|
class utf8_graphname(MuninPlugin):
|
||||||
"A plugin with a UTF-8 name"
|
"A plugin with a UTF-8 name"
|
||||||
def fetch(self, conf):
|
def fetch(self, conf):
|
||||||
load = open("/proc/loadavg", "r").read()
|
return "apples.value %.2f" % self.find_load()
|
||||||
load, rest = load.split(" ", 1)
|
|
||||||
load = float(load)
|
|
||||||
return "apples.value %.2f" % load
|
|
||||||
|
|
||||||
def config(self, conf):
|
def config(self, conf):
|
||||||
return """graph_title Example UTF-8 graph
|
return """graph_title Example UTF-8 graph
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue