With the release of “VMware Skyline Advisor Pro”, the Skyline Insights API is made available. With the new API, you can query and script to receive Skyline’s Proactive Findings data. Even without Skyline Insights API, you were able to export Findings to CSV. Do you want to send the Findings data to slack so you and your team can take action?
- In some organizations, VMware admins might not go into Skyline Advisor to review the Findings.
- Not every group has access to Skyline Advisor. Since Findings can be vSphere, vSAN, NSX, vROPS, vRA, Horizon , VCF related, or relevant to different environments some team members might not see the Findings. They, then, can experience problems and create SRs (instead of proactively fixing the problems before they occur).
- You may see the Findings, but there is no way to identify the ones you want to address, tag others, comment, or mark off as completed. Using Slack, you can do that.
- In some organizations, VMware admins might not go into Skyline Advisor to review the findings.
- Not every group have access to Skyline Advisor. Since Findings can be vSphere, vSAN, vROPS, Horizon, VCF, and more, some groups might not see the findings. They, then, would hit problems and create SRs (instead of proactively fixing the problems before they occur).
- You may see the findings, but there is not way to identify the ones you want to address, comment, or marked off as completed. Using Slack, you can do that.
Here is how to do it…
Slack App Side
First, you need to create a bot in Slack. This bot need access to a particular channel with the following rights (Bot Token Scopes/User Token Scopes):
- channels:read
- chat:write
- files:write
- groups:read
- im:read
- incoming-webhook
- mpim:read
Save off your Token in OAuth/permissions
Scripting Side
Here is the example code using curl
1 2 3 4 5 6 |
TEXT=$(cat YOUR-CSVFILE) curl -X POST -H 'Authorization: Bearer xoxb-123456' -H 'Content-type: application/json' --data '{ "channel":"C02XXXXXXXX", "text": "'"$TEXT"'", "color":"#3AA3E3"}' https://slack.com/api/chat.postMessage |
Here is the example code using powercli
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$TEXT = get-content $CSV $TOKEN = "xoxb-123456" $CHANNEL = "C02XXXXXXXX" $METHOD = "Post" import-csv YOUR-CSV | foreach-object { $FINDID = $_."Finding Id" $VCENTER = $_."Source Name" $ESX= $_."Object Name" $KB = $_."Reference" $Body = @{ channel = $CHANNEL text = "Finding id: $FINDID `r Source Name: $VCENTER `r Object Name: $ESX `r Reference: $KB" color = "#3AA3E3" attachment_type = "default" } $headers = @{Authorization = "Bearer $TOKEN"} Invoke-RestMethod -Method $METHOD -Uri "https://slack.com/api/chat.postMessage" -Headers $headers -Body $body |
Now you have what is needed on the Slack side to prepare with two examples (shell and PowerCLI) on how to send the CSV export into slack.
Comments