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

Alerts on heartbeat are not triggered #183

Closed
gregoryb opened this issue Mar 15, 2019 · 6 comments · Fixed by #186
Closed

Alerts on heartbeat are not triggered #183

gregoryb opened this issue Mar 15, 2019 · 6 comments · Fixed by #186
Labels
bug Something isn't working

Comments

@gregoryb
Copy link

Describe the bug
Alerts on heartbeat are not created. They are set as expired but no alert is triggered.

To Reproduce
Steps to reproduce the behavior:

  1. Create a heartbeat with 30s timeout for exemple.
  2. Wait more than 30s.
  3. Run: alerta --config-file alerta_cli.conf heartbeats --alert
  4. Status is expired but there is no new alert in the GUI.

Expected behavior
A new alert displayed in the GUI.

Screenshots
Alerta_Heartbeat

Additional context
Ubuntu 18.04

@satterly
Copy link
Member

You didn't include the output of the alerta heartbeats --alert command. You should have gotten something like this ...

$ alerta --profile heroku heartbeats --alert
ID                                    ORIGIN                 CUSTOMER    TAGS                                      CREATED              RECEIVED             LATENCY    TIMEOUT    SINCE               STATUS
------------------------------------  ---------------------  ----------  ----------------------------------------  -------------------  -------------------  ---------  ---------  ------------------  --------
52f1019d-fb5f-4970-bc79-0b302d2a166a  riemann/ubuntu-bionic              5.0.0                                     2018/09/03 21:18:24  2018/09/03 21:18:24  0ms        86400s     192 days, 23:49:15  expired
7dd54c56-99d0-4097-b52d-2582ac2d43ba  riemann/localhost                  5.0.0                                     2018/09/03 20:39:54  2018/09/03 20:39:54  0ms        86400s     193 days, 0:27:45   expired
47027ee3-3897-4999-9e58-a59f1b7b7a6e  system1                            environment:Production,group:Network,foo  2018/11/17 15:32:16  2018/11/17 15:32:16  247ms      10s        118 days, 4:35:24   expired
e0ae60d7-9d7b-44db-99ff-ebccba283120  system2                            environment:Production,group:Network,foo  2018/11/17 15:32:28  2018/11/17 15:32:28  230ms      10s        118 days, 4:35:11   expired
4719ab4f-d5bb-495a-a7c1-0a645e007ef2  dc1-oem-02                         environment:Development,group:Network     2018/11/17 15:42:58  2018/11/17 15:42:58  246ms      2s         118 days, 4:24:41   expired
0a8bb017-4fdf-4b4b-9f6e-e37e0d49ae19  baz                                                                          2019/02/11 12:20:52  2019/02/11 12:20:52  71ms       86400s     32 days, 7:46:47    expired
Alerting 6 heartbeats  [####################################]  100%

Please paste your output below. Thanks.

@gregoryb
Copy link
Author

alerta_cli.conf

[DEFAULT]
timezone = Europe/Paris
output = json
endpoint = http://localhost:5000
key = vCO4jNDDVPO249nZlvkuRBoiHI6R9svQ73nNq8bp
sslverify = off
debug = yes

Output

alerta --config-file alerta_cli.conf heartbeats --alert
send: b'GET /heartbeats HTTP/1.1\r\nHost: localhost:5000\r\nUser-Agent: python-requests/2.21.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nAuthorization: Key vCO4jNDDVPO249nZlvkuRBoiHI6R9svQ73nNq8bp\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Fri, 15 Mar 2019 20:32:04 GMT
header: Server: Apache/2.4.29 (Ubuntu)
header: Content-Length: 365
header: Access-Control-Allow-Origin: http://localhost
header: Vary: Origin
header: Keep-Alive: timeout=5, max=100
header: Connection: Keep-Alive
header: Content-Type: application/json

body: {"heartbeats":[{"createTime":"2019-03-15T16:02:54.093Z","customer":null,"href":"http://localhost:5000/heartbeat/03e0be4a-20aa-4573-baf3-4c799fd62c29","id":"03e0be4a-20aa-4573-baf3-4c799fd62c29","latency":0,"origin":"toto","receiveTime":"2019-03-15T16:02:54.093Z","since":16150,"status":"expired","tags":[],"timeout":20,"type":"Heartbeat"}],"status":"ok","total":1}

[
    {
        "createTime": "2019-03-15T16:02:54.093Z",
        "customer": null,
        "href": "http://localhost:5000/heartbeat/03e0be4a-20aa-4573-baf3-4c799fd62c29",
        "id": "03e0be4a-20aa-4573-baf3-4c799fd62c29",
        "latency": 0,
        "origin": "toto",
        "receiveTime": "2019-03-15T16:02:54.093Z",
        "since": 16150,
        "status": "expired",
        "tags": [],
        "timeout": 20,
        "type": "Heartbeat"
    }
]

@satterly
Copy link
Member

satterly commented Mar 15, 2019

What version of the API and CLI is this? For example ...

$ alerta --profile heroku version
alerta 6.8.1
alerta client 6.8.1
requests 2.19.1
click 7.0

@gregoryb
Copy link
Author

gregoryb commented Mar 15, 2019

With debug

alerta --config-file alerta_cli.conf version
send: b'GET /management/status HTTP/1.1\r\nHost: localhost:5000\r\nUser-Agent: python-requests/2.21.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nAuthorization: Key vCO4jNDDVPO249nZlvkuRBoiHI6R9svQ73nNq8bp\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Fri, 15 Mar 2019 21:07:42 GMT
header: Server: Apache/2.4.29 (Ubuntu)
header: Content-Length: 422
header: Access-Control-Allow-Origin: http://localhost
header: Vary: Origin,Accept-Encoding
header: Content-Encoding: gzip
header: Keep-Alive: timeout=5, max=100
header: Connection: Keep-Alive
header: Content-Type: application/json

body: {"application":"alerta","metrics":[{"description":"Total number of alerts in the database","group":"alerts","name":"total","title":"Total alerts","type":"gauge","value":4},{"count":5257,"description":"Total time and number of alert queries","group":"alerts","name":"queries","title":"Alert queries","totalTime":68440,"type":"timer"},{"count":2633,"description":"Total time and number of count queries","group":"alerts","name":"counts","title":"Count alerts","totalTime":32446,"type":"timer"},{"count":1,"description":"Total time to tag number of alerts","group":"alerts","name":"tagged","title":"Tagging alerts","totalTime":15,"type":"timer"},{"count":6,"description":"Total time and number of alerts with status changed","group":"alerts","name":"status","title":"Alert status change","totalTime":104,"type":"timer"},{"description":"Allow consoles to auto-refresh alerts","group":"switch","name":"auto-refresh-allow","title":"Alerta console auto-refresh","type":"text","value":"ON"},{"description":"Allow alerts to be submitted via the API","group":"switch","name":"sender-api-allow","title":"API alert submission","type":"text","value":"ON"}],"time":1552684062436,"uptime":18818695,"version":"6.8.1"}

alerta 6.8.1
alerta client 6.8.1
requests 2.21.0
click 7.0

@satterly
Copy link
Member

If you comment out the "json output" line it will work ...

[DEFAULT]
timezone = Europe/Paris
; output = json
endpoint = http://localhost:5000
key = vCO4jNDDVPO249nZlvkuRBoiHI6R9svQ73nNq8bp
sslverify = off
debug = yes

This is a bug. It should still generate alerts no matter what output format you use.

@gregoryb
Copy link
Author

Fixed using the workaround. Thank you.

@satterly satterly transferred this issue from alerta/alerta Apr 28, 2019
@satterly satterly added the bug Something isn't working label May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants