def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet('dump_file')) self._category = self.envGet('category', default='elfstats_calls') self._show_dummy_graph = self.envGet('show_dummy_graph', default=1, conv=int) # # DRAWING # keys = self._elfstatsInfo.get_method_keys() #Special case when no data is available. Output dummy graph not to confuse Munin. if not keys and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph('Calls - no data available', self._category, info='No data') self.appendGraph(NO_DATA_GRAPH, graph) #NUMBER OF CALLS for method groups for key in keys: method = self._elfstatsInfo.get_method_by_key(key) graph_name = method.get_graph_group_prefix() + 'total_calls' if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph('elfstats - number of calls for %s methods' % method.group.upper(), self._category, info='Method group %s' % method.group.upper(), args='--base 1000', vlabel='Number of calls in 5 min') self.appendGraph(graph_name, graph) graph.addField(method.name, method.name, draw='LINE1', type='GAUGE', info=method.name) #NUMBER OF STALLED CALLS for method groups for key in keys: method = self._elfstatsInfo.get_method_by_key(key) graph_name = method.get_graph_group_prefix() + 'stalled_calls' if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph('elfstats - number of stalled calls for %s methods' % method.group.upper(), self._category, info='Method group %s: number of calls exceeding the threshold' % method.group.upper(), args='--base 1000', vlabel='Number of stalled calls in 5 min') self.appendGraph(graph_name, graph) graph.addField(method.name, method.name, draw='LINE1', type='GAUGE', info=method.name)
def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet('dump_file')) self._category = self.envGet('category', default='elfstats_resp_codes') self._show_dummy_graph = self.envGet('show_dummy_graph', default=1, conv=int) # # DRAWING # important_codes = self._elfstatsInfo.get_important_response_codes() all_codes = self._elfstatsInfo.get_response_codes() #Special case when no data is available. Output dummy graph not to confuse Munin. if not important_codes and not all_codes and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph('Response codes - no data available', self._category, info='No data') self.appendGraph(NO_DATA_GRAPH, graph) #IMPORTANT RESPONSE CODES for code in important_codes: graph_name = 'elfstats_response_code_' + code if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph('elfstats - Calls per response code - %s' % code, self._category, info='Response %s code' % code, args='--base 1000 --logarithmic --units=si', vlabel='Number of calls per 5 min') self.appendGraph(graph_name, graph) graph.addField(code, code, draw='LINE2', type='GAUGE', info=code) #OTHER RESPONSE CODES GROUPED BY 100 for code in all_codes: if not code in self._elfstatsInfo.get_important_response_codes(): graph_name = 'elfstats_response_codes_%sXX' % code[0] if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph('elfstats - Calls per response codes - %sXX' % code[0], self._category, info='Response %sXX code' % code[0], args='--base 1000', vlabel='Number of calls per 5 min') self.appendGraph(graph_name, graph) graph.addField(code, code, draw='LINE1', type='GAUGE', info=code)
def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet("dump_file")) self._category = self.envGet("category", default="elfstats_total_records") self._show_dummy_graph = self.envGet("show_dummy_graph", default=1, conv=int) # # DRAWING # all_statuses = set(self._elfstatsInfo.get_records_statuses()) statuses_to_draw = all_statuses.difference(STATUSES_TO_SKIP) # Special case when no data is available. Output dummy graph not to confuse Munin. if not statuses_to_draw and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph("Total records - no data available", self._category, info="No data") self.appendGraph(NO_DATA_GRAPH, graph) graph_name = "elfstats_total_records" if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph( "elfstats - Number of log records per status", self._category, info="Total number of records", args="--base 1000 --logarithmic --units=si", vlabel="Number of records per 5 min", ) self.appendGraph(graph_name, graph) for status in statuses_to_draw: graph.addField(status, status, draw="LINE2", type="GAUGE", info=status)
def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet('dump_file')) self._category = self.envGet('category', default='elfstats_percentiles') self._show_dummy_graph = self.envGet('show_dummy_graph', default=1, conv=int) # # DRAWING # keys = self._elfstatsInfo.get_method_keys() #Special case when no data is available. Output dummy graph not to confuse Munin. if not keys and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph('Percentiles - no data available', self._category, info='No data') self.appendGraph(NO_DATA_GRAPH, graph) #METHOD percentiles for key in keys: method = self._elfstatsInfo.get_method_by_key(key) graph_name = method.get_graph_name() if self.graphEnabled(graph_name): graph = MuninGraph('elfstats - %s method calls percentiles' % method.get_full_name(), self._category, info='Method %s' % method.get_full_name(), args='--base 1000 --logarithmic --units=si', vlabel='Response time in ms') graph.addField('min', 'shortest', draw='LINE1', type='GAUGE', info='longest', colour='67E667') graph.addField('avg', 'average', draw='LINE2', type='GAUGE', info='average', colour='00CC00') graph.addField('max', 'longest', draw='LINE1', type='GAUGE', info='longest', colour='FF7373') for p, draw, colour in PERCENTILES: graph.addField('p' + str(p), str(p) + '%', draw=draw, type='GAUGE', info=str(p)+'%', colour=colour) self.appendGraph(graph_name, graph)
def __init__(self, argv=(), env=None, debug=False): """ Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet('dump_file')) self._category = self.envGet('category', default='elfstats_patterns') self._show_dummy_graph = self.envGet('show_dummy_graph', default=1, conv=int) # # DRAWING # ids = self._elfstatsInfo.get_pattern_ids() #Special case when no data is available. Output dummy graph not to confuse Munin. if not ids and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph('Patterns - no data available', self._category, info='No data') self.appendGraph(NO_DATA_GRAPH, graph) for pattern_id in ids: graph_name = GRAPH_NAME_PREFIX + pattern_id if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph('elfstats - Number of %s pattern appearances ' % pattern_id.upper(), self._category, info='Number of pattern matches in access log', args='--base 1000 --logarithmic --units=si', vlabel='Number of matches per 5 min') self.appendGraph(graph_name, graph) for metric in METRICS: graph.addField(metric, metric, draw='LINE2', type='GAUGE', info=metric)
class MuninElfstatsPercentilesPlugin(MuninPlugin): """Multigraph Munin Plugin for monitoring web servers.""" plugin_name = 'elfstatsm_percentiles' isMultigraph = True isMultiInstance = True def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet('dump_file')) self._category = self.envGet('category', default='elfstats_percentiles') self._show_dummy_graph = self.envGet('show_dummy_graph', default=1, conv=int) # # DRAWING # keys = self._elfstatsInfo.get_method_keys() #Special case when no data is available. Output dummy graph not to confuse Munin. if not keys and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph('Percentiles - no data available', self._category, info='No data') self.appendGraph(NO_DATA_GRAPH, graph) #METHOD percentiles for key in keys: method = self._elfstatsInfo.get_method_by_key(key) graph_name = method.get_graph_name() if self.graphEnabled(graph_name): graph = MuninGraph('elfstats - %s method calls percentiles' % method.get_full_name(), self._category, info='Method %s' % method.get_full_name(), args='--base 1000 --logarithmic --units=si', vlabel='Response time in ms') graph.addField('min', 'shortest', draw='LINE1', type='GAUGE', info='longest', colour='67E667') graph.addField('avg', 'average', draw='LINE2', type='GAUGE', info='average', colour='00CC00') graph.addField('max', 'longest', draw='LINE1', type='GAUGE', info='longest', colour='FF7373') for p, draw, colour in PERCENTILES: graph.addField('p' + str(p), str(p) + '%', draw=draw, type='GAUGE', info=str(p)+'%', colour=colour) self.appendGraph(graph_name, graph) def retrieveVals(self): # #RETRIEVING VALUES # #METHOD percentiles (except of STATIC) for key in self._elfstatsInfo.get_method_keys(): method = self._elfstatsInfo.get_method_by_key(key) graph_name = method.get_graph_name() if self.hasGraph(graph_name): self.setGraphVal(graph_name, 'min', method.min) self.setGraphVal(graph_name, 'avg', method.avg) self.setGraphVal(graph_name, 'max', method.max) for p, _, _ in PERCENTILES: self.setGraphVal(graph_name, 'p' + str(p), method.get_percentile(p)) def autoconf(self): return True def parse_key(self, key): split = key.split('_') return split[0], split[1]
class MuninElfstatsTotalRecordsPlugin(MuninPlugin): """Multigraph Munin Plugin for monitoring web servers.""" plugin_name = "elfstatsm_total_records" isMultigraph = True isMultiInstance = True def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet("dump_file")) self._category = self.envGet("category", default="elfstats_total_records") self._show_dummy_graph = self.envGet("show_dummy_graph", default=1, conv=int) # # DRAWING # all_statuses = set(self._elfstatsInfo.get_records_statuses()) statuses_to_draw = all_statuses.difference(STATUSES_TO_SKIP) # Special case when no data is available. Output dummy graph not to confuse Munin. if not statuses_to_draw and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph("Total records - no data available", self._category, info="No data") self.appendGraph(NO_DATA_GRAPH, graph) graph_name = "elfstats_total_records" if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph( "elfstats - Number of log records per status", self._category, info="Total number of records", args="--base 1000 --logarithmic --units=si", vlabel="Number of records per 5 min", ) self.appendGraph(graph_name, graph) for status in statuses_to_draw: graph.addField(status, status, draw="LINE2", type="GAUGE", info=status) def retrieveVals(self): # # RETRIEVING VALUES # all_statuses = set(self._elfstatsInfo.get_records_statuses()) statuses_to_draw = all_statuses.difference(STATUSES_TO_SKIP) for status in statuses_to_draw: graph_name = "elfstats_total_records" if self.hasGraph(graph_name): self.setGraphVal(graph_name, status, self._elfstatsInfo.get_number_records_by_status(status)) def autoconf(self): return True def parse_key(self, key): split = key.split("_") return split[0], split[1]
class MuninElfstatsPatternsPlugin(MuninPlugin): """Multigraph Munin Plugin for monitoring web servers.""" plugin_name = 'elfstatsm_patterns' isMultigraph = True isMultiInstance = True def __init__(self, argv=(), env=None, debug=False): """ Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet('dump_file')) self._category = self.envGet('category', default='elfstats_patterns') self._show_dummy_graph = self.envGet('show_dummy_graph', default=1, conv=int) # # DRAWING # ids = self._elfstatsInfo.get_pattern_ids() #Special case when no data is available. Output dummy graph not to confuse Munin. if not ids and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph('Patterns - no data available', self._category, info='No data') self.appendGraph(NO_DATA_GRAPH, graph) for pattern_id in ids: graph_name = GRAPH_NAME_PREFIX + pattern_id if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph('elfstats - Number of %s pattern appearances ' % pattern_id.upper(), self._category, info='Number of pattern matches in access log', args='--base 1000 --logarithmic --units=si', vlabel='Number of matches per 5 min') self.appendGraph(graph_name, graph) for metric in METRICS: graph.addField(metric, metric, draw='LINE2', type='GAUGE', info=metric) def retrieveVals(self): # #RETRIEVING VALUES # ids = self._elfstatsInfo.get_pattern_ids() for pattern_id in ids: graph_name = GRAPH_NAME_PREFIX + pattern_id if self.hasGraph(graph_name): for metric in METRICS: self.setGraphVal(graph_name, metric, self._elfstatsInfo.get_value_for_pattern(pattern_id, metric)) def autoconf(self): return True def parse_key(self, key): split = key.split('_') return split[0], split[1]
def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet("dump_file")) self._category = self.envGet("category", default="tt_resp_times") self._show_dummy_graph = self.envGet("show_dummy_graph", default=1, conv=int) # # DRAWING # keys = self._elfstatsInfo.get_method_keys() # Special case when no data is available. Output dummy graph not to confuse Munin. if not keys and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph("Response times - no data available", self._category, info="No data") self.appendGraph(NO_DATA_GRAPH, graph) # TOTAL RESPONSE TIME for method groups (except small groups) for key in keys: method = self._elfstatsInfo.get_method_by_key(key) if not method.group in self._elfstatsInfo.get_small_groups(): graph_name = method.get_graph_group_prefix() + "response_total" if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph( "elfstats - total response time for %s methods" % method.group.upper(), self._category, info="Method group %s" % method.group.upper(), args="--base 1000 --logarithmic --units=si", vlabel="Response time in ms", ) self.appendGraph(graph_name, graph) graph.addField(method.name, method.name, draw="LINE1", type="GAUGE", info=method.name) # AVERAGE RESPONSE TIME for method groups (except small groups) for key in keys: method = self._elfstatsInfo.get_method_by_key(key) if not method.group in self._elfstatsInfo.get_small_groups(): graph_name = method.get_graph_group_prefix() + "response_avg" if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph( "elfstats - average response time for %s methods" % method.group.upper(), self._category, info="Method group %s" % method.group.upper(), args="--base 1000 --logarithmic --units=si", vlabel="Response time in ms", ) self.appendGraph(graph_name, graph) graph.addField(method.name, method.name, draw="LINE1", type="GAUGE", info=method.name)
class MuninElfstatsResponseTimesPlugin(MuninPlugin): """Multigraph Munin Plugin for monitoring web servers.""" plugin_name = "elfstatsm_response_times" isMultigraph = True isMultiInstance = True def __init__(self, argv=(), env=None, debug=False): """Populate Munin Plugin with MuninGraph instances. @param argv: List of command line arguments. @param env: Dictionary of environment variables. @param debug: Print debugging messages if True. (Default: False) """ MuninPlugin.__init__(self, argv, env, debug) self._elfstatsInfo = ElfstatsInfo(self.envGet("dump_file")) self._category = self.envGet("category", default="tt_resp_times") self._show_dummy_graph = self.envGet("show_dummy_graph", default=1, conv=int) # # DRAWING # keys = self._elfstatsInfo.get_method_keys() # Special case when no data is available. Output dummy graph not to confuse Munin. if not keys and self._show_dummy_graph: if self.graphEnabled(NO_DATA_GRAPH): graph = MuninGraph("Response times - no data available", self._category, info="No data") self.appendGraph(NO_DATA_GRAPH, graph) # TOTAL RESPONSE TIME for method groups (except small groups) for key in keys: method = self._elfstatsInfo.get_method_by_key(key) if not method.group in self._elfstatsInfo.get_small_groups(): graph_name = method.get_graph_group_prefix() + "response_total" if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph( "elfstats - total response time for %s methods" % method.group.upper(), self._category, info="Method group %s" % method.group.upper(), args="--base 1000 --logarithmic --units=si", vlabel="Response time in ms", ) self.appendGraph(graph_name, graph) graph.addField(method.name, method.name, draw="LINE1", type="GAUGE", info=method.name) # AVERAGE RESPONSE TIME for method groups (except small groups) for key in keys: method = self._elfstatsInfo.get_method_by_key(key) if not method.group in self._elfstatsInfo.get_small_groups(): graph_name = method.get_graph_group_prefix() + "response_avg" if self.graphEnabled(graph_name): if self.hasGraph(graph_name): graph = self._getGraph(graph_name) else: graph = MuninGraph( "elfstats - average response time for %s methods" % method.group.upper(), self._category, info="Method group %s" % method.group.upper(), args="--base 1000 --logarithmic --units=si", vlabel="Response time in ms", ) self.appendGraph(graph_name, graph) graph.addField(method.name, method.name, draw="LINE1", type="GAUGE", info=method.name) def retrieveVals(self): # # RETRIEVING VALUES # # TOTAL RESPONSE TIME for method groups (except of small groups) for key in self._elfstatsInfo.get_method_keys(): method = self._elfstatsInfo.get_method_by_key(key) if not method.group in self._elfstatsInfo.get_small_groups(): graph_name = method.get_graph_group_prefix() + "response_total" if self.hasGraph(graph_name): if method.calls != "U" and method.avg != "U": self.setGraphVal(graph_name, method.name, int(method.calls) * int(method.avg)) else: self.setGraphVal(graph_name, method.name, EMPTY_VALUE) # AVERAGE RESPONSE TIME for method groups (except of small groups) for key in self._elfstatsInfo.get_method_keys(): method = self._elfstatsInfo.get_method_by_key(key) if not method.group in self._elfstatsInfo.get_small_groups(): graph_name = method.get_graph_group_prefix() + "response_avg" if self.hasGraph(graph_name): self.setGraphVal(graph_name, method.name, method.avg) def autoconf(self): return True def parse_key(self, key): split = key.split("_") return split[0], split[1]