From 566bd1bb32be70ff2dc3f3510fa86e7d9e7a9407 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Wed, 27 Sep 2017 10:44:55 +0200 Subject: [PATCH] added a new option called 'graph_mode' to view the memory graph in two different modes --- Changes | 7 +++++++ lib/system.pm | 35 +++++++++++++++++++++++++---------- monitorix.conf | 1 + 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index 60de05a..01e4b9f 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,10 @@ +3.NN.N - DD-MMM-2017 +==================== +- Added a new option called 'graph_mode' to view the memory graph in two + different modes: 'real' (being the default) and 'interpreted'. + (suggested by Ɓukasz "Cyber Killer" Korpalski, cyberkiller8 AT gmail.com) + + 3.10.0 - 25-Sep-2017 ==================== - Added a complete graph for IPMI sensors using the 'ipmitool' command. diff --git a/lib/system.pm b/lib/system.pm index ba27cf6..2d9c5ba 100644 --- a/lib/system.pm +++ b/lib/system.pm @@ -655,16 +655,29 @@ sub system_cgi { undef(@tmpz); undef(@CDEF); if($config->{os} eq "Linux" || $config->{os} eq "FreeBSD") { - push(@tmp, "AREA:m_mused#EE4444:Used"); - push(@tmp, "AREA:m_mcach#44EE44:Cached"); - push(@tmp, "AREA:m_mbuff#CCCCCC:Buffers"); - push(@tmp, "AREA:m_macti#E29136:Active"); - push(@tmp, "AREA:m_minac#448844:Inactive"); - push(@tmp, "LINE2:m_minac#008800"); - push(@tmp, "LINE2:m_macti#E29136"); - push(@tmp, "LINE2:m_mbuff#888888"); - push(@tmp, "LINE2:m_mcach#00EE00"); - push(@tmp, "LINE2:m_mused#EE0000"); + if(lc($system->{graph_mode} || "") eq "interpreted") { + push(@tmp, "AREA:m_mcach#44EE44:Cached"); + push(@tmp, "AREA:m_mbuff#CCCCCC:Buffers"); + push(@tmp, "AREA:m_macti#E29136:Active"); + push(@tmp, "AREA:m_minac#448844:Inactive"); + push(@tmp, "AREA:m_mused_i#EE4444:Used"); + push(@tmp, "LINE2:m_mused_i#EE0000"); + push(@tmp, "LINE2:m_minac#008800"); + push(@tmp, "LINE2:m_macti#E29136"); + push(@tmp, "LINE2:m_mbuff#888888"); + push(@tmp, "LINE2:m_mcach#00EE00"); + } else { + push(@tmp, "AREA:m_mused#EE4444:Used"); + push(@tmp, "AREA:m_mcach#44EE44:Cached"); + push(@tmp, "AREA:m_mbuff#CCCCCC:Buffers"); + push(@tmp, "AREA:m_macti#E29136:Active"); + push(@tmp, "AREA:m_minac#448844:Inactive"); + push(@tmp, "LINE2:m_minac#008800"); + push(@tmp, "LINE2:m_macti#E29136"); + push(@tmp, "LINE2:m_mbuff#888888"); + push(@tmp, "LINE2:m_mcach#00EE00"); + push(@tmp, "LINE2:m_mused#EE0000"); + } } elsif($config->{os} eq "OpenBSD" || $config->{os} eq "NetBSD") { push(@tmp, "AREA:m_mused#EE4444:Used"); push(@tmp, "AREA:m_macti#44EE44:Active"); @@ -707,6 +720,7 @@ sub system_cgi { "CDEF:m_mbuff=mbuff,1024,*", "CDEF:m_mcach=mcach,1024,*", "CDEF:m_mused=m_mtotl,mfree,1024,*,-", + "CDEF:m_mused_i=m_mtotl,mfree,1024,*,-,m_mbuff,-,m_mcach,-", "CDEF:m_macti=macti,1024,*", "CDEF:m_minac=minac,1024,*", "CDEF:allvalues=mtotl,mbuff,mcach,mfree,macti,minac,+,+,+,+,+", @@ -742,6 +756,7 @@ sub system_cgi { "CDEF:m_mbuff=mbuff,1024,*", "CDEF:m_mcach=mcach,1024,*", "CDEF:m_mused=m_mtotl,mfree,1024,*,-", + "CDEF:m_mused_i=m_mtotl,mfree,1024,*,-,m_mbuff,-,m_mcach,-", "CDEF:m_macti=macti,1024,*", "CDEF:m_minac=minac,1024,*", "CDEF:allvalues=mtotl,mbuff,mcach,mfree,macti,minac,+,+,+,+,+", diff --git a/monitorix.conf b/monitorix.conf index 0d8b149..1e8e490 100644 --- a/monitorix.conf +++ b/monitorix.conf @@ -124,6 +124,7 @@ secure_log_date_format = %b %e # SYSTEM graph # ----------------------------------------------------------------------------- + graph_mode = real loadavg_enabled = n loadavg_timeintvl = 3600