VMware Cloud Community
elliott0184
Contributor
Contributor
Jump to solution

vRops Webhook

Hi all,

I am currently trying to send vRops alerts to Ms Teams (that we have just started using). After a bit of googling i came across a webhook middle man to process the request and put it backout for the webhook on ms teams to accept. The middleman is a docker container. (GitHub - vmw-loginsight/webhook-shims: Shims for Log Insight 3.3+ and vRealize Operations Manager 6.... ) I have this up and running i can ping both the vrops server and middleman from each other.

According to the output on the middleman it is reciving the POST but it doesnt seem to be pusing it any further.

This is what the output on the server looks like {

2018-07-31 13:49:51,619 INFO 172.16.191.47 - - [31/Jul/2018 13:49:51] "POST /endpoint/msteams/test HTTP/1.1" 500 -

2018-07-31 13:49:51,629 INFO 172.16.191.47 - - [31/Jul/2018 13:49:51] "PUT /endpoint/msteams/test HTTP/1.1" 500 -

}

I have added in the webhook urlfrom teams in the appropriate section. Has anyone used this before.

Kind Regards

Reply
0 Kudos
1 Solution

Accepted Solutions
sxnxr
Commander
Commander
Jump to solution

From what i can see is you have created a new endpoint on the shim named MSteams.py

In the /loginsightwebhookdemo/webhook-shims/loginsightwebhookdemo you have the msteams.py

in the same folder have you edited the __init__.py and added in the new endpoint under # Import individual shims

import loginsightwebhookdemo.msteams

reboot the shim. this will load your endpoint.

Edit the msteams.py with the info you have ( target msteams url and the rest fields of the incoming alert to the output fields that msteams will use)

# Parameters

TEMPLATEURL = 'http://your target.com'

This is what we use for the transform

payload = {

      "result": {

           "TransformerName": "VMWare",

           "AlertMessage": a['info'],

           "EventInstance": a['subType'],

           "Criticality": a['criticality'],

           "EventName": a['AlertName'],

           "HostName": a['resourceName'].replace('.ourcompany.com',''),

           "EventType": a['type'],

           "EventSubType": a['subType'],

           "type": "link",

           "url": a['url'],

View solution in original post

Reply
0 Kudos
12 Replies
GayathriS
Expert
Expert
Jump to solution

Have you got all pre-requisites configured on vrops with respective to this rest API calls.

Also from the middleman msteam is there any communication gap to Vrops .

Reply
0 Kudos
elliott0184
Contributor
Contributor
Jump to solution

I have all the prerequisites that i am aware of installed, i don't think there is a gap as i said it appears that the middleman is reciving information from vRops it just doens't seem to be passing it on from there.

More of the output;

2018-07-31 14:04:28,227 INFO 172.16.191.47 - - [31/Jul/2018 14:04:28] "PUT /endpoint/msteams/45119f77-4d23-4de2-9c0f-daee7c39c35e HTTP/1.1" 404 -

2018-07-31 14:04:28,939 INFO 172.16.191.47 - - [31/Jul/2018 14:04:28] "PUT /endpoint/msteams/2d07bdea-1b13-457a-b770-1aa2dbf6f570 HTTP/1.1" 404 -

2018-07-31 14:07:22,204 INFO 172.16.191.47 - - [31/Jul/2018 14:07:22] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:07:22,206 INFO 172.16.191.47 - - [31/Jul/2018 14:07:22] "POST /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:08:54,843 INFO 172.16.191.47 - - [31/Jul/2018 14:08:54] "POST /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:08:54,846 INFO 172.16.191.47 - - [31/Jul/2018 14:08:54] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:09:10,878 INFO 172.16.191.47 - - [31/Jul/2018 14:09:10] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:09:10,879 INFO 172.16.191.47 - - [31/Jul/2018 14:09:10] "POST /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:09:15,260 INFO 172.16.191.47 - - [31/Jul/2018 14:09:15] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:09:15,261 INFO 172.16.191.47 - - [31/Jul/2018 14:09:15] "POST /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:09:23,726 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "PUT /endpoint/msteams/e55e85e6-d0a5-4855-a5a9-07b12ae2a112 HTTP/1.1" 404 -

2018-07-31 14:09:23,744 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "PUT /endpoint/msteams/eada4f28-4aa1-43cd-bb1b-77329b5ad6a3 HTTP/1.1" 404 -

2018-07-31 14:09:23,745 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "POST /endpoint/msteams/2643b017-9b58-4566-b92f-3fc5538322a2 HTTP/1.1" 404 -

2018-07-31 14:09:23,792 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "PUT /endpoint/msteams/f3e3ce55-2dc4-48db-b08e-059517f1978d HTTP/1.1" 404 -

2018-07-31 14:09:23,801 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "PUT /endpoint/msteams/f3c73359-2dc9-4354-898f-cebc7003567c HTTP/1.1" 404 -

2018-07-31 14:09:23,977 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "PUT /endpoint/msteams/5b7abc3f-3823-4c88-b03f-6666fda472a7 HTTP/1.1" 404 -

2018-07-31 14:09:23,980 INFO 172.16.191.47 - - [31/Jul/2018 14:09:23] "POST /endpoint/msteams/be982239-ce3d-48ae-a31b-da59985ae27d HTTP/1.1" 404 -

2018-07-31 14:10:11,930 INFO 172.16.191.47 - - [31/Jul/2018 14:10:11] "POST /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:10:11,933 INFO 172.16.191.47 - - [31/Jul/2018 14:10:11] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:10:18,757 INFO 172.16.191.47 - - [31/Jul/2018 14:10:18] "POST /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:10:18,761 INFO 172.16.191.47 - - [31/Jul/2018 14:10:18] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:11:41,743 INFO 172.16.191.47 - - [31/Jul/2018 14:11:41] "PUT /endpoint/msteams/test HTTP/1.1" 404 -

2018-07-31 14:11:41,745 INFO 172.16.191.47 - - [31/Jul/2018 14:11:41] "POST /endpoint/msteams/test HTTP/1.1" 404 -

Thankyou for answering back so quick

Reply
0 Kudos
GayathriS
Expert
Expert
Jump to solution

If thats the case then I beilive we may have to look between the middle man and the application to which you are sending the alert to .

Is there any thing stopping there that you could see ?

Reply
0 Kudos
elliott0184
Contributor
Contributor
Jump to solution

I have checked if the file holding the config for the output address has executable permissions (not that it should make a difference), i have ensured that there is no firewall blocking the middle man and the vrops server.  I am able to get to the webhook url from inside the business firewall so i dought that it is being blocked by that either.

I have re added the webhook connector in teams a couple of times and then updated the url in the settings.

Reply
0 Kudos
GayathriS
Expert
Expert
Jump to solution

Not on the Vrops or middle man i.e docker as you as said, but the endpoint which is msteam( to which the alert needs to sent)

Reply
0 Kudos
sxnxr
Commander
Commander
Jump to solution

did you add your endpoint to the __init__.py

also when you send the alert to the shim server what does the journalctl file say ( i am using photon and not docker so not sure if the log is the same)

Reply
0 Kudos
elliott0184
Contributor
Contributor
Jump to solution

So on Ms Teams we have set-up the incoming webhook. It then gives you a url for you to send the webhook to.

pastedImage_0.png

pastedImage_2.png

This i what i get when i browse to the url.

Reply
0 Kudos
elliott0184
Contributor
Contributor
Jump to solution

The msteams is imported in the __init__.py on the last line. Is that i needed to add for that point.

The docker container doesn't have a journalctl but the host doesn't seem to flag up any errors at all when looking though it. Also, the docker logs seem not to have any errors in it

Reply
0 Kudos
sxnxr
Commander
Commander
Jump to solution

From what i can see is you have created a new endpoint on the shim named MSteams.py

In the /loginsightwebhookdemo/webhook-shims/loginsightwebhookdemo you have the msteams.py

in the same folder have you edited the __init__.py and added in the new endpoint under # Import individual shims

import loginsightwebhookdemo.msteams

reboot the shim. this will load your endpoint.

Edit the msteams.py with the info you have ( target msteams url and the rest fields of the incoming alert to the output fields that msteams will use)

# Parameters

TEMPLATEURL = 'http://your target.com'

This is what we use for the transform

payload = {

      "result": {

           "TransformerName": "VMWare",

           "AlertMessage": a['info'],

           "EventInstance": a['subType'],

           "Criticality": a['criticality'],

           "EventName": a['AlertName'],

           "HostName": a['resourceName'].replace('.ourcompany.com',''),

           "EventType": a['type'],

           "EventSubType": a['subType'],

           "type": "link",

           "url": a['url'],

Reply
0 Kudos
elliott0184
Contributor
Contributor
Jump to solution

pastedImage_0.png

This is the files that are inside the folder. The __init__.py does have the import loginsightwebhookdemo.msteams in is and here is the msteams.py file

pastedImage_1.png

The URL goes on and on but didnt want to make the picture massive and unreadble. I have tired it without the brackets but it makes no difference either way

Reply
0 Kudos
elliott0184
Contributor
Contributor
Jump to solution

Tried a new docker and double checked everything rebooted and it worked thanks for all your help Smiley Happy

Reply
0 Kudos
AyaShahein
Contributor
Contributor
Jump to solution

Do I have to use a middle man?

Reply
0 Kudos