alerta / alerta-contrib

Contributed integrations, plugins and custom webhooks
http://alerta.io
MIT License
120 stars 171 forks source link

Api gateway integration #230

Closed jackfrost82 closed 5 years ago

jackfrost82 commented 5 years ago

I'm writing an integration in order to open incident on servicenow via a custom api gateway. I managed to open the incident and add a custom attribute "servicenowID" to the alert. If I close the alert from alerta webui I managed to close the incident on servicenow. If I send the same alert with severity "normal" the status on alerta change to close but I didn't managed to close the incident on service now because the alert has not the attribute ServiceNowID. How can I get attributes of a "parent" alert I'm updating when I send the same alert changing his severity? Thanks Jack

satterly commented 5 years ago

There is no "parent" alert. The normal severity alert updates the existing critical alert and then discarded. This means the servicenowID is available to the normal severity alert without you having to do anything. See the following example below...

$ alerta send -E Development -S Foo -e node_down -r net01 -s critical
cd6fd837-d581-422c-bf3d-9e7fc6a7789f (indeterminate -> critical)
$ alerta update -i cd6fd837 -A servicenow=1234
$ alerta query -q event:node_down --details
cd6fd837|2019/01/08 08:54:46|critical|    0|-|Development|Foo       |net01             |Misc        |node_down       |n/a
   |
    severity   | indeterminate -> critical
    trend      | moreSevere
    status     | open
    resource   | net01
    group      | Misc
    event      | node_down
    value      | None
    tags       |
    ip         | 127.0.0.1
    servicenow | 1234
        time created  | 2019/01/08 08:54:46
        time received | 2019/01/08 08:54:46
        last received | 2019/01/08 08:54:46
        latency       | 32.0ms
        timeout       | 86400s
            alert id     | cd6fd837-d581-422c-bf3d-9e7fc6a7789f
            last recv id | cd6fd837-d581-422c-bf3d-9e7fc6a7789f
            customer     | None
            environment  | Development
            service      | Foo
            resource     | net01
            type         | exceptionAlert
            repeat       | False
            origin       | alertad/macbook.lan
            correlate    |
$ alerta send -E Development -S Foo -e node_down -r net01 -s normal
cd6fd837-d581-422c-bf3d-9e7fc6a7789f (critical -> normal)
$ alerta query -q event:node_down --details
cd6fd837|2019/01/08 08:55:09|normal|    0|-|Development|Foo       |net01             |Misc        |node_down       |n/a
   |
    severity   | critical -> normal
    trend      | lessSevere
    status     | closed
    resource   | net01
    group      | Misc
    event      | node_down
    value      | None
    tags       |
    ip         | 127.0.0.1
    servicenow | 1234
        time created  | 2019/01/08 08:55:09
        time received | 2019/01/08 08:55:09
        last received | 2019/01/08 08:55:09
        latency       | 27.0ms
        timeout       | 86400s
            alert id     | cd6fd837-d581-422c-bf3d-9e7fc6a7789f
            last recv id | 1d0f8d2d-0831-42b2-b1a9-b530ca7094e2
            customer     | None
            environment  | Development
            service      | Foo
            resource     | net01
            type         | exceptionAlert
            repeat       | False
            origin       | alertad/macbook.lan
            correlate    |
steffenschumacher commented 3 years ago

Did this integration ever fly? I'd need the same kind of integration if available..

raghu033 commented 3 years ago

I am also looking for similar integration. If available please kindly help.

sandrorotabulo commented 3 years ago

I'm also looking for this integration... it could be helpful ... :-) ;-)