mirror of https://github.com/mikaku/Monitorix.git
Revert "Add refresh_interval option to disk.pm."
This reverts commit 2c4eaa2a69
.
This commit is contained in:
parent
2c4eaa2a69
commit
9a58d8462a
86
lib/disk.pm
86
lib/disk.pm
|
@ -40,8 +40,6 @@ sub disk_init {
|
||||||
my $info;
|
my $info;
|
||||||
my @ds;
|
my @ds;
|
||||||
my @rra;
|
my @rra;
|
||||||
my @ds_to_change_heartbeat;
|
|
||||||
my $rrd_heartbeat;
|
|
||||||
my @tmp;
|
my @tmp;
|
||||||
my $n;
|
my $n;
|
||||||
|
|
||||||
|
@ -50,12 +48,6 @@ sub disk_init {
|
||||||
my @max;
|
my @max;
|
||||||
my @last;
|
my @last;
|
||||||
|
|
||||||
my $heartbeat = 120;
|
|
||||||
my $refresh_interval = ($config->{disk}->{refresh_interval} || 0);
|
|
||||||
if($refresh_interval > 0) {
|
|
||||||
$heartbeat = 2 * $refresh_interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $k (sort keys %{$disk->{list}}) {
|
foreach my $k (sort keys %{$disk->{list}}) {
|
||||||
# values delimitted by ", " (comma + space)
|
# values delimitted by ", " (comma + space)
|
||||||
my @dsk = split(', ', $disk->{list}->{$k});
|
my @dsk = split(', ', $disk->{list}->{$k});
|
||||||
|
@ -89,15 +81,6 @@ sub disk_init {
|
||||||
push(@rra, substr($key, 4, index($key, ']') - 4));
|
push(@rra, substr($key, 4, index($key, ']') - 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(index($key, 'ds[') == 0) {
|
|
||||||
if(index($key, '.minimal_heartbeat') != -1) {
|
|
||||||
$rrd_heartbeat = %$info{$key};
|
|
||||||
if($rrd_heartbeat != $heartbeat) {
|
|
||||||
my $ds_name = substr($key, 3, index($key, ']') - 3);
|
|
||||||
push(@ds_to_change_heartbeat, $ds_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(scalar(@ds) / 24 != keys(%{$disk->{list}})) {
|
if(scalar(@ds) / 24 != keys(%{$disk->{list}})) {
|
||||||
logger("$myself: Detected size mismatch between <list>...</list> (" . keys(%{$disk->{list}}) . ") and $rrd (" . scalar(@ds) / 24 . "). Resizing it accordingly. All historical data will be lost. Backup file created.");
|
logger("$myself: Detected size mismatch between <list>...</list> (" . keys(%{$disk->{list}}) . ") and $rrd (" . scalar(@ds) / 24 . "). Resizing it accordingly. All historical data will be lost. Backup file created.");
|
||||||
|
@ -107,18 +90,6 @@ sub disk_init {
|
||||||
logger("$myself: Detected size mismatch between 'max_historic_years' (" . $config->{max_historic_years} . ") and $rrd (" . ((scalar(@rra) -12) / 4) . "). Resizing it accordingly. All historical data will be lost. Backup file created.");
|
logger("$myself: Detected size mismatch between 'max_historic_years' (" . $config->{max_historic_years} . ") and $rrd (" . ((scalar(@rra) -12) / 4) . "). Resizing it accordingly. All historical data will be lost. Backup file created.");
|
||||||
rename($rrd, "$rrd.bak");
|
rename($rrd, "$rrd.bak");
|
||||||
}
|
}
|
||||||
if((-e $rrd) && scalar(@ds_to_change_heartbeat) > 0) {
|
|
||||||
logger("$myself: Detected heartbeat mismatch between set (" . $heartbeat . ") and $rrd (" . $rrd_heartbeat . "). Tuning it accordingly.");
|
|
||||||
my @tune_arguments;
|
|
||||||
foreach(@ds_to_change_heartbeat) {
|
|
||||||
push(@tune_arguments, "-h");
|
|
||||||
push(@tune_arguments, "$_:$heartbeat");
|
|
||||||
}
|
|
||||||
|
|
||||||
RRDs::tune($rrd, @tune_arguments);
|
|
||||||
my $err = RRDs::error;
|
|
||||||
logger("ERROR: while tuning $rrd: $err") if $err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(-e $rrd)) {
|
if(!(-e $rrd)) {
|
||||||
|
@ -130,30 +101,30 @@ sub disk_init {
|
||||||
push(@last, "RRA:LAST:0.5:1440:" . (365 * $n));
|
push(@last, "RRA:LAST:0.5:1440:" . (365 * $n));
|
||||||
}
|
}
|
||||||
for($n = 0; $n < keys(%{$disk->{list}}); $n++) {
|
for($n = 0; $n < keys(%{$disk->{list}}); $n++) {
|
||||||
push(@tmp, "DS:disk" . $n . "_hd0_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd0_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd0_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd0_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd0_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd0_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd1_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd1_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd1_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd1_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd1_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd1_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd2_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd2_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd2_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd2_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd2_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd2_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd3_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd3_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd3_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd3_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd3_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd3_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd4_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd4_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd4_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd4_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd4_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd4_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd5_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd5_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd5_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd5_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd5_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd5_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd6_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd6_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd6_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd6_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd6_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd6_smart2:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd7_temp:GAUGE:" . $heartbeat . ":0:100");
|
push(@tmp, "DS:disk" . $n . "_hd7_temp:GAUGE:120:0:100");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd7_smart1:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd7_smart1:GAUGE:120:0:U");
|
||||||
push(@tmp, "DS:disk" . $n . "_hd7_smart2:GAUGE:" . $heartbeat . ":0:U");
|
push(@tmp, "DS:disk" . $n . "_hd7_smart2:GAUGE:120:0:U");
|
||||||
}
|
}
|
||||||
eval {
|
eval {
|
||||||
RRDs::create($rrd,
|
RRDs::create($rrd,
|
||||||
|
@ -223,15 +194,6 @@ sub disk_update {
|
||||||
my $n;
|
my $n;
|
||||||
my $rrdata = "N";
|
my $rrdata = "N";
|
||||||
|
|
||||||
my $refresh_interval = ($config->{disk}->{refresh_interval} || 0);
|
|
||||||
if($refresh_interval > 60) {
|
|
||||||
# If desired refreshed only every refresh_interval seconds.
|
|
||||||
# This logic will refresh atleast once a month.
|
|
||||||
my (undef, $min, $hour, $day) = localtime(time);
|
|
||||||
return if(($min + 60 * $hour + 60 * 24 * $day) % int($refresh_interval / 60));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach my $k (sort keys %{$disk->{list}}) {
|
foreach my $k (sort keys %{$disk->{list}}) {
|
||||||
# values delimitted by ", " (comma + space)
|
# values delimitted by ", " (comma + space)
|
||||||
my @dsk = split(', ', $disk->{list}->{$k});
|
my @dsk = split(', ', $disk->{list}->{$k});
|
||||||
|
|
|
@ -1354,7 +1354,7 @@ This is a list of groups of disk drives that you want to monitor. Each group wil
|
||||||
.P
|
.P
|
||||||
WARNING: Every time the number of groups in this option changes, Monitorix will resize the \fIdisk.rrd\fP file accordingly, removing all historical data.
|
WARNING: Every time the number of groups in this option changes, Monitorix will resize the \fIdisk.rrd\fP file accordingly, removing all historical data.
|
||||||
.P
|
.P
|
||||||
To collect the disk drive temperatures and health the \fIsmartmontools\fP or the \fIhddtemp\fP command are required. \fIsmartmontools\fP will wake up sleeping disk and keep them from getting to sleep. To avoid this set \fIrespect_standby = y\fP and \frefresh_interval\fP to at least twice the standby time as a call to \fIsmartctl\fP or \fIhddtemp\fP will reset the standby timer of the disk.
|
To collect the disk drive temperatures and health the \fIsmartmontools\fP or the \fIhddtemp\fP command are required. \fIsmartmontools\fP will wake up sleeping disk. To avoid this set \fIrespect_standby = y\fP.
|
||||||
.P
|
.P
|
||||||
It is recommended that you first check if either \fIsmartctl\fP(8) or \fIhddtemp\fP are able to collect data from the disk drive(s) that you plan to monitor. You may test this with the following command:
|
It is recommended that you first check if either \fIsmartctl\fP(8) or \fIhddtemp\fP are able to collect data from the disk drive(s) that you plan to monitor. You may test this with the following command:
|
||||||
.P
|
.P
|
||||||
|
@ -1497,21 +1497,6 @@ This option changes this behavior and permits to continue working even if the de
|
||||||
.P
|
.P
|
||||||
Default value: \fIn\fP
|
Default value: \fIn\fP
|
||||||
.RE
|
.RE
|
||||||
.P
|
|
||||||
.BI respect_standby
|
|
||||||
.RS
|
|
||||||
Getting smart information will wake up sleeping disks and keep them from getting to sleep. To avoid waking them up set \fIrespect_standby = y\fP. This will inhibit a smart request in case the drive is in standby causing gaps in the graph but not waking it up.
|
|
||||||
.P
|
|
||||||
Default value: \fIn\fP
|
|
||||||
.RE
|
|
||||||
.P
|
|
||||||
.BI refresh_interval
|
|
||||||
.RS
|
|
||||||
Refresh interval in seconds. This is an option to reduce the execution of the \fIsmartctl\fP and \fIhddtemp\fP command and undesired side effects caused by this. Default value 0 means normal refresh with all other plots. The refresh will happen independently from the interval once a month at the first day of the month at 0:00 hours.
|
|
||||||
Keep in mind that changing the \fBrefresh_interval\fP is possible without loosing history but changing the interval to a smaller one will introduce gaps in the data at the transition point.
|
|
||||||
.P
|
|
||||||
Default value: \fI0\fP
|
|
||||||
.RE
|
|
||||||
.SS Filesystem usage and I/O activity (fs.pm)
|
.SS Filesystem usage and I/O activity (fs.pm)
|
||||||
This graph is able to monitor an unlimited number of filesystems.
|
This graph is able to monitor an unlimited number of filesystems.
|
||||||
.P
|
.P
|
||||||
|
|
Loading…
Reference in New Issue