Upload files to "/"
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
from jira import JIRA
|
||||
from influxdb import InfluxDBClient
|
||||
import argparse
|
||||
import time
|
||||
import pandas as pd
|
||||
|
||||
#from datetime import datetime, timedelta
|
||||
from datetime import date, 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()))
|
||||
yesterday = str(date.today() - timedelta(100000))
|
||||
today = str(date.today())
|
||||
|
||||
def main(influxhost, influxport):
|
||||
influxuser = 'CMWrite'
|
||||
influxpass = 'CMWrite'
|
||||
databasename = 'ASPM'
|
||||
client = InfluxDBClient(host=influxhost, port=influxport, username=influxuser, password=influxpass, database=databasename)
|
||||
# client.drop_measurement('jira')
|
||||
query = "select * from dns where time >= \'" + yesterday + "\' and time < \'" + today + "\'"
|
||||
points = client.query(query, chunked=True, chunk_size=10000).get_points()
|
||||
df = pd.DataFrame(points)
|
||||
print df
|
||||
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,31 @@
|
||||
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.query('delete from dns')
|
||||
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Create paths from info in "paths.csv"
|
||||
# (Note: No space before or after commas in paths.csv)
|
||||
# (Requests status codes -
|
||||
# https://github.com/requests/requests/blob/master/requests/status_codes.py)
|
||||
#
|
||||
|
||||
import csv
|
||||
from api_fns import *
|
||||
|
||||
with open('paths.csv', mode='r') as csv_file:
|
||||
csv_reader = csv.DictReader(csv_file)
|
||||
for row in csv_reader:
|
||||
# pp_json(row)
|
||||
|
||||
r1 = create_network_path(row['org_id'], row['source_mp'],
|
||||
row['target'])
|
||||
if r1.status_code == requests.codes.created:
|
||||
print('Created: org/src/targ {}/{}/{}'
|
||||
.format(row['org_id'], row['source_mp'], row['target']))
|
||||
else:
|
||||
print('Unable to create: {}'.format(r1.json()['messages'][0]))
|
||||
Reference in New Issue
Block a user