def panel_bus(host, width=None): title = 'Device changes per bus' panel = new_graph(title, width=width) add_metric(panel, host, 'sensors.bus.*', der=True) set_yaxis_labels(panel, 'changed devices') set_yaxis_minimum(panel, 'left', None) return panel
def panel_website_requests_total(host, metric_base, width=None): title = "Total requests" panel = new_graph(title, width=width) add_metric(panel, host, '%s.total.count' % (metric_base), 'Requests', scale=True) set_yaxis_labels(panel, "req/s") return panel
def panel_website_requests_per_user(host, metric_base, width=None): title = "Requests per User" panel = new_graph(title, width=width) add_metric(panel, host, '%s.user.*.count' % (metric_base), [-2], scale=True) set_yaxis_labels(panel, 'req/s') zero_missing_points(panel) return panel
def panel_website_requests_per_method(host, metric_base, width=None): title = "Requests per HTTP method" panel = new_graph(title, width=width) for method in METHODS: add_metric(panel, host, '%s.method.%s.count' % (metric_base, method), [-2], scale=True) set_yaxis_labels(panel, "req/s") return panel
def panel_count(host, base, kinds=['*'], prefix='All', by=None, width=None, zero_missing=False): title = prefix + ' Log Lines' if by: title += ' by ' + by panel = new_graph(title, width=width) for kind in kinds: add_metric(panel, host, '%s.%s.count' % (base, kind), [-2]) set_yaxis_labels(panel, "Lines/min") zero_missing_points(panel) return panel
def panel_website_requests_per_status_group(host, metric_base, width=None): title = "Requests per HTTP response status" panel = new_graph(title, width=width) add_metric(panel, host, '%s.status.1xx.count' % (metric_base), '1xx - Informational', scale=True) add_metric(panel, host, '%s.status.2xx.count' % (metric_base), '2xx - Success', scale=True) add_metric(panel, host, '%s.status.3xx.count' % (metric_base), '3xx - Redirection', scale=True) add_metric(panel, host, '%s.status.4xx.count' % (metric_base), '4xx - Client error', scale=True) add_metric(panel, host, '%s.status.5xx.count' % (metric_base), '5xx - Server error', scale=True) add_metric(panel, host, '%s.status.unparsable.count' % (metric_base), 'Unparsable', scale=True) set_yaxis_labels(panel, "req/s") return panel
def panel_website_ssl(host, aspect, metric_base, width=None): title = 'SSL %ss' % (aspect) panel = new_graph(title, width=width) add_metric(panel, host, '%s.ssl.%s.*.count' % (metric_base, aspect.replace(' ', '_').lower()), alias=[8], scale=True) set_yaxis_labels(panel, "req/s") zero_missing_points(panel) return panel
def panel_load(host, cpu_count=False, width=None): title = "Load" panel = new_graph(title, width=width) add_metric(panel, host, 'loadavg.15', 'Load 15m') add_metric(panel, host, 'loadavg.01', 'Load 1m') set_decimals(panel, 2) set_fill(panel, 0) set_yaxis_labels(panel, "load") add_series_override(panel, '/CPUs/', {'linewidth': 3}) add_series_override(panel, '/Load 15/', {'linewidth': 0, 'fill': 4}) set_threshold_w_fallback(panel, cpu_count, host) return panel
def panel_website_total_requests(host, engine, width=None): title = 'Total requests served' panel = new_graph(title, width=width) add_metric(panel, host, [ 'logs.%s.*.*.total.count' % (engine), 'logs.%s.*.total.count' % (engine) ], 'Total requests', scale=True) add_metric(panel, host, 'logs.%s.*.*.total.count' % (engine), [-4, -3], scale=True) add_metric(panel, host, 'logs.%s.*.total.count' % (engine), [-3], scale=True) set_yaxis_labels(panel, "req/s") return panel
def panel_website_requests_per_status(host, metric_base, status, alias, width=None): if status == '*': title = 'All available statuses' alias = [-2] else: title = 'Status %s (%s)' % (status, alias) alias = '%s - %s' % (status, alias) panel = new_graph(title, width=width) add_metric(panel, host, "%s.status.%s.count" % (metric_base, status), alias, scale=True) set_yaxis_labels(panel, 'req/s') zero_missing_points(panel) return panel