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

Support to set severity while sending alerts to Alerta #2056

Open
gaddevijay opened this issue Sep 13, 2018 · 1 comment · May be fixed by #2584
Open

Support to set severity while sending alerts to Alerta #2056

gaddevijay opened this issue Sep 13, 2018 · 1 comment · May be fixed by #2584

Comments

@gaddevijay
Copy link

Alerta supports lot of severity levels. Below is a link for the full list.
http://docs.alerta.io/en/latest/api/alert.html#severity-table

As of today there is a hard mapping of Kapacitor's AertNode critical, warning and Info levels to on of the Alerta's severities.
There is no possibility of setting severity of alerts when sending to Alerta apart from what kapacitor already mapped.

This issue is being raised to request the support for setting the severity for alerts that are being sent to Alerta from Kapacitor.

@gunnaraasen
Copy link
Member

The kapacitor alert levels are set for the 1.x line.

Could this be addressed in the Kapacitor Alerta plugin by allowing an additional descriptive tag (or maybe an interpretation of the .id() or .message()) to override the Kapacitor alert designation with one of the Alerta severities if present?

sp1r added a commit to sp1r/kapacitor that referenced this issue Jun 17, 2021
Fix influxdata#2056

This commit allows usage of all or some Alerta Severities. It provides two keywords to fine tune kapacitor built-in severities.

1. First, you can rename kapacitor serverity levels: crit, warn, info, ok to any other severities configured in your Alerta:

    |alert()
        // ...
        .alerta()
            // ...
            .renameSeverity('crit', 'major')
            .renameSeverity('info', 'notice')

I suppose this will cover most of the cases. But if you do want a lot of severity levels:

2. You can add custom severity levels, which will be avaluated on Alerta handler level after built-in alert was triggered.

    |alert()
        // ...
        .warn(lambda: "cpu" > 50)
        .alerta()
            // ...
            .addSeverity('minor', 3, lambda: "cpu" > 60)
            .addSeverity('major', 2, lambda: "cpu" > 70)
            .addSeverity('critical', 1, lambda: "cpu" > 80)
            .addSeverity('fatal', 0, lambda: "cpu" > 90)

Note: evaluation of addSeverity condition only happen after build-in alert is triggered, so you need some entry point (like .warn() in exmple), which should cover all range of values interesting to you.
Note: this severities use Alerta's code order - higher severity has lower code (0 for fatal, 9 for ok)
Note: .addSeverity() is quite useless in combination with .stateChangesOnly(), but Alerta has decent deduplication mechanism, so it shouldn't be a problem
@sp1r sp1r linked a pull request Jun 17, 2021 that will close this issue
4 tasks
sp1r added a commit to sp1r/kapacitor that referenced this issue Jun 17, 2021
Fix influxdata#2056

This commit allows usage of all or some Alerta Severities. It provides two keywords to fine tune kapacitor built-in severities.

1. First, you can rename kapacitor serverity levels: crit, warn, info, ok to any other severities configured in your Alerta:

    |alert()
        // ...
        .alerta()
            // ...
            .renameSeverity('crit', 'major')
            .renameSeverity('info', 'notice')

I suppose this will cover most of the cases. But if you do want a lot of severity levels:

2. You can add custom severity levels, which will be avaluated on Alerta handler level after built-in alert was triggered.

    |alert()
        // ...
        .warn(lambda: "cpu" > 50)
        .alerta()
            // ...
            .addSeverity('minor', 3, lambda: "cpu" > 60)
            .addSeverity('major', 2, lambda: "cpu" > 70)
            .addSeverity('critical', 1, lambda: "cpu" > 80)
            .addSeverity('fatal', 0, lambda: "cpu" > 90)

Note: evaluation of addSeverity condition only happen after build-in alert is triggered, so you need some entry point (like .warn() in exmple), which should cover all range of values interesting to you.
Note: this severities use Alerta's code order - higher severity has lower code (0 for fatal, 9 for ok)
Note: .addSeverity() is quite useless in combination with .stateChangesOnly(), but Alerta has decent deduplication mechanism, so it shouldn't be a problem
sp1r added a commit to sp1r/kapacitor that referenced this issue Jun 17, 2021
Fix influxdata#2056

This commit allows usage of all or some Alerta Severities. It provides two keywords to fine tune kapacitor built-in severities.

1. First, you can rename kapacitor serverity levels: crit, warn, info, ok to any other severities configured in your Alerta:

    |alert()
        // ...
        .alerta()
            // ...
            .renameSeverity('crit', 'major')
            .renameSeverity('info', 'notice')

I suppose this will cover most of the cases. But if you do want a lot of severity levels:

2. You can add custom severity levels, which will be avaluated on Alerta handler level after built-in alert was triggered.

    |alert()
        // ...
        .warn(lambda: "cpu" > 50)
        .alerta()
            // ...
            .addSeverity('minor', 3, lambda: "cpu" > 60)
            .addSeverity('major', 2, lambda: "cpu" > 70)
            .addSeverity('critical', 1, lambda: "cpu" > 80)
            .addSeverity('fatal', 0, lambda: "cpu" > 90)

Note: evaluation of addSeverity condition only happen after build-in alert is triggered, so you need some entry point (like .warn() in exmple), which should cover all range of values interesting to you.
Note: this severities use Alerta's code order - higher severity has lower code (0 for fatal, 9 for ok)
Note: .addSeverity() is quite useless in combination with .stateChangesOnly(), but Alerta has decent deduplication mechanism, so it shouldn't be a problem
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

Successfully merging a pull request may close this issue.

2 participants