Skip to content

Commit

Permalink
Added mem_free to graph.d/mem_report.php graph. Was present in gangli…
Browse files Browse the repository at this point in the history
…a web 1. Also ported RGB color definition from there.

Reason:
Displaying memory graph for linux works as expected, but metrics from windows
Host sFlow agents displayed swap usage where free memory should be displayed.
Therefore it presented itself as when machine has all of it's memory and lots
of swap space occupied, when that was clearly not the case.

This change adds it back to graph stack and also displays now/min/max/avg
values in the legend.
  • Loading branch information
bostjan committed May 12, 2014
1 parent 21c3261 commit 06fae4c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conf_default.php.in
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ $conf['mem_used_color'] = "5555cc";
$conf['mem_shared_color'] = "0000aa";
$conf['mem_cached_color'] = "33cc33";
$conf['mem_buffered_color'] = "99ff33";
$conf['mem_free_color'] = "00ff00";
$conf['mem_free_color'] = "f0ffc0";
$conf['mem_swapped_color'] = "9900CC";

#
Expand Down
16 changes: 16 additions & 0 deletions graph.d/mem_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@ function graph_mem_report ( &$rrdtool_graph ) {
}
}

if (file_exists("$rrd_dir/mem_free.rrd")) {
$series .= "STACK:'bmem_free'#${conf['mem_free_color']}:'Free${rmspace}' ";

if ( $conf['graphreport_stats'] ) {
$series .= "CDEF:free_pos=bmem_free,0,INF,LIMIT "
. "VDEF:free_last=free_pos,LAST "
. "VDEF:free_min=free_pos,MINIMUM "
. "VDEF:free_avg=free_pos,AVERAGE "
. "VDEF:free_max=free_pos,MAXIMUM "
. "GPRINT:'free_last':' ${space1}Now\:%6.1lf%s' "
. "GPRINT:'free_min':'${space1}Min\:%6.1lf%s${eol1}' "
. "GPRINT:'free_avg':'${space2}Avg\:%6.1lf%s' "
. "GPRINT:'free_max':'${space1}Max\:%6.1lf%s\\l' ";
}
}

if (file_exists("$rrd_dir/swap_total.rrd")) {
$series .= "DEF:'swap_total'='${rrd_dir}/swap_total.rrd':'sum':AVERAGE "
. "DEF:'swap_free'='${rrd_dir}/swap_free.rrd':'sum':AVERAGE "
Expand Down

0 comments on commit 06fae4c

Please sign in to comment.