Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnddias/0265cbb393c293d85fa8900f997e16d4 to your computer and use it in GitHub Desktop.
Save johnddias/0265cbb393c293d85fa8900f997e16d4 to your computer and use it in GitHub Desktop.
Start Telegraf Agent Bootstrap for vROps 8.1
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