break else: color, emoji = color_config['not classified'].split(',') formatted_message = '<font color=\"{0}\">{1} {2}</font>'.format( color, emoji, message) return formatted_message if __name__ == '__main__': locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8') args = matrix.flags() args['message'] = " ".join(args['message']) if args['debug'] is True: matrix.set_log_level('DEBUG') else: matrix.set_log_level() try: config = matrix.merge_config(args, matrix.read_config(args['config'])) config['matrix'] = matrix.merge_config(args, config['matrix']) except FileNotFoundError: config = args if None in [config['username'], config['password'], config['room']]: raise color_config = {} for key, value in config['colors'].items():
""" data = {} zapi = init(config) hosts = _get_hosts_in_groups(zapi, hostgroup) if hosts is not None: for host in hosts: value = _get_itemvalue(zapi, host['hostid'], keys) data[host['name']] = value return data if __name__ == '__main__': args = flags() if args['debug'] is True: set_log_level('DEBUG') else: set_log_level() logging.debug(args) config = read_config(args['config'], args['realm']) logging.debug('configuration:\n%s', config) values = get_itemvalues_for_group(config, 'Clustermanagers', ['cms.chunks_left', 'agent.ping']) for name, value in sorted(values.items()): print("{0:10s}: {1}".format(name, value)) # triggers = []