Hi,
Is the Webhook notification channel available in Monitoring compatible with MS Teams Incoming Webhook connector?
I've configured an Incoming Webhook connector in one of my Teams channel and have set the URL in GCP Monitoring Webhook config. However, I do not see any messages in the Teams channel after sending multiple "Test Connection".
Is there something additional that needs to be done to get this working?
Thanks.
Solved! Go to Solution.
Hello,
The Webhook Channel notification only supports Public End Points. You can't use webhooks for notifications unless the endpoint is public. If you need notification that is not public, create Pub/Sub notifications combined with a pull subscription to that notification topic. You can examine the cause of failure from your Cloud Logging log entries with a filter (resource.type="stackdriver_notification_channel"). Please check [1]
[1] https://cloud.google.com/monitoring/alerts/troubleshooting-alerts#webhook
Thanks
Hello,
The Webhook Channel notification only supports Public End Points. You can't use webhooks for notifications unless the endpoint is public. If you need notification that is not public, create Pub/Sub notifications combined with a pull subscription to that notification topic. You can examine the cause of failure from your Cloud Logging log entries with a filter (resource.type="stackdriver_notification_channel"). Please check [1]
[1] https://cloud.google.com/monitoring/alerts/troubleshooting-alerts#webhook
Thanks
Hey,
I didn't understood how creating a Pub/Sub notifications combined with a pull subscription to that notification topic solving this issue?
After I'm creating a new topic with a pull subscription to that notification topic how do I consume those messages to MS Teams?
I have got a webhook URL from MS Teams and I want to feed it with loged base alerts from GCP can you please explain what is the full cycle I have to go trough?
I have created a GitHub repo where I explain how to do this with Go and pubsub https://github.com/foward/gcp-monitoring-to-msteams
Hi friveros1,
I'm a newbie in GCP. Could you explain in details please? I'm not familiar with gcloud sdk.
I'm trying to send log notification to MS Teams via Google alert Webhooks notification channel. The Email channel is working but not Webhooks channel. Am i missing something? Maybe permissions?? I have the following settings:
- a log sink to collect the fail logs in Dataform & Workflows
- pub/sub topic&subscription
- alert: Email channel+ pub/sub channel + Webhooks channel (MS Teams); log query: resource.type="dataform.googleapis.com/Repository"
severity=ERROR
- Workflows, Dataform
- permission: Pub/Sub Publisher to monitoring service account xxxx@gcp-sa-monitoring-notification.iam.gserviceaccount.com
Not sure any other permissions should be given and to which service accounts?
- Cloud function:
created in the console. trigger with pub/sub subscription. Runtime NodeJS 18. pass in the WEBHOOK_URL in Runtime environment variables
const request = require('request');
const webhookURL = process.env.WEBHOOK_URL;
exports.subscriber = (pubSubEvent, context) => {
const age = Date.now() - Date.parse(context.timestamp);
if (age > 60*60*1000) {
return;
}
let body = Buffer.from(pubSubEvent.data, 'base64').toString('utf-8');
const options = {
url: webhookURL,
headers: {
'Content-Type': 'application/json; charset=utf-8'
//'Authorization': 'Basic ' + Buffer.from('username:password').toString('base64')
},
body: body,
};
req = request.post(options, (err, res, body) => {
if (err) {
console.error(err);
throw new Error(err);
}
if (res.statusCode != 200) {
console.error(body);
throw new Error(res.StatusMessage);
}
});
};
Thanks in advance
Or any better solution? thanks in advance
Example our data center connect with GCP via interconnection so can we use private Microsoft Teams webhook in this case ?