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

Create alert with Responders and VisibleTo not working #81

Open
betorvs opened this issue Mar 31, 2021 · 8 comments
Open

Create alert with Responders and VisibleTo not working #81

betorvs opened this issue Mar 31, 2021 · 8 comments

Comments

@betorvs
Copy link

betorvs commented Mar 31, 2021

Hi all,

I have some questions:

  • Is this Responders and VisibleTo need extra configuration in opsgenie side?
  • Is this only an option for advanced plans?
  • Is there any extra documentation about how to create an alert using this golang sdk that shows how to write the code?

Description

Following this opsgenie documentation I'm trying to add both fields in alert creation:

...
createResult, err := alertClient.Create(ctx, &alert.CreateAlertRequest{
		Message:     title,
		Alias:       alias,
		Description: something,
		Responders:  teams,
		VisibleTo:   visibilityTeams,
		...

in teams variable:

[]alert.Responder{alert.Responder{Type:"team", Name:"ops", Id:"", Username:""},}

in visibilityTeams:

[]alert.Responder{alert.Responder{Type:"team", Name:"sre", Id:"", Username:""},}

But when I checked in my opsgenie free account logs, it doesn't work (only responders):

_incomingData
_parsedData
note null
-responders
0 ops
-actions [ ]
-tags [ webserver01, check-nginx, default, agent ]
alias webserver01/check-nginx
description example output
source sensuGo
message webserver01/check-nginx
priority P5
user Alert API
_extraProperties { subscriptions: [testing], interval: 20, status: 1 }
entity webserver01
integrationType Sensu
integrationName ops_Sensu

Why in incomingData.parsedData there's no visibleTo field?

I'm trying to add this option in my sensu opsgenie plugin
And I'm using sensu integration to grant me an API key.

Thanks for any help.

@EnverKESMEN
Copy link

EnverKESMEN commented Apr 1, 2021

We've deprecated the visibleTo field. But not removed from Public API for backward compatibility. Basically, we're adding that field to the responder list and act like responders.

Sorry for that wrong reply. I thought teams. We are still using the visibleTo field. I've tested with my enterprise account and you're right. We don't write that field here. But not sure if it should be here or not. Let me discuss this with my team.

image

@betorvs
Copy link
Author

betorvs commented Apr 20, 2021

any news @EnverKESMEN ?

@EnverKESMEN
Copy link

I created an internal task about this issue and it is in the current sprint. I'll update here when it's done.

@EnverKESMEN
Copy link

image
Hello again, we started to log id and type for visibleTo field.

@betorvs
Copy link
Author

betorvs commented May 24, 2021

I will test and comment here. Thanks @EnverKESMEN

@betorvs
Copy link
Author

betorvs commented May 25, 2021

Hi again @EnverKESMEN ,
Just one question: If I send a test alert to "ops" team and add "sre" team as visibleTo, should it appear in alert short description? Like "ops" and "sre", instead only "ops" (I pasted it here in alert).

Log:
Screenshot 2021-05-25 at 09 18 26

Alert:

Screenshot 2021-05-25 at 09 19 05

@EnverKESMEN
Copy link

Only ops team will see in description because only responder is ops. Also, SRE team members can see the alert because they have visibleTo right.

from our public api doc
https://docs.opsgenie.com/docs/alert-api#create-alert
Teams and users that the alert will become visible to without sending any notification.
Please note: that alert will be visible to the teams that are specified within responders field by default, so there is no need to re-specify them within visibleTo field. You can refer below for example values.

@betorvs
Copy link
Author

betorvs commented May 30, 2021

Hi @EnverKESMEN ,
From your public api doc If the API Key belongs to a team integration, this field will be overwritten with the owner team. it means if I create an integration apy-key in ops team, I cannot add sre team as responders using that api-key. Is it?
I was testing with multiple responders and I wasn't able to create an alert with multiple responders.

Screenshot 2021-05-30 at 08 52 43

In alert it keeps showing Responders: ops only.

How can I create an api-key to be used for this case? for multiple responders I mean.

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

No branches or pull requests

2 participants