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

feat: Zenoss event handler #2484

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

alespour
Copy link
Contributor

@alespour alespour commented Feb 19, 2021

This PR adds Zenoss event handler as requested by https://github.com/influxdata/feature-requests/issues/72. Fixes #2483.

The handler provides options for Zenoss basic event fields:

handler option event field default value
summary Summary '{{ .Message }}'
device Device "" (empty string)
component Component "" (empty string)
severity Severity severity level (see Severity mapping)
eventClass Event Class "" (empty string)
eventClassKey Event Class Key "" (empty string)
collector Collector (optional) none
message Message (optional) none

In addition to the basic fields, custom fields can be set with customField option. The value of a custom field can be simple type or a string representation of JSON object. There are also handler options to override Zenoss event-related values set in the configuration: action, method, type, tid. All these options support templates with the following variables available: Name, TaskName, ID, Message, Details, Time, Duration, Level, Recoverable and Tags.

Severity mapping
Alert level is mapped to Zenoss event severity according to mapping specified in the configuration file. Severity can be specified either as a number or a string (see Event severity levels). The default configuration maps OK to Clear, Info to Info, Warning to Warning and Critical to Critical.

TICKscript examples:

stream
  |from()
    .measurement('cpu')
  |alert()
    .crit(lambda: "usage_user" > 90)
    .message('Hey, check your CPU')
    .zenoss()
        .device('{{ index .Tags "host" }}')
        .component('CPU')
        .eventClass('/App')
stream
  |from()
    .measurement('cpu')
  |alert()
    .crit(lambda: "usage_user" > 90)
    .message('Hey, check your CPU')
    .zenoss()
        .action('CustomRouter')
        .method('add_event')
        .device('{{ index .Tags "host" }}')
        .component('CPU')
        .eventClass('/App')
        .collector('localhost')
        .customField('ticks', 3300)

Default configuration:

[zenoss]
  # Configure Zenoss.
  enabled = false
  # The Zenoss URL.
  url = "https://tenant.zenoss.io/zport/dmd/evconsole_router"
  # Username for HTTP BASIC authentication
  # username = ""
  # Password for HTTP BASIC authentication
  # password = ""
  # Action (router name).
  action = "EventsRouter"
  # Router method.
  method = "add_event"
  # Event type.
  type = "rpc"
  # Temporary request transaction ID.
  tid = 1
  # Alert level to event severity mapping.
  severity-map = { OK = "Clear", Info = "Info", Warning = "Warning", Critical = "Critical" }
Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated

@alespour alespour changed the title Add Zenoss support feat: Zenoss event handler Feb 23, 2021
@alespour alespour force-pushed the feat/zenoss-simple branch 2 times, most recently from 747f552 to e544156 Compare March 1, 2021 10:27
@alespour alespour marked this pull request as ready for review March 1, 2021 10:54
@timhallinflux timhallinflux modified the milestone: 1.9 Mar 11, 2021
@timhallinflux timhallinflux mentioned this pull request Mar 11, 2021
4 tasks
@docmerlin
Copy link
Contributor

docmerlin commented Mar 12, 2021

@alespour :Can you move this to try to merge with v1.6-master instead of pointing at current master?

@alespour alespour changed the base branch from master to v1.6-master March 14, 2021 13:11
@alespour
Copy link
Contributor Author

alespour commented Mar 14, 2021

@docmerlin Done.

@docmerlin docmerlin merged commit 9db2610 into influxdata:v1.6-master Mar 15, 2021
docmerlin added a commit that referenced this pull request Apr 7, 2021
* feat: add Zenoss event handler (#2484)

* feat(kafka): route alerts to partitions by ID, allow for configuring the hashing strategy (#2493)

* test: protoc failing on build, skip broken tests (#2506)

* fix: Zenoss testing (#2509)

* fix: Zenoss testing

* test: add missing test

* feat: pull in auth code from Kapacitor Enterprise (#2512)

And add a config option to enable it.

* fix: external Zenoss testability (#2514)

* chore: go mod tidy

* tests: fix tests and go vet from merge

* chore: go fmt

* Update Changelog

* Update Changelog

* Update CHANGELOG.md

Co-authored-by: Daniel Moran <danxmoran@gmail.com>

* Update CHANGELOG.md

Co-authored-by: Daniel Moran <danxmoran@gmail.com>

Co-authored-by: alespour <42931850+alespour@users.noreply.github.com>
Co-authored-by: Daniel Moran <danxmoran@gmail.com>
Co-authored-by: Sam Arnold <sarnold@influxdata.com>
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 this pull request may close these issues.

Add Zenoss Event Handler
3 participants