Example #1
0
def get_names_list():

        prom_request_url = client.concatenate_url(os.getenv
                                                  ("aggregator_endpoint"),
                                                  query_url)
        current_time = str(datetime.datetime.now().isoformat())+"Z"
        query = "node_uname_info"
        payload = {"query": query, "time": current_time}
        resp = client.http_request("GET", prom_request_url, headers,
                                   payload, None, None)
        names_list, nodename_list = response_parser.get_node_name_list(resp.text)
        return names_list, nodename_list
def get_names_list(search_string, search_type):

    prom_request_url = client.concatenate_url(os.getenv("aggregator_endpoint"),
                                              query_url)
    current_time = str(datetime.datetime.now().isoformat()) + "Z"
    if search_string is None or search_type is None:
        query = "node_uname_info"
    else:
        query = "node_uname_info{"+search_type+"=~"+'"' + \
            search_string+'"'+"}"
    payload = {"query": query, "time": current_time}
    resp = client.http_request("GET", prom_request_url, headers, payload, None,
                               None)
    names_list, nodename_list = response_parser.get_node_name_list(resp.text)
    return names_list, nodename_list
def get_names_list(search_string, search_type):

        prom_request_url = client.concatenate_url(os.getenv
                                                  ("aggregator_endpoint"),
                                                  query_url)
        current_time = str(datetime.datetime.now().isoformat())+"Z"
        if search_string is None or search_type is None:
            query = "node_uname_info"
        else:
            query = "node_uname_info{"+search_type+"=~"+'"' + \
                search_string+'"'+"}"
        payload = {"query": query, "time": current_time}
        resp = client.http_request("GET", prom_request_url, headers,
                                   payload, None, None)
        node_list = response_parser.get_node_name_list(resp.text)
        return node_list
Example #4
0
def get_names_list(message):

    if message['names_list'] is None:
        prom_request_url = client.concatenate_url(os.getenv
                                                  ("aggregator_endpoint"),
                                                  query_url)
        current_time = str(datetime.datetime.now().isoformat())+"Z"
        query = "node_uname_info{"+message["search_type"]+"=~"+'"' + \
                message["search_string"]+'"'+"}"
        payload = {"query": query, "time": current_time}
        resp = client.http_request("GET", prom_request_url, headers,
                                   payload, None, None)
        names_list = response_parser.get_node_name_list(resp.text)
        return names_list, ""
    else:
        return message['names_list'], ""
Example #5
0
def get_names_list(message):

    if message['names_list'] is None:
        prom_request_url = client.concatenate_url(
            os.getenv("aggregator_endpoint"), query_url)
        current_time = str(datetime.datetime.now().isoformat()) + "Z"
        if "exclude" in message.keys() and message['exclude']:
            query = "node_uname_info{"+message["search_type"]+"!~"+'"' + \
                message["search_string"]+'"'+"}"
        else:
            query = "node_uname_info{"+message["search_type"]+"=~"+'"' + \
                message["search_string"]+'"'+"}"

        payload = {"query": query, "time": current_time}
        resp = client.http_request("GET", prom_request_url, headers, payload,
                                   None, None)
        names_list, _ = response_parser.get_node_name_list(resp.text)
        return names_list, ""
    else:
        return message['names_list'], ""