roles/collect-logs/library/ara_influxdb.py
def send(file_path, in_url, in_port, in_user, in_pass, in_db):
    '''Actual sending of data to InfluxDB server via network

    :param file_path: path to file with data to send
    :param in_url: InfluxDB URL
    :param in_port: InfluxDB port
    :param in_user: InfluxDB user
    :param in_pass: InfluxDB password
    :param in_db: InfluxDB database name
    :return: True if sent successfully, otherwise False
    '''
    url = in_url.rstrip("/")
    if in_port != 80:
        url += ":%d" % in_port
    url += "/write"
    params = {"db": in_db, "precision": "s"}
    if in_user:
        if not in_pass:
            if os.environ.get('INFLUXDB_PASSWORD'):
                with open(os.environ['INFLUXDB_PASSWORD']) as f:
                    in_pass = f.read().strip()
            else:
                return False, 'InfluxDB password was not provided!'
        auth = HTTPBasicAuth(in_user, in_pass)
    else:
        auth = None
    with open(file_path, "rb") as payload:
        req = requests.post(url, params=params, data=payload, auth=auth,
                            verify=False)
    if not req or req.status_code != 204:
        return False, "HTTP: %s\nResponse: %s" % (req.status_code, req.content)
    return True, ''
Actual sending of data to InfluxDB server via network

    :param file_path: path to file with data to send
    :param in_url: InfluxDB URL
    :param in_port: InfluxDB port
    :param in_user: InfluxDB user
    :param in_pass: InfluxDB password
    :param in_db: InfluxDB database name
    :return: True if sent successfully, otherwise False
    
Actual sending of data to InfluxDB server via network
Actual sending of data to InfluxDB server via network
def send(file_path, in_url, in_port, in_user, in_pass, in_db):
    url = in_url.rstrip("/")
    if in_port != 80:
        url += ":%d" % in_port
    url += "/write"
    params = {"db": in_db, "precision": "s"}
    if in_user:
        if not in_pass:
            if os.environ.get('INFLUXDB_PASSWORD'):
                with open(os.environ['INFLUXDB_PASSWORD']) as f:
                    in_pass = f.read().strip()
            else:
                return False, 'InfluxDB password was not provided!'
        auth = HTTPBasicAuth(in_user, in_pass)
    else:
        auth = None
    with open(file_path, "rb") as payload:
        req = requests.post(url, params=params, data=payload, auth=auth,
                            verify=False)
    if not req or req.status_code != 204:
        return False, "HTTP: %s\nResponse: %s" % (req.status_code, req.content)
    return True, ''
def send ( file_path , in_url , in_port , in_user , in_pass , in_db ) : url = in_url . rstrip ( "/" ) if in_port != 80 : url += ":%d" % in_port url += "/write" params = { "db" : in_db , "precision" : "s" } if in_user : if not in_pass : if os . environ . get ( 'INFLUXDB_PASSWORD' ) : with open ( os . environ [ 'INFLUXDB_PASSWORD' ] ) as f : in_pass = f . read ( ) . strip ( ) else : return False , 'InfluxDB password was not provided!' auth = HTTPBasicAuth ( in_user , in_pass ) else : auth = None with open ( file_path , "rb" ) as payload : req = requests . post ( url , params = params , data = payload , auth = auth , verify = False ) if not req or req . status_code != 204 : return False , "HTTP: %s\nResponse: %s" % ( req . status_code , req . content ) return True , ''
Actual sending of data to InfluxDB server via network
Actual sending of data to InfluxDB server via network
'''Actual sending of data to InfluxDB server via network

    :param file_path: path to file with data to send
    :param in_url: InfluxDB URL
    :param in_port: InfluxDB port
    :param in_user: InfluxDB user
    :param in_pass: InfluxDB password
    :param in_db: InfluxDB database name
    :return: True if sent successfully, otherwise False
    '''
True if sent successfully, otherwise False
True if sent successfully otherwise False
file_path
path to file with data to send
path to file with data to send
in_url
None
in_port
None
in_user
None
in_pass
None
in_db
InfluxDB database name
InfluxDB database name