-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(monitoring): changing to use Prometheus data for the CPU usage (#…
…528)
- Loading branch information
1 parent
02cdfa8
commit cd66e9c
Showing
1 changed file
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
local grafana = import '../../grafonnet-lib/grafana.libsonnet'; | ||
local defaults = import '../../grafonnet-lib/defaults.libsonnet'; | ||
|
||
local panels = grafana.panels; | ||
local targets = grafana.targets; | ||
local overrides = defaults.overrides; | ||
local panels = grafana.panels; | ||
local targets = grafana.targets; | ||
local alert = grafana.alert; | ||
local alertCondition = grafana.alertCondition; | ||
local overrides = defaults.overrides; | ||
|
||
{ | ||
new(ds, vars):: | ||
panels.timeseries( | ||
title = 'CPU Utilization', | ||
datasource = ds.cloudwatch, | ||
datasource = ds.prometheus, | ||
) | ||
.configure(overrides.cpu(defaults.configuration.timeseries_resource)) | ||
.setAlert(defaults.alerts.cpu( | ||
.setAlert(alert.new( | ||
namespace = 'RPC Proxy', | ||
env = vars.environment, | ||
title = 'ECS', | ||
name = "RPC %s - High CPU usage" % vars.environment, | ||
message = "RPC %s - High CPU usage" % vars.environment, | ||
period = '5m', | ||
frequency = '1m', | ||
noDataState = 'alerting', | ||
notifications = vars.notifications, | ||
)) | ||
|
||
.addTarget(targets.cloudwatch( | ||
alias = 'CPU (Max)', | ||
datasource = ds.cloudwatch, | ||
dimensions = { | ||
ServiceName: vars.ecs_service_name | ||
alertRuleTags = { | ||
'og_priority': 'P3', | ||
}, | ||
metricName = 'CPUUtilization', | ||
namespace = 'AWS/ECS', | ||
statistic = 'Maximum', | ||
refId = 'CPU_Max', | ||
conditions = [ | ||
alertCondition.new( | ||
evaluatorParams = [ 70 ], | ||
evaluatorType = 'gt', | ||
operatorType = 'or', | ||
queryRefId = 'CPU_Avg', | ||
queryTimeStart = '5m', | ||
reducerType = 'avg', | ||
), | ||
] | ||
)) | ||
.addTarget(targets.cloudwatch( | ||
alias = 'CPU (Avg)', | ||
datasource = ds.cloudwatch, | ||
dimensions = { | ||
ServiceName: vars.ecs_service_name | ||
}, | ||
metricName = 'CPUUtilization', | ||
namespace = 'AWS/ECS', | ||
statistic = 'Average', | ||
.addTarget(targets.prometheus( | ||
datasource = ds.prometheus, | ||
expr = 'sum(rate(cpu_usage_sum[$__rate_interval])) / sum(rate(cpu_usage_count[$__rate_interval]))', | ||
refId = 'CPU_Avg', | ||
)) | ||
} |