def do_status_events_list(sc, args): """List all events.""" arg_names = ['host_name', 'service_description', 'event_type', 'start_time', 'end_time', 'page_size', 'page', 'live_query'] arg = _dict_from_args(args, arg_names) events = sc.status.events.list(**arg) if args.json: print(utils.json_formatter(events)) else: cols = utils.get_columns(events, ['host_name', 'service_description', 'event_type']) formatters = reduce(_create_format, cols, {}) utils.print_list(events, cols, formatters=formatters)
def do_status_metrics_show(sc, args): """Give the last status metrics.""" arg_names = ['host_name', 'metric_name', 'service_description', ] arg = _dict_from_args(args, arg_names) metrics = sc.status.hosts.metrics.get(**arg) if args.json: print(utils.json_formatter(metrics)) else: if isinstance(metrics, dict): metrics = [metrics] cols = utils.get_columns(metrics, ['metric_name', ]) formatters = reduce(_create_format, cols, {}) utils.print_list(metrics, cols, formatters=formatters)
def do_status_metrics_list(sc, args): """List all status metrics.""" arg_names = ['host_name', 'metric_name', 'start_time', 'end_time', 'service_description', 'live_query', 'page_size', 'page', ] arg = _dict_from_args(args, arg_names) metrics = sc.status.hosts.metrics.list(**arg) if args.json: print(utils.json_formatter(metrics)) else: cols = utils.get_columns(metrics, []) formatters = reduce(_create_format, cols, {}) utils.print_list(metrics, cols, formatters=formatters)