Skip to content

Add VictorOps Notifier#417

Merged
fabxc merged 1 commit intoprometheus:masterfrom
rhazdon:master
Jul 27, 2016
Merged

Add VictorOps Notifier#417
fabxc merged 1 commit intoprometheus:masterfrom
rhazdon:master

Conversation

@rhazdon
Copy link
Copy Markdown

@rhazdon rhazdon commented Jul 3, 2016

Hi,

I upgraded the alertmanager for sending alerts to VictorOps.
In my company we are using this feature already so please excuse I didn't open a discussion beforehand.

What do you think about it?

@beorn7
Copy link
Copy Markdown
Member

beorn7 commented Jul 6, 2016

@brian-brazil @fabxc I guess you are more likely than me to have an opinion on this.

VERSION Outdated
@@ -1 +1 @@
0.2.1
0.2.2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version change will happen during release, not upon individual commits.

Copy link
Copy Markdown
Author

@rhazdon rhazdon Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. :)
I will fix that asap.

EDIT: Removed.

@mirthy
Copy link
Copy Markdown

mirthy commented Jul 12, 2016

Any more progress with this? What do we need to do here?

@rhazdon
Copy link
Copy Markdown
Author

rhazdon commented Jul 13, 2016

@mirthy Yes, in 2-3 days. I became a daddy two days ago. :)

@rhazdon
Copy link
Copy Markdown
Author

rhazdon commented Jul 19, 2016

I rebased my fork and solved the merge conflicts.

@mirthy
Copy link
Copy Markdown

mirthy commented Jul 21, 2016

Hi guys, looks like @rhazdon made some more changes, any chance someone could look at this again? Sorry to be a pain. Is there anything I can do to help?

@rhazdon
Copy link
Copy Markdown
Author

rhazdon commented Jul 26, 2016

Hi Guys,
is there anything I should change or improve? :)

@fabxc
Copy link
Copy Markdown
Contributor

fabxc commented Jul 26, 2016

I was on vacation. Am looking now.

notify/impl.go Outdated
}

fmt.Printf("unexpected VictorOps response from %s (POSTed %s), %s: %s",
apiURL, msg, resp.Status, body)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No line break here.

Also this should be using log.Debugf rather than fmt.Printf.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fabxc, thank you very much. You are right, I fixed that. :)

@fabxc
Copy link
Copy Markdown
Contributor

fabxc commented Jul 26, 2016

@rhazdon please also check the comment on the entity ID above.

@rhazdon
Copy link
Copy Markdown
Author

rhazdon commented Jul 26, 2016

I did. Testing it currently on prodution.

@fabxc
Copy link
Copy Markdown
Contributor

fabxc commented Jul 26, 2016

Thanks. Can you squash that into one commit and then we should be good for merge.

@fabxc
Copy link
Copy Markdown
Contributor

fabxc commented Jul 26, 2016

Nope, compile error ahead.

Add default VictorOpsAPIURL

Add VictorOps default config

Add VictorOpsConfig struct in notifiers

Add new template tags for victorops

Add notifications logic for victorops

Compiled template tags with make assets

Remove common labels from entity_id template

Set messageType default value to CRITICAL

Recovery messageType is not configurable anymore. Firing state only allows specific keys

Make assets

Using log.Debugf

EntityID should not be configureable

Remove entity_id from template

Use GroupKey(ctx) as entity_id

Improve debug logging

Fix type of entity_id
@fabxc
Copy link
Copy Markdown
Contributor

fabxc commented Jul 27, 2016

👍

@fabxc fabxc merged commit 42696d9 into prometheus:master Jul 27, 2016
@fuzzyami
Copy link
Copy Markdown

fuzzyami commented Oct 19, 2016

@rhazdon
Thanks for your work on VO integration - its something we'd want to use too.

I'm trying it now - and my alerts have payloads ("StateMessage" in VO terms) that could be somewhat improved. The current format contains (among other things) a space-delimited list of values:

"TooManyConfs1 AMS 3.3.3.3 GER-03 1.1.1.1"

This list originates in the key-value pairs that are part of the alert-data in the AlertManager. It would be awesome if that list contained both the keys and the values from the alert:

alertname:TooManyConfs1 datacetner:AMS external_ip:3.3.3.3 region:GER-03 internal_ip:1.1.1.1

Those key/value pairs provide important context to the alert. Without the key, the readability of the alert is greatly reduced. Perhaps this can be easily fixed?

@brian-brazil
Copy link
Copy Markdown
Contributor

That's a default for all receivers where the message is considered short, as usually you'll know what the values are from experience and there's things like SMS size limits to worry about. You can override it with notification templates.

@fuzzyami
Copy link
Copy Markdown

Thanks, Brian.

For future readers of this thread, I'm pasting below our current VictorOps receiver config. This is a little crude, but it provides all the info we need (alert name is first, then summary and finally full 'payload'). In the future we might customize the summary text and drop the labels.

receivers:
- name: victorOps-receiver
  victorops_configs:
    - api_key: <our_secrect_api_key>
        routing_key: <our_routing_key>
        message: 'Alert: {{ .CommonLabels.alertname }}. Summary:{{ .CommonAnnotations.summary }}. RawData: {{ .CommonLabels }}'

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.

6 participants