influxdata / influxdata/kapacitor

failed to send event to Alerta: Post kapacitor/alert: unsupported protocol scheme ""

Open
#1,336 12 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

```
CentOS Linux release 7.2.1511 (Core)
Kapacitor 1.2.0 (git: master 5408057e5a3493d3b5bd38d5d535ea45b587f8ff)
Alerta 4.9.0
```

Receiving the following error when trying to alert from tick script.

```
[cpu_test_alerta:alert6] 2017/04/22 19:58:20 D! INFO alert triggered id:influxdb1.mycompany.com/cpu_used msg:influxdb1.mycompany.com/cpu_used:1.722827463193596 data:&{cpu map[host:influxdb1.mycompany.com] [time sigma stat] [[2017-04-22 19:58:20 +0000 UTC 0.04569644662193269 1.722827463193596]]}
[cpu_test_alerta:alert6] 2017/04/22 19:58:20 E! failed to send event to Alerta: Post kapacitor/alert: unsupported protocol scheme ""
```
However service-tests works and I'm able to see alert in Alerta console.

```
$ kapacitor service-tests alerta
Service Success Message
alerta true
```

kapacitor.conf
```
[alerta]
enabled = true
environment = "Production"
origin = "Kapacitor"
token = ""
url = "http://alerta.mycompany.com/api"
```

Tick script
```
// Parameters
var info = 10
var warn = 80
var crit = 90
var infoSig = 2.5
var warnSig = 3
var critSig = 3.5
var period = 10s
var every = 10s

// Dataframe
var data = stream
|from()
.database('telegraf')
.retentionPolicy('autogen')
.measurement('cpu')
.groupBy('host')
.where(lambda: "cpu" == 'cpu-total')
|eval(lambda: 100.0 - "usage_idle")
.as('used')
|window()
.period(period)
.every(every)
|mean('used')
.as('stat')

// Thresholds
var alert = data
|eval(lambda: sigma("stat"))
.as('sigma')
.keep()
|alert()
.id('{{ index .Tags "host"}}/cpu_used')
.message('{{ .ID }}:{{ index .Fields "stat" }}')
.info(lambda: "stat" > info OR "sigma" > infoSig)
.warn(lambda: "stat" > warn OR "sigma" > warnSig)
.crit(lambda: "stat" > crit OR "sigma" > critSig)

// Alert
alert
.log('/tmp/cpu_alert_log.txt')
.alerta()
.resource('Hostname or service')
.event('Something went wrong')
```

What am I doing wrong?

Contributor guide

Open the contributing guide

Research direction

Start with the alerta service-tests path and the alert node's .alerta() path, using the supplied kapacitor.conf and tick script to compare how the configured URL is used. Reproduce the unsupported protocol scheme error and verify that a triggered alert is posted to the configured Alerta URL, as service-tests already does.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.