Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Hangouts Chat integration - HTTP/Post issue #2759

Open
OtoKiroo opened this issue Apr 14, 2023 · 0 comments
Open

Google Hangouts Chat integration - HTTP/Post issue #2759

OtoKiroo opened this issue Apr 14, 2023 · 0 comments

Comments

@OtoKiroo
Copy link

OtoKiroo commented Apr 14, 2023

Hi, im trying to send alerts to a google chat room using a webhook URL generated for the chatroom using HTTP/Post since kapacitor does not natively support Google Hangouts as an endpoint handler like grafana does. I am not able to get anything across, if someone has a clue or has had to deal with a similar situation, i would appreciate feedback. Also, maybe you guys could look into implementing Google chats as a handler in chronograf like grafana, thanks !

Here is the TICKScript:
var db = 'telegraf'

var rp = 'autogen'

var measurement = 'mem'

var groupBy = []

var whereFilter = lambda: ("host" == 'Proxmox')

var name = 'Memory Alert'

var idVar = name

var message = ' {{.ID}} is {{.Level}} value: {{ index .Fields "value" }}'

var idTag = 'alertID'

var levelTag = 'level'

var messageField = 'message'

var durationField = 'duration'

var outputDB = 'chronograf'

var outputRP = 'autogen'

var outputMeasurement = 'alerts'

var triggerType = 'threshold'

var crit = 1

var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda: "used")
.as('value')

var trigger = data
|alert()
.crit(lambda: "value" > crit)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.post('https://chat.googleapis.com/v1/spaces/AAAAi4UyLxA/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=2uf24LgaUpWc5esVflh52DzwGTbYjZdRTzuWMz-rhRE%3D')
.header('Content-Type', 'application/json')
trigger
|eval(lambda: float("value"))
.as('value')
.keep()
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag('alertName', name)
.tag('triggerType', triggerType)

trigger
|httpOut('output')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant