adding projects to repo

This commit is contained in:
dtomlinson
2019-11-04 14:38:31 +00:00
parent 6728b1ecf3
commit a285fad1ee
65 changed files with 171244 additions and 1 deletions

62
vrops-api/approach2.py Normal file
View File

@@ -0,0 +1,62 @@
import base64
import json
import os
import sys
sys.path.append(os.getcwd())
from vropsAPI import vropsAPI
# Authenticate:
vrops = vropsAPI.authenticate(
'https://sc1prapvro01/',
'svc_splunkVROPS@Group.WilliamHill.PLC',
'whgroup',
base64.b64decode(b'UmFjaW5nMjEyMg==').decode(),
verify=False,
)
# Load VM dict
with open('approach1-vms-example.json', 'r') as vms:
vrops.allVMS = json.load(vms)
# Get list of these VMS
allVMSIdList = vrops.getValuesList(vrops.allVMS)
# Load VM_Host dict
with open('approach1-vms_hosts-example.json', 'r') as vmsHosts:
vrops.VMSHostsNames = json.load(vmsHosts)
# Set the cluster
vrops.chosenCluster = 'SC1PRCONTXWHCUXCCL01'
# # Add a single VM to a list to pull back (can add more VMs to this list if
# # needed)
# myList = []
# myList.append(list(vrops.allVMS.values())[100])
# Get data for a vm
vrops.getStatsFromVMS(
begin=vrops.epochRelativeTime(vrops.epochNow, minutes=-30),
end=vrops.epochNow,
intervalType='MINUTES',
intervalQuantifier='1',
rollUpType='AVG',
resourceId=allVMSIdList,
statKey=['rescpu|actav1_latest'],
)
# Export the data into readable format
vrops.exportVMData()
# Save to disk
vrops.saveToDisk(
vrops.export, indent=4, filePrefix='approach2-export', breakLine=True
)