From a7559573808206af515394e13915ac1cb99b6ac0 Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:12:35 +0200 Subject: [PATCH] Add refresh_interval option in minutes to du.pm --- lib/du.pm | 8 ++++++++ man/man5/monitorix.conf.5 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/du.pm b/lib/du.pm index be684e9..d3ad7b5 100644 --- a/lib/du.pm +++ b/lib/du.pm @@ -140,6 +140,14 @@ sub du_update { my $str; my $rrdata = "N"; + my $refresh_interval = ($config->{du}->{refresh_interval} || 0); + if($refresh_interval > 0) { + # If desired refreshed only every refresh_interval minutes. + # This logic will refresh atleast once a day. + my (undef, $min, $hour) = localtime(time); + return if(($min + 60 * $hour) % $refresh_interval); + } + my $e = 0; while($e < scalar(my @dl = split(',', $du->{list}))) { my $type; diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index a28f6e7..17dcf11 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -1637,7 +1637,7 @@ This is a comma-separated list of pool names. The number of pool names defined h .SS Directory usage statistics (du.pm) This graph is able to monitor the usage of an unlimited number of directories. .P -IMPORTANT NOTE: The \fIdu\fP command makes intensive disk I/O access that might slow down the whole system. Moreover, continued executions of this command will affect the buffer cache mechanism and this will also increase the system response time. +IMPORTANT NOTE: The \fIdu\fP command makes intensive disk I/O access that might slow down the whole system. Moreover, continued executions of this command will affect the buffer cache mechanism and this will also increase the system response time. To reduce executions \fIrefresh_interval\fP can be specified in minutes (Use 0 for default refresh interval). .P .BI list .RS