From 6df2ce234039b907d12459d75436d31bb803d127 Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 21 Jan 2012 12:44:03 +0100 Subject: [PATCH 01/10] Add a simple graph testing plugin, and use critical instead of alarm --- tools/munin-node-from-hell/README.rst | 4 +-- tools/munin-node-from-hell/basic.conf | 15 +++++++++ .../munin-node-from-hell/muninnode-from-hell | 32 +++++++++++++++++-- tools/munin-node-from-hell/notifications.conf | 2 +- 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 tools/munin-node-from-hell/basic.conf diff --git a/tools/munin-node-from-hell/README.rst b/tools/munin-node-from-hell/README.rst index 5731e589..2e7a04aa 100644 --- a/tools/munin-node-from-hell/README.rst +++ b/tools/munin-node-from-hell/README.rst @@ -10,8 +10,8 @@ stuff we do at http://hostedmunin.com/ . Use it as you feel fit :) Current features controlled via config file: * Respond slowly or never to queries. -* Have plugins that always are in warning or alarm. -* Extensive number of plugins. +* Have plugins that always are in warning or critical. +* Extensive number of plugins runnint at once. * Run on multiple ports at the same time, to test huge amounts of clients. diff --git a/tools/munin-node-from-hell/basic.conf b/tools/munin-node-from-hell/basic.conf new file mode 100644 index 00000000..64c83add --- /dev/null +++ b/tools/munin-node-from-hell/basic.conf @@ -0,0 +1,15 @@ +# +# Initialise plugins that test the basic functions of Munin. +# +# + +[instance:basic] +pluginprofile = basic +port = 4000 + +[pluginprofile:basic] +plugins = always_warning, always_critical, graph_area + +[base] +# when building an example config with --muninconf, what hostname to output. +hostname = localhost diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index 187c4138..5106a123 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -91,7 +91,7 @@ class always_warning(MuninPlugin): return """graph_title Always in warning graph_vlabel Level graph_scale no -graph_info A simple graph that is always in warning or alarm +graph_info A simple graph that is always in warning or critical graph_category active_notification generic.label Level generic.info Level usually above warning level @@ -99,10 +99,36 @@ generic.warn 5 generic.crit 10""" modules["always_warning"] = always_warning() -class always_alarm(always_warning): +class always_critical(always_warning): def fetch(self, conf): return "generic.value 20" -modules["always_alarm"] = always_alarm() +modules["always_critical"] = always_critical() + +class graph_area(MuninPlugin): + "A plugin that uses STACK and AREA. From proc_pri. Use: testing the grapher" + def fetch(self, conf): + return """high.value 3 + low.value 2 + locked.value 1""" + + def config(self, conf): + return """graph_title AREA and STACK +graph_order low high locked +graph_category graphtes t +graph_info This graph shows nuber of processes at each priority +graph_args --base 1000 -l 0 +graph_vlabel Number of processes +high.label high priority +high.draw STACK +high.info The number of high-priority processes (tasks) +low.label low priority +low.draw AREA +low.info The number of low-priority processes (tasks) +locked.label locked in memory +locked.draw STACK +locked.info The number of processes that have pages locked into memory (for real-time and custom IO) +""" +modules["graph_area"] = graph_area() class ArgumentTCPserver(SocketServer.ThreadingTCPServer): diff --git a/tools/munin-node-from-hell/notifications.conf b/tools/munin-node-from-hell/notifications.conf index 5a7b2c91..61f05118 100644 --- a/tools/munin-node-from-hell/notifications.conf +++ b/tools/munin-node-from-hell/notifications.conf @@ -12,7 +12,7 @@ port = 3000 #port = 4940 #sleepyness = 30 [pluginprofile:notif] -plugins = always_warning, always_alarm +plugins = always_warning, always_critical [base] # when building an example config with --muninconf, what hostname to output. From 071b1cace3495654a46e964784f6b3ec8ff154ab Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 21 Jan 2012 13:22:30 +0100 Subject: [PATCH 02/10] clean up alarm plugins, fix typo in graphtest --- .../munin-node-from-hell/muninnode-from-hell | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index 5106a123..83a725e6 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -84,37 +84,42 @@ class tarpit(MuninPlugin): modules["tarpit"] = tarpit() class always_warning(MuninPlugin): + conftext = """graph_title Always in LEVEL +graph_vlabel Level +graph_scale no +graph_info A simple graph that is always in LEVEL +graph_category active_notification +generic.label Level +generic.info Level usually above warning level +generic.warning 5 +generic.critical 10""" + def fetch(self, conf): return "generic.value 10" def config(self, conf): - return """graph_title Always in warning -graph_vlabel Level -graph_scale no -graph_info A simple graph that is always in warning or critical -graph_category active_notification -generic.label Level -generic.info Level usually above warning level -generic.warn 5 -generic.crit 10""" + return self.conftext.replace("LEVEL","warning") modules["always_warning"] = always_warning() class always_critical(always_warning): def fetch(self, conf): return "generic.value 20" + + def config(self, conf): + return self.conftext.replace("LEVEL","critical") modules["always_critical"] = always_critical() class graph_area(MuninPlugin): "A plugin that uses STACK and AREA. From proc_pri. Use: testing the grapher" def fetch(self, conf): return """high.value 3 - low.value 2 - locked.value 1""" +low.value 2 +locked.value 1""" def config(self, conf): return """graph_title AREA and STACK graph_order low high locked -graph_category graphtes t +graph_category graphtest graph_info This graph shows nuber of processes at each priority graph_args --base 1000 -l 0 graph_vlabel Number of processes From 851979ebad828989b61a3a488a326337deda4c7b Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 21 Jan 2012 14:14:44 +0100 Subject: [PATCH 03/10] use a different category for always_XX --- tools/munin-node-from-hell/muninnode-from-hell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index 83a725e6..06f0ef60 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -88,7 +88,7 @@ class always_warning(MuninPlugin): graph_vlabel Level graph_scale no graph_info A simple graph that is always in LEVEL -graph_category active_notification +graph_category always_LEVEL generic.label Level generic.info Level usually above warning level generic.warning 5 From db72714eb4c50835f0ffcce813d19b3c234c1ca5 Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 21 Jan 2012 20:42:53 +0100 Subject: [PATCH 04/10] rename dses to easier check correct graphing --- .../munin-node-from-hell/muninnode-from-hell | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index 06f0ef60..b7130742 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -112,26 +112,26 @@ modules["always_critical"] = always_critical() class graph_area(MuninPlugin): "A plugin that uses STACK and AREA. From proc_pri. Use: testing the grapher" def fetch(self, conf): - return """high.value 3 -low.value 2 -locked.value 1""" + return """first.value 3 +second.value 2 +third.value 1""" def config(self, conf): return """graph_title AREA and STACK -graph_order low high locked +graph_order first second third graph_category graphtest graph_info This graph shows nuber of processes at each priority graph_args --base 1000 -l 0 graph_vlabel Number of processes -high.label high priority -high.draw STACK -high.info The number of high-priority processes (tasks) -low.label low priority -low.draw AREA -low.info The number of low-priority processes (tasks) -locked.label locked in memory -locked.draw STACK -locked.info The number of processes that have pages locked into memory (for real-time and custom IO) +first.label first +first.draw STACK +first.info The number of first-priority processes (tasks) +second.label second +second.draw AREA +second.info The number of second-priority processes (tasks) +third.label third +third.draw STACK +third.info The number of processes that have pages third into memory (for real-time and custom IO) """ modules["graph_area"] = graph_area() From 1c70bc928e088c7cc2cb13fe8502f20b11f32c5a Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 21 Jan 2012 20:51:40 +0100 Subject: [PATCH 05/10] Revert "rename dses to easier check correct graphing" Really, not a good idea. This reverts commit db72714eb4c50835f0ffcce813d19b3c234c1ca5. --- .../munin-node-from-hell/muninnode-from-hell | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index b7130742..06f0ef60 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -112,26 +112,26 @@ modules["always_critical"] = always_critical() class graph_area(MuninPlugin): "A plugin that uses STACK and AREA. From proc_pri. Use: testing the grapher" def fetch(self, conf): - return """first.value 3 -second.value 2 -third.value 1""" + return """high.value 3 +low.value 2 +locked.value 1""" def config(self, conf): return """graph_title AREA and STACK -graph_order first second third +graph_order low high locked graph_category graphtest graph_info This graph shows nuber of processes at each priority graph_args --base 1000 -l 0 graph_vlabel Number of processes -first.label first -first.draw STACK -first.info The number of first-priority processes (tasks) -second.label second -second.draw AREA -second.info The number of second-priority processes (tasks) -third.label third -third.draw STACK -third.info The number of processes that have pages third into memory (for real-time and custom IO) +high.label high priority +high.draw STACK +high.info The number of high-priority processes (tasks) +low.label low priority +low.draw AREA +low.info The number of low-priority processes (tasks) +locked.label locked in memory +locked.draw STACK +locked.info The number of processes that have pages locked into memory (for real-time and custom IO) """ modules["graph_area"] = graph_area() From e215f1569918fab16701146d123b6e27424bac4c Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 4 Feb 2012 16:50:48 +0100 Subject: [PATCH 06/10] fix typos --- tools/munin-node-from-hell/README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/munin-node-from-hell/README.rst b/tools/munin-node-from-hell/README.rst index 2e7a04aa..9cc61d74 100644 --- a/tools/munin-node-from-hell/README.rst +++ b/tools/munin-node-from-hell/README.rst @@ -11,7 +11,7 @@ Current features controlled via config file: * Respond slowly or never to queries. * Have plugins that always are in warning or critical. -* Extensive number of plugins runnint at once. +* Extensive number of plugins running at once. * Run on multiple ports at the same time, to test huge amounts of clients. @@ -21,8 +21,8 @@ Usage munin-node-from-hell takes two arguments; the mode and which config file to use. Mode is either --run or --muninconf. -This software is meant to run as an ordinary unix user, please don't run -it as root without some thought. +This software is meant to run as an ordinary Unix user, please don't run +it as root. You probably want: From 3b485e4546a650f0e2869a685177f43b45295081 Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Sat, 4 Feb 2012 18:56:29 +0100 Subject: [PATCH 07/10] moar plugins --- tools/munin-node-from-hell/tarpit.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/munin-node-from-hell/tarpit.conf b/tools/munin-node-from-hell/tarpit.conf index 3a0995de..ecc6cc29 100644 --- a/tools/munin-node-from-hell/tarpit.conf +++ b/tools/munin-node-from-hell/tarpit.conf @@ -6,7 +6,7 @@ pluginprofile = tarpit port = 3000 [pluginprofile:tarpit] -plugins = tarpit, load, locks +plugins = load, locks, tarpit, load, locks [pluginprofile:base] plugins = load, locks, locks, load, load, locks, locks, load, load, load From 352a9baf9429ac320613b927e7205f5b747566b4 Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Thu, 9 Feb 2012 14:47:17 +0100 Subject: [PATCH 08/10] Add UTF8 plugins --- .../munin-node-from-hell/muninnode-from-hell | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index 06f0ef60..fabab78b 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -1,4 +1,5 @@ #!/usr/bin/python +# .- coding: utf-8 -. # # Artificial munin node that behaves in all the ways you would like # ordinary nodes _not_ to behave. @@ -135,6 +136,40 @@ locked.info The number of processes that have pages locked into memory (for real """ modules["graph_area"] = graph_area() +class utf8_graphcat(MuninPlugin): + "A plugin with a graph category which has UTF-8 in it" + def fetch(self, conf): + load = open("/proc/loadavg", "r").read() + load, rest = load.split(" ", 1) + load = float(load) + return "apples.value %.2f" % load + + def config(self, conf): + return """graph_title Example UTF-8 graph +graph_vlabel apples +graph_category foo™ +apples.label apples +graph_info Apples eaten +apples.info Apples eaten""" +modules["utf8_graphcat"] = utf8_graphcat() + +class utf8_graphname(MuninPlugin): + "A plugin with a UTF-8 name" + def fetch(self, conf): + load = open("/proc/loadavg", "r").read() + load, rest = load.split(" ", 1) + load = float(load) + return "apples.value %.2f" % load + + def config(self, conf): + return """graph_title Example UTF-8 graph +graph_vlabel apples +graph_category system +apples.label apples +graph_info Apples eaten +apples.info Apples eaten""" +modules["utf8_™graphname"] = utf8_graphname() + class ArgumentTCPserver(SocketServer.ThreadingTCPServer): def __init__(self, server_address, RequestHandlerClass, args): From f110d3ddb1d146595dd4f7b1622b22c9b8ef1405 Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Thu, 9 Feb 2012 14:47:30 +0100 Subject: [PATCH 09/10] verbose mode as runtime flag --- tools/munin-node-from-hell/muninnode-from-hell | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index fabab78b..2256dbf6 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -188,7 +188,7 @@ class MuninHandler(SocketServer.StreamRequestHandler): """ def handle(self): - print "%s: Connection from %s:%s. server args is %s" \ + if self.server.args.get("verbose"): print "%s: Connection from %s:%s. server args is %s" \ % (self.server.args["name"], self.client_address[0], self.client_address[1], self.server.args) # slow path hostname = self.server.args["name"] @@ -264,7 +264,7 @@ def start_servers(instances): def usage(): - print "Usage: %s [--run] [--muninconf] " % sys.argv[0] + print "Usage: %s [--run] [--verbose] [--muninconf] " % sys.argv[0] def main(): if len(sys.argv) <= 2: @@ -326,6 +326,8 @@ def main(): instanceconfig[k] = v instanceconfig["plugins"] = plugins + if "--verbose" in sys.argv: + instanceconfig["verbose"] = True instanceconfig["name"] = "%s-%s" % (instancename, portinstance) instanceconfig["expanded_port"] = portinstance From 0442899e04cea0d35710a54444809f0a76f6cd0b Mon Sep 17 00:00:00 2001 From: Lasse Karstensen Date: Thu, 9 Feb 2012 15:42:42 +0100 Subject: [PATCH 10/10] last arg is the config file --- tools/munin-node-from-hell/muninnode-from-hell | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/munin-node-from-hell/muninnode-from-hell b/tools/munin-node-from-hell/muninnode-from-hell index 2256dbf6..30b05473 100755 --- a/tools/munin-node-from-hell/muninnode-from-hell +++ b/tools/munin-node-from-hell/muninnode-from-hell @@ -271,8 +271,12 @@ def main(): usage() sys.exit(1) + verbose = False + if "--verbose" in sys.argv: + verbose = True + config = ConfigParser.RawConfigParser() - config.read(sys.argv[2]) + config.read(sys.argv[-1]) instancekeys = [ key for key in config.sections() if key.startswith("instance:") ] servers = {} @@ -343,6 +347,7 @@ def main(): if "--run" in sys.argv: + if verbose: print "Starting up.." servers = start_servers(instances) try: