What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

HTTP Post Notifications to google chat

Votes:

0

Your Vote:

Up

Down

Hi,

My workplace are in the process of moving from Slack to g suite, and thus I wanted to move my current webhook notification to google chats. The slack webhook was super easy to setup, and the notifications were very useful and easily customizable, which I'm trying to replicate. (I just want Group, Name, Sensor etc, nothing fancy)

A bit of documentation I've been following: https://developers.google.com/hangouts/chat/how-tos/webhooks https://developers.google.com/hangouts/chat/reference/message-formats/basic

However I could not get webhooks to work with google so I am trying to use Execute HTTP Action instead.

I've entered the required details (URL, No SNI, Method: POST, and a payload of: { "text": "Hello, world" }

I have tested the above to prove my google chat works https://reqbin.com/ and it was successful. But that is JSON which PRTG cant use?

I have tried this and it still didn't work: https://kb.paessler.com/en/topic/69937-how-do-you-send-http-post-data-properly-through-prtg

In the notification logs am getting a HTTP 400 error which I think indicates that the incorrect format was used.

I am not a programmer so this is a bit out of my skill set.

I see I am not allowed to use XML or JSON in the payload So my question is what format does PRTG HTTP Post send ?

To summarize: I want to send notifications to google chats (which I think wants json format, but PRTG cant send) about down devices with name,ip,sensor etc.

google http json notifications webhook

Created on Mar 5, 2020 5:16:44 PM by  r_net_ad (0) 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hi there,

Excuse me, you're right here. I was thinking of the HTTP Advanced Sensor here, which supports the JSON format, the notifications indeed don't.

Therefore, the second variant to write a script for the notification to send the JSON via POST would be the way to go.


Kind regards,
Felix Saure, Tech Support Team

Created on Mar 6, 2020 7:38:59 PM by  Felix Saure [Paessler Support]



7 Replies

Votes:

0

Your Vote:

Up

Down

Hi there,

Putting a JSON in the payload of an HTTP Post request should indeed be the way to go. You can open the Notification Delivery Logging to exactly see what's getting send by the notification to see if Google accepts it. Next to this, you always have the possibility to create your very own script to do this and execute the notification via the Execute Exe/Script notification type.


Kind regards,
Felix Saure, Tech Support Team

Created on Mar 6, 2020 11:16:07 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks

I've turned on logging but not yet been able to restart the service.

You say that I CAN use JSON in the payload but the tip on PRTG says I cannot. Conflicting information. Can you clarify which is true?

https://imgur.com/a/bVTropP

Created on Mar 6, 2020 11:31:10 AM by  r_net_ad (0) 1



Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hi there,

Excuse me, you're right here. I was thinking of the HTTP Advanced Sensor here, which supports the JSON format, the notifications indeed don't.

Therefore, the second variant to write a script for the notification to send the JSON via POST would be the way to go.


Kind regards,
Felix Saure, Tech Support Team

Created on Mar 6, 2020 7:38:59 PM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

OK I have found a format that google chat likes using powershell.

$uri = "https://chat.googleapis.com/mywebhookaddress"

$body = ConvertTo-JSON @{ text = 'Hello Channel' }

Invoke-RestMethod -uri $uri -Method Post -body $body -ContentType 'application/json'

I can run that in powershell directly and it works.

However I cannot get PRTG to execute it via a notification. The log shows the following error:

Error sending "EXE": Error1. MyPRTGServerName : The term 'MyPRTGServerName' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 ch

I've done some googling and searched on here. My PRTG installation is 64bit, I've set the execution policy to remote signed on 32bit powershell but its still not working.

Any suggestions? I'm a newbie to this. Thanks

Created on Mar 9, 2020 2:54:22 PM by  r_net_ad (0) 1



Votes:

0

Your Vote:

Up

Down

Hi Richard,

I'm afraid that customizing of such scripts is not part of our usual support, maybe the community can help out here. According to the error message, MyPRTGServerName needs to be replaced by the actual server name.


Kind regards,
Felix Saure, Tech Support Team

Created on Mar 10, 2020 5:42:49 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

This is 2020. PRTG needs to support json payloads. Come on...

Created on Oct 14, 2020 11:51:56 PM by  cmichetti (0)



Votes:

0

Your Vote:

Up

Down

Hello there,

Not at the very moment natively I'm afraid. Using custom notifications is still possible if it's required in your environment. You can then forward parameters to the script to also use the same notification script for different notification templates.


Kind regards,
Felix Saure, Tech Support Team

Created on Oct 16, 2020 6:18:46 AM by  Felix Saure [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.