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
544073b7
Commit
544073b7
authored
Jun 09, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): make sure saved alerts are valid
parent
a1f97e0b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletions
+6
-1
pkg/models/alerts.go
+4
-0
pkg/services/alerting/dashboard_parser.go
+1
-1
pkg/services/alerting/rule_reader.go
+1
-0
No files found.
pkg/models/alerts.go
View file @
544073b7
...
...
@@ -27,6 +27,10 @@ type AlertRule struct {
Updated
time
.
Time
`json:"updated"`
}
func
(
alertRule
*
AlertRule
)
ValidToSave
()
bool
{
return
alertRule
.
Query
!=
""
&&
alertRule
.
Frequency
!=
0
&&
alertRule
.
QueryRange
!=
0
&&
alertRule
.
Name
!=
""
}
func
(
this
*
AlertRule
)
Equals
(
other
*
AlertRule
)
bool
{
result
:=
false
...
...
pkg/services/alerting/dashboard_parser.go
View file @
544073b7
...
...
@@ -65,7 +65,7 @@ func ParseAlertsFromDashboard(cmd *m.SaveDashboardCommand) []*m.AlertRule {
alert
.
DatasourceId
=
query
.
Result
.
Id
}
if
alert
.
Query
!=
""
{
if
alert
.
ValidToSave
()
{
alerts
=
append
(
alerts
,
alert
)
}
}
...
...
pkg/services/alerting/rule_reader.go
View file @
544073b7
...
...
@@ -64,6 +64,7 @@ func (arr *AlertRuleReader) Fetch() []*AlertRule {
model
.
Description
=
ruleDef
.
Description
model
.
Aggregator
=
ruleDef
.
Aggregator
model
.
State
=
ruleDef
.
State
model
.
QueryRange
=
ruleDef
.
QueryRange
res
[
i
]
=
model
}
...
...
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