示例#1
0
def main():
    args = parser.parse_args()
    global elastic_config
    elastic_config = common.LoadElasticConfig("puppet-show")
    pattern = elastic_config.index_pattern
    lookback = elastic_config.lookback
    indices = common.get_indexes(lookback, pattern)
    hosts = elastic_config.hosts
    port = elastic_config.port
    username = elastic_config.username
    password = elastic_config.password
    environment = elastic_config.environment
    if args.verbose:
        root = logging.getLogger()
        if root.handlers:
            for handler in root.handlers:
                root.removeHandler(handler)
        logging.basicConfig(level=logging.INFO)
    else:
        logging.basicConfig(level=logging.ERROR)
    if args.unresponsive:
        logging.info("Finding unresponsive nodes...")
        find_unresponsive(args.unresponsive)
    elif args.failures:
        logging.info("Finding nodes not compiling their catalog")
        find_failed_catalogs()
示例#2
0
def main():
    args = parser.parse_args()
    global elastic_config
    elastic_config = common.LoadElasticConfig("puppet-show")
    pattern = elastic_config.index_pattern
    lookback = elastic_config.lookback
    indices = common.get_indexes(lookback, pattern)
    hosts = elastic_config.hosts
    port = elastic_config.port
    username = elastic_config.username
    password = elastic_config.password
    environment = elastic_config.environment
    if args.verbose:
        root = logging.getLogger()
        if root.handlers:
            for handler in root.handlers:
                root.removeHandler(handler)
        logging.basicConfig(level=logging.INFO)
    else:
         logging.basicConfig(level=logging.ERROR)
    if args.unresponsive:
        logging.info("Finding unresponsive nodes...")
        find_unresponsive(args.unresponsive)
    elif args.failures:
        logging.info("Finding nodes not compiling their catalog")
        find_failed_catalogs()
示例#3
0
def search(elastic_config, fqdn):
    pattern = elastic_config.index_pattern
    lookback = elastic_config.lookback
    indices = common.get_indexes(lookback, pattern)
    hosts = elastic_config.hosts
    port = elastic_config.port
    username = elastic_config.username
    password = elastic_config.password
    environment = elastic_config.environment
    es = ElasticSearch(hosts, port=port, username=username, password=password)
    #try:
    doc = es.search(common.build_query(fqdn, environment), index=indices)
    return doc, fqdn
示例#4
0
def search(elastic_config, fqdn):
    pattern = elastic_config.index_pattern
    lookback = elastic_config.lookback
    indices = common.get_indexes(lookback, pattern)
    hosts = elastic_config.hosts
    port = elastic_config.port
    username = elastic_config.username
    password = elastic_config.password
    environment = elastic_config.environment
    es = ElasticSearch(hosts, port=port, username=username, password=password)
    #try:
    doc = es.search(common.build_query(fqdn, environment), index=indices)
    return doc, fqdn
示例#5
0
def search(query):
    pattern = elastic_config.index_pattern
    lookback = elastic_config.lookback
    indices = common.get_indexes(lookback, pattern)
    hosts = elastic_config.hosts
    port = elastic_config.port
    username = elastic_config.username
    password = elastic_config.password
    environment = elastic_config.environment
    es = ElasticSearch(hosts, port=443, username=username, password=password)
    try:
        logging.info("Querying Elasticsearch using {0}".format(query))
        doc = es.search(query, index=indices)
        return doc
    except:
        logging.error("Unexpected error searching for {0}. Passing".format(query))
        pass
示例#6
0
def search(query):
    pattern = elastic_config.index_pattern
    lookback = elastic_config.lookback
    indices = common.get_indexes(lookback, pattern)
    hosts = elastic_config.hosts
    port = elastic_config.port
    username = elastic_config.username
    password = elastic_config.password
    environment = elastic_config.environment
    es = ElasticSearch(hosts, port=443, username=username, password=password)
    try:
        logging.info("Querying Elasticsearch using {0}".format(query))
        doc = es.search(query, index=indices)
        return doc
    except:
        logging.error(
            "Unexpected error searching for {0}. Passing".format(query))
        pass