Com o GreenLight you can trigger an alert to a Microsoft Teams Channel. The following example explains how you can do that with the generica Linux Shell Script action


Requisitos


Configuração

  • Create the following script and
###############################
#!/bin/bash
##
## make sure you add a # at the end of the lines for the variable declarations and the curl command, 
## so you don't accidentally get embedded carriage returns
## 
## instructions for setting up a webhook in Teams: 
## https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
## TODO: add your webhook url below; you could also set this up to pass the URL as a parameter, like GL_MESSAGE below
WEBHOOK_URL="https://your.webhook.url" #
##
## parameter $1 is the message type (like "INFORMATION" or "ERROR"), parameter $2 is the first parameter in the action; 
## parameters in GreenLight need to be surrounded by single quotes, e.g. 'Connection to ${config.nodeDefinition.name} failed'
GL_MESSAGE="$1: $2" #
##
jsonPayload=$(cat << _EOM_
{
"text": "<pre>$GL_MESSAGE</pre>"
}
_EOM_
)
##
curl -H "Content-Type: application/json" -d "$jsonPayload" $WEBHOOK_URL #


  • Upload the script to your GreenLight server using WinSCP or similar, to: / opt /panagenda/appdata/volumes/gl/scripts/gl_action

  • Create a Linux Shell Script action (the Parameter is the message that will be sent, be sure to remember to enclose it in 'single quotes'):