Skip to content

Commit

Permalink
Import CloudWatch mixin. (prometheus-community#695)
Browse files Browse the repository at this point in the history
Co-authored-by: Cristian Greco <[email protected]>
  • Loading branch information
jeschkies and cristiangreco authored Oct 25, 2022
1 parent 28f3185 commit 19157a9
Show file tree
Hide file tree
Showing 13 changed files with 1,242 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mixin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# CloudWatch Mixin

This is a Prometheus [Monitoring Mixin](https://monitoring.mixins.dev/) that comes with pre-defined dashboards.

It can be installed e.g. with [Grizzly](https://grafana.github.io/grizzly):

```
$ grr apply mixin.libsonnet
```
5 changes: 5 additions & 0 deletions mixin/config.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// use to override the default configuration of base mixin
_config+:: {
},
}
7 changes: 7 additions & 0 deletions mixin/dashboards/all.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
'ebs.json': import 'ebs.libsonnet',
'ec2.json': import 'ec2.libsonnet',
'lambda.json': import 'lambda.libsonnet',
'rds.json': import 'rds.libsonnet',
's3.json': import 's3.libsonnet',
}
21 changes: 21 additions & 0 deletions mixin/dashboards/common.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Tooltip type
// 0 = 'default': no shared crosshair or tooltip
// 1 = 'shared_crosshair': shared tooltip
// 2 = 'shared_tooltip': shared crosshair AND shared tooltip
tooltipSharedCrosshair: 1,

// Refresh
// 1 = 'load': Queries the data source every time the dashboard loads
// 2 = 'time': Queries the data source when the dashboard time range changes
refreshOnPageLoad: 1,
refreshOnTimeRangeChange: 2,

// Sorting
// 0: Without Sort,
// 1: Alphabetical (asc)
// 2: Alphabetical (desc)
// 3: Numerical (asc)
// 4: Numerical (desc)
sortAlphabeticalAsc: 1,
}
253 changes: 253 additions & 0 deletions mixin/dashboards/ebs.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
local common = import 'common.libsonnet';
local grafana = import 'grafonnet-7.0/grafana.libsonnet';

local allLabels = 'scrape_job=~"$job", region=~"$region", dimension_VolumeId=~"$volume"';

grafana.dashboard.new(
title='AWS EBS',
description='Visualize Amazon EBS metrics',
tags=['Amazon', 'AWS', 'CloudWatch', 'EBS'],
graphTooltip=common.tooltipSharedCrosshair,
)
.addTemplate(
grafana.template.datasource.new(
name='datasource',
query='prometheus',
label='Data Source',
)
)
.addTemplate(
grafana.template.query.new(
name='job',
label='job',
datasource='$datasource',
query='label_values(aws_ebs_info, scrape_job)',
refresh=common.refreshOnPageLoad,
includeAll=true,
multi=true,
sort=common.sortAlphabeticalAsc,
allValue='.+',
)
)
.addTemplate(
grafana.template.query.new(
name='region',
label='Region',
datasource='$datasource',
query='label_values(aws_ebs_volume_idle_time_average, region)',
refresh=common.refreshOnTimeRangeChange,
includeAll=true,
multi=true,
sort=common.sortAlphabeticalAsc,
)
)
.addTemplate(
grafana.template.query.new(
name='volume',
label='Volume',
datasource='$datasource',
query='label_values(aws_ebs_volume_idle_time_average{scrape_job=~"$job", region=~"$region"}, dimension_VolumeId)',
refresh=common.refreshOnTimeRangeChange,
includeAll=true,
multi=true,
sort=common.sortAlphabeticalAsc,
)
)
.addPanels(
[
grafana.panel.text.new(
title='Info',
content=|||
Showing metrics only for AWS resources that have tags assigned to them. For more information, see [Amazon CloudWatch Metrics for Amazon EBS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cloudwatch_ebs.html).
|||,
)
.setGridPos(w=24, h=3),

grafana.panel.graph.new(
title='Volume read bandwidth (bytes)',
datasource='$datasource',
)
.setGridPos(w=12, h=8)
.addYaxis(format='bps', min=0)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_read_bytes_sum{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume write bandwidth (bytes)',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=12)
.addYaxis(format='bps', min=0)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_write_bytes_sum{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume read throughput (operations)',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=0, y=8)
.addYaxis(format='ops', min=0)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_read_ops_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume write throughput (operations)',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=12, y=8)
.addYaxis(format='ops', min=0)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_write_ops_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume idle time',
datasource='$datasource',
)
.setGridPos(w=8, h=8, x=0, y=16)
.addYaxis(
format='percent',
max=100,
min=0,
)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_idle_time_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume total read time',
datasource='$datasource',
)
.setGridPos(w=8, h=8, x=8, y=16)
.addYaxis(
format='percent',
max=100,
min=0,
)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_total_read_time_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume total write time',
datasource='$datasource',
)
.setGridPos(w=8, h=8, x=16, y=16)
.addYaxis(
format='percent',
max=100,
min=0,
)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_total_write_time_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume queue length (bytes)',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=0, y=24)
.addYaxis(format='short', min=0, max=1)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_queue_length_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume throughput percentage',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=12, y=24)
.addYaxis(
format='percent',
max=100,
min=0,
)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_throughput_percentage_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),


grafana.panel.graph.new(
title='Burst balance',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=0, y=32)
.addYaxis(
format='percent',
max=100,
min=0,
)
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_burst_balance_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

grafana.panel.graph.new(
title='Volume consumed r/w operations',
datasource='$datasource',
)
.setGridPos(w=12, h=8, x=12, y=32)
.addYaxis(format='short')
.addYaxis()
.addTarget(
grafana.target.prometheus.new(
expr='aws_ebs_volume_consumed_read_write_ops_average{%s}' % [allLabels],
legendFormat='{{dimension_VolumeId}}',
datasource='$datasource',
),
),

]
)
Loading

0 comments on commit 19157a9

Please sign in to comment.