Skip to content

changes in alert request body #105

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ func Roleingestor(stream string) string {

func getTargetBody() string {
return ` {
"name":"targetName",
"type": "webhook",
"endpoint": "https://webhook.site/ec627445-d52b-44e9-948d-56671df3581e",
"headers": {},
Expand All @@ -489,12 +490,8 @@ func getTargetBody() string {

func getIdFromTargetResponse(body io.Reader) string {
type TargetConf struct {
Type string `json:"type"`
Endpoint string `json:"endpoint"`
Headers string `json:"headers"`
SkipTlsCheck string `json:"skipTlsCheck"`
Repeat string `json:"repeat"`
Id string `json:"id"`
Type string `json:"type"`
Id string `json:"id"`
}
var response []TargetConf
if err := json.NewDecoder(body).Decode(&response); err != nil {
Expand All @@ -520,14 +517,14 @@ func getAlertBody(stream string, targetId string) string {
"conditions": {
"conditionConfig": [
{
"column": "status",
"operator": ">=",
"value": "200"
"column": "level",
"operator": "=",
"value": "info"
}
]
},
"column": "status",
"operator": "<=",
"column": "level",
"operator": "=",
"value": 100
}
]
Expand Down Expand Up @@ -586,15 +583,15 @@ func createAlertResponse(id string, state string, stream string, targetId string
"operator": null,
"conditionConfig": [
{
"column": "status",
"operator": ">=",
"value": "200"
"column": "level",
"operator": "=",
"value": "info"
}
]
},
"groupBy": null,
"column": "status",
"operator": "<=",
"column": "level",
"operator": "=",
"value": 100
}
]
Expand Down