Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
755f6035
Commit
755f6035
authored
Mar 14, 2019
by
zhulongcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more info to victorOps alert notifications
parent
9ac69fef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
pkg/services/alerting/notifiers/victorops.go
+15
-0
No files found.
pkg/services/alerting/notifiers/victorops.go
View file @
755f6035
...
@@ -92,14 +92,29 @@ func (this *VictoropsNotifier) Notify(evalContext *alerting.EvalContext) error {
...
@@ -92,14 +92,29 @@ func (this *VictoropsNotifier) Notify(evalContext *alerting.EvalContext) error {
messageType
=
AlertStateRecovery
messageType
=
AlertStateRecovery
}
}
fields
:=
make
(
map
[
string
]
interface
{},
0
)
fieldLimitCount
:=
4
for
index
,
evt
:=
range
evalContext
.
EvalMatches
{
fields
[
evt
.
Metric
]
=
evt
.
Value
if
index
>
fieldLimitCount
{
break
}
}
bodyJSON
:=
simplejson
.
New
()
bodyJSON
:=
simplejson
.
New
()
bodyJSON
.
Set
(
"message_type"
,
messageType
)
bodyJSON
.
Set
(
"message_type"
,
messageType
)
bodyJSON
.
Set
(
"entity_id"
,
evalContext
.
Rule
.
Name
)
bodyJSON
.
Set
(
"entity_id"
,
evalContext
.
Rule
.
Name
)
bodyJSON
.
Set
(
"entity_display_name"
,
evalContext
.
GetNotificationTitle
())
bodyJSON
.
Set
(
"timestamp"
,
time
.
Now
()
.
Unix
())
bodyJSON
.
Set
(
"timestamp"
,
time
.
Now
()
.
Unix
())
bodyJSON
.
Set
(
"state_start_time"
,
evalContext
.
StartTime
.
Unix
())
bodyJSON
.
Set
(
"state_start_time"
,
evalContext
.
StartTime
.
Unix
())
bodyJSON
.
Set
(
"state_message"
,
evalContext
.
Rule
.
Message
)
bodyJSON
.
Set
(
"state_message"
,
evalContext
.
Rule
.
Message
)
bodyJSON
.
Set
(
"monitoring_tool"
,
"Grafana v"
+
setting
.
BuildVersion
)
bodyJSON
.
Set
(
"monitoring_tool"
,
"Grafana v"
+
setting
.
BuildVersion
)
bodyJSON
.
Set
(
"alert_url"
,
ruleUrl
)
bodyJSON
.
Set
(
"alert_url"
,
ruleUrl
)
bodyJSON
.
Set
(
"metrics"
,
fields
)
if
evalContext
.
Error
!=
nil
{
bodyJSON
.
Set
(
"error_message"
,
evalContext
.
Error
.
Error
())
}
if
evalContext
.
ImagePublicUrl
!=
""
{
if
evalContext
.
ImagePublicUrl
!=
""
{
bodyJSON
.
Set
(
"image_url"
,
evalContext
.
ImagePublicUrl
)
bodyJSON
.
Set
(
"image_url"
,
evalContext
.
ImagePublicUrl
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment