Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get free disk space in percentage for multiple nodes using Grafana

I use Grafana (v2.1.3) for metrics visualization. Metrics comes from Graphite collected by collectd. The target graph is to display free disk space in percents for multiple nodes, e.g. lets say folder is /data, so metric which represents free space in bytes is:

collectd.$node.df-data.df_complex-free

The metrics which represent total space is sum of:

collectd.$node.df-data.*

So, I have following config:

Series A: collectd.$node.df-data.df_complex-free (Invisible)
Series B: collectd.$node.df-data.* (Invisible)
Series C: alias(asPercent(#A, sumSeries(#B)), 'Free space')

Here $node is a variable which is selected from drop-down list (All, node1, node2, node3, etc.). It works as expected when one specific node is selected, but wrong one All option is selected, (e.g. if percentage per node is ~ 95%, then when All is selected 24% is displayed).

Another option (would be probably more preferable:

Series A: collectd.$node.df-data.df_complex-free
Series B: groupByNode(collectd.$node.df-data.*, 1, 'sum')
Series C: scale(divideSeries(#A, #B), 100)

Again for single node it's fine, but once "All nodes" option is selected, then following error is displayed:

divideSeries second argument must reference exactly 1 series

Any ideas? I believe there should be simple solution.

like image 951
Vytautas Arminas Avatar asked Jan 23 '17 18:01

Vytautas Arminas


1 Answers

Since you're using collectd and the df plugin you can just enable the ValuesPercentage parameter in your /etc/collectd.conf.d/df.conf, then you'll be able to query collectd.$node.df-data.percent_bytes-free

https://collectd.org/wiki/index.php/Plugin:DF

like image 171
AussieDan Avatar answered Nov 08 '22 22:11

AussieDan