Tech Tested
I was recently working with a client who was trying to send information from Aria Operations into Jira. There is no native integration with Jira so the two most evident options are (1) using a web hook to push information out of Aria Ops, or (2) using APIs to pull information from Aria Ops.
I will start with web hooks because that is the most straightforward:
Webhooks in Aria Ops:
To use web hooks, navigate to Configure > Alerts > Notifications
Press Add at the top.
You will have to move through the tabs by adding a name and then defining the alert criteria.
Once you are on the third tab, this is where you can set the Outbound method:
5. Select Webhook Notification Plugin.
6. You will have to create a new web hook instance by pressing the + sign.
Note: You can access the Outbound Methods directly by navigating to Configure > Alerts > Outbound Settings
Brock Peterson has a great blog on this (using web hooks for slack): https://www.brockpeterson.com/post/send-vmware-aria-operations-alerts-to-slack
API in Aria Ops:
Leveraging APIs is another option to pull data into Jira, however there is a bit more configuration that is required.
Firstly, I would encourage people to read through these links to get a sense of how the APIs work and to become aware of some of the "gotchas":
Aria Ops Official Documentation: https://docs.vmware.com/en/VMware-Aria-Operations/SaaS/API-Programming-Operations/GUID-C27B4402-56DF-45D6-8813-EC2617D24407.html
Using Powershell: https://virtualg.uk/getting-started-with-the-vrops-rest-api/
Using Postman: https://angrysysops.com/2022/02/25/vrops-api-first-steps-what-to-do-what-to-use/
To access the Swagger based APIs, append your Aria Ops on perm server url with "/suite-api/doc/swagger-ui.html" or your SaaS server with "/vrops-cloud/suite-api/doc/swagger-ui.html"
Once you have done this, you will realize that one of the trickiest things that you have to do is retrieve a token.
Postman:
The most straightforward example uses Postman:
If you are following the above documentation, note that the instructions seem to imply that you need to input the RAW json code as follows:
{
"username": "{{username}}",
"authSource": "{{source}}",
"password": "{{password}}"
}
However, it is important to note that "authSource" is optional. Therefore my code was simply as follows:
It is worth noting that the token will be an alpha numeric string and also contains an expiration date.
Python Code:
Another more involved approach would be to create a python script that regularly refreshes the API token. A peer of mine, Alonso Trejo Mora, wrote the following script which can be uploaded in an IDE to accomplish this.
His script is as follows:
import requests
import os # Not a Pip dependency. Built into Python.
import json # Not a Pip dependency. Built into Python.
# Use your Refresh Token to obtain a temporary Bearer Token
# source: https://developer.vmware.com/apis/vrealize-operations/vrealize-operations-cloud-api/latest/
def Fetch_New_Bearer_Token():
refresh_token_path_from_root = os.getcwd() + "/csp-monitoring-refreshToken.txt"
with open(refresh_token_path_from_root, 'r') as f:
requestUrl = "https://console.cloud.vmware.com"
extension = "/csp/gateway/am/api/auth/api-tokens/authorize"
headers = { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}
data = f"refresh_token={refresh_token}"
response = requests.post(requestUrl+extension, headers=headers, data=data)
print(response.status_code)
if response.status_code != 200:
print(f'ERROR: Status code {response.status_code}')
exit(1)
jsonResponse = response.json()
accessToken = jsonResponse['access_token']
# Update the Bearer Token file with the new Bearer Token.
access_token_path_from_root = os.getcwd() + "/csp-monitoring-accessToken.txt"
with open(access_token_path_from_root, 'w') as f:
f.truncate(0)
f.write(accessToken)
if name == '__main__':
Fetch_New_Bearer_Token()