forked from kubernetes-monitoring/kubernetes-mixin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes-monitoring#127 from wiremind/persistent…
…volumeusage Add Persistent Volumes Usage Grafana dashboard
Showing
3 changed files
with
111 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
local grafana = import 'grafonnet/grafana.libsonnet'; | ||
local dashboard = grafana.dashboard; | ||
local row = grafana.row; | ||
local prometheus = grafana.prometheus; | ||
local template = grafana.template; | ||
local graphPanel = grafana.graphPanel; | ||
local promgrafonnet = import '../lib/promgrafonnet/promgrafonnet.libsonnet'; | ||
local numbersinglestat = promgrafonnet.numbersinglestat; | ||
local gauge = promgrafonnet.gauge; | ||
|
||
{ | ||
grafanaDashboards+:: { | ||
'persistentvolumesusage.json': | ||
local sizeGraph = graphPanel.new( | ||
'Volume Space Usage', | ||
datasource='$datasource', | ||
format='percent', | ||
max=100, | ||
min=0, | ||
span=12, | ||
legend_show=true, | ||
legend_values=true, | ||
legend_min=true, | ||
legend_max=true, | ||
legend_current=true, | ||
legend_total=false, | ||
legend_avg=true, | ||
legend_alignAsTable=false, | ||
legend_rightSide=false, | ||
).addTarget(prometheus.target( | ||
||| | ||
(kubelet_volume_stats_capacity_bytes{%(kubeletSelector)s, persistentvolumeclaim="$volume"} - kubelet_volume_stats_available_bytes{%(kubeletSelector)s, persistentvolumeclaim="$volume"}) / kubelet_volume_stats_capacity_bytes{%(kubeletSelector)s, persistentvolumeclaim="$volume"} * 100 | ||
||| % $._config, | ||
legendFormat='{{ Usage }}', | ||
intervalFactor=1, | ||
)); | ||
|
||
local inodesGraph = graphPanel.new( | ||
'Volume inodes Usage', | ||
datasource='$datasource', | ||
format='percent', | ||
max=100, | ||
min=0, | ||
span=12, | ||
legend_show=true, | ||
legend_values=true, | ||
legend_min=true, | ||
legend_max=true, | ||
legend_current=true, | ||
legend_total=false, | ||
legend_avg=true, | ||
legend_alignAsTable=false, | ||
legend_rightSide=false, | ||
).addTarget(prometheus.target( | ||
||| | ||
kubelet_volume_stats_inodes_used{%(kubeletSelector)s, persistentvolumeclaim="$volume"} / kubelet_volume_stats_inodes{%(kubeletSelector)s, persistentvolumeclaim="$volume"} * 100 | ||
||| % $._config, | ||
legendFormat='{{ Usage }}', | ||
intervalFactor=1, | ||
)); | ||
|
||
dashboard.new( | ||
'Persistent Volumes', | ||
time_from='now-7d', | ||
uid=($._config.grafanaDashboardIDs['nodes.json']), | ||
).addTemplate( | ||
{ | ||
current: { | ||
text: 'Prometheus', | ||
value: 'Prometheus', | ||
}, | ||
hide: 0, | ||
label: null, | ||
name: 'datasource', | ||
options: [], | ||
query: 'prometheus', | ||
refresh: 1, | ||
regex: '', | ||
type: 'datasource', | ||
}, | ||
) | ||
.addTemplate( | ||
template.new( | ||
'namespace', | ||
'$datasource', | ||
'label_values(kubelet_volume_stats_capacity_bytes{%(kubeletSelector)s}, exported_namespace)' % $._config, | ||
label='Namespace', | ||
refresh='time', | ||
) | ||
) | ||
.addTemplate( | ||
template.new( | ||
'volume', | ||
'$datasource', | ||
'label_values(kubelet_volume_stats_capacity_bytes{%(kubeletSelector)s, exported_namespace="$namespace"}, persistentvolumeclaim)' % $._config, | ||
label='PersistentVolumeClaim', | ||
refresh='time', | ||
) | ||
) | ||
.addRow( | ||
row.new() | ||
.addPanel(sizeGraph) | ||
) | ||
.addRow( | ||
row.new() | ||
.addPanel(inodesGraph) | ||
), | ||
}, | ||
} |
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 |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
"version": "master" | ||
} | ||
] | ||
} | ||
} |