influxdata / kapacitor

Open source framework for processing, monitoring, and alerting on time series data
MIT License
2.31k stars 492 forks source link

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

Open druchoo opened 7 years ago

druchoo commented 7 years ago
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?

nathanielc commented 7 years ago

@druchoo Your config looks correct and as you state the service test is working. I'll see if I can reproduce locally.

abadyan-vonage commented 7 years ago

+1

druchoo commented 7 years ago

Hi @nathanielc, have you had a chance to look into this?

Feralus commented 7 years ago

Hi @druchoo, did you find a solution for the unsupported protocol scheme "" error? I get the same error when I try to use alerta.

druchoo commented 7 years ago

@Feralus, Unfortunately not. We're not really using Alerta anymore so I haven't followed up.

drfickle commented 6 years ago

I'm having this same issue with Kapacitor 1.5.1, only I also get the error when running kapacitor service-tests alerta

I'm using url = "http://localhost:8080" because I have Kapacitor and Alerta on the same host, but if I go to that URL it outputs the JSON API, so that should be fine.

Any suggestions on how to track down where the configuration is getting lost?

drfickle commented 6 years ago

FWIW, I now have this working after deleting my /var/lib/kapacitor/kapacitor.db and restarting kapacitor with the alerta-relevant sections filled in properly this time. Kapacitor would read change to the file such as [logging] level, but ignored changes I made to the [alerta] section. shrug

mgiammarco commented 5 years ago

Hello, I have the same problem. I have tried the workaround to remove kapacitor.db and start from scratch. Now I get the error "must specify url" even if I put the correct url in envinroment. In hope this problem can be solved because Alerta is supported as an alert endpoint and I have proposed Influx because it supported alerta.

mgiammarco commented 5 years ago

I reply to my self: I must fill all fields and then again I get the first error on this thread.

mgiammarco commented 5 years ago

Can some solve this bug?????

mgiammarco commented 5 years ago

I am monitoring the traffic with tcpdump actually no post request starts.

mgiammarco commented 5 years ago

Ok I have finally made it work but I suppose it is a workaround. Actually you must: