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
ebada26b
Commit
ebada26b
authored
Jun 17, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'alerting' into alerting_notifications
parents
946dc0ec
e8a324c7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
0 deletions
+10
-0
pkg/models/alert.go
+1
-0
pkg/services/alerting/extractor.go
+1
-0
pkg/services/alerting/extractor_test.go
+5
-0
pkg/services/sqlstore/alert_test.go
+2
-0
pkg/services/sqlstore/migrations/alert_mig.go
+1
-0
No files found.
pkg/models/alert.go
View file @
ebada26b
...
...
@@ -16,6 +16,7 @@ type Alert struct {
State
string
Handler
int64
Enabled
bool
Frequency
int64
Created
time
.
Time
Updated
time
.
Time
...
...
pkg/services/alerting/extractor.go
View file @
ebada26b
...
...
@@ -78,6 +78,7 @@ func (e *DashAlertExtractor) GetAlerts() ([]*m.Alert, error) {
Handler
:
jsonAlert
.
Get
(
"handler"
)
.
MustInt64
(),
Enabled
:
jsonAlert
.
Get
(
"enabled"
)
.
MustBool
(),
Description
:
jsonAlert
.
Get
(
"description"
)
.
MustString
(),
Frequency
:
getTimeDurationStringToSeconds
(
jsonAlert
.
Get
(
"frequency"
)
.
MustString
()),
}
valueQuery
:=
jsonAlert
.
Get
(
"query"
)
...
...
pkg/services/alerting/extractor_test.go
View file @
ebada26b
...
...
@@ -215,6 +215,11 @@ func TestAlertRuleExtraction(t *testing.T) {
So
(
alerts
[
1
]
.
Handler
,
ShouldEqual
,
0
)
})
Convey
(
"should extract frequency in seconds"
,
func
()
{
So
(
alerts
[
0
]
.
Frequency
,
ShouldEqual
,
60
)
So
(
alerts
[
1
]
.
Frequency
,
ShouldEqual
,
60
)
})
Convey
(
"should extract panel idc"
,
func
()
{
So
(
alerts
[
0
]
.
PanelId
,
ShouldEqual
,
3
)
So
(
alerts
[
1
]
.
PanelId
,
ShouldEqual
,
4
)
...
...
pkg/services/sqlstore/alert_test.go
View file @
ebada26b
...
...
@@ -22,6 +22,7 @@ func TestAlertingDataAccess(t *testing.T) {
Name
:
"Alerting title"
,
Description
:
"Alerting description"
,
Settings
:
simplejson
.
New
(),
Frequency
:
1
,
},
}
...
...
@@ -52,6 +53,7 @@ func TestAlertingDataAccess(t *testing.T) {
So
(
alert
.
Name
,
ShouldEqual
,
"Alerting title"
)
So
(
alert
.
Description
,
ShouldEqual
,
"Alerting description"
)
So
(
alert
.
State
,
ShouldEqual
,
"OK"
)
So
(
alert
.
Frequency
,
ShouldEqual
,
1
)
})
Convey
(
"Alerts with same dashboard id and panel id should update"
,
func
()
{
...
...
pkg/services/sqlstore/migrations/alert_mig.go
View file @
ebada26b
...
...
@@ -17,6 +17,7 @@ func addAlertMigrations(mg *Migrator) {
{
Name
:
"description"
,
Type
:
DB_NVarchar
,
Length
:
255
,
Nullable
:
false
},
{
Name
:
"state"
,
Type
:
DB_NVarchar
,
Length
:
255
,
Nullable
:
false
},
{
Name
:
"settings"
,
Type
:
DB_Text
,
Nullable
:
false
},
{
Name
:
"frequency"
,
Type
:
DB_BigInt
,
Nullable
:
false
},
{
Name
:
"handler"
,
Type
:
DB_BigInt
,
Nullable
:
false
},
{
Name
:
"enabled"
,
Type
:
DB_Bool
,
Nullable
:
false
},
{
Name
:
"created"
,
Type
:
DB_DateTime
,
Nullable
:
false
},
...
...
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