31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
from jira import JIRA
|
|
from influxdb import InfluxDBClient
|
|
import argparse
|
|
import time
|
|
from datetime import datetime, timedelta
|
|
#current_time = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
|
|
current_time = time.strftime('%Y-%m-%dT%H:%M:%SZ',time.localtime(time.time()))
|
|
|
|
|
|
def main(influxhost, influxport):
|
|
influxuser = 'CMWrite'
|
|
influxpass = 'CMWrite'
|
|
databasename = 'ASPM'
|
|
client = InfluxDBClient(host=influxhost, port=influxport, username=influxuser, password=influxpass, database=databasename)
|
|
print client.get_list_measurements()
|
|
|
|
|
|
# Allow command line overrides for host and port influxDB
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(
|
|
description='Sync Jira items with specific tag into InfluxDB database')
|
|
parser.add_argument('--host', type=str, required=False, default='itmetricsdb.mathworks.com',
|
|
help='hostname of InfluxDB http API')
|
|
parser.add_argument('--port', type=int, required=False, default=8086,
|
|
help='port of InfluxDB http API')
|
|
return parser.parse_args()
|
|
|
|
# grab arguments
|
|
if __name__ == '__main__':
|
|
args = parse_args()
|
|
main(influxhost=args.host, influxport=args.port) |