def _list(): """List all configured monitors""" zkclient = context.GLOBAL.zk.conn suspended_monitors = masterapi.get_suspended_appmonitors(zkclient) monitors = [ masterapi.get_appmonitor( zkclient, app, suspended_monitors=suspended_monitors, ) for app in masterapi.appmonitors(zkclient) ] cli.out(formatter(monitors))
def _list(match=None): """List configured monitors.""" if match is None: match = '*' zkclient = context.GLOBAL.zk.conn monitors = [ masterapi.get_appmonitor(zkclient, app) for app in masterapi.appmonitors(zkclient) ] filtered = [ monitor for monitor in monitors if (monitor is not None and fnmatch.fnmatch(monitor['_id'], match)) ] return sorted(filtered, key=lambda item: item['_id'])