From e48cfa1aac0bac274214a15c128ac6283ee4bf35 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Fri, 16 Dec 2016 11:23:20 +0100 Subject: [PATCH] changed the way how scales the memory graph in 'system.pm', now the units are in bytes, so the y-axis will scale accordingly --- Changes | 2 ++ lib/system.pm | 34 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Changes b/Changes index c1f09fa..754671a 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ - Improved the 'system.pm' graph with more detailed information about processes (sleeping, waiting I/O, zombie, stopped, paging and running). It also includes two new graphs: entropy and uptime. +- Changed the way how scales the memory graph in 'system.pm', now the units are + in bytes, so the y-axis will scale accordingly. - Changed to be more thickness the lines of Greylisting graph in 'mail.pm'. - Fixed an undeclared global symbol "$imgfmt_lc" in 'traffacct.pm'. diff --git a/lib/system.pm b/lib/system.pm index 8a68770..5b624e3 100644 --- a/lib/system.pm +++ b/lib/system.pm @@ -440,6 +440,7 @@ sub system_cgi { $title = !$silent ? $title : ""; my $total_mem; + my $total_mem_bytes; if($config->{os} eq "Linux") { $total_mem = `grep -w MemTotal: /proc/meminfo | awk '{print \$2}'`; @@ -448,6 +449,7 @@ sub system_cgi { $total_mem = `/sbin/sysctl -n hw.physmem`; # in bytes chomp($total_mem); } + $total_mem_bytes = int($total_mem * 1024); # in bytes $total_mem = int($total_mem / 1024); # in MB @@ -682,10 +684,10 @@ sub system_cgi { "--title=$config->{graphs}->{_system2} (${total_mem}MB) ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", "--imgformat=$imgfmt_uc", - "--vertical-label=Megabytes", + "--vertical-label=bytes", "--width=$width", "--height=$height", - "--upper-limit=$total_mem", + "--upper-limit=$total_mem_bytes", "--lower-limit=0", "--rigid", "--base=1024", @@ -699,12 +701,12 @@ sub system_cgi { "DEF:mfree=$rrd:system_mfree:AVERAGE", "DEF:macti=$rrd:system_macti:AVERAGE", "DEF:minac=$rrd:system_minac:AVERAGE", - "CDEF:m_mtotl=mtotl,1024,/", - "CDEF:m_mbuff=mbuff,1024,/", - "CDEF:m_mcach=mcach,1024,/", - "CDEF:m_mused=m_mtotl,mfree,1024,/,-", - "CDEF:m_macti=macti,1024,/", - "CDEF:m_minac=minac,1024,/", + "CDEF:m_mtotl=mtotl,1024,*", + "CDEF:m_mbuff=mbuff,1024,*", + "CDEF:m_mcach=mcach,1024,*", + "CDEF:m_mused=m_mtotl,mfree,1024,*,-", + "CDEF:m_macti=macti,1024,*", + "CDEF:m_minac=minac,1024,*", "CDEF:allvalues=mtotl,mbuff,mcach,mfree,macti,minac,+,+,+,+,+", @CDEF, @tmp, @@ -717,10 +719,10 @@ sub system_cgi { "--title=$config->{graphs}->{_system2} (${total_mem}MB) ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", "--imgformat=$imgfmt_uc", - "--vertical-label=Megabytes", + "--vertical-label=bytes", "--width=$width", "--height=$height", - "--upper-limit=$total_mem", + "--upper-limit=$total_mem_bytes", "--lower-limit=0", "--rigid", "--base=1024", @@ -734,12 +736,12 @@ sub system_cgi { "DEF:mfree=$rrd:system_mfree:AVERAGE", "DEF:macti=$rrd:system_macti:AVERAGE", "DEF:minac=$rrd:system_minac:AVERAGE", - "CDEF:m_mtotl=mtotl,1024,/", - "CDEF:m_mbuff=mbuff,1024,/", - "CDEF:m_mcach=mcach,1024,/", - "CDEF:m_mused=m_mtotl,mfree,1024,/,-", - "CDEF:m_macti=macti,1024,/", - "CDEF:m_minac=minac,1024,/", + "CDEF:m_mtotl=mtotl,1024,*", + "CDEF:m_mbuff=mbuff,1024,*", + "CDEF:m_mcach=mcach,1024,*", + "CDEF:m_mused=m_mtotl,mfree,1024,*,-", + "CDEF:m_macti=macti,1024,*", + "CDEF:m_minac=minac,1024,*", "CDEF:allvalues=mtotl,mbuff,mcach,mfree,macti,minac,+,+,+,+,+", @CDEF, @tmp);