Created
June 9, 2020 10:49
-
-
Save johnddias/0265cbb393c293d85fa8900f997e16d4 to your computer and use it in GitHub Desktop.
Start Telegraf Agent Bootstrap for vROps 8.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def installAgent(context, inputs): | |
if "verify" not in inputs.keys(): | |
inputs["verify"] = True | |
print(inputs["verify"]) | |
headers = {'Content-type':'application/json','Accept':'application/json','Authorization':'vRealizeOpsToken '+ inputs["token"]} | |
payload = { | |
"resourceCredentials" : [ { | |
"resourceId" : inputs["resourceId"], | |
"username" : inputs["user"], | |
"password" : inputs["passwd"], | |
"addRuntimeUser" : True | |
} ] | |
} | |
r = requests.request('POST','https://'+inputs["vropsHost"]+'/suite-api/api/applications/agents', data=json.dumps(payload), headers=headers, verify=inputs["verify"]) | |
res = {'code':r.status_code, 'text':json.loads(r.text)} | |
return(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment