def panel_iostat_queue_length(host, width=None): title = 'Avg. Queue length' panel = new_graph(title, width=width) add_metric(panel, host, "iostat.*.average_queue_length", [-2]) return panel
def panel_sensor_group(host, title, group, unit, width=None): panel = new_graph(title, width=width) add_metric(panel, host, 'sensors.%s.*.*' % (group)) set_yaxis_units(panel, unit) return panel
def panel_equivalent_a4_impressions(host, width=None): panel = new_graph('Equvalent impressions A4', width=width) add_metric(panel, host, 'jetdirect.usage.equivalent_impressions_a4_letter.*.*') return panel
def panel_phone_credit_left(phone): panel = new_graph('Credits left') add_metric(panel, 'phones', phone + '.credit', [2], kind='services') set_decimals(panel, 2) set_yaxis_units(panel, "currencyEUR") return panel
def panel_phone_credit_use(phone): panel = new_graph('Credits use') add_metric(panel, 'phones', phone + '.credit', [2], scale=-1, nnder=True, kind='services') set_decimals(panel, 2) set_yaxis_units(panel, "currencyEUR") return panel
def panel_graphite_cache(host, width=None): title = "Cache" panel = new_graph(title, width=width) add_metric(panel, host, "graphite.carbon.agents.*.cache.queries") add_metric(panel, host, "graphite.carbon.agents.*.cache.queues") return panel
def panel_graphite_monitors(host, width=None): title = "Monitors" panel = new_graph(title, width=width) add_metric(panel, host, "graphite.carbon.agents.*.creates") add_metric(panel, host, "graphite.carbon.agents.*.errors") return panel
def panel_library_lent_items_total(library): panel = new_graph('Lent items total') add_metric(panel, 'libraries', library + '.lent_items.current.total', [2], kind='services') 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 set_threshold_w_fallback(panel, cpu_count, host=None): color = 'rgb(216, 27, 27)' if cpu_count: set_threshold(panel, cpu_count, color) set_yaxis_maximum(panel, 'left', int(cpu_count) * 5. / 4) elif host: add_metric(panel, host, 'cpu.cpu_count', 'CPUs') add_series_override(panel, '/CPUs/', {'linewidth': 2.5}) set_colors(panel, {'CPUs': color})
def panel_diskspace_percent(host, width=None): title = 'Disk % free' panel = new_graph(title, width=width) add_metric(panel, host, "diskspace.*.byte_percentfree", [-2]) set_yaxis_units(panel, "percent") return panel
def panel_diskspace_bytes(host, width=None): title = 'Disk bytes available' panel = new_graph(title, width=width) add_metric(panel, host, "diskspace.*.byte_avail", [-2]) set_yaxis_units(panel, "bytes") return panel
def panel_length_average(host, base, width=None): title = "Average Line Length" panel = new_graph(title, width=width) add_metric(panel, host, '%s.total.length.average' % (base), 'Bytes') set_yaxis_units(panel, "bytes") return panel
def panel_network_bytes(host, title='Network bytes', width=None): panel = new_graph(title, width=width) add_metric(panel, host, 'network.*.rx_byte', [-2, -1]) add_metric(panel, host, 'network.*.tx_byte', [-2, -1]) set_yaxis_units(panel, "Bps") return panel
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_apache_workers_basic(host, width=None): title = "Workers (basic)" panel = new_graph(title, width=width) add_metric(panel, host, 'apache.localhost.BusyWorkers', 'Busy') add_metric(panel, host, 'apache.localhost.IdleWorkers', 'Idle') set_stacked_mode(panel) return panel
def panel_supply(host, supply, supply_aspect, metric_base, metric_end, width=None, alias=None): if alias is None: alias = [-2, -1] panel = new_graph('%s %s' % (supply, supply_aspect), width=width) add_metric(panel, host, '%s.%s' % (metric_base, metric_end), alias) set_extended_colors(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_network_packets(host, width=None): title = 'Network packets' panel = new_graph(title, width=width) add_metric(panel, host, 'network.*.rx_packets', [-2, -1]) add_metric(panel, host, 'network.*.tx_packets', [-2, -1]) set_yaxis_units(panel, "pps") 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_impressions(host, width=None): panel = new_graph('Actual Impressions', width=width) add_metric(panel, host, 'jetdirect.usage.impressions.*.*') add_series_override(panel, '/units/', { 'legend': False, 'hiddenSeries': True }) return panel
def panel_load_kind(host, kind=1, cpu_count=False): title = "Load %sm" % (kind) panel = new_graph(title) add_metric(panel, host, 'loadavg.%s' % (str(kind).zfill(2)), 'Load %sm' % kind) set_decimals(panel, 2) set_threshold_w_fallback(panel, cpu_count, host) return panel
def panel_library_lent_items_categories(library): panel = new_graph('Lent items by category') add_metric(panel, 'libraries', library + '.lent_items.current.category.*', [6], kind='services') zero_missing_points(panel) return panel
def panel_library_next_due_date(library): panel = new_graph('Next due date') add_metric(panel, 'libraries', library + '.lent_items.next_due_date_days', [2], kind='services') set_yaxis_units(panel, "d") return panel
def panel_website_timing_total(host, metric_base, width=None): title = "Total request timings" panel = new_graph(title, width=width) add_metric(panel, host, '%s.total.duration.*' % (metric_base), [-1]) connect_missing_points(panel) set_point_mode(panel) set_yaxis_units(panel, "ms") return panel
def panel_website_timing_per_status(host, metric_base, status, alias, width=None): title = 'Status %s (%s)' % (status, alias) panel = new_graph(title, width=width) for p in TIMINGS: add_metric(panel, host, '%s.status.%s.duration.%s' % (metric_base, status, p[0]), p[1]) connect_missing_points(panel) set_point_mode(panel) set_yaxis_units(panel, "ms") return panel
def panel_website_timing_per_method(host, metric_base, width=None): title = "q50 request timings per HTTP method" panel = new_graph(title, width=width) for method in METHODS: add_metric(panel, host, '%s.method.%s.duration.q50' % (metric_base, method), [-3]) connect_missing_points(panel) set_point_mode(panel) set_yaxis_units(panel, "ms") 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_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