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
e80000ce
Commit
e80000ce
authored
May 27, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(alerting): skip if operator does not exist
parent
1f990da5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
pkg/services/alerting/executor.go
+9
-4
No files found.
pkg/services/alerting/executor.go
View file @
e80000ce
...
...
@@ -19,6 +19,7 @@ var operators map[string]compareFn = map[string]compareFn{
">="
:
func
(
num1
,
num2
float64
)
bool
{
return
num1
>=
num2
},
"<"
:
func
(
num1
,
num2
float64
)
bool
{
return
num1
<
num2
},
"<="
:
func
(
num1
,
num2
float64
)
bool
{
return
num1
<=
num2
},
""
:
func
(
num1
,
num2
float64
)
bool
{
return
false
},
}
var
aggregator
map
[
string
]
aggregationFn
=
map
[
string
]
aggregationFn
{
...
...
@@ -40,14 +41,18 @@ func (this *ExecutorImpl) Execute(rule m.AlertRule, responseQueue chan *AlertRes
}
func
(
this
*
ExecutorImpl
)
ValidateRule
(
rule
m
.
AlertRule
,
series
m
.
TimeSeriesSlice
)
*
AlertResult
{
for
_
,
v
:=
range
series
{
var
aggValue
=
aggregator
[
rule
.
Aggregator
](
v
)
for
_
,
serie
:=
range
series
{
if
aggregator
[
rule
.
Aggregator
]
==
nil
{
continue
}
var
aggValue
=
aggregator
[
rule
.
Aggregator
](
serie
)
if
rule
.
CritOperator
!=
""
&&
operators
[
rule
.
CritOperator
](
float64
(
rule
.
CritLevel
),
aggValue
)
{
if
operators
[
rule
.
CritOperator
](
float64
(
rule
.
CritLevel
),
aggValue
)
{
return
&
AlertResult
{
State
:
m
.
AlertStateCritical
,
Id
:
rule
.
Id
,
ActualValue
:
aggValue
}
}
if
rule
.
WarnOperator
!=
""
&&
operators
[
rule
.
WarnOperator
](
float64
(
rule
.
WarnLevel
),
aggValue
)
{
if
operators
[
rule
.
WarnOperator
](
float64
(
rule
.
WarnLevel
),
aggValue
)
{
return
&
AlertResult
{
State
:
m
.
AlertStateWarn
,
Id
:
rule
.
Id
,
ActualValue
:
aggValue
}
}
}
...
...
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